mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-25 05:29:34 +00:00
chiptune: try to add support for loading multiple files
hours of debugging, traced to a stray $. Urgh.
This commit is contained in:
parent
2f4e90f4ab
commit
0a5ee09b92
@ -72,6 +72,7 @@ filename_pad_spaces:
|
|||||||
cpy #30 ; fill 30 bytes
|
cpy #30 ; fill 30 bytes
|
||||||
bne filename_pad_spaces
|
bne filename_pad_spaces
|
||||||
|
|
||||||
|
filename_pad_done:
|
||||||
|
|
||||||
ldy #8 ; filename ptr offset = 8
|
ldy #8 ; filename ptr offset = 8
|
||||||
lda #<filename
|
lda #<filename
|
||||||
@ -83,15 +84,39 @@ filename_pad_spaces:
|
|||||||
ldx #1 ; open existing file
|
ldx #1 ; open existing file
|
||||||
|
|
||||||
jsr dos33_open ; open file
|
jsr dos33_open ; open file
|
||||||
|
bcs error_open
|
||||||
|
|
||||||
jsr dos33_read ; read buffer
|
jsr dos33_read ; read buffer
|
||||||
|
bcc now_close
|
||||||
|
; got an error
|
||||||
|
; error 05 is OK (OUT OF DATA)
|
||||||
|
; because we try to read too much
|
||||||
|
ldy #$a
|
||||||
|
lda (FILEML),Y
|
||||||
|
cmp #5
|
||||||
|
beq now_close
|
||||||
|
|
||||||
|
jmp error_read
|
||||||
|
|
||||||
|
now_close:
|
||||||
jsr dos33_close ; close file
|
jsr dos33_close ; close file
|
||||||
|
bcs error_close
|
||||||
clc
|
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
error_open:
|
||||||
|
lda #$f5
|
||||||
|
brk
|
||||||
|
error_read:
|
||||||
|
ldy #$a
|
||||||
|
lda (FILEML),y
|
||||||
|
tay
|
||||||
|
lda #$f6
|
||||||
|
brk
|
||||||
|
error_close:
|
||||||
|
lda #$f7
|
||||||
|
brk
|
||||||
|
|
||||||
;=================================
|
;=================================
|
||||||
; get_dos_buffer
|
; get_dos_buffer
|
||||||
;=================================
|
;=================================
|
||||||
@ -224,6 +249,7 @@ dos33_close:
|
|||||||
sta (FILEML),y
|
sta (FILEML),y
|
||||||
|
|
||||||
jsr filemanager_interface
|
jsr filemanager_interface
|
||||||
|
bcs error_close
|
||||||
|
|
||||||
ldy #0 ; mark dos buffer as free again
|
ldy #0 ; mark dos buffer as free again
|
||||||
tya
|
tya
|
||||||
@ -246,7 +272,7 @@ dos33_read:
|
|||||||
|
|
||||||
ldy #6 ; point to number of bytes to read
|
ldy #6 ; point to number of bytes to read
|
||||||
lda #<read_size
|
lda #<read_size
|
||||||
sta (FILEML),y ; we want to read 255 bytes
|
sta (FILEML),y ; we want to read read_size bytes
|
||||||
iny
|
iny
|
||||||
lda #>read_size
|
lda #>read_size
|
||||||
sta (FILEML),y
|
sta (FILEML),y
|
||||||
@ -258,7 +284,7 @@ dos33_read:
|
|||||||
lda #>disk_buff
|
lda #>disk_buff
|
||||||
sta (FILEML),y
|
sta (FILEML),y
|
||||||
|
|
||||||
bne filemanager_interface ; same as JMP
|
jmp filemanager_interface
|
||||||
|
|
||||||
filename:
|
filename:
|
||||||
; OUT.0
|
; OUT.0
|
||||||
|
@ -342,3 +342,8 @@ Thought it only took 1s max? Not in face of interrupts.
|
|||||||
|
|
||||||
TIME_TAKEN ($88) stores how long took to decode
|
TIME_TAKEN ($88) stores how long took to decode
|
||||||
INTRO2: 60@19, 60@36, 62@50 61@1:03 61@1:32 60@2:05 61@2:32
|
INTRO2: 60@19, 60@36, 62@50 61@1:03 61@1:32 60@2:05 61@2:32
|
||||||
|
|
||||||
|
+ Our old friend, forget the # so we're comparing against some random
|
||||||
|
zero page value rather than a constsant
|
||||||
|
|
||||||
|
+ Related, the accidentally put in a $ when I meant for it to be decimal.
|
||||||
|
@ -132,18 +132,19 @@ mockingboard_found:
|
|||||||
|
|
||||||
jsr new_song
|
jsr new_song
|
||||||
|
|
||||||
|
; jsr increment_file ; debug
|
||||||
|
; jsr new_song
|
||||||
|
|
||||||
|
; cli
|
||||||
|
|
||||||
|
|
||||||
lda #<UNPACK_BUFFER ; set input pointer
|
|
||||||
sta INL
|
|
||||||
lda #>UNPACK_BUFFER
|
|
||||||
sta INH
|
|
||||||
|
|
||||||
|
|
||||||
;============================
|
;============================
|
||||||
; Enable 6502 interrupts
|
; Enable 6502 interrupts
|
||||||
;============================
|
;============================
|
||||||
|
|
||||||
;cli ; clear interrupt mask
|
cli ; clear interrupt mask
|
||||||
|
|
||||||
|
|
||||||
;============================
|
;============================
|
||||||
@ -175,7 +176,7 @@ check_copy_loop:
|
|||||||
|
|
||||||
inc COPY_OFFSET ; (opt: make subtract?) ; 5
|
inc COPY_OFFSET ; (opt: make subtract?) ; 5
|
||||||
|
|
||||||
lda #$14
|
lda #14 ; NOT HEX URGH!
|
||||||
cmp COPY_OFFSET
|
cmp COPY_OFFSET
|
||||||
bne check_copy_loop
|
bne check_copy_loop
|
||||||
|
|
||||||
@ -232,6 +233,8 @@ done_play:
|
|||||||
jsr increment_file
|
jsr increment_file
|
||||||
jsr new_song
|
jsr new_song
|
||||||
|
|
||||||
|
cli
|
||||||
|
|
||||||
jmp main_loop
|
jmp main_loop
|
||||||
|
|
||||||
forever_loop:
|
forever_loop:
|
||||||
@ -347,6 +350,10 @@ read_size EQU $4000
|
|||||||
adc #0
|
adc #0
|
||||||
sta LZ4_SRC+1
|
sta LZ4_SRC+1
|
||||||
|
|
||||||
|
lda #<UNPACK_BUFFER ; set input pointer
|
||||||
|
sta INL
|
||||||
|
lda #>UNPACK_BUFFER
|
||||||
|
sta INH
|
||||||
|
|
||||||
; Decompress first chunks
|
; Decompress first chunks
|
||||||
|
|
||||||
@ -361,8 +368,6 @@ read_size EQU $4000
|
|||||||
|
|
||||||
jsr setup_next_subsong
|
jsr setup_next_subsong
|
||||||
|
|
||||||
cli ; start playing
|
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;=================
|
;=================
|
||||||
@ -510,7 +515,7 @@ filename_found:
|
|||||||
increment_file:
|
increment_file:
|
||||||
inc WHICH_FILE
|
inc WHICH_FILE
|
||||||
lda WHICH_FILE
|
lda WHICH_FILE
|
||||||
cmp NUM_FILES
|
cmp #NUM_FILES
|
||||||
bne done_increment
|
bne done_increment
|
||||||
lda #0
|
lda #0
|
||||||
sta WHICH_FILE
|
sta WHICH_FILE
|
||||||
|
@ -27,6 +27,9 @@ COLOR EQU $30
|
|||||||
; dos33 zero page = 26-2f, 35-38, 3e 3f 40-4d
|
; dos33 zero page = 26-2f, 35-38, 3e 3f 40-4d
|
||||||
; overlap applesoft 67-6a,6f,70,af,b0,ca-cd,d8
|
; overlap applesoft 67-6a,6f,70,af,b0,ca-cd,d8
|
||||||
|
|
||||||
|
|
||||||
|
; DOS33: Confirmed kills $68
|
||||||
|
|
||||||
RWTSL EQU $60
|
RWTSL EQU $60
|
||||||
RWTSH EQU $61
|
RWTSH EQU $61
|
||||||
DOSBUFL EQU $62
|
DOSBUFL EQU $62
|
||||||
@ -35,8 +38,8 @@ FILEML EQU $64
|
|||||||
FILEMH EQU $65
|
FILEMH EQU $65
|
||||||
;TURNING EQU $60
|
;TURNING EQU $60
|
||||||
;SCREEN_X EQU $61 ; not used?
|
;SCREEN_X EQU $61 ; not used?
|
||||||
SCREEN_Y EQU $67
|
;SCREEN_Y EQU $62
|
||||||
WHICH_FILE EQU $68
|
|
||||||
|
|
||||||
;ANGLE EQU $63
|
;ANGLE EQU $63
|
||||||
;HORIZ_SCALE_I EQU $64
|
;HORIZ_SCALE_I EQU $64
|
||||||
@ -95,6 +98,8 @@ C_COLOR EQU $85
|
|||||||
COPY_TIME EQU $86
|
COPY_TIME EQU $86
|
||||||
DECOMPRESS_TIME EQU $87
|
DECOMPRESS_TIME EQU $87
|
||||||
TIME_TAKEN EQU $88
|
TIME_TAKEN EQU $88
|
||||||
|
SCREEN_Y EQU $89
|
||||||
|
WHICH_FILE EQU $8A
|
||||||
;NUM2L EQU $80
|
;NUM2L EQU $80
|
||||||
;NUM2H EQU $81
|
;NUM2H EQU $81
|
||||||
;RESULT EQU $82 ; 83,84,85
|
;RESULT EQU $82 ; 83,84,85
|
||||||
|
Loading…
Reference in New Issue
Block a user