mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-26 16:33:43 +00:00
megademo: add interrupt-driven music during mode7 segment
This commit is contained in:
parent
4767e7e5c5
commit
7e8b3ec3aa
@ -30,6 +30,7 @@ MEGADEMO: megademo.o
|
||||
megademo.o: megademo.s \
|
||||
zp.inc hardware.inc \
|
||||
gr_hline.s gr_offsets.s vapor_lock.s delay_a.s wait_keypress.s \
|
||||
mockingboard.s \
|
||||
c64_opener.s c64.img.lz4 \
|
||||
falling_apple.s apple_40_96.inc \
|
||||
starring.s starring1.inc starring2.inc starring3.img.lz4\
|
||||
@ -61,7 +62,7 @@ megaload.o: megaload.s
|
||||
MUSIC.1000: music_1000.o
|
||||
ld65 -o MUSIC.1000 music_1000.o -C ../linker_scripts/apple2_1000.inc
|
||||
|
||||
music_1000.o: music_1000.s
|
||||
music_1000.o: music_1000.s mockingboard.s
|
||||
ca65 -o music_1000.o music_1000.s -l music_1000.lst
|
||||
|
||||
####
|
||||
|
@ -101,7 +101,6 @@ reset_ay_right:
|
||||
; Setup initial conditions
|
||||
;=========================
|
||||
|
||||
|
||||
; 7: ENABLE
|
||||
ldx #7
|
||||
lda #$38 ; noise disabled, ABC enabled
|
||||
@ -120,7 +119,7 @@ reset_ay_right:
|
||||
sta $03ff
|
||||
|
||||
;============================
|
||||
; Enable 50Hz clock on 6522
|
||||
; Enable 60Hz clock on 6522
|
||||
;============================
|
||||
|
||||
sei ; disable interrupts just in case
|
||||
@ -134,13 +133,14 @@ reset_ay_right:
|
||||
sta $C40D ; IFR: 1100, enable interrupt on timer one oflow
|
||||
sta $C40E ; IER: 1100, enable timer one interrupt
|
||||
|
||||
lda #$1A
|
||||
lda #$1a
|
||||
sta $C404 ; write into low-order latch
|
||||
lda #$41
|
||||
sta $C405 ; write into high-order latch,
|
||||
; load both values into counter
|
||||
; clear interrupt and start counting
|
||||
|
||||
; 9c40 / 1e6 = .040s, 25Hz
|
||||
; 4fe7 / 1e6 = .020s, 50Hz
|
||||
; 411a / 1e6 = .016s, 60Hz
|
||||
|
||||
@ -148,6 +148,7 @@ reset_ay_right:
|
||||
|
||||
interrupt_handler:
|
||||
; A saved by firmware in $45
|
||||
sta $45
|
||||
txa
|
||||
pha ; save X
|
||||
tya
|
||||
@ -161,6 +162,8 @@ interrupt_handler:
|
||||
tax ; restore X
|
||||
lda $45 ; restore A
|
||||
|
||||
bit $C404 ; clear 6522 interrupt by reading T1C-L ; 4
|
||||
|
||||
rti ; return from interrupt ; 6
|
||||
|
||||
|
||||
|
@ -62,6 +62,8 @@ island_flying_directions:
|
||||
|
||||
mode7_flying:
|
||||
|
||||
cli ; enable interrupts (play music)
|
||||
|
||||
;================================
|
||||
; one-time setup
|
||||
;================================
|
||||
@ -153,6 +155,7 @@ done_key:
|
||||
done_mode7:
|
||||
bit KEYRESET
|
||||
; done
|
||||
sei ; disable interrupts
|
||||
rts
|
||||
|
||||
check_up:
|
||||
|
@ -140,6 +140,7 @@ to_begin_loop:
|
||||
|
||||
; 3116 - 1038 (music) = 2078
|
||||
|
||||
jsr play_music
|
||||
|
||||
; Try X=5 Y=67 cycles=2078
|
||||
; Try X=11 Y=51 cycles=3112 R4
|
||||
|
Loading…
x
Reference in New Issue
Block a user