mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-01 05:31:52 +00:00
lemm: full song plays
awkward pauses though, takes more than 50Hz/20ms to decompress
This commit is contained in:
parent
a63540bc21
commit
a38436af74
@ -50,7 +50,13 @@ ym_play_music:
|
||||
frame_loop:
|
||||
ldy #0
|
||||
lda (CURRENT_FRAME_L),Y
|
||||
jsr update_register
|
||||
cmp #$ff
|
||||
bne all_good
|
||||
cpx #1 ; see if A coarse is $FF
|
||||
beq go_next_chunk ; if so, end of song, loop
|
||||
|
||||
all_good:
|
||||
jsr update_ay_register
|
||||
|
||||
clc
|
||||
lda CURRENT_FRAME_H
|
||||
@ -70,20 +76,59 @@ frame_loop:
|
||||
cmp #$D4
|
||||
bne not_oflo
|
||||
|
||||
; FIXME: handle out of data properly
|
||||
lda #$D0
|
||||
sta BASE_FRAME_H
|
||||
go_next_chunk:
|
||||
inc CURRENT_CHUNK
|
||||
jsr load_song_chunk
|
||||
|
||||
|
||||
not_oflo:
|
||||
|
||||
jmp exit_interrupt
|
||||
|
||||
;=================================
|
||||
; Finally done with this interrupt
|
||||
;=================================
|
||||
|
||||
quiet_exit:
|
||||
stx DONE_PLAYING
|
||||
jsr clear_ay_both
|
||||
|
||||
; mute the sound
|
||||
|
||||
ldx #7
|
||||
lda #$ff
|
||||
jsr update_ay_register
|
||||
|
||||
|
||||
jmp done_pt3_update_register
|
||||
exit_interrupt:
|
||||
|
||||
pla
|
||||
tay ; restore Y
|
||||
pla
|
||||
tax ; restore X
|
||||
pla ; restore a ; 4
|
||||
|
||||
; on II+/IIe (but not IIc) we need to do this?
|
||||
interrupt_smc:
|
||||
lda $45 ; restore A
|
||||
plp
|
||||
|
||||
rti ; return from interrupt ; 6
|
||||
|
||||
;============
|
||||
; typical
|
||||
; ???? cycles
|
||||
|
||||
|
||||
|
||||
|
||||
update_register:
|
||||
|
||||
;=========================
|
||||
; update ay_register
|
||||
; reg in X
|
||||
; value in A
|
||||
|
||||
update_ay_register:
|
||||
|
||||
pt3_irq_smc2:
|
||||
stx MOCK_6522_ORA1 ; put address on PA1 ; 4
|
||||
@ -111,42 +156,6 @@ pt3_irq_smc7:
|
||||
|
||||
rts
|
||||
|
||||
done_pt3_update_register:
|
||||
|
||||
done_pt3_irq_handler:
|
||||
|
||||
jmp exit_interrupt
|
||||
|
||||
;=================================
|
||||
; Finally done with this interrupt
|
||||
;=================================
|
||||
|
||||
quiet_exit:
|
||||
stx DONE_PLAYING
|
||||
jsr clear_ay_both
|
||||
|
||||
ldx #$ff ; also mute the channel
|
||||
stx AY_REGISTERS+7 ; just in case
|
||||
|
||||
|
||||
exit_interrupt:
|
||||
|
||||
pla
|
||||
tay ; restore Y
|
||||
pla
|
||||
tax ; restore X
|
||||
pla ; restore a ; 4
|
||||
|
||||
; on II+/IIe (but not IIc) we need to do this?
|
||||
interrupt_smc:
|
||||
lda $45 ; restore A
|
||||
plp
|
||||
|
||||
rti ; return from interrupt ; 6
|
||||
|
||||
;============
|
||||
; typical
|
||||
; ???? cycles
|
||||
|
||||
|
||||
|
||||
|
@ -163,34 +163,21 @@ skip_all_checks:
|
||||
; switch in language card
|
||||
; read/write RAM, $d000 bank 2
|
||||
|
||||
lda $C083
|
||||
lda $C083
|
||||
|
||||
; lda $C081 ; enable ROM
|
||||
; lda $C081 ; enable write
|
||||
lda $C083
|
||||
lda $C083
|
||||
|
||||
; actually load it
|
||||
|
||||
lda #<lemm5_part1_lzsa
|
||||
sta getsrc_smc+1 ; LZSA_SRC_LO
|
||||
lda #>lemm5_part1_lzsa
|
||||
sta getsrc_smc+2 ; LZSA_SRC_HI
|
||||
lda #0
|
||||
sta CURRENT_CHUNK
|
||||
sta DONE_PLAYING
|
||||
|
||||
lda #$d0
|
||||
jsr load_song_chunk
|
||||
|
||||
jsr decompress_lzsa2_fast
|
||||
lda #1
|
||||
sta LOOP
|
||||
|
||||
lda #0
|
||||
sta DONE_PLAYING
|
||||
sta BASE_FRAME_L
|
||||
|
||||
lda #$D0
|
||||
sta BASE_FRAME_H
|
||||
|
||||
lda #1
|
||||
sta LOOP
|
||||
|
||||
jsr mockingboard_patch ; patch to work in slots other than 4?
|
||||
jsr mockingboard_patch ; patch to work in slots other than 4?
|
||||
|
||||
;=======================
|
||||
; Set up 50Hz interrupt
|
||||
@ -283,6 +270,34 @@ load_graphics_loop:
|
||||
|
||||
|
||||
|
||||
;========================
|
||||
; load song chunk
|
||||
; CURRENT_CHUNK is which one
|
||||
|
||||
load_song_chunk:
|
||||
ldx CURRENT_CHUNK
|
||||
lda music_parts_l,X
|
||||
sta getsrc_smc+1 ; LZSA_SRC_LO
|
||||
lda music_parts_h,X
|
||||
sta getsrc_smc+2 ; LZSA_SRC_HI
|
||||
bne load_song_chunk_good
|
||||
|
||||
; wrapped
|
||||
lda #$00
|
||||
sta CURRENT_CHUNK
|
||||
beq load_song_chunk ; try again
|
||||
|
||||
load_song_chunk_good:
|
||||
lda #$d0
|
||||
sta BASE_FRAME_H
|
||||
|
||||
jsr decompress_lzsa2_fast
|
||||
|
||||
lda #0
|
||||
sta BASE_FRAME_L
|
||||
|
||||
rts
|
||||
|
||||
;==========================
|
||||
; includes
|
||||
;==========================
|
||||
@ -319,19 +334,17 @@ config_string:
|
||||
.byte 0,23,"APPLE II?, 48K, MOCKINGBOARD: NO, SSI: N",0
|
||||
; MOCKINGBOARD: NONE
|
||||
|
||||
|
||||
; .include "pt3_lib_core.s"
|
||||
; .include "pt3_lib_init.s"
|
||||
; .include "interrupt_handler.s"
|
||||
; .include "pt3_lib_mockingboard_detect.s"
|
||||
; .include "pt3_lib_mockingboard_setup.s"
|
||||
|
||||
new_title:
|
||||
.include "graphics/graphics_test.inc"
|
||||
|
||||
|
||||
|
||||
music_parts_h:
|
||||
.byte >lemm5_part1_lzsa,>lemm5_part2_lzsa,>lemm5_part3_lzsa,$00
|
||||
music_parts_l:
|
||||
.byte <lemm5_part1_lzsa,<lemm5_part2_lzsa,<lemm5_part3_lzsa
|
||||
|
||||
lemm5_part1_lzsa:
|
||||
.incbin "music/lemm5.part1.lzsa"
|
||||
|
||||
lemm5_part2_lzsa:
|
||||
.incbin "music/lemm5.part2.lzsa"
|
||||
lemm5_part3_lzsa:
|
||||
.incbin "music/lemm5.part3.lzsa"
|
||||
|
@ -50,79 +50,10 @@ CURRENT_FRAME_L = $70
|
||||
CURRENT_FRAME_H = $71
|
||||
BASE_FRAME_L = $72
|
||||
BASE_FRAME_H = $73
|
||||
CURRENT_CHUNK = $74
|
||||
|
||||
|
||||
; pt3 player registers
|
||||
REGISTER_DUMP = $70
|
||||
AY_REGISTERS = $70
|
||||
A_FINE_TONE = $70
|
||||
A_COARSE_TONE = $71
|
||||
B_FINE_TONE = $72
|
||||
B_COARSE_TONE = $73
|
||||
C_FINE_TONE = $74
|
||||
C_COARSE_TONE = $75
|
||||
NOISE = $76
|
||||
ENABLE = $77
|
||||
PT3_MIXER_VAL = $77
|
||||
A_VOLUME = $78
|
||||
B_VOLUME = $79
|
||||
C_VOLUME = $7A
|
||||
ENVELOPE_FINE = $7B
|
||||
ENVELOPE_COARSE = $7C
|
||||
ENVELOPE_SHAPE = $7D
|
||||
COPY_OFFSET = $7E
|
||||
DECODER_STATE = $7F
|
||||
|
||||
PATTERN_L = $7E
|
||||
PATTERN_H = $7F
|
||||
|
||||
|
||||
; note 70-7f also used by disk code
|
||||
|
||||
; note: rest are up at $f0
|
||||
|
||||
; We have to save/restore the following values
|
||||
; when loading/storing from disk
|
||||
|
||||
WHICH_LOAD = $80 ; which file to load
|
||||
|
||||
DUKE_XL = $81
|
||||
DUKE_X = $82 ; location of protagonist
|
||||
DUKE_Y = $83
|
||||
DUKE_DIRECTION = $84
|
||||
DUKE_WALKING = $85
|
||||
DUKE_JUMPING = $86
|
||||
|
||||
LASER_OUT = $87
|
||||
LASER_X = $88
|
||||
LASER_Y = $89
|
||||
LASER_DIRECTION = $8A
|
||||
APPLEII_MODEL = $8B
|
||||
TILEMAP_Y = $8C
|
||||
|
||||
DUKE_FOOT_OFFSET = $8D
|
||||
|
||||
FIREPOWER = $8E
|
||||
INVENTORY = $8F
|
||||
INV_RED_KEY = $80
|
||||
INV_BLUE_KEY = $20
|
||||
INV_SHOE = $08
|
||||
INV_GRIP = $02
|
||||
HEALTH = $90
|
||||
SCORE0 = $91
|
||||
SCORE1 = $92
|
||||
SCORE2 = $93
|
||||
UPDATE_STATUS = $94
|
||||
|
||||
DUKE_FALLING = $95
|
||||
DUKE_SHOOTING = $96
|
||||
KICK_UP_DUST = $97
|
||||
SUPPRESS_WALK = $98
|
||||
ENEMY_DATAL = $99
|
||||
ENEMY_DATAH = $9A
|
||||
DOOR_ACTIVATED = $9B
|
||||
LASER_TILE = $9C
|
||||
TILE_TEMP = $9D
|
||||
|
||||
; done game puzzle state
|
||||
|
||||
@ -153,9 +84,6 @@ DISP_PAGE = $ED ; ALL
|
||||
DRAW_PAGE = $EE ; ALL
|
||||
|
||||
; rest of pt3_player
|
||||
MB_DETECTED = $EF
|
||||
WHICH_CHUNK = $F0
|
||||
MB_CHUNK_OFFSET = $F1
|
||||
LOOP = $F4
|
||||
MB_VALUE = $F5
|
||||
MB_ADDR_L = $F6
|
||||
@ -163,17 +91,6 @@ MB_ADDR_H = $F7
|
||||
DONE_PLAYING = $F8
|
||||
DONE_SONG = $F9
|
||||
|
||||
; rest of pt3_player
|
||||
PT3_TEMP = $EF
|
||||
ORNAMENT_L = $F0
|
||||
ORNAMENT_H = $F1
|
||||
SAMPLE_L = $F2
|
||||
SAMPLE_H = $F3
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TEMP = $FA
|
||||
TEMPY = $FB
|
||||
@ -182,26 +99,3 @@ INH = $FD
|
||||
OUTL = $FE
|
||||
OUTH = $FF
|
||||
|
||||
; read any file slot 6 version
|
||||
; based on FASTLD6 and RTS copyright (c) Peter Ferrie 2011-2013,2018
|
||||
|
||||
; modified to assemble with ca65 -- vmw
|
||||
; added code to patch it to run from current disk slot -- vmw
|
||||
|
||||
|
||||
adrlo = $26 ; constant from boot prom
|
||||
adrhi = $27 ; constant from boot prom
|
||||
tmpsec = $3c ; constant from boot prom
|
||||
reqsec = $3d ; constant from boot prom
|
||||
sizelo = $44
|
||||
sizehi = $45
|
||||
secsize = $46
|
||||
|
||||
ldsizel = $70
|
||||
ldsizeh = $71
|
||||
namlo = $7b
|
||||
namhi = $7c
|
||||
step = $7d ; state for stepper motor
|
||||
tmptrk = $7e ; temporary copy of current track
|
||||
phase = $7f ; current phase for /seek
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user