mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-26 11:30:12 +00:00
mockingboard: got compressed version working (mostly)
This commit is contained in:
parent
0faa94473b
commit
b90eb5877e
@ -3,11 +3,13 @@ include ../Makefile.inc
|
||||
DOS33 = ../dos33fs-utils/dos33
|
||||
PNG2GR = ../gr-utils/png2gr
|
||||
|
||||
all: dump_ed mock.dsk
|
||||
all: dump_ed mock.dsk lzss_compress
|
||||
|
||||
mock.dsk: KSP_THEME_UNCOMPRESSED KSP_THEME_COMPRESSED
|
||||
mock.dsk: KSP_THEME_UNCOMPRESSED KSP_THEME_COMPRESSED \
|
||||
KSP_THEME_INTERRUPT
|
||||
$(DOS33) -y mock_test.dsk BSAVE -a 0x1000 KSP_THEME_UNCOMPRESSED
|
||||
$(DOS33) -y mock_test.dsk BSAVE -a 0x1000 KSP_THEME_COMPRESSED
|
||||
$(DOS33) -y mock_test.dsk BSAVE -a 0x1000 KSP_THEME_INTERRUPT
|
||||
|
||||
KSP_THEME_COMPRESSED: ksp_theme_compressed.o
|
||||
ld65 -o KSP_THEME_COMPRESSED ksp_theme_compressed.o -C ./apple2_1000.inc
|
||||
@ -17,6 +19,15 @@ ksp_theme_compressed.o: ksp_theme_compressed.s \
|
||||
ksp_theme_compressed.inc
|
||||
ca65 -o ksp_theme_compressed.o ksp_theme_compressed.s -l ksp_theme_compressed.lst
|
||||
|
||||
KSP_THEME_INTERRUPT: ksp_theme_interrupt.o
|
||||
ld65 -o KSP_THEME_INTERRUPT ksp_theme_interrupt.o -C ./apple2_1000.inc
|
||||
|
||||
ksp_theme_interrupt.o: ksp_theme_interrupt.s \
|
||||
../asm_routines/mockingboard.s \
|
||||
ksp_title.inc
|
||||
ca65 -o ksp_theme_interrupt.o ksp_theme_interrupt.s -l ksp_theme_interrupt.lst
|
||||
|
||||
|
||||
KSP_THEME_UNCOMPRESSED: ksp_theme_uncompressed.o
|
||||
ld65 -o KSP_THEME_UNCOMPRESSED ksp_theme_uncompressed.o -C ./apple2_1000.inc
|
||||
|
||||
@ -40,6 +51,12 @@ dump_ed: dump_ed.o notes.o
|
||||
$(CC) $(LFLAGS) -o dump_ed dump_ed.o notes.o
|
||||
|
||||
|
||||
lzss_compress.o: lzss_compress.c
|
||||
$(CC) $(CFLAGS) -c lzss_compress.c
|
||||
|
||||
lzss_compress: lzss_compress.o
|
||||
$(CC) $(LFLAGS) -o lzss_compress lzss_compress.o
|
||||
|
||||
clean:
|
||||
rm -f *~ TITLE.GR *.o *.lst ED KSP_THEME_UNCOMPRESSED dump_ed
|
||||
|
||||
|
@ -7,7 +7,7 @@ ksptheme:
|
||||
; Author name: Felipe Falanghe
|
||||
; Comment: Tracked by Vince Weaver
|
||||
|
||||
.byte $00,$80,$38,$00 ; 00000
|
||||
.byte $01,$80,$38,$00 ; 00000
|
||||
.byte $60,$35,$BD,$EE,$DD,$01,$07,$0D,$0D,$0D ; 00096
|
||||
.byte $01,$00,$07,$0E,$0E,$0E ; 00097
|
||||
.byte $01,$00,$07,$0F,$0F,$0F ; 00098
|
||||
@ -939,5 +939,6 @@ ksptheme:
|
||||
.byte $01,$00,$01,$09 ; 04035
|
||||
.byte $08,$00,$01,$08 ; 04043
|
||||
.byte $01,$01,$00,$01,$00 ; 04044
|
||||
.byte $ff
|
||||
; Raw size = 57792 bytes
|
||||
; Updated size = 4800 bytes
|
||||
|
@ -20,6 +20,27 @@
|
||||
sta OUTH
|
||||
jsr move_and_print
|
||||
|
||||
jsr mockingboard_detect_slot4
|
||||
cpx #$1
|
||||
beq mockingboard_found
|
||||
|
||||
lda #<not_message
|
||||
sta OUTL
|
||||
lda #>not_message
|
||||
sta OUTH
|
||||
inc CV
|
||||
jsr move_and_print
|
||||
|
||||
jmp forever_loop
|
||||
|
||||
mockingboard_found:
|
||||
lda #<found_message
|
||||
sta OUTL
|
||||
lda #>found_message
|
||||
sta OUTH
|
||||
inc CV
|
||||
jsr move_and_print
|
||||
|
||||
;============================
|
||||
; Init the Mockingboard
|
||||
;============================
|
||||
@ -40,8 +61,8 @@
|
||||
lda #>ksptheme
|
||||
sta INH
|
||||
|
||||
ldy #0
|
||||
new_frame:
|
||||
ldy #0
|
||||
lda (INL),Y ; read in frame delay
|
||||
cmp #$ff ; see if end
|
||||
beq done_play ; if so, done
|
||||
@ -49,90 +70,96 @@ new_frame:
|
||||
tax
|
||||
old_frame:
|
||||
dex ; decrement the frame diff
|
||||
bpl delay_a_bit ; if not there yet, delay
|
||||
beq bottom_regs ; if not there yet, delay
|
||||
jsr delay_50Hz
|
||||
jmp old_frame
|
||||
|
||||
top_regs:
|
||||
bottom_regs:
|
||||
iny
|
||||
lda (INL),Y ; load low reg bitmask
|
||||
ldx #$ff
|
||||
top_regs_loop:
|
||||
inx
|
||||
cmp #$8
|
||||
beq bottom_regs
|
||||
ror
|
||||
bcc top_regs_loop
|
||||
lda (INL),Y ; load low reg bitmask
|
||||
sta MASK
|
||||
ldx #$ff ; init to -1
|
||||
bottom_regs_loop:
|
||||
inx ; increment X
|
||||
cpx #$8 ; if we reach 8, done
|
||||
beq top_regs ; move on to top
|
||||
|
||||
stx XX
|
||||
sty YY
|
||||
ror MASK
|
||||
bcc bottom_regs_loop ; if bit not set in mask, skip reg
|
||||
|
||||
iny
|
||||
lda (INL),Y ; read in value
|
||||
tax
|
||||
stx XX ; save X
|
||||
|
||||
ldy XX
|
||||
iny ; get next output value
|
||||
lda (INL),Y ; read in value
|
||||
|
||||
sty YY ; save Y
|
||||
|
||||
tax ; value in X
|
||||
ldy XX ; register# in Y
|
||||
|
||||
; reg in Y, value in X
|
||||
jsr write_ay_left ; assume 3 channel (not six)
|
||||
jsr write_ay_right ; so write same to both left/write
|
||||
jsr write_ay_left ; assume 3 channel (not six)
|
||||
jsr write_ay_right ; so write same to both left/write
|
||||
|
||||
ldx XX ; restore X
|
||||
ldy YY ; restore Y
|
||||
|
||||
jmp bottom_regs_loop ; loop
|
||||
|
||||
top_regs:
|
||||
iny ; point to next value
|
||||
lda (INL),Y ; load top reg bitmask
|
||||
sta MASK
|
||||
ldx #$7 ; load X as 7 (we increment first)
|
||||
top_regs_loop:
|
||||
inx ; increment
|
||||
cpx #$16
|
||||
beq done_with_masks ; exit if done
|
||||
|
||||
ror MASK
|
||||
bcc top_regs_loop ; loop if not set
|
||||
|
||||
stx XX ; save X value
|
||||
|
||||
iny ; point to value
|
||||
lda (INL),Y ; read in output value
|
||||
|
||||
sty YY ; save Y value
|
||||
|
||||
tax ; value in X
|
||||
ldy XX ; register in Y
|
||||
|
||||
; reg in Y, value in X
|
||||
jsr write_ay_left ; assume 3 channel (not six)
|
||||
jsr write_ay_right ; so write same to both left/write
|
||||
|
||||
ldx XX
|
||||
ldy YY
|
||||
|
||||
jmp top_regs_loop
|
||||
|
||||
bottom_regs:
|
||||
done_with_masks:
|
||||
iny
|
||||
lda (INL),Y ; load low reg bitmask
|
||||
ldx #$ff
|
||||
bottom_regs_loop:
|
||||
inx
|
||||
cmp #$8
|
||||
beq delay_a_bit
|
||||
ror
|
||||
bcc bottom_regs_loop
|
||||
clc
|
||||
tya
|
||||
adc INL
|
||||
sta INL
|
||||
lda #0
|
||||
adc INH
|
||||
sta INH
|
||||
|
||||
jsr delay_50Hz
|
||||
|
||||
stx XX
|
||||
sty YY
|
||||
jmp new_frame
|
||||
|
||||
iny
|
||||
lda (INL),Y ; read in value
|
||||
tax
|
||||
|
||||
ldy XX
|
||||
|
||||
; reg in Y, value in X
|
||||
jsr write_ay_left ; assume 3 channel (not six)
|
||||
jsr write_ay_right ; so write same to both left/write
|
||||
|
||||
ldx XX
|
||||
ldy YY
|
||||
|
||||
jmp bottom_regs_loop
|
||||
|
||||
; reg in Y, value in X
|
||||
jsr write_ay_left ; assume 3 channel (not six)
|
||||
jsr write_ay_right ; so write same to both left/write
|
||||
|
||||
delay_a_bit:
|
||||
|
||||
lda #86
|
||||
jsr WAIT ; delay 1/2(26+27A+5A^2) us
|
||||
; 50Hz = 20ms = 20000us
|
||||
; 40000 = 26+27A+5A^2
|
||||
; 5a^2+27a-39974 = 0
|
||||
; A = 86.75
|
||||
|
||||
jmp old_frame
|
||||
done_play:
|
||||
|
||||
jsr clear_ay_left
|
||||
jsr clear_ay_right
|
||||
|
||||
|
||||
lda #0
|
||||
sta CH
|
||||
lda #2
|
||||
lda #3
|
||||
sta CV
|
||||
lda #<done_message
|
||||
sta OUTL
|
||||
@ -144,6 +171,19 @@ done_play:
|
||||
forever_loop:
|
||||
jmp forever_loop
|
||||
|
||||
|
||||
|
||||
delay_50Hz:
|
||||
|
||||
lda #86
|
||||
jsr WAIT ; delay 1/2(26+27A+5A^2) us
|
||||
; 50Hz = 20ms = 20000us
|
||||
; 40000 = 26+27A+5A^2
|
||||
; 5a^2+27a-39974 = 0
|
||||
; A = 86.75
|
||||
rts
|
||||
|
||||
|
||||
;=========
|
||||
;routines
|
||||
;=========
|
||||
@ -160,4 +200,6 @@ forever_loop:
|
||||
; strings
|
||||
;=========
|
||||
mocking_message: .asciiz "ASSUMING MOCKINGBOARD IN SLOT #4"
|
||||
not_message: .byte "NOT "
|
||||
found_message: .asciiz "FOUND"
|
||||
done_message: .asciiz "DONE PLAYING"
|
||||
|
188
mockingboard/ksp_theme_interrupt.s
Normal file
188
mockingboard/ksp_theme_interrupt.s
Normal file
@ -0,0 +1,188 @@
|
||||
; Play the KSP theme, but compressed a bit (only write registers that change)
|
||||
; Still 3-channel
|
||||
; The KSP theme is fairly small, will need to compress more
|
||||
|
||||
.include "zp.inc"
|
||||
|
||||
;=============================
|
||||
; Print message
|
||||
;=============================
|
||||
jsr HOME
|
||||
jsr TEXT
|
||||
|
||||
lda #0
|
||||
sta DRAW_PAGE
|
||||
sta CH
|
||||
sta CV
|
||||
lda #<mocking_message
|
||||
sta OUTL
|
||||
lda #>mocking_message
|
||||
sta OUTH
|
||||
jsr move_and_print
|
||||
|
||||
jsr mockingboard_detect_slot4
|
||||
cpx #$1
|
||||
beq mockingboard_found
|
||||
|
||||
lda #<not_message
|
||||
sta OUTL
|
||||
lda #>not_message
|
||||
sta OUTH
|
||||
inc CV
|
||||
jsr move_and_print
|
||||
|
||||
jmp forever_loop
|
||||
|
||||
mockingboard_found:
|
||||
|
||||
lda #<found_message
|
||||
sta OUTL
|
||||
lda #>found_message
|
||||
sta OUTH
|
||||
inc CV
|
||||
jsr move_and_print
|
||||
|
||||
|
||||
;============================
|
||||
; Init the Mockingboard
|
||||
;============================
|
||||
|
||||
jsr mockingboard_init
|
||||
jsr reset_ay_left
|
||||
jsr reset_ay_right
|
||||
jsr clear_ay_left
|
||||
jsr clear_ay_right
|
||||
|
||||
|
||||
;===========================
|
||||
; load pointer to the music
|
||||
;===========================
|
||||
|
||||
lda #<ksptheme
|
||||
sta INL
|
||||
lda #>ksptheme
|
||||
sta INH
|
||||
|
||||
ldy #0
|
||||
new_frame:
|
||||
lda (INL),Y ; read in frame delay
|
||||
cmp #$ff ; see if end
|
||||
beq done_play ; if so, done
|
||||
|
||||
tax
|
||||
old_frame:
|
||||
dex ; decrement the frame diff
|
||||
bpl delay_a_bit ; if not there yet, delay
|
||||
|
||||
top_regs:
|
||||
iny
|
||||
lda (INL),Y ; load low reg bitmask
|
||||
ldx #$ff
|
||||
top_regs_loop:
|
||||
inx
|
||||
cmp #$8
|
||||
beq bottom_regs
|
||||
ror
|
||||
bcc top_regs_loop
|
||||
|
||||
stx XX
|
||||
sty YY
|
||||
|
||||
iny
|
||||
lda (INL),Y ; read in value
|
||||
tax
|
||||
|
||||
ldy XX
|
||||
|
||||
; reg in Y, value in X
|
||||
jsr write_ay_left ; assume 3 channel (not six)
|
||||
jsr write_ay_right ; so write same to both left/write
|
||||
|
||||
ldx XX
|
||||
ldy YY
|
||||
|
||||
jmp top_regs_loop
|
||||
|
||||
bottom_regs:
|
||||
iny
|
||||
lda (INL),Y ; load low reg bitmask
|
||||
ldx #$ff
|
||||
bottom_regs_loop:
|
||||
inx
|
||||
cmp #$8
|
||||
beq delay_a_bit
|
||||
ror
|
||||
bcc bottom_regs_loop
|
||||
|
||||
|
||||
stx XX
|
||||
sty YY
|
||||
|
||||
iny
|
||||
lda (INL),Y ; read in value
|
||||
tax
|
||||
|
||||
ldy XX
|
||||
|
||||
; reg in Y, value in X
|
||||
jsr write_ay_left ; assume 3 channel (not six)
|
||||
jsr write_ay_right ; so write same to both left/write
|
||||
|
||||
ldx XX
|
||||
ldy YY
|
||||
|
||||
jmp bottom_regs_loop
|
||||
|
||||
; reg in Y, value in X
|
||||
jsr write_ay_left ; assume 3 channel (not six)
|
||||
jsr write_ay_right ; so write same to both left/write
|
||||
|
||||
delay_a_bit:
|
||||
|
||||
lda #86
|
||||
jsr WAIT ; delay 1/2(26+27A+5A^2) us
|
||||
; 50Hz = 20ms = 20000us
|
||||
; 40000 = 26+27A+5A^2
|
||||
; 5a^2+27a-39974 = 0
|
||||
; A = 86.75
|
||||
|
||||
jmp old_frame
|
||||
done_play:
|
||||
|
||||
jsr clear_ay_left
|
||||
jsr clear_ay_right
|
||||
|
||||
|
||||
lda #0
|
||||
sta CH
|
||||
lda #2
|
||||
sta CV
|
||||
lda #<done_message
|
||||
sta OUTL
|
||||
lda #>done_message
|
||||
sta OUTH
|
||||
jsr move_and_print
|
||||
|
||||
|
||||
forever_loop:
|
||||
jmp forever_loop
|
||||
|
||||
;=========
|
||||
;routines
|
||||
;=========
|
||||
.include "../asm_routines/gr_offsets.s"
|
||||
.include "../asm_routines/text_print.s"
|
||||
.include "../asm_routines/mockingboard.s"
|
||||
|
||||
;=======
|
||||
; music
|
||||
;=======
|
||||
.include "ksp_theme_compressed.inc"
|
||||
|
||||
;=========
|
||||
; strings
|
||||
;=========
|
||||
mocking_message: .asciiz "LOOKING FOR MOCKINGBOARD IN SLOT #4: "
|
||||
not_message: .byte "NOT "
|
||||
found_message: .asciiz "FOUND"
|
||||
done_message: .asciiz "DONE PLAYING"
|
Binary file not shown.
@ -100,7 +100,8 @@ KEY_OFFSET EQU $8D
|
||||
DRAW_BLUE_SKY EQU $8E
|
||||
RANDOM_POINTER EQU $8F
|
||||
FRAME_COUNT EQU $90
|
||||
AY_FRAME EQU $91
|
||||
MB_ADDRL EQU $91
|
||||
MB_ADDRH EQU $92
|
||||
|
||||
SHIPY EQU $E4
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user