;quick test for page and savebin
player=49152

       page 0
       org 26000
startMain
       entrypoint $

  	di
        ld a,16+0;origina screen + page 0
        ld bc,#7ffd
        ld (23388),a
        out (c),a
	;set stack
	ld sp,25999
	xor a
        out (254),a
        ;clear screen
        ld hl,16384
        ld de,16385
        ld bc,6911
        ld (hl),l
        ldir
        ei

        call startMusic

loop:
        ld hl,23560         ; LAST K system variable.
        ld (hl),0           ; put null value there.
        
        halt
        call player+5

        ld a,(23560)
        cp '1'
        jp z,playMusic1
        cp '2'
        jp z,playMusic2
        cp '3'
        jp z,playMusic3
        cp '4'
        jp z,playMusic4
        cp '5'
        jp z,playMusic5
        cp '6'
        jp z,playMusic6
       
        jp loop


playMusic1:
        call player+8
        call migBorder
        
        ld a,16+0
        ld bc,#7ffd
        ld (23388),a
        out (c),a

        call startMusic
        
        jp loop

playMusic2:
        call player+8
        call migBorder

        ld a,16+1
        ld bc,#7ffd
        ld (23388),a
        out (c),a

        call startMusic

        jp loop

playMusic3:
        call player+8
        call migBorder

        ld a,16+3
        ld bc,#7ffd
        ld (23388),a
        out (c),a

        call startMusic

        jp loop

playMusic4:
        call player+8
        call migBorder

        ld a,16+4
        ld bc,#7ffd
        ld (23388),a
        out (c),a

        call startMusic

        jp loop

playMusic5:
        call player+8
        call migBorder

        ld a,16+6
        ld bc,#7ffd
        ld (23388),a
        out (c),a

        call startMusic

        jp loop


playMusic6:
        call player+8
        call migBorder

        ld a,16+7
        ld bc,#7ffd
        ld (23388),a
        out (c),a

        call startMusic

        jp loop

migBorder:
        halt
        ld a,1
        out (254),a
        halt
        xor a
        out (254),a
        halt
        ret

startMusic:
        ld hl,m0
        call player+3
        ret

       org 49152
       FILE "music\player.bin"
       defb(512)0
m0:    FILE "music\0.pt3"
       
endMain
       savebin "build\main.bin",startMain,endMain-startMain
       ;or savebin "main.bin",startMain,$-startMain


       page 1
       org 49152
page1
       FILE "music\player.bin"
       defb(512)0
m1:    FILE "music\1.pt3"
page1end
       savebin "build\page1.bin",page1,page1end-page1

       page 3
       org 49152
page3
       FILE "music\player.bin"
       defb(512)0
m3:    FILE "music\3.pt3"
page3end
       savebin "build\page3.bin",page3,page3end-page3

       page 4
       org 49152
page4
       FILE "music\player.bin"
       defb(512)0
m4:    FILE "music\4.pt3"
page4end
       savebin "build\page4.bin",page4,page4end-page4

       page 6
       org 49152
page6
       FILE "music\player.bin"
       defb(512)0
m6:    FILE "music\6.pt3"
page6end
       savebin "build\page6.bin",page6,page6end-page6

       page 7
       org 49152
page7
       FILE "music\player.bin"
       defb(512)0
m7:    FILE "music\7.pt3"
page7end
       savebin "build\page7.bin",page6,page6end-page6

       
       run "build\!build.bat"
