mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-10-09 11:54:59 +00:00
pt3: start implementing things
This commit is contained in:
parent
a4699be604
commit
39b68db975
BIN
pt3_player/HELLO
BIN
pt3_player/HELLO
Binary file not shown.
@ -11,7 +11,7 @@ $(DOS33):
|
|||||||
pt3_player.dsk: PT3_PLAYER HELLO
|
pt3_player.dsk: PT3_PLAYER HELLO
|
||||||
cp empty.dsk pt3_player.dsk
|
cp empty.dsk pt3_player.dsk
|
||||||
$(DOS33) -y pt3_player.dsk SAVE A HELLO
|
$(DOS33) -y pt3_player.dsk SAVE A HELLO
|
||||||
$(DOS33) -y pt3_player.dsk BSAVE -a 0x0800 PT3_PLAYER
|
$(DOS33) -y pt3_player.dsk BSAVE -a 0x1000 PT3_PLAYER
|
||||||
$(DOS33) -y pt3_player.dsk BSAVE -a 0x2000 EA.PT3
|
$(DOS33) -y pt3_player.dsk BSAVE -a 0x2000 EA.PT3
|
||||||
# $(DOS33) -y chiptune_player.dsk BSAVE -a 0x1c00 ./krw/CHRISTMAS.KRW
|
# $(DOS33) -y chiptune_player.dsk BSAVE -a 0x1c00 ./krw/CHRISTMAS.KRW
|
||||||
# $(DOS33) -y chiptune_player.dsk BSAVE -a 0x1c00 ./krw/CRMOROS.KRW
|
# $(DOS33) -y chiptune_player.dsk BSAVE -a 0x1c00 ./krw/CRMOROS.KRW
|
||||||
@ -36,9 +36,10 @@ HELLO: hello.bas
|
|||||||
../asoft_basic-utils/tokenize_asoft < hello.bas > HELLO
|
../asoft_basic-utils/tokenize_asoft < hello.bas > HELLO
|
||||||
|
|
||||||
PT3_PLAYER: pt3_player.o
|
PT3_PLAYER: pt3_player.o
|
||||||
ld65 -o PT3_PLAYER pt3_player.o -C ../linker_scripts/apple2_800.inc
|
ld65 -o PT3_PLAYER pt3_player.o -C ../linker_scripts/apple2_1000.inc
|
||||||
|
|
||||||
pt3_player.o: pt3_player.s
|
pt3_player.o: pt3_player.s \
|
||||||
|
gr_fast_clear.s pt3.s
|
||||||
# mockingboard.s \
|
# mockingboard.s \
|
||||||
# keypress_minimal.s \
|
# keypress_minimal.s \
|
||||||
# qkumba_rts.s \
|
# qkumba_rts.s \
|
||||||
|
14
pt3_player/TODO
Normal file
14
pt3_player/TODO
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
Notes into background?
|
||||||
|
Colored, octave is color?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
AA
|
||||||
|
|
||||||
|
AA 5555
|
||||||
|
A A 5
|
||||||
|
AAAA 555
|
||||||
|
A A 5
|
||||||
|
A A 555
|
193
pt3_player/gr_fast_clear.s
Normal file
193
pt3_player/gr_fast_clear.s
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
clear_screens:
|
||||||
|
;===================================
|
||||||
|
; Clear top/bottom of page 0
|
||||||
|
;===================================
|
||||||
|
|
||||||
|
lda #$0
|
||||||
|
sta DRAW_PAGE
|
||||||
|
jsr clear_top
|
||||||
|
jsr clear_bottom
|
||||||
|
|
||||||
|
;===================================
|
||||||
|
; Clear top/bottom of page 1
|
||||||
|
;===================================
|
||||||
|
|
||||||
|
lda #$4
|
||||||
|
sta DRAW_PAGE
|
||||||
|
jsr clear_top
|
||||||
|
jsr clear_bottom
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
clear_bottoms:
|
||||||
|
;===================================
|
||||||
|
; Clear bottom of page 0
|
||||||
|
;===================================
|
||||||
|
|
||||||
|
lda #$0
|
||||||
|
sta DRAW_PAGE
|
||||||
|
jsr clear_bottom
|
||||||
|
|
||||||
|
;===================================
|
||||||
|
; Clear bottom of page 1
|
||||||
|
;===================================
|
||||||
|
|
||||||
|
lda #$4
|
||||||
|
sta DRAW_PAGE
|
||||||
|
jsr clear_bottom
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;=========================================================
|
||||||
|
; clear_top
|
||||||
|
;=========================================================
|
||||||
|
; clear DRAW_PAGE
|
||||||
|
; original = 14,558 cycles(?) 15ms, 70Hz
|
||||||
|
; OPTIMIZED MAX (page0,48rows): 45*120+4+6 = 5410 = 5.4ms 185Hz
|
||||||
|
; (pageX,40rows): 50*120+4+6 = 6010 = 6.0ms 166Hz
|
||||||
|
; 50*120+4+6+37 = 6055 = 6.0ms 166Hz
|
||||||
|
clear_top:
|
||||||
|
lda #0 ; 2
|
||||||
|
clear_top_a:
|
||||||
|
sta COLOR ; 3
|
||||||
|
clc ; 2
|
||||||
|
lda DRAW_PAGE ; 3
|
||||||
|
|
||||||
|
adc #4 ; 2
|
||||||
|
sta __ctf+2 ; 3
|
||||||
|
sta __ctf+5 ; 3
|
||||||
|
adc #1 ; 2
|
||||||
|
sta __ctf+8 ; 3
|
||||||
|
sta __ctf+11 ; 3
|
||||||
|
adc #1 ; 2
|
||||||
|
sta __ctf2+2 ; 3
|
||||||
|
sta __ctf2+5 ; 3
|
||||||
|
adc #1 ; 2
|
||||||
|
sta __ctf2+8 ; 3
|
||||||
|
sta __ctf2+11 ; 3
|
||||||
|
|
||||||
|
|
||||||
|
ldy #120 ; 2
|
||||||
|
lda COLOR ; 3
|
||||||
|
clear_top_fast_loop:
|
||||||
|
__ctf:
|
||||||
|
sta $400,Y ; 5
|
||||||
|
sta $480,Y ; 5
|
||||||
|
sta $500,Y ; 5
|
||||||
|
sta $580,Y ; 5
|
||||||
|
|
||||||
|
cpy #80 ; 2
|
||||||
|
bpl no_draw_bottom ; 2nt/3
|
||||||
|
__ctf2:
|
||||||
|
sta $600,Y ; 5
|
||||||
|
sta $680,Y ; 5
|
||||||
|
sta $700,Y ; 5
|
||||||
|
sta $780,Y ; 5
|
||||||
|
no_draw_bottom:
|
||||||
|
|
||||||
|
dey ; 2
|
||||||
|
bpl clear_top_fast_loop ; 2nt/3
|
||||||
|
|
||||||
|
rts ; 6
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;=========================================================
|
||||||
|
; clear_bottom
|
||||||
|
;=========================================================
|
||||||
|
; clear bottom of draw page
|
||||||
|
|
||||||
|
clear_bottom:
|
||||||
|
clc ; 2
|
||||||
|
lda DRAW_PAGE ; 3
|
||||||
|
|
||||||
|
adc #6 ; 2
|
||||||
|
sta __cbf2+2 ; 3
|
||||||
|
sta __cbf2+5 ; 3
|
||||||
|
adc #1 ; 2
|
||||||
|
sta __cbf2+8 ; 3
|
||||||
|
sta __cbf2+11 ; 3
|
||||||
|
|
||||||
|
|
||||||
|
ldy #119 ; 2
|
||||||
|
lda #$a0 ; Normal Space ; 2
|
||||||
|
clear_bottom_fast_loop:
|
||||||
|
__cbf2:
|
||||||
|
sta $600,Y ; 5
|
||||||
|
sta $680,Y ; 5
|
||||||
|
sta $700,Y ; 5
|
||||||
|
sta $780,Y ; 5
|
||||||
|
|
||||||
|
dey ; 2
|
||||||
|
cpy #80 ; 2
|
||||||
|
bpl clear_bottom_fast_loop ; 2nt/3
|
||||||
|
|
||||||
|
rts ; 6
|
||||||
|
|
||||||
|
|
||||||
|
clear_screens_notext:
|
||||||
|
;===================================
|
||||||
|
; Clear top/bottom of page 0
|
||||||
|
;===================================
|
||||||
|
|
||||||
|
lda #$0
|
||||||
|
sta DRAW_PAGE
|
||||||
|
jsr clear_all
|
||||||
|
|
||||||
|
;===================================
|
||||||
|
; Clear top/bottom of page 1
|
||||||
|
;===================================
|
||||||
|
|
||||||
|
lda #$4
|
||||||
|
sta DRAW_PAGE
|
||||||
|
jsr clear_all
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;=========================================================
|
||||||
|
; clear_all
|
||||||
|
;=========================================================
|
||||||
|
; clear 48 rows
|
||||||
|
; clear color: clear_all_color+1
|
||||||
|
|
||||||
|
clear_all:
|
||||||
|
clc ; 2
|
||||||
|
lda DRAW_PAGE ; 3
|
||||||
|
|
||||||
|
adc #4 ; 2
|
||||||
|
sta __caf+2 ; 3
|
||||||
|
sta __caf+5 ; 3
|
||||||
|
adc #1 ; 2
|
||||||
|
sta __caf+8 ; 3
|
||||||
|
sta __caf+11 ; 3
|
||||||
|
adc #1 ; 2
|
||||||
|
sta __caf2+2 ; 3
|
||||||
|
sta __caf2+5 ; 3
|
||||||
|
adc #1 ; 2
|
||||||
|
sta __caf2+8 ; 3
|
||||||
|
sta __caf2+11 ; 3
|
||||||
|
|
||||||
|
|
||||||
|
ldy #120 ; 2
|
||||||
|
clear_all_color:
|
||||||
|
lda #0 ; 2
|
||||||
|
clear_all_fast_loop:
|
||||||
|
__caf:
|
||||||
|
sta $400,Y ; 5
|
||||||
|
sta $480,Y ; 5
|
||||||
|
sta $500,Y ; 5
|
||||||
|
sta $580,Y ; 5
|
||||||
|
__caf2:
|
||||||
|
sta $600,Y ; 5
|
||||||
|
sta $680,Y ; 5
|
||||||
|
sta $700,Y ; 5
|
||||||
|
sta $780,Y ; 5
|
||||||
|
|
||||||
|
dey ; 2
|
||||||
|
bpl clear_all_fast_loop ; 2nt/3
|
||||||
|
|
||||||
|
rts ; 6
|
@ -291,13 +291,13 @@ done_time:
|
|||||||
; Visualization
|
; Visualization
|
||||||
;============================
|
;============================
|
||||||
|
|
||||||
jsr clear_top
|
; jsr clear_top
|
||||||
lda RASTERBARS_ON
|
; lda RASTERBARS_ON
|
||||||
beq skip_rasters
|
; beq skip_rasters
|
||||||
jsr draw_rasters
|
; jsr draw_rasters
|
||||||
skip_rasters:
|
;skip_rasters:
|
||||||
jsr volume_bars
|
; jsr volume_bars
|
||||||
jsr page_flip
|
; jsr page_flip
|
||||||
|
|
||||||
|
|
||||||
check_keyboard:
|
check_keyboard:
|
||||||
|
93
pt3_player/pt3.s
Normal file
93
pt3_player/pt3.s
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
; TODO
|
||||||
|
; move some of these flags to be bits rather than bytes?
|
||||||
|
; enabled could be bit 6 or 7 for fast checking
|
||||||
|
;
|
||||||
|
; Use memset to set things to 0?
|
||||||
|
|
||||||
|
NOTE_WHICH=0
|
||||||
|
NOTE_VOLUME=1
|
||||||
|
NOTE_TONE_SLIDING=2
|
||||||
|
NOTE_ENABLED=3
|
||||||
|
NOTE_ENVELOPE_ENABLED=4
|
||||||
|
NOTE_SAMPLE_POINTER=5
|
||||||
|
NOTE_SAMPLE_LOOP=7
|
||||||
|
NOTE_SAMPLE_LENGTH=8
|
||||||
|
|
||||||
|
note_a:
|
||||||
|
.byte 'A' ; NOTE_WHICH
|
||||||
|
.byte $0 ; NOTE_VOLUME
|
||||||
|
.byte $0 ; NOTE_TONE_SLIDING
|
||||||
|
.byte $0 ; NOTE_ENABLED
|
||||||
|
.byte $0 ; NOTE_ENVELOPE_ENABLED
|
||||||
|
.word $0 ; NOTE_SAMPLE_POINTER
|
||||||
|
.byte $0 ; NOTE_SAMPLE_LOOP
|
||||||
|
.byte $0 ; NOTE_SAMPLE_LENGTH
|
||||||
|
note_b:
|
||||||
|
.byte 'B' ; NOTE_WHICH
|
||||||
|
.byte $0 ; NOTE_VOLUME
|
||||||
|
.byte $0 ; NOTE_TONE_SLIDING
|
||||||
|
.byte $0 ; NOTE_ENABLED
|
||||||
|
.byte $0 ; NOTE_ENVELOPE_ENABLED
|
||||||
|
.word $0 ; NOTE_SAMPLE_POINTER
|
||||||
|
.byte $0 ; NOTE_SAMPLE_LOOP
|
||||||
|
.byte $0 ; NOTE_SAMPLE_LENGTH
|
||||||
|
note_c:
|
||||||
|
.byte 'C' ; NOTE_WHICH
|
||||||
|
.byte $0 ; NOTE_VOLUME
|
||||||
|
.byte $0 ; NOTE_TONE_SLIDING
|
||||||
|
.byte $0 ; NOTE_ENABLED
|
||||||
|
.byte $0 ; NOTE_ENVELOPE_ENABLED
|
||||||
|
.word $0 ; NOTE_SAMPLE_POINTER
|
||||||
|
.byte $0 ; NOTE_SAMPLE_LOOP
|
||||||
|
.byte $0 ; NOTE_SAMPLE_LENGTH
|
||||||
|
|
||||||
|
pt3_noise_period: .byte $0
|
||||||
|
pt3_noise_add: .byte $0
|
||||||
|
pt3_envelope_period: .byte $0
|
||||||
|
pt3_envelope_type: .byte $0
|
||||||
|
pt3_current_pattern: .byte $0
|
||||||
|
|
||||||
|
|
||||||
|
load_ornament:
|
||||||
|
rts
|
||||||
|
|
||||||
|
load_sample:
|
||||||
|
rts
|
||||||
|
|
||||||
|
pt3_init_song:
|
||||||
|
lda #$f
|
||||||
|
sta note_a+NOTE_VOLUME
|
||||||
|
sta note_b+NOTE_VOLUME
|
||||||
|
sta note_c+NOTE_VOLUME
|
||||||
|
lda #$0
|
||||||
|
sta note_a+NOTE_TONE_SLIDING
|
||||||
|
sta note_b+NOTE_TONE_SLIDING
|
||||||
|
sta note_c+NOTE_TONE_SLIDING
|
||||||
|
sta note_a+NOTE_ENABLED
|
||||||
|
sta note_b+NOTE_ENABLED
|
||||||
|
sta note_c+NOTE_ENABLED
|
||||||
|
sta note_a+NOTE_ENVELOPE_ENABLED
|
||||||
|
sta note_b+NOTE_ENVELOPE_ENABLED
|
||||||
|
sta note_c+NOTE_ENVELOPE_ENABLED
|
||||||
|
lda #'A'
|
||||||
|
jsr load_ornament
|
||||||
|
lda #'A'
|
||||||
|
jsr load_sample
|
||||||
|
lda #'B'
|
||||||
|
jsr load_ornament
|
||||||
|
lda #'B'
|
||||||
|
jsr load_sample
|
||||||
|
lda #'C'
|
||||||
|
jsr load_ornament
|
||||||
|
lda #'C'
|
||||||
|
jsr load_sample
|
||||||
|
|
||||||
|
lda #$0
|
||||||
|
sta pt3_noise_period
|
||||||
|
sta pt3_noise_add
|
||||||
|
sta pt3_envelope_period
|
||||||
|
sta pt3_envelope_type
|
||||||
|
sta pt3_current_pattern
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
Binary file not shown.
@ -1,33 +1,20 @@
|
|||||||
; VMW Chiptune Player
|
; VMW Chiptune Player
|
||||||
|
|
||||||
.include "zp.inc"
|
.include "zp.inc"
|
||||||
; program is ~4k, so from 0xc00 to 0x1C00
|
|
||||||
LZ4_BUFFER EQU $1C00 ; $1C00 - $5C00, 16k for now
|
PT3_LOC = $2000
|
||||||
DISK_BUFFER EQU $5D00 ; for disk loading
|
|
||||||
UNPACK_BUFFER EQU $6000 ; $6000 - $9800, 14k, $3800
|
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
|
NUM_FILES EQU 15
|
||||||
|
|
||||||
|
|
||||||
jmp chiptune_setup
|
|
||||||
|
|
||||||
.include "chip_title_uncompressed.inc"
|
|
||||||
|
|
||||||
.align $400
|
|
||||||
|
|
||||||
;=============================
|
;=============================
|
||||||
; Setup
|
; Setup
|
||||||
;=============================
|
;=============================
|
||||||
chiptune_setup:
|
pt3_setup:
|
||||||
; jsr HOME
|
jsr HOME
|
||||||
; jsr TEXT
|
jsr TEXT
|
||||||
|
|
||||||
; Init disk code
|
; Init disk code
|
||||||
|
|
||||||
@ -36,22 +23,16 @@ chiptune_setup:
|
|||||||
; init variables
|
; init variables
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
sta DRAW_PAGE
|
; sta DRAW_PAGE
|
||||||
sta CH
|
; sta CH
|
||||||
sta CV
|
; sta CV
|
||||||
sta DONE_PLAYING
|
; sta DONE_PLAYING
|
||||||
sta MB_CHUNK_OFFSET
|
; sta MB_CHUNK_OFFSET
|
||||||
sta DECODE_ERROR
|
; sta DECODE_ERROR
|
||||||
|
|
||||||
; lda #0
|
|
||||||
; lda #4 ; start at DEMO4
|
|
||||||
; lda #7 ; start at LYRA
|
|
||||||
; lda #10 ; start at SDEMO
|
|
||||||
sta WHICH_FILE
|
sta WHICH_FILE
|
||||||
|
|
||||||
|
; lda #$ff
|
||||||
lda #$ff
|
; sta RASTERBARS_ON
|
||||||
sta RASTERBARS_ON
|
|
||||||
|
|
||||||
; print detection message
|
; print detection message
|
||||||
|
|
||||||
@ -96,10 +77,10 @@ mockingboard_found:
|
|||||||
; Vector address goes to 0x3fe/0x3ff
|
; Vector address goes to 0x3fe/0x3ff
|
||||||
; FIXME: should chain any existing handler
|
; FIXME: should chain any existing handler
|
||||||
|
|
||||||
lda #<interrupt_handler
|
; lda #<interrupt_handler
|
||||||
sta $03fe
|
; sta $03fe
|
||||||
lda #>interrupt_handler
|
; lda #>interrupt_handler
|
||||||
sta $03ff
|
; sta $03ff
|
||||||
|
|
||||||
;============================
|
;============================
|
||||||
; Enable 50Hz clock on 6522
|
; Enable 50Hz clock on 6522
|
||||||
@ -161,65 +142,26 @@ mockingboard_found:
|
|||||||
;============================
|
;============================
|
||||||
; Init Background
|
; Init Background
|
||||||
;============================
|
;============================
|
||||||
jsr set_gr_page0
|
; jsr set_gr_page0
|
||||||
|
|
||||||
lda #0
|
; lda #0
|
||||||
sta DRAW_PAGE
|
; sta DRAW_PAGE
|
||||||
sta SCREEN_Y
|
; sta SCREEN_Y
|
||||||
|
|
||||||
;============================
|
;============================
|
||||||
; Enable 6502 interrupts
|
; Enable 6502 interrupts
|
||||||
;============================
|
;============================
|
||||||
|
|
||||||
cli ; clear interrupt mask
|
; cli ; clear interrupt mask
|
||||||
|
|
||||||
|
|
||||||
;============================
|
;============================
|
||||||
; Loop forever
|
; Loop forever
|
||||||
;============================
|
;============================
|
||||||
main_loop:
|
main_loop:
|
||||||
lda DECODE_ERROR
|
|
||||||
beq check_copy
|
|
||||||
sei
|
|
||||||
brk
|
|
||||||
|
|
||||||
check_copy:
|
|
||||||
lda COPY_TIME
|
|
||||||
beq check_decompress ; if zero, skip
|
|
||||||
|
|
||||||
lda #0
|
jmp main_loop
|
||||||
sta COPY_OFFSET
|
|
||||||
check_copy_loop:
|
|
||||||
jsr page_copy ;6+3621
|
|
||||||
|
|
||||||
inc COPY_OFFSET ; (opt: make subtract?) ; 5
|
|
||||||
|
|
||||||
lda #14 ; NOT HEX URGH!
|
|
||||||
cmp COPY_OFFSET
|
|
||||||
bne check_copy_loop
|
|
||||||
|
|
||||||
lda #0 ; we are done
|
|
||||||
sta COPY_TIME
|
|
||||||
|
|
||||||
check_decompress:
|
|
||||||
lda DECOMPRESS_TIME
|
|
||||||
beq check_done ; if zero, skip
|
|
||||||
|
|
||||||
jsr setup_next_subsong ; decompress
|
|
||||||
|
|
||||||
lda MB_CHUNK_OFFSET
|
|
||||||
sta TIME_TAKEN
|
|
||||||
|
|
||||||
lda #0
|
|
||||||
sta DECOMPRESS_TIME
|
|
||||||
|
|
||||||
;============================
|
|
||||||
; visualization
|
|
||||||
;============================
|
|
||||||
; jsr clear_top
|
|
||||||
; jsr draw_rasters
|
|
||||||
; jsr volume_bars
|
|
||||||
; jsr page_flip
|
|
||||||
|
|
||||||
check_done:
|
check_done:
|
||||||
lda #$ff
|
lda #$ff
|
||||||
@ -271,19 +213,19 @@ new_song:
|
|||||||
; Init Variables
|
; Init Variables
|
||||||
;=========================
|
;=========================
|
||||||
|
|
||||||
lda #$0
|
; lda #$0
|
||||||
sta FRAME_COUNT
|
; sta FRAME_COUNT
|
||||||
sta A_VOLUME
|
; sta A_VOLUME
|
||||||
sta B_VOLUME
|
; sta B_VOLUME
|
||||||
sta C_VOLUME
|
; sta C_VOLUME
|
||||||
sta COPY_OFFSET
|
; sta COPY_OFFSET
|
||||||
sta DECOMPRESS_TIME
|
; sta DECOMPRESS_TIME
|
||||||
sta COPY_TIME
|
; sta COPY_TIME
|
||||||
sta MB_CHUNK_OFFSET
|
; sta MB_CHUNK_OFFSET
|
||||||
lda #$20
|
; lda #$20
|
||||||
sta DECODER_STATE
|
; sta DECODER_STATE
|
||||||
lda #3
|
; lda #3
|
||||||
sta CHUNKSIZE
|
; sta CHUNKSIZE
|
||||||
|
|
||||||
;===========================
|
;===========================
|
||||||
; Print loading message
|
; Print loading message
|
||||||
@ -304,7 +246,7 @@ new_song:
|
|||||||
|
|
||||||
|
|
||||||
;===========================
|
;===========================
|
||||||
; Load in KRW file
|
; Load in PT3 file
|
||||||
;===========================
|
;===========================
|
||||||
|
|
||||||
jsr get_filename
|
jsr get_filename
|
||||||
@ -349,9 +291,9 @@ space_loop:
|
|||||||
done_name_loop:
|
done_name_loop:
|
||||||
|
|
||||||
; open and read a file
|
; open and read a file
|
||||||
; loads to whatever it was BSAVED at (default is $1C00)
|
; loads to whatever it was BSAVED at (default is $2000)
|
||||||
|
|
||||||
jsr read_file ; read KRW file from disk
|
jsr read_file ; read PT3 file from disk
|
||||||
|
|
||||||
|
|
||||||
;=========================
|
;=========================
|
||||||
@ -360,24 +302,34 @@ done_name_loop:
|
|||||||
|
|
||||||
jsr clear_bottoms ; clear bottom of page 0/1
|
jsr clear_bottoms ; clear bottom of page 0/1
|
||||||
|
|
||||||
lda #>LZ4_BUFFER ; point to LZ4 data
|
; NUL terminate the strings we want to print
|
||||||
sta OUTH
|
lda #0
|
||||||
lda #<LZ4_BUFFER
|
sta PT3_LOC+$3E
|
||||||
sta OUTL
|
sta PT3_LOC+$62
|
||||||
|
|
||||||
ldy #3 ; skip KRW magic at front
|
|
||||||
|
|
||||||
; print title
|
; print title
|
||||||
|
|
||||||
|
lda #>(PT3_LOC+$1E) ; point to header title
|
||||||
|
sta OUTH
|
||||||
|
lda #<(PT3_LOC+$1E)
|
||||||
|
sta OUTL
|
||||||
|
|
||||||
lda #20 ; VTAB 20: HTAB from file
|
lda #20 ; VTAB 20: HTAB from file
|
||||||
jsr print_header_info
|
jsr print_header_info
|
||||||
|
|
||||||
; Print Author
|
; Print Author
|
||||||
|
|
||||||
|
lda #>(PT3_LOC+$42) ; point to header title
|
||||||
|
sta OUTH
|
||||||
|
lda #<(PT3_LOC+$42)
|
||||||
|
sta OUTL
|
||||||
|
|
||||||
lda #21 ; VTAB 21: HTAB from file
|
lda #21 ; VTAB 21: HTAB from file
|
||||||
jsr print_header_info
|
jsr print_header_info
|
||||||
|
|
||||||
; Print clock
|
; Print clock
|
||||||
lda #23 ; VTAB 23: HTAB from file
|
; lda #23 ; VTAB 23: HTAB from file
|
||||||
jsr print_header_info
|
; jsr print_header_info
|
||||||
|
|
||||||
; Print Left Arrow (INVERSE)
|
; Print Left Arrow (INVERSE)
|
||||||
lda #'<'
|
lda #'<'
|
||||||
@ -397,74 +349,10 @@ done_name_loop:
|
|||||||
sta $777
|
sta $777
|
||||||
sta $B77
|
sta $B77
|
||||||
|
|
||||||
|
jsr pt3_init_song
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; Point LZ4 src at proper place
|
|
||||||
|
|
||||||
ldy #0
|
|
||||||
lda #>(LZ4_BUFFER+3)
|
|
||||||
sta LZ4_SRC+1
|
|
||||||
lda #<(LZ4_BUFFER+3)
|
|
||||||
sta LZ4_SRC
|
|
||||||
|
|
||||||
lda (LZ4_SRC),Y ; get header skip
|
|
||||||
clc
|
|
||||||
adc LZ4_SRC
|
|
||||||
sta LZ4_SRC
|
|
||||||
lda LZ4_SRC+1
|
|
||||||
adc #0
|
|
||||||
sta LZ4_SRC+1
|
|
||||||
|
|
||||||
lda #<UNPACK_BUFFER ; set input pointer
|
|
||||||
sta INL
|
|
||||||
lda #>UNPACK_BUFFER
|
|
||||||
sta INH
|
|
||||||
|
|
||||||
; Decompress first chunks
|
|
||||||
|
|
||||||
lda #$0
|
|
||||||
sta COPY_OFFSET
|
|
||||||
sta DECOMPRESS_TIME
|
|
||||||
lda #$3
|
|
||||||
sta CHUNKSIZE
|
|
||||||
lda #$20
|
|
||||||
sta DECODER_STATE
|
|
||||||
sta COPY_TIME
|
|
||||||
|
|
||||||
jsr setup_next_subsong
|
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;=================
|
|
||||||
; next sub-song
|
|
||||||
;=================
|
|
||||||
setup_next_subsong:
|
|
||||||
|
|
||||||
ldy #0
|
|
||||||
|
|
||||||
lda (LZ4_SRC),Y ; get next size value
|
|
||||||
sta LZ4_END
|
|
||||||
iny
|
|
||||||
lda (LZ4_SRC),Y
|
|
||||||
sta LZ4_END+1
|
|
||||||
|
|
||||||
lda #2 ; increment pointer
|
|
||||||
clc
|
|
||||||
adc LZ4_SRC
|
|
||||||
sta LZ4_SRC
|
|
||||||
lda LZ4_SRC+1
|
|
||||||
adc #0
|
|
||||||
sta LZ4_SRC+1
|
|
||||||
|
|
||||||
jsr lz4_decode ; decode
|
|
||||||
|
|
||||||
; tail-call?
|
|
||||||
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;===================
|
;===================
|
||||||
; print header info
|
; print header info
|
||||||
@ -475,63 +363,11 @@ setup_next_subsong:
|
|||||||
print_header_info:
|
print_header_info:
|
||||||
|
|
||||||
sta CV
|
sta CV
|
||||||
|
lda #4
|
||||||
iny ; adjust pointer
|
|
||||||
tya
|
|
||||||
ldy #0
|
|
||||||
clc
|
|
||||||
adc OUTL
|
|
||||||
sta OUTL
|
|
||||||
lda OUTH
|
|
||||||
adc #$0
|
|
||||||
sta OUTH
|
|
||||||
|
|
||||||
lda (OUTL),Y ; get HTAB value
|
|
||||||
sta CH
|
sta CH
|
||||||
|
|
||||||
inc OUTL ; increment 16-bits
|
|
||||||
bne bloop22
|
|
||||||
inc OUTH
|
|
||||||
bloop22:
|
|
||||||
|
|
||||||
jmp print_both_pages ; print, tail call
|
jmp print_both_pages ; print, tail call
|
||||||
|
|
||||||
|
|
||||||
;==============================================
|
|
||||||
; plan: takes 256 50Hz to play a chunk
|
|
||||||
; need to copy 14 256-byte blocks
|
|
||||||
; PLAY A (copying C)
|
|
||||||
; PLAY B (copying C)
|
|
||||||
; PLAY D (decompressing A/B/C)
|
|
||||||
|
|
||||||
|
|
||||||
;========================
|
|
||||||
; page copy
|
|
||||||
;========================
|
|
||||||
; want to copy:
|
|
||||||
; SRC: chunk_buffer+(2*256)+(COPY_OFFSET*3*256)
|
|
||||||
; DST: chunk_buffer+$2A00+(COPY_OFFSET*256)
|
|
||||||
page_copy:
|
|
||||||
clc ; 2
|
|
||||||
lda #>(UNPACK_BUFFER+512) ; 3
|
|
||||||
adc COPY_OFFSET ; 3
|
|
||||||
adc COPY_OFFSET ; 3
|
|
||||||
adc COPY_OFFSET ; 3
|
|
||||||
sta page_copy_loop+2 ; self modify ; 5
|
|
||||||
|
|
||||||
lda #>(UNPACK_BUFFER+$2A00) ; 2
|
|
||||||
adc COPY_OFFSET ; 3
|
|
||||||
sta page_copy_loop+5 ; self modify ; 5
|
|
||||||
|
|
||||||
ldx #$00 ; 2
|
|
||||||
page_copy_loop:
|
|
||||||
lda $1000,x ; 4
|
|
||||||
sta $1000,X ; 5
|
|
||||||
inx ; 2
|
|
||||||
bne page_copy_loop ; 2nt/3
|
|
||||||
rts ; 6
|
|
||||||
;======================
|
|
||||||
; 2+14*256+6+29= 3621
|
|
||||||
|
|
||||||
|
|
||||||
;==================
|
;==================
|
||||||
@ -546,9 +382,9 @@ get_filename:
|
|||||||
ldy #0
|
ldy #0
|
||||||
ldx WHICH_FILE
|
ldx WHICH_FILE
|
||||||
|
|
||||||
lda #<krw_file ; point to filename
|
lda #<song_list ; point to filename
|
||||||
sta INL
|
sta INL
|
||||||
lda #>krw_file
|
lda #>song_list
|
||||||
sta INH
|
sta INH
|
||||||
|
|
||||||
get_filename_loop:
|
get_filename_loop:
|
||||||
@ -604,7 +440,7 @@ done_decrement:
|
|||||||
; filenames
|
; filenames
|
||||||
;==========
|
;==========
|
||||||
|
|
||||||
krw_file:
|
song_list:
|
||||||
|
|
||||||
.include "song_list.inc"
|
.include "song_list.inc"
|
||||||
|
|
||||||
@ -614,7 +450,7 @@ krw_file:
|
|||||||
.include "../asm_routines/gr_offsets.s"
|
.include "../asm_routines/gr_offsets.s"
|
||||||
.include "text_print.s"
|
.include "text_print.s"
|
||||||
.include "../asm_routines/mockingboard_a.s"
|
.include "../asm_routines/mockingboard_a.s"
|
||||||
.include "../asm_routines/gr_fast_clear.s"
|
.include "gr_fast_clear.s"
|
||||||
.include "../asm_routines/pageflip.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/gr_setpage.s"
|
||||||
@ -622,13 +458,11 @@ krw_file:
|
|||||||
.include "../asm_routines/gr_hlin.s"
|
.include "../asm_routines/gr_hlin.s"
|
||||||
.include "../asm_routines/lz4_decode.s"
|
.include "../asm_routines/lz4_decode.s"
|
||||||
.include "../asm_routines/keypress_minimal.s"
|
.include "../asm_routines/keypress_minimal.s"
|
||||||
.include "rasterbars.s"
|
;.include "rasterbars.s"
|
||||||
.include "volume_bars.s"
|
;.include "volume_bars.s"
|
||||||
.if .def(UNROLLED)
|
|
||||||
.include "interrupt_handler_unrolled.s"
|
|
||||||
.else
|
|
||||||
.include "interrupt_handler.s"
|
.include "interrupt_handler.s"
|
||||||
.endif
|
.include "pt3.s"
|
||||||
|
|
||||||
;=========
|
;=========
|
||||||
; strings
|
; strings
|
||||||
;=========
|
;=========
|
||||||
|
@ -19,8 +19,7 @@
|
|||||||
; tmptrk = $f9 ; temporary copy of current track
|
; tmptrk = $f9 ; temporary copy of current track
|
||||||
; phase = $fa ; current phase for /seek
|
; phase = $fa ; current phase for /seek
|
||||||
|
|
||||||
dirbuf = $5d00
|
dirbuf = $c00 ; note, don't put this immediately below
|
||||||
;$1e00 ; note, don't put this immediately below
|
|
||||||
; the value being read as destaddr-4
|
; the value being read as destaddr-4
|
||||||
; is temporarily overwritten during read
|
; is temporarily overwritten during read
|
||||||
; process
|
; process
|
||||||
|
2
pt3_player/song_list.inc
Normal file
2
pt3_player/song_list.inc
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
.asciiz "EA.PT3"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user