2019-06-07 19:18:51 +00:00
|
|
|
;=================
|
|
|
|
; VMW PT3_LIB test
|
|
|
|
;=================
|
|
|
|
; template for using the pt3_lib
|
|
|
|
|
|
|
|
; zero page definitions
|
|
|
|
.include "zp.inc"
|
|
|
|
|
2019-06-10 18:08:17 +00:00
|
|
|
; some firmware locations
|
|
|
|
.include "hardware.inc"
|
|
|
|
|
2019-06-07 19:18:51 +00:00
|
|
|
; Location the files load at.
|
|
|
|
; If you change this, you need to update the Makefile
|
|
|
|
|
|
|
|
PT3_LOC = song
|
|
|
|
|
2019-09-11 20:56:48 +00:00
|
|
|
; the below will make for more compact code, at the expense
|
2019-12-29 03:35:14 +00:00
|
|
|
; of using $80 - $ff zero page addresses by the decoder.
|
2019-09-11 20:56:48 +00:00
|
|
|
|
|
|
|
; PT3_USE_ZERO_PAGE = 1
|
|
|
|
|
2019-06-07 19:18:51 +00:00
|
|
|
|
|
|
|
;=============================
|
|
|
|
; Setup
|
|
|
|
;=============================
|
|
|
|
pt3_setup:
|
|
|
|
jsr HOME
|
|
|
|
jsr TEXT
|
|
|
|
|
|
|
|
;===============
|
|
|
|
; init variables
|
|
|
|
;===============
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
sta DONE_PLAYING
|
2019-12-29 03:35:14 +00:00
|
|
|
sta LOOP ; change to 1 to loop forever
|
2019-06-07 19:18:51 +00:00
|
|
|
|
|
|
|
;=======================
|
|
|
|
; Detect mockingboard
|
|
|
|
;========================
|
|
|
|
|
2019-12-29 03:35:14 +00:00
|
|
|
jsr print_mockingboard_detect ; print message
|
2019-06-07 19:18:51 +00:00
|
|
|
|
2019-12-28 23:04:19 +00:00
|
|
|
jsr mockingboard_detect ; call detection routine
|
2019-12-29 03:35:14 +00:00
|
|
|
|
2019-12-28 23:04:19 +00:00
|
|
|
bcs mockingboard_found
|
2019-06-07 19:18:51 +00:00
|
|
|
|
2019-09-12 04:21:08 +00:00
|
|
|
jsr print_mocking_notfound
|
2019-12-29 03:35:14 +00:00
|
|
|
|
|
|
|
; possibly can't detect on IIc so just try with slot#4 anyway
|
|
|
|
; even if not detected
|
|
|
|
|
2019-09-12 04:21:08 +00:00
|
|
|
jmp setup_interrupt
|
2019-06-07 19:18:51 +00:00
|
|
|
|
|
|
|
mockingboard_found:
|
2019-09-12 04:21:08 +00:00
|
|
|
|
2019-12-29 03:35:14 +00:00
|
|
|
; print found message
|
|
|
|
|
|
|
|
|
|
|
|
; modify message to print slot value
|
|
|
|
|
2019-12-28 23:04:19 +00:00
|
|
|
lda MB_ADDR_H
|
|
|
|
sec
|
|
|
|
sbc #$10
|
|
|
|
sta found_message+11
|
|
|
|
|
2019-09-12 04:21:08 +00:00
|
|
|
jsr print_mocking_found
|
|
|
|
|
2019-12-29 03:35:14 +00:00
|
|
|
;==================================================
|
|
|
|
; patch the playing code with the proper slot value
|
|
|
|
;==================================================
|
|
|
|
|
|
|
|
jsr mockingboard_patch
|
|
|
|
|
2019-12-29 04:20:17 +00:00
|
|
|
setup_interrupt:
|
|
|
|
|
2019-09-12 04:21:08 +00:00
|
|
|
;=======================
|
|
|
|
; Set up 50Hz interrupt
|
|
|
|
;========================
|
|
|
|
|
2019-09-12 04:51:17 +00:00
|
|
|
jsr mockingboard_init
|
2019-12-28 23:04:19 +00:00
|
|
|
jsr mockingboard_setup_interrupt
|
2019-06-07 19:18:51 +00:00
|
|
|
|
|
|
|
;============================
|
|
|
|
; Init the Mockingboard
|
|
|
|
;============================
|
|
|
|
|
|
|
|
jsr reset_ay_both
|
|
|
|
jsr clear_ay_both
|
|
|
|
|
|
|
|
;==================
|
|
|
|
; init song
|
|
|
|
;==================
|
|
|
|
|
|
|
|
jsr pt3_init_song
|
|
|
|
|
|
|
|
;============================
|
|
|
|
; Enable 6502 interrupts
|
|
|
|
;============================
|
|
|
|
start_interrupts:
|
|
|
|
cli ; clear interrupt mask
|
|
|
|
|
|
|
|
|
|
|
|
;============================
|
|
|
|
; Loop forever
|
|
|
|
;============================
|
2019-09-11 20:08:36 +00:00
|
|
|
forever_loop:
|
2019-09-11 20:56:48 +00:00
|
|
|
jmp forever_loop
|
2019-06-07 19:18:51 +00:00
|
|
|
|
|
|
|
|
2019-09-11 20:56:48 +00:00
|
|
|
;========================================
|
2019-06-07 19:18:51 +00:00
|
|
|
;========================================
|
|
|
|
|
|
|
|
; Helper routines below
|
|
|
|
|
|
|
|
;========================================
|
|
|
|
;========================================
|
|
|
|
|
2019-12-28 21:45:43 +00:00
|
|
|
;==================================
|
|
|
|
; Print mockingboard detect message
|
|
|
|
;==================================
|
|
|
|
; note: on IIc must do this before enabling interrupt
|
|
|
|
; as we disable ROM (COUT won't work?)
|
|
|
|
|
|
|
|
print_mockingboard_detect:
|
|
|
|
|
|
|
|
; print detection message
|
|
|
|
ldy #0
|
|
|
|
print_mocking_message:
|
|
|
|
lda mocking_message,Y ; load loading message
|
|
|
|
beq done_mocking_message
|
|
|
|
ora #$80
|
|
|
|
jsr COUT
|
|
|
|
iny
|
|
|
|
jmp print_mocking_message
|
|
|
|
done_mocking_message:
|
|
|
|
jsr CROUT1
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
print_mocking_notfound:
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
print_not_message:
|
|
|
|
lda not_message,Y ; load loading message
|
|
|
|
beq print_not_message_done
|
|
|
|
ora #$80
|
|
|
|
jsr COUT
|
|
|
|
iny
|
|
|
|
jmp print_not_message
|
|
|
|
print_not_message_done:
|
|
|
|
rts
|
|
|
|
|
|
|
|
print_mocking_found:
|
|
|
|
ldy #0
|
|
|
|
print_found_message:
|
|
|
|
lda found_message,Y ; load loading message
|
|
|
|
beq done_found_message
|
|
|
|
ora #$80
|
|
|
|
jsr COUT
|
|
|
|
iny
|
|
|
|
jmp print_found_message
|
|
|
|
done_found_message:
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
;=========
|
|
|
|
; strings
|
|
|
|
;=========
|
2019-12-28 23:04:19 +00:00
|
|
|
mocking_message: .asciiz "LOOKING FOR MOCKINGBOARD: "
|
2019-12-28 21:45:43 +00:00
|
|
|
not_message: .byte "NOT "
|
2019-12-28 23:04:19 +00:00
|
|
|
found_message: .asciiz "FOUND SLOT#4"
|
2019-12-28 21:45:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2019-06-07 19:18:51 +00:00
|
|
|
;=========
|
|
|
|
; vars
|
|
|
|
;=========
|
|
|
|
|
|
|
|
;=========
|
|
|
|
;routines
|
|
|
|
;=========
|
2019-09-12 04:21:08 +00:00
|
|
|
|
2019-09-11 20:08:36 +00:00
|
|
|
.include "pt3_lib_core.s"
|
|
|
|
.include "pt3_lib_init.s"
|
2019-12-28 23:04:19 +00:00
|
|
|
.include "pt3_lib_mockingboard_setup.s"
|
2019-09-12 04:21:08 +00:00
|
|
|
.include "interrupt_handler.s"
|
2019-12-29 03:35:14 +00:00
|
|
|
; if you're self patching, detect has to be after interrupt_handler.s
|
|
|
|
.include "pt3_lib_mockingboard_detect.s"
|
2019-12-28 23:04:19 +00:00
|
|
|
|
2019-06-07 19:18:51 +00:00
|
|
|
;=============
|
|
|
|
; include song
|
|
|
|
;=============
|
|
|
|
.align 256 ; must be on page boundary
|
|
|
|
; this can be fixed but some changes would have
|
|
|
|
; to be made throughout the player code
|
|
|
|
song:
|
|
|
|
.incbin "../pt3_player/music/EA.PT3"
|
2019-08-21 19:07:20 +00:00
|
|
|
;.incbin "../ootw/ootw_audio/ootw_outro.pt3"
|