mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-23 11:33:07 +00:00
megamusic: frame lock
This commit is contained in:
parent
c208d0f5a7
commit
02f0758c31
@ -16,7 +16,8 @@ megamusic.dsk: MEGAMUSIC MEGALOAD
|
||||
MEGAMUSIC: megamusic.o
|
||||
ld65 -o MEGAMUSIC megamusic.o -C ../linker_scripts/apple2_4000.inc
|
||||
|
||||
megamusic.o: megamusic.s
|
||||
megamusic.o: megamusic.s \
|
||||
play_music.s falling_apple.s
|
||||
ca65 -o megamusic.o megamusic.s -l megamusic.lst
|
||||
|
||||
|
||||
|
@ -150,14 +150,20 @@ page1_loop: ; delay 115+(7 loop)+4 (bit)+4(extra)
|
||||
; -1 (+1-2) from above
|
||||
; -25 inc framecount
|
||||
; -7 see if timeout
|
||||
; -100 play_music
|
||||
; -10 keypress
|
||||
;================
|
||||
; 4507
|
||||
; 4407
|
||||
|
||||
; Try X=149 Y=6 cycles=4507
|
||||
jsr play_music ; 6+94
|
||||
|
||||
ldy #6 ; 2
|
||||
faloop1:ldx #149 ; 2
|
||||
|
||||
; Try X=219 Y=4 cycles=4405R2
|
||||
|
||||
nop
|
||||
|
||||
ldy #4 ; 2
|
||||
faloop1:ldx #219 ; 2
|
||||
faloop2:dex ; 2
|
||||
bne faloop2 ; 2nt/3
|
||||
dey ; 2
|
||||
@ -193,7 +199,8 @@ fa_doneinc:
|
||||
; 7 cycles
|
||||
lda FRAMEH ; 3
|
||||
cmp #100 ; 2
|
||||
beq fa_done ; 3
|
||||
nop
|
||||
;beq fa_done ; 3
|
||||
; -1
|
||||
|
||||
;=====================
|
||||
|
@ -8,6 +8,11 @@
|
||||
|
||||
megamusic_start: ; this should end up at $4000
|
||||
|
||||
;===================
|
||||
; Init mockingboard
|
||||
;===================
|
||||
jsr mockingboard_init
|
||||
|
||||
;===================
|
||||
; set graphics mode
|
||||
;===================
|
||||
@ -25,50 +30,17 @@ game_over_man:
|
||||
jmp game_over_man
|
||||
|
||||
|
||||
; .include "lz4_decode.s"
|
||||
; .include "c64_opener.s"
|
||||
.include "falling_apple.s"
|
||||
.include "gr_unrle.s"
|
||||
.include "gr_copy.s"
|
||||
; .include "starring.s"
|
||||
; .include "starring_people.s"
|
||||
; .include "check_email.s"
|
||||
.align $100
|
||||
.include "gr_offsets.s"
|
||||
.include "gr_hline.s"
|
||||
.include "vapor_lock.s"
|
||||
.include "delay_a.s"
|
||||
; .include "wait_keypress.s"
|
||||
; .include "random16.s"
|
||||
.align $100
|
||||
; .include "fireworks.s"
|
||||
; .include "hgr.s"
|
||||
; .include "bird_mountain.s"
|
||||
; .include "move_letters.s"
|
||||
.align $100
|
||||
; .include "gr_putsprite.s"
|
||||
; .include "mode7.s"
|
||||
; .include "space_bars.s"
|
||||
; .include "takeoff.s"
|
||||
; .include "leaving.s"
|
||||
; .include "arrival.s"
|
||||
; .include "waterfall.s"
|
||||
; .include "text_print.s"
|
||||
.align $100
|
||||
; .include "screen_split.s"
|
||||
|
||||
;============================
|
||||
; Include Sprites
|
||||
;============================
|
||||
.align $100
|
||||
; .include "tfv_sprites.inc"
|
||||
; .include "mode7_sprites.inc"
|
||||
|
||||
;=================================
|
||||
; Include Text for Sliding Letters
|
||||
; *DONT CROSS PAGES*
|
||||
;=================================
|
||||
;.include "letters.s"
|
||||
.include "mockingboard.s"
|
||||
.include "play_music.s"
|
||||
|
||||
;============================
|
||||
; Include Lores Graphics
|
||||
@ -78,8 +50,3 @@ game_over_man:
|
||||
; falling_apple
|
||||
.include "apple_40_96.inc"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
151
megamusic/mockingboard.s
Normal file
151
megamusic/mockingboard.s
Normal file
@ -0,0 +1,151 @@
|
||||
; ZP addresses
|
||||
|
||||
; left channel
|
||||
MOCK_6522_1_ORB = $C400 ; 6522 #1 port b data
|
||||
MOCK_6522_1_ORA = $C401 ; 6522 #1 port a data
|
||||
MOCK_6522_1_DDRB = $C402 ; 6522 #1 data direction port B
|
||||
MOCK_6522_1_DDRA = $C403 ; 6522 #1 data direction port A
|
||||
MOCK_6522_1_T1C_L = $C404 ; 6522 #1 Low-order counter
|
||||
MOCK_6522_1_T1C_H = $C405 ; 6522 #1 High-order counter
|
||||
MOCK_6522_1_T1L_L = $C406 ; 6522 #1 Low-order latch
|
||||
MOCK_6522_1_T1L_H = $C407 ; 6522 #1 High-order latch
|
||||
MOCK_6522_1_T2C_L = $C408 ; 6522 #1 Timer2 Low-order Latch/Counter
|
||||
MOCK_6522_1_T2C_H = $C409 ; 6522 #1 Timer2 High-order Latch/Counter
|
||||
MOCK_6522_1_SR = $C40A ; 6522 #1 Shift Register
|
||||
MOCK_6522_1_ACR = $C40B ; 6522 #1 Auxiliary Control Register
|
||||
MOCK_6522_1_PCR = $C40C ; 6522 #1 Peripheral Control Register
|
||||
MOCK_6522_1_IFR = $C40D ; 6522 #1 Interrupt Flag Register
|
||||
MOCK_6522_1_IER = $C40E ; 6522 #1 Interrupt Enable Register
|
||||
MOCK_6522_1_ORAN = $C40F ; 6522 #1 port a data, no handshake
|
||||
|
||||
; right channel
|
||||
MOCK_6522_2_ORB = $C480 ; 6522 #2 port b data
|
||||
MOCK_6522_2_ORA = $C481 ; 6522 #2 port a data
|
||||
MOCK_6522_2_DDRB = $C482 ; 6522 #2 data direction port B
|
||||
MOCK_6522_2_DDRA = $C483 ; 6522 #2 data direction port A
|
||||
MOCK_6522_2_T1C_L = $C484 ; 6522 #2 Low-order counter
|
||||
MOCK_6522_2_T1C_H = $C485 ; 6522 #2 High-order counter
|
||||
MOCK_6522_2_T1L_L = $C486 ; 6522 #2 Low-order latch
|
||||
MOCK_6522_2_T1L_H = $C487 ; 6522 #2 High-order latch
|
||||
MOCK_6522_2_T2C_L = $C488 ; 6522 #2 Timer2 Low-order Latch/Counter
|
||||
MOCK_6522_2_T2C_H = $C489 ; 6522 #2 Timer2 High-order Latch/Counter
|
||||
MOCK_6522_2_SR = $C48A ; 6522 #2 Shift Register
|
||||
MOCK_6522_2_ACR = $C48B ; 6522 #2 Auxiliary Control Register
|
||||
MOCK_6522_2_PCR = $C48C ; 6522 #2 Peripheral Control Register
|
||||
MOCK_6522_2_IFR = $C48D ; 6522 #2 Interrupt Flag Register
|
||||
MOCK_6522_2_IER = $C48E ; 6522 #2 Interrupt Enable Register
|
||||
MOCK_6522_2_ORAN = $C48F ; 6522 #2 port a data, no handshake
|
||||
|
||||
|
||||
; AY-3-8910 commands on port B
|
||||
; RESET BDIR BC1
|
||||
MOCK_AY_RESET = $0 ; 0 0 0
|
||||
MOCK_AY_INACTIVE = $4 ; 1 0 0
|
||||
MOCK_AY_READ = $5 ; 1 0 1
|
||||
MOCK_AY_WRITE = $6 ; 1 1 0
|
||||
MOCK_AY_LATCH_ADDR = $7 ; 1 1 1
|
||||
|
||||
|
||||
;========================
|
||||
; Mockingboard Init
|
||||
;========================
|
||||
; Initialize the 6522s
|
||||
; set the data direction for all pins of PortA/PortB to be output
|
||||
|
||||
mockingboard_init:
|
||||
lda #$ff ; all 8 pins output (1), portA
|
||||
|
||||
sta MOCK_6522_1_DDRA
|
||||
sta MOCK_6522_2_DDRA
|
||||
; only 3 pins output (1), port B
|
||||
lda #$7
|
||||
sta MOCK_6522_1_DDRB
|
||||
|
||||
sta MOCK_6522_2_DDRB
|
||||
|
||||
|
||||
reset_ay_both:
|
||||
;======================
|
||||
; Reset Left AY-3-8910
|
||||
;======================
|
||||
reset_ay_left:
|
||||
lda #MOCK_AY_RESET
|
||||
sta MOCK_6522_1_ORB
|
||||
lda #MOCK_AY_INACTIVE
|
||||
sta MOCK_6522_1_ORB
|
||||
|
||||
; AY-3-8913: Wait 5 us
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
|
||||
;======================
|
||||
; Reset Right AY-3-8910
|
||||
;======================
|
||||
reset_ay_right:
|
||||
lda #MOCK_AY_RESET
|
||||
sta MOCK_6522_2_ORB
|
||||
lda #MOCK_AY_INACTIVE
|
||||
sta MOCK_6522_2_ORB
|
||||
|
||||
; AY-3-8913: Wait 5 us
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
|
||||
;=========================
|
||||
; Setup initial conditions
|
||||
;=========================
|
||||
|
||||
|
||||
; 7: ENABLE
|
||||
ldx #7
|
||||
lda #$38 ; noise disabled, ABC enabled
|
||||
sta MB_VALUE
|
||||
jsr write_ay_both
|
||||
|
||||
rts
|
||||
|
||||
|
||||
|
||||
;=========================================
|
||||
; Write Right/Left to save value AY-3-8910
|
||||
;=========================================
|
||||
; register in X
|
||||
; value in MB_VALUE
|
||||
|
||||
write_ay_both:
|
||||
; address
|
||||
stx MOCK_6522_1_ORA ; put address on PA1 ; 4
|
||||
stx MOCK_6522_2_ORA ; put address on PA2 ; 4
|
||||
lda #MOCK_AY_LATCH_ADDR ; latch_address on PB1 ; 2
|
||||
sta MOCK_6522_1_ORB ; latch_address on PB1 ; 4
|
||||
sta MOCK_6522_2_ORB ; latch_address on PB2 ; 4
|
||||
lda #MOCK_AY_INACTIVE ; go inactive ; 2
|
||||
sta MOCK_6522_1_ORB ; 4
|
||||
sta MOCK_6522_2_ORB ; 4
|
||||
;===========
|
||||
; 28
|
||||
; value
|
||||
lda MB_VALUE ; 3
|
||||
sta MOCK_6522_1_ORA ; put value on PA1 ; 4
|
||||
sta MOCK_6522_2_ORA ; put value on PA2 ; 4
|
||||
lda #MOCK_AY_WRITE ; ; 2
|
||||
sta MOCK_6522_1_ORB ; write on PB1 ; 4
|
||||
sta MOCK_6522_2_ORB ; write on PB2 ; 4
|
||||
lda #MOCK_AY_INACTIVE ; go inactive ; 2
|
||||
sta MOCK_6522_1_ORB ; 4
|
||||
sta MOCK_6522_2_ORB ; 4
|
||||
;===========
|
||||
; 31
|
||||
|
||||
rts ; 6
|
||||
;===========
|
||||
; 65
|
||||
|
||||
|
||||
|
21
megamusic/play_music.s
Normal file
21
megamusic/play_music.s
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
; takes
|
||||
; 3 + 80 + 11 = 94
|
||||
play_music:
|
||||
ldy MB_FRAME ; 3
|
||||
|
||||
lda mal00,Y ; 4
|
||||
sta MB_VALUE ; 3
|
||||
ldx #0 ; 2
|
||||
jsr write_ay_both ; 6+65
|
||||
|
||||
inc MB_FRAME ; 5
|
||||
|
||||
rts ; 6
|
||||
|
||||
.align $100
|
||||
|
||||
mal00:
|
||||
.incbin "music/mock.al.00"
|
||||
mal02:
|
||||
.incbin "music/mock.al.02"
|
@ -111,7 +111,7 @@ MB_VALUE = $91
|
||||
MB_ADDRL = $91
|
||||
MB_ADDRH = $92
|
||||
DONE_PLAYING = $93
|
||||
MB_CHUNK_OFFSET = $94
|
||||
MB_FRAME = $94
|
||||
CHUNKSIZE = $95
|
||||
LZ4_DONE = $96
|
||||
DECODE_ERROR = $97
|
||||
|
Loading…
x
Reference in New Issue
Block a user