pt3: hook up interrupt handler

This commit is contained in:
Vince Weaver 2019-05-07 11:33:07 -04:00
parent 9744d73f73
commit cff2778086
4 changed files with 57 additions and 13 deletions

View File

@ -39,7 +39,7 @@ PT3_PLAYER: pt3_player.o
ld65 -o PT3_PLAYER pt3_player.o -C ../linker_scripts/apple2_1000.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_lib.s gr_fast_clear.s pt3_lib.s interrupt_handler.s
# mockingboard.s \ # mockingboard.s \
# keypress_minimal.s \ # keypress_minimal.s \
# qkumba_rts.s \ # qkumba_rts.s \

View File

@ -22,14 +22,16 @@ interrupt_handler:
; inc $0404 ; debug (flashes char onscreen) inc $0404 ; debug (flashes char onscreen)
bit $C404 ; clear 6522 interrupt by reading T1C-L ; 4 bit $C404 ; clear 6522 interrupt by reading T1C-L ; 4
lda DONE_PLAYING ; 3 jmp exit_interrupt
beq mb_play_music ; if song done, don't play music ; 3/2nt
jmp check_keyboard ; 3 ; lda DONE_PLAYING ; 3
; beq mb_play_music ; if song done, don't play music ; 3/2nt
; jmp check_keyboard ; 3
;============ ;============
; 13 ; 13

View File

@ -48,6 +48,10 @@ pt3_envelope_type: .byte $0
pt3_current_pattern: .byte $0 pt3_current_pattern: .byte $0
pt3_music_len: .byte $0 pt3_music_len: .byte $0
; Header offsets
PT3_HEADER_FREQUENCY = $63
load_ornament: load_ornament:
rts rts
@ -91,6 +95,44 @@ pt3_init_song:
rts rts
;=====================================
; Calculate Note
;=====================================
CalculateNote:
rts
;=====================================
; Decode Note
;=====================================
DecodeNote:
rts
;======================================
; GetNoteFreq
;======================================
; Return frequency from lookup table
; Which note is in Y
; return in X,A (high,low)
GetNoteFreq:
lda PT3_LOC+PT3_HEADER_FREQUENCY
cmp #1
bne freq_table_2
lda PT3NoteTable_ST_high,Y
tax
lda PT3NoteTable_ST_low,Y
rts
freq_table_2:
lda PT3NoteTable_ASM_34_35_high,Y
tax
lda PT3NoteTable_ASM_34_35_low,Y
rts
@ -139,7 +181,7 @@ PT3NoteTable_ASM_34_35_high:
.byte $00,$00,$00,$00,$00,$00,$00,$00 .byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00 .byte $00,$00,$00,$00,$00,$00,$00,$00
PT3NoteTable_ASM_34_35_lo: PT3NoteTable_ASM_34_35_low:
.byte $10,$55,$A4,$FC,$5F,$CA,$3D,$B8 .byte $10,$55,$A4,$FC,$5F,$CA,$3D,$B8
.byte $3B,$C5,$55,$EC,$88,$2A,$D2,$7E .byte $3B,$C5,$55,$EC,$88,$2A,$D2,$7E
.byte $2F,$E5,$9E,$5C,$1D,$E2,$AB,$76 .byte $2F,$E5,$9E,$5C,$1D,$E2,$AB,$76

View File

@ -23,10 +23,10 @@ pt3_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
sta WHICH_FILE sta WHICH_FILE
@ -77,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
@ -152,7 +152,7 @@ mockingboard_found:
; Enable 6502 interrupts ; Enable 6502 interrupts
;============================ ;============================
; cli ; clear interrupt mask cli ; clear interrupt mask
;============================ ;============================