

;===============================================================

.macro	m_play

wait    lda $d40b
        cmp #:1
        bne wait

	lda #:1
	sta $d01a

       	jsr player.sound

	lda #0
	sta $d01a
.endm

;===============================================================

	org $2000

	.local dl
	.byte $70,$70,$70
	.byte $42,a(sm)
	.byte $02,$70,$02,$02,$02,$70,$02,$02
	.byte $41,a(dl)
	.endl

	.local sm
;	.byte "0123456789012345678901234567890123456789"
	.byte "  Party:    Silly Venture 2k13          "
	.byte "  Compo:    ATARI XL/XE POKEY MSX COMPO "
	.byte "  Title:    Heavy Traffic               "
	.byte "  Author:   Bartek Wasiel aka BeWu/MSB  "
	.byte "  Runtime:  3:08                        "
	.byte "  Player:   Theta Music Composer 2.0    "
	.byte "  Info:     Stereo, 2nd POKEY required  "
	.endl

	.proc main

	mwa #dl $230
	mva #14 709
	mva #0 710

	lda #$70
	ldx #>msx
	ldy #<msx
	jsr init

	ldx #0		;TMC
	txa
	jsr init

;	lda #$10
;	ldx #0
;	jsr player.init

loop    lda 20
        cmp 20
        beq *-2

        jsr play		// pierwsze glowne wywolanie playera (1x na ramke)
;	jsr player.sound

;
;	ift msx.fps = 2		// player wywolywany 2x na ramke
;
;	m_play 48
;
;	eli msx.fps = 3		// player wywolywany 3x na ramke
;
;	m_play 20
;	m_play 76
;
;	eli msx.fps = 4		// player wywolywany 4x na ramke
;
;	m_play 8
;	m_play 48
;	m_play 88
;
;	eif

	lda $d20f
	and #12
	cmp #12
	bne return
	lda $d010
	beq return
	lda $d01f
	cmp #7
	bne return

        jmp loop

return	rts


;===============================================================


	icl "TM2-Player.asm"

	
	org $8000
	.local msx
	ins 'HEAVYTRA.tm2',+6
	.endl


	.endp		;End of main

        run main
