;;; gcc for m6809 : Mar 17 2019 11:56:12
;;; 4.3.6 (gcc6809)
;;; ABI version 1
;;; -mabi=bx -mint8 -fomit-frame-pointer -O0
	.module	demo2.enr.c
; GNU C (GCC) version 4.3.6 (gcc6809) (m6809-unknown-none)
;	compiled by GNU C version 5.4.0 20160609, GMP version 6.1.0, MPFR version 3.1.4.
; GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
; options passed:  -fno-gcse -fverbose-asm -W -Wall -Wextra -Wconversion
; -Werror -fomit-frame-pointer -fno-toplevel-reorder -mint8
; -msoft-reg-count=0 -std=gnu99 -fno-time-report
; -I/home/chrissalo/Vide/C/PeerC/vectrex/include -D__INLINE_RUM=1
; -DOMMIT_FRAMEPOINTER=1 -I/home/chrissalo/Vide/projects/Demo2/include
; /home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c
; options enabled:  -falign-loops -fargument-alias -fauto-inc-dec
; -fbranch-count-reg -fcommon -fearly-inlining
; -feliminate-unused-debug-types -ffunction-cse -fgcse-lm -fident -fivopts
; -fkeep-static-consts -fleading-underscore -fmath-errno
; -fmerge-debug-strings -fmove-loop-invariants -fomit-frame-pointer
; -fpcc-struct-return -fpeephole -fsched-interblock -fsched-spec
; -fsched-stalled-insns-dep -fsigned-zeros -fsplit-ivs-in-unroller
; -ftrapping-math -ftree-loop-im -ftree-loop-ivcanon -ftree-loop-optimize
; -ftree-parallelize-loops= -ftree-reassoc -ftree-scev-cprop
; -ftree-vect-loop-version -fverbose-asm -fzero-initialized-in-bss
; Compiler executable checksum: 74a0323a4f41feb77857e3eae52873ae
	.area	.text
LC0:
	.byte	77,85,83,73,67,-128,0
LC1:
	.byte	66,85,84,84,79,78,32,49
	.byte	32,83,67,82,65,77,66,76
	.byte	69,-128,0
LC2:
	.byte	66,85,84,84,79,78,32,50
	.byte	32,67,82,65,90,89,32,67
	.byte	79,65,83,84,69,82,-128,0
LC3:
	.byte	66,85,84,84,79,78,32,51
	.byte	32,66,69,82,90,69,82,75
	.byte	-128,0
LC4:
	.byte	66,85,84,84,79,78,32,52
	.byte	32,83,79,76,65,82,32,81
	.byte	85,69,83,84,-128,0
	.globl	_main
_main:
	pshs	u	;
	leas	-22,s	;,,
;----- asm -----
; 71 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[64]  unsigned char last_button = 0;        /* one auto variable... remember the * /
; 0 "" 2
;--- end asm ---
	clr	21,s	; last_button
;----- asm -----
; 73 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[65]  check_buttons();                       /* last pressed button * /
; 0 "" 2
;--- end asm ---
	jsr	_check_buttons
;----- asm -----
; 75 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[66]  while (1)                             /* never to return... * /
; 0 "" 2
;--- end asm ---
L9:
;----- asm -----
; 78 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[68]    start_one_vectrex_round();          /* start 'de round * /
; 0 "" 2
;--- end asm ---
	jsr	_start_one_vectrex_round
;----- asm -----
; 80 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[69]    VIA_t1_cnt_lo = MAX_SCALE;               /* set scale factor * /
; 0 "" 2
;--- end asm ---
	ldb	#-16	;,
	stb	_VIA_t1_cnt_lo	;, VIA_t1_cnt_lo
;----- asm -----
; 82 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[70]    Intensity_a(MAX_BRIGHTNESS);          /* set some brightness * /
; 0 "" 2
;--- end asm ---
	ldb	#127	;,
	stb	20,s	;, a
;----- asm -----
; 3427 "/home/chrissalo/Vide/C/PeerC/vectrex/include/vec_rum_inl.h" 1
	lda 20,s	; a
	jsr ___Intensity_a; BIOS call
; 0 "" 2
; 84 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[71]    Print_Str_d(120,-20, "MUSIC�");        /* print on screen * /
; 0 "" 2
;--- end asm ---
	ldb	#120	;,
	stb	16,s	;, a
	ldb	#-20	;,
	stb	17,s	;, b
	ldx	#LC0	; tmp33,
	stx	18,s	; tmp33, u
;----- asm -----
; 666 "/home/chrissalo/Vide/C/PeerC/vectrex/include/vec_rum_inl.h" 1
	lda 16,s	; a
	ldb 17,s	; b
	ldu 18,s	; u
	jsr ___Print_Str_d; BIOS call
; 0 "" 2
; 86 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[72]    Print_Str_d(80,-100, "BUTTON 1 SCRAMBLE�");
; 0 "" 2
;--- end asm ---
	ldb	#80	;,
	stb	12,s	;, a
	ldb	#-100	;,
	stb	13,s	;, b
	ldx	#LC1	; tmp34,
	stx	14,s	; tmp34, u
;----- asm -----
; 666 "/home/chrissalo/Vide/C/PeerC/vectrex/include/vec_rum_inl.h" 1
	lda 12,s	; a
	ldb 13,s	; b
	ldu 14,s	; u
	jsr ___Print_Str_d; BIOS call
; 0 "" 2
; 88 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[73]    Print_Str_d(40,-100, "BUTTON 2 CRAZY COASTER�");
; 0 "" 2
;--- end asm ---
	ldb	#40	;,
	stb	8,s	;, a
	ldb	#-100	;,
	stb	9,s	;, b
	ldx	#LC2	; tmp35,
	stx	10,s	; tmp35, u
;----- asm -----
; 666 "/home/chrissalo/Vide/C/PeerC/vectrex/include/vec_rum_inl.h" 1
	lda 8,s	; a
	ldb 9,s	; b
	ldu 10,s	; u
	jsr ___Print_Str_d; BIOS call
; 0 "" 2
; 90 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[74]    Print_Str_d(00,-100, "BUTTON 3 BERZERK�");
; 0 "" 2
;--- end asm ---
	clr	4,s	; a
	ldb	#-100	;,
	stb	5,s	;, b
	ldx	#LC3	; tmp36,
	stx	6,s	; tmp36, u
;----- asm -----
; 666 "/home/chrissalo/Vide/C/PeerC/vectrex/include/vec_rum_inl.h" 1
	lda 4,s	; a
	ldb 5,s	; b
	ldu 6,s	; u
	jsr ___Print_Str_d; BIOS call
; 0 "" 2
; 92 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[75]    Print_Str_d(-40,-100,"BUTTON 4 SOLAR QUEST�");
; 0 "" 2
;--- end asm ---
	ldb	#-40	;,
	stb	,s	;, a
	ldb	#-100	;,
	stb	1,s	;, b
	ldx	#LC4	; tmp37,
	stx	2,s	; tmp37, u
;----- asm -----
; 666 "/home/chrissalo/Vide/C/PeerC/vectrex/include/vec_rum_inl.h" 1
	lda ,s	; a
	ldb 1,s	; b
	ldu 2,s	; u
	jsr ___Print_Str_d; BIOS call
; 0 "" 2
; 94 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[76]    if ((button_1_1_pressed()) && (last_button != 1)) /* check the button 1 * /
; 0 "" 2
;--- end asm ---
	jsr	_button_1_1_pressed
	tstb	; D.2328
	beq	L2	;
	ldb	21,s	;, last_button
	cmpb	#1	;cmpqi:	;,
	beq	L2	;
;----- asm -----
; 97 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[78]      play_song((void*)&Vec_Music_4);                   /* play a song * /
; 0 "" 2
;--- end asm ---
	ldx	#_Vec_Music_4	;,
	jsr	_play_song
;----- asm -----
; 99 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[79]      last_button = 1;                             /* and remember this button * /
; 0 "" 2
;--- end asm ---
	ldb	#1	;,
	stb	21,s	;, last_button
	bra	L3	;
L2:
;----- asm -----
; 102 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[81]    if ((button_1_2_pressed()) && (last_button != 2)) /* check the button 2 * /
; 0 "" 2
;--- end asm ---
L3:
	jsr	_button_1_2_pressed
	tstb	; D.2331
	beq	L4	;
	ldb	21,s	;, last_button
	cmpb	#2	;cmpqi:	;,
	beq	L4	;
;----- asm -----
; 105 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[83]      play_song((void*)&Vec_Music_1);                    /* play a song * /
; 0 "" 2
;--- end asm ---
	ldx	#_Vec_Music_1	;,
	jsr	_play_song
;----- asm -----
; 107 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[84]      last_button = 2;                             /* and remember this button * /
; 0 "" 2
;--- end asm ---
	ldb	#2	;,
	stb	21,s	;, last_button
	bra	L5	;
L4:
;----- asm -----
; 110 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[86]    if ((button_1_3_pressed()) && (last_button != 3)) /* check the button 3 * /
; 0 "" 2
;--- end asm ---
L5:
	jsr	_button_1_3_pressed
	tstb	; D.2334
	beq	L6	;
	ldb	21,s	;, last_button
	cmpb	#3	;cmpqi:	;,
	beq	L6	;
;----- asm -----
; 113 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[88]      play_song((void*)&Vec_Music_2	);                          /* play a song * /
; 0 "" 2
;--- end asm ---
	ldx	#_Vec_Music_2	;,
	jsr	_play_song
;----- asm -----
; 115 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[89]      last_button = 3;                             /* and remember this button * /
; 0 "" 2
;--- end asm ---
	ldb	#3	;,
	stb	21,s	;, last_button
	bra	L7	;
L6:
;----- asm -----
; 118 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[91]    if ((button_1_4_pressed()) && (last_button != 4)) /* check the button 4 * /
; 0 "" 2
;--- end asm ---
L7:
	jsr	_button_1_4_pressed
	tstb	; D.2335
	beq	L8	;
	ldb	21,s	;, last_button
	cmpb	#4	;cmpqi:	;,
	beq	L8	;
;----- asm -----
; 121 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[93]      play_song((void*)&Vec_Music_5	);                      /* play a song * /
; 0 "" 2
;--- end asm ---
	ldx	#_Vec_Music_5	;,
	jsr	_play_song
;----- asm -----
; 123 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[94]      last_button = 4;                             /* and remember this button * /
; 0 "" 2
;--- end asm ---
	ldb	#4	;,
	stb	21,s	;, last_button
L8:
;----- asm -----
; 126 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[96]    check_buttons();                               /* read again for next round * /
; 0 "" 2
;--- end asm ---
	jsr	_check_buttons
	lbra	L9	;
_button_1_4_pressed:
	jsr	_buttons_pressed
	andb	#8	; D.2192,
	rts
_buttons_pressed:
	ldb	_Vec_Buttons	; D.2169, Vec_Buttons
	rts
_button_1_3_pressed:
	jsr	_buttons_pressed
	andb	#4	; D.2187,
	rts
_button_1_2_pressed:
	jsr	_buttons_pressed
	andb	#2	; D.2182,
	rts
_play_song:
	leas	-2,s	;,,
	stx	,s	; song, song
;----- asm -----
; 58 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[53]  Vec_Music_Flag = 1;       /* A makro to write to a specific memory * /
; 0 "" 2
;--- end asm ---
	ldb	#1	;,
	stb	_Vec_Music_Flag	;, Vec_Music_Flag
;----- asm -----
; 60 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[54]  current_song = song;                /* address * /
; 0 "" 2
;--- end asm ---
	ldx	,s	; tmp27, song
	stx	_current_song	; tmp27, current_song
	leas	2,s	;,,
	rts
_button_1_1_pressed:
	jsr	_buttons_pressed
	andb	#1	; D.2177,
	rts
_start_one_vectrex_round:
	pshs	y,u	;
	leas	-2,s	;,,
;----- asm -----
; 42 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[41]  DP_to_C8();                        /* vectrex internal... dp must point * /
; 0 "" 2
; 316 "/home/chrissalo/Vide/C/PeerC/vectrex/include/vec_rum_inl.h" 1
	jsr ___DP_to_C8; BIOS call
; 0 "" 2
; 44 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[42]  Init_Music_chk(current_song);    /* to c800, could make a function which * /
; 0 "" 2
;--- end asm ---
	ldx	_current_song	; current_song.1, current_song
	stx	,s	; current_song.1, u
;----- asm -----
; 2917 "/home/chrissalo/Vide/C/PeerC/vectrex/include/vec_rum_inl.h" 1
	ldu ,s	; u
	jsr ___Init_Music_chk; BIOS call
; 0 "" 2
; 46 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[43]  Wait_Recal();                       /* sets this up allright... * /
; 0 "" 2
; 97 "/home/chrissalo/Vide/C/PeerC/vectrex/include/vec_rum_inl.h" 1
	jsr ___Wait_Recal; BIOS call
; 0 "" 2
; 48 "/home/chrissalo/Vide/projects/Demo2/source/demo2.enr.c" 1
	; #ENR#[44]  Do_Sound();
; 0 "" 2
; 2880 "/home/chrissalo/Vide/C/PeerC/vectrex/include/vec_rum_inl.h" 1
	jsr ___Do_Sound; BIOS call
; 0 "" 2
;--- end asm ---
	leas	2,s	;,,
	puls	y,u,pc	;
_check_buttons:
;----- asm -----
; 2286 "/home/chrissalo/Vide/C/PeerC/vectrex/include/vec_rum_inl.h" 1
	jsr ___Read_Btns; BIOS call
; 0 "" 2
;--- end asm ---
	rts
	.area	.bss
	.globl	_current_song
_current_song:	.blkb	2
