diff --git a/pt3_player/Makefile b/pt3_player/Makefile index d26aba1e..8547d29e 100644 --- a/pt3_player/Makefile +++ b/pt3_player/Makefile @@ -39,7 +39,7 @@ PT3_PLAYER: pt3_player.o ld65 -o PT3_PLAYER pt3_player.o -C ../linker_scripts/apple2_1000.inc 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 \ # keypress_minimal.s \ # qkumba_rts.s \ diff --git a/pt3_player/interrupt_handler.s b/pt3_player/interrupt_handler.s index 1f36d108..b5018ee6 100644 --- a/pt3_player/interrupt_handler.s +++ b/pt3_player/interrupt_handler.s @@ -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 - lda DONE_PLAYING ; 3 - beq mb_play_music ; if song done, don't play music ; 3/2nt - jmp check_keyboard ; 3 + jmp exit_interrupt + +; lda DONE_PLAYING ; 3 +; beq mb_play_music ; if song done, don't play music ; 3/2nt +; jmp check_keyboard ; 3 ;============ ; 13 diff --git a/pt3_player/pt3_lib.s b/pt3_player/pt3_lib.s index 1ca3d70b..553ad9ec 100644 --- a/pt3_player/pt3_lib.s +++ b/pt3_player/pt3_lib.s @@ -48,6 +48,10 @@ pt3_envelope_type: .byte $0 pt3_current_pattern: .byte $0 pt3_music_len: .byte $0 +; Header offsets + +PT3_HEADER_FREQUENCY = $63 + load_ornament: rts @@ -91,6 +95,44 @@ pt3_init_song: 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 -PT3NoteTable_ASM_34_35_lo: +PT3NoteTable_ASM_34_35_low: .byte $10,$55,$A4,$FC,$5F,$CA,$3D,$B8 .byte $3B,$C5,$55,$EC,$88,$2A,$D2,$7E .byte $2F,$E5,$9E,$5C,$1D,$E2,$AB,$76 diff --git a/pt3_player/pt3_player.s b/pt3_player/pt3_player.s index f371a250..21c77e37 100644 --- a/pt3_player/pt3_player.s +++ b/pt3_player/pt3_player.s @@ -23,10 +23,10 @@ pt3_setup: ; init variables lda #0 -; sta DRAW_PAGE + sta DRAW_PAGE ; sta CH ; sta CV -; sta DONE_PLAYING + sta DONE_PLAYING ; sta MB_CHUNK_OFFSET ; sta DECODE_ERROR sta WHICH_FILE @@ -77,10 +77,10 @@ mockingboard_found: ; Vector address goes to 0x3fe/0x3ff ; FIXME: should chain any existing handler -; lda #interrupt_handler -; sta $03ff + lda #interrupt_handler + sta $03ff ;============================ ; Enable 50Hz clock on 6522 @@ -152,7 +152,7 @@ mockingboard_found: ; Enable 6502 interrupts ;============================ -; cli ; clear interrupt mask + cli ; clear interrupt mask ;============================