From 6146f3a229e78a6cbefa9e33f807f2710af520a7 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Mon, 19 Nov 2018 20:38:13 -0500 Subject: [PATCH] dya: merge in the changes from updated chiptune_player --- dya/Makefile | 12 ++--- dya/chip_title.inc | 51 ------------------ dya/chiptune_player.s | 123 ++++++++++++++++++++++++++++-------------- dya/zp.inc | 14 ++++- 4 files changed, 102 insertions(+), 98 deletions(-) delete mode 100644 dya/chip_title.inc diff --git a/dya/Makefile b/dya/Makefile index 1de165cf..ce2e2eb5 100644 --- a/dya/Makefile +++ b/dya/Makefile @@ -11,23 +11,23 @@ $(DOS33): chiptune_dya.dsk: CHIPTUNE_PLAYER HELLO cp chiptune_empty.dsk chiptune_dya.dsk $(DOS33) -y chiptune_dya.dsk SAVE A HELLO - $(DOS33) -y chiptune_dya.dsk BSAVE -a 0x0C00 CHIPTUNE_PLAYER - $(DOS33) -y chiptune_dya.dsk SAVE B DOTD1.KRW - $(DOS33) -y chiptune_dya.dsk SAVE B DOTD2.KRW + $(DOS33) -y chiptune_dya.dsk BSAVE -a 0x0800 CHIPTUNE_PLAYER + $(DOS33) -y chiptune_dya.dsk BSAVE -a 0x1c00 DOTD1.KRW + $(DOS33) -y chiptune_dya.dsk BSAVE -a 0x1c00 DOTD2.KRW HELLO: hello.bas ../asoft_basic-utils/tokenize_asoft < hello.bas > HELLO CHIPTUNE_PLAYER: chiptune_player.o - ld65 -o CHIPTUNE_PLAYER chiptune_player.o -C ../linker_scripts/apple2_c00.inc + ld65 -o CHIPTUNE_PLAYER chiptune_player.o -C ../linker_scripts/apple2_800.inc chiptune_player.o: chiptune_player.s \ ../asm_routines/mockingboard.s \ ../asm_routines/dos33_routines.s \ ../asm_routines/lz4_decode.s \ ../asm_routines/keypress_minimal.s \ - rasterbars.s volume_bars.s interrupt_handler.s \ - chip_title.inc zp.inc + rasterbars.s volume_bars.s interrupt_handler.s qkumba_rts.s \ + chip_title_uncompressed.inc zp.inc ca65 -o chiptune_player.o chiptune_player.s -l chiptune_player.lst CHIPTUNE_UNROLLED: chiptune_unrolled.o diff --git a/dya/chip_title.inc b/dya/chip_title.inc deleted file mode 100644 index 4f3a4d4f..00000000 --- a/dya/chip_title.inc +++ /dev/null @@ -1,51 +0,0 @@ -chip_title: .byte $28 ; ysize=40 - .byte $AE,$00, $A3,$10, $40, $A3,$20, $40, $A3,$20, $A0,$14,$00 - .byte $A3,$10, $11, $A4,$91, $00, $A3,$11, $44, $A3,$22 - .byte $44, $A3,$22, $00, $A4,$91, $11, $A3,$10, $A8,$00 - .byte $10, $11, $91,$91, $99, $A3,$D9, $DD, $CD,$CD - .byte $C0, $00, $11, $A3,$44, $22, $A3,$44, $22 - .byte $00, $C0, $CD,$CD, $DD, $A3,$D9, $99, $A3,$91 - .byte $11, $10, $A3,$00, $10, $91, $D9,$D9, $DD - .byte $CD,$CD, $A3,$6C, $A3,$06, $00, $01, $A3,$04, $02 - .byte $A3,$04, $02, $00, $A3,$06, $A3,$6C, $A3,$CD, $DD - .byte $D9,$D9, $91, $10, $00,$00, $11, $A0,$24,$00, $11 - .byte $00,$00, $11, $00, $20, $22,$22, $00, $22 - .byte $00, $22, $00, $22, $00, $22,$22, $20 - .byte $00, $A3,$33, $00, $33, $00, $33, $00 - .byte $33, $00,$00, $33, $00, $A3,$33, $00, $A3,$33 - .byte $00, $11, $00,$00, $11, $00, $22, $A3,$00 - .byte $22, $20, $22, $00, $22, $00, $22 - .byte $00, $22, $00,$00, $33, $00,$00, $33, $00 - .byte $33, $00, $33,$33, $30, $33, $00, $33 - .byte $30, $00,$00, $33, $30,$30, $00, $11, $00,$00 - .byte $11, $00, $22, $A3,$00, $22, $02, $22 - .byte $00, $22, $00, $22,$22, $02, $00,$00, $33 - .byte $00,$00, $33, $00, $33, $00, $33, $00 - .byte $33,$33, $00, $33, $03, $00,$00, $03,$03, $33 - .byte $00, $11, $00,$00, $11, $00, $02, $22,$22 - .byte $00, $22, $00, $22, $00, $22, $00 - .byte $22, $A4,$00, $33, $00,$00, $A3,$33, $00, $33 - .byte $00,$00, $33, $00, $A3,$33, $00, $A3,$33, $00 - .byte $11, $00, $10, $11, $A0,$24,$00, $11, $10 - .byte $11, $A8,$00, $A0,$15,$40, $A9,$00, $11,$11, $A4,$00, $C0 - .byte $A3,$00, $44, $A3,$55, $44, $A5,$55, $44, $55 - .byte $45, $55, $44, $94, $44, $4E, $44 - .byte $4E, $44, $A6,$00, $C0, $00,$00, $11,$11, $00,$00 - .byte $C0, $CC, $C0,$C0, $00,$00, $44, $A3,$55, $44 - .byte $A5,$55, $44, $55, $54, $55, $44, $94 - .byte $44, $55, $44, $55, $44, $A4,$00, $C0 - .byte $CC, $C0,$C0, $00, $11,$11, $00, $A4,$9D, $A3,$00 - .byte $A0,$12,$44, $64, $44, $64, $44, $00,$00, $A4,$9D - .byte $00,$00, $11,$11, $00, $A5,$21, $00,$00, $44, $A3,$55 - .byte $44, $A5,$55, $44, $55, $45, $55, $44 - .byte $54,$54, $44, $66, $44, $66, $44, $00,$00 - .byte $A5,$21, $00, $11,$11, $00,$00, $A3,$06, $A3,$00, $44 - .byte $A3,$55, $44, $A5,$55, $44, $55, $54, $55 - .byte $44, $45,$45, $44, $46, $44, $46, $44 - .byte $A3,$00, $A3,$06, $00,$00, $11,$11, $A8,$00, $A0,$15,$44, $57 - .byte $A8,$00, $11,$11, $A8,$00, $05, $AB,$04, $C4, $D4 - .byte $C4, $D4, $C4, $D4, $C4, $D4, $04 - .byte $05, $A8,$00, $11,$11, $A0,$14,$00, $0C, $0D, $0C - .byte $0D, $0C, $0D, $0C, $0D, $AA,$00, $11,$11 - .byte $A0,$26,$10, $11 - .byte $A1 diff --git a/dya/chiptune_player.s b/dya/chiptune_player.s index 47f1acb8..9e55622a 100644 --- a/dya/chiptune_player.s +++ b/dya/chiptune_player.s @@ -3,17 +3,35 @@ .include "zp.inc" ; program is ~4k, so from 0xc00 to 0x1C00 LZ4_BUFFER EQU $1C00 ; $1C00 - $5C00, 16k for now -UNPACK_BUFFER EQU $5E00 ; $5E00 - $9600, 14k, $3800 - ; trying not to hit DOS at $9600 - ; Reserve 3 chunks plus spare (14k) +DISK_BUFFER EQU $5D00 ; for disk loading +UNPACK_BUFFER EQU $6000 ; $6000 - $9800, 14k, $3800 + + ; by using qkumba's RTS code + ; no need for DOS, so we actually + ; are free the whole way to $C000 + ; instead of stopping at $9600 + ; $6000 - $C000 = 24k + NUM_FILES EQU 15 + + jmp chiptune_setup + +.include "chip_title_uncompressed.inc" + + .align $400 + ;============================= ; Setup ;============================= - jsr HOME - jsr TEXT +chiptune_setup: +; jsr HOME +; jsr TEXT + + ; Init disk code + + jsr rts_init ; init variables @@ -22,25 +40,26 @@ NUM_FILES EQU 15 sta CH sta CV sta DONE_PLAYING - sta XPOS sta MB_CHUNK_OFFSET sta DECODE_ERROR +; lda #0 +; lda #4 ; start at DEMO4 +; lda #7 ; start at LYRA +; lda #10 ; start at SDEMO + sta WHICH_FILE + + lda #$ff sta RASTERBARS_ON -; lda #4 ; start at DEMO4 -; lda #7 ; start at LYRA - lda #10 ; start at SDEMO - sta WHICH_FILE - ; print detection message - lda #mocking_message - sta OUTH - jsr move_and_print ; print it +; lda #mocking_message +; sta OUTH +; jsr move_and_print ; print it jsr mockingboard_detect_slot4 ; call detection routine cpx #$1 @@ -111,25 +130,27 @@ mockingboard_found: ; Draw title screen ;============================ - jsr set_gr_page0 ; set page 0 +; jsr set_gr_page0 ; set page 0 - lda #$4 ; draw page 1 - sta DRAW_PAGE +; lda #$4 ; draw page 1 +; sta DRAW_PAGE - jsr clear_screens ; clear both screens +; jsr clear_screens ; clear both screens - lda #chip_title - sta GBASH +; lda #chip_title +; sta GBASH + +; bit PAGE1 ; Load image ; load the image - lda #<$400 - sta BASL - lda #>$400 - sta BASH +; lda #<$800 +; sta BASL +; lda #>$800 +; sta BASH - jsr load_rle_gr +; jsr load_rle_gr ;================== ; load first song @@ -288,7 +309,7 @@ new_song: jsr get_filename - lda #8 + lda #8 ; print filename to screen sta CH lda #21 sta CV @@ -299,8 +320,36 @@ new_song: sta OUTH jsr print_both_pages -disk_buff EQU LZ4_BUFFER -read_size EQU $4000 + + ; needs to be space-padded $A0 30-byte filename + + lda #readfile_filename + sta namhi + + ldy #0 + ldx #30 ; 30 chars +name_loop: + lda (INL),Y + beq space_loop + ora #$80 + sta (namlo),Y + iny + dex + bne name_loop + beq done_name_loop +space_loop: + lda #$a0 ; pad with ' ' + sta (namlo),Y + iny + dex + bne space_loop + +done_name_loop: + + ; open and read a file + ; loads to whatever it was BSAVED at (default is $1C00) jsr read_file ; read KRW file from disk @@ -567,9 +616,9 @@ krw_file: .include "../asm_routines/mockingboard_a.s" .include "../asm_routines/gr_fast_clear.s" .include "../asm_routines/pageflip.s" -.include "../asm_routines/gr_unrle.s" +;.include "../asm_routines/gr_unrle.s" .include "../asm_routines/gr_setpage.s" -.include "../asm_routines/dos33_routines.s" +.include "qkumba_rts.s" .include "../asm_routines/gr_hlin.s" .include "../asm_routines/lz4_decode.s" .include "../asm_routines/keypress_minimal.s" @@ -583,13 +632,9 @@ krw_file: ;========= ; strings ;========= -mocking_message: .asciiz "LOOKING FOR MOCKINGBOARD IN SLOT #4" +;mocking_message: .asciiz "LOOKING FOR MOCKINGBOARD IN SLOT #4" not_message: .byte "NOT " found_message: .asciiz "FOUND" ;done_message: .asciiz "DONE PLAYING" loading_message: .asciiz "LOADING" -;============ -; graphics -;============ -.include "chip_title.inc" diff --git a/dya/zp.inc b/dya/zp.inc index fff64073..859fc61c 100644 --- a/dya/zp.inc +++ b/dya/zp.inc @@ -153,8 +153,18 @@ DRAW_PAGE EQU $EE ;FIRST EQU $F0 LASTKEY EQU $F1 ;PADDLE_STATUS EQU $F2 -XPOS EQU $F3 -YPOS EQU $F4 + ;XPOS EQU $F3 + ;YPOS EQU $F4 + + + namlo = $f6 + namhi = $f7 + step = $f8 ; state for stepper motor + tmptrk = $f9 ; temporary copy of current track + phase = $fa ; current phase for /seek + + + TEMP EQU $FA ;RUN EQU $FA ;TEMP2 EQU $FB