2019-05-17 16:57:39 +00:00
|
|
|
;===============
|
|
|
|
; VMW PT3 Player
|
|
|
|
;===============
|
2019-05-07 00:16:45 +00:00
|
|
|
|
2019-05-17 16:57:39 +00:00
|
|
|
; zero page definitions
|
2019-05-07 00:16:45 +00:00
|
|
|
.include "zp.inc"
|
2019-06-09 05:01:28 +00:00
|
|
|
.include "hardware.inc"
|
2019-05-07 00:16:45 +00:00
|
|
|
|
2019-05-17 16:57:39 +00:00
|
|
|
; Location the files load at.
|
|
|
|
; If you change this, you need to update the Makefile
|
2019-05-14 15:52:50 +00:00
|
|
|
PT3_LOC = $4000
|
2019-05-07 00:16:45 +00:00
|
|
|
|
2019-09-11 20:08:36 +00:00
|
|
|
PT3_USE_ZERO_PAGE = 1
|
|
|
|
|
2019-05-17 16:57:39 +00:00
|
|
|
; Number of files. Should probably detect this automatically
|
2019-11-20 20:18:24 +00:00
|
|
|
NUM_FILES = 20
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
;=============================
|
|
|
|
; Setup
|
|
|
|
;=============================
|
2019-05-07 04:28:42 +00:00
|
|
|
pt3_setup:
|
|
|
|
jsr HOME
|
|
|
|
jsr TEXT
|
2019-05-07 00:16:45 +00:00
|
|
|
|
2019-05-17 16:57:39 +00:00
|
|
|
bit LORES ; Lo-res graphics
|
2019-05-14 15:52:50 +00:00
|
|
|
bit SET_GR
|
2019-06-18 17:43:33 +00:00
|
|
|
bit TEXTGR ; split text/graphics
|
2019-05-14 15:52:50 +00:00
|
|
|
|
2019-05-16 16:19:20 +00:00
|
|
|
jsr clear_screens
|
|
|
|
|
2019-06-07 20:52:31 +00:00
|
|
|
;===============================
|
|
|
|
; Check for Apple II/II+/IIe/IIc
|
|
|
|
;===============================
|
2019-05-17 16:57:39 +00:00
|
|
|
; this is used to see if we have lowecase support
|
2019-05-17 02:38:13 +00:00
|
|
|
|
|
|
|
lda $FBB3 ; IIe and newer is $06
|
|
|
|
cmp #6
|
2019-12-29 04:20:17 +00:00
|
|
|
beq done_lowecase_smc
|
2019-05-17 02:38:13 +00:00
|
|
|
|
2019-06-09 04:53:49 +00:00
|
|
|
lda #$d0 ; set if older than a IIe
|
|
|
|
sta apple_ii_smc
|
2019-12-29 04:20:17 +00:00
|
|
|
|
|
|
|
done_lowecase_smc:
|
|
|
|
|
2019-05-17 02:38:13 +00:00
|
|
|
|
2019-05-17 16:57:39 +00:00
|
|
|
;===============
|
2019-05-07 00:16:45 +00:00
|
|
|
; Init disk code
|
2019-05-17 16:57:39 +00:00
|
|
|
;===============
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
jsr rts_init
|
|
|
|
|
2019-05-17 16:57:39 +00:00
|
|
|
;===============
|
2019-05-07 00:16:45 +00:00
|
|
|
; init variables
|
2019-05-17 16:57:39 +00:00
|
|
|
;===============
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
lda #0
|
2019-05-07 15:33:07 +00:00
|
|
|
sta DRAW_PAGE
|
|
|
|
sta DONE_PLAYING
|
2019-05-07 00:16:45 +00:00
|
|
|
sta WHICH_FILE
|
2019-05-17 17:19:04 +00:00
|
|
|
sta LOOP
|
2019-05-07 00:16:45 +00:00
|
|
|
|
2019-05-17 16:57:39 +00:00
|
|
|
;=======================
|
|
|
|
; Detect mockingboard
|
|
|
|
;========================
|
|
|
|
|
2019-12-29 04:20:17 +00:00
|
|
|
jsr mockingboard_detect ; call detection routine
|
2019-05-07 00:16:45 +00:00
|
|
|
|
2019-12-29 04:20:17 +00:00
|
|
|
bcs mockingboard_found
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
lda #<not_message ; if not found, print that
|
|
|
|
sta OUTL
|
|
|
|
lda #>not_message
|
|
|
|
sta OUTH
|
|
|
|
inc CV
|
|
|
|
jsr move_and_print
|
|
|
|
|
|
|
|
; jmp forever_loop ; and wait forever
|
|
|
|
|
2019-12-29 04:20:17 +00:00
|
|
|
jmp init_mockingboard ; try anyway in slot#4
|
|
|
|
|
2019-05-07 00:16:45 +00:00
|
|
|
mockingboard_found:
|
|
|
|
; lda #<found_message ; print found message
|
|
|
|
; sta OUTL
|
|
|
|
; lda #>found_message
|
|
|
|
; sta OUTH
|
|
|
|
; inc CV
|
|
|
|
; jsr move_and_print
|
|
|
|
|
2019-12-29 04:20:17 +00:00
|
|
|
;==================================================
|
|
|
|
; patch the playing code with the proper slot value
|
|
|
|
;==================================================
|
2019-05-07 00:16:45 +00:00
|
|
|
|
2019-12-29 04:20:17 +00:00
|
|
|
jsr mockingboard_patch
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
;============================
|
2019-12-29 04:20:17 +00:00
|
|
|
; Init the Mockingboard
|
2019-05-07 00:16:45 +00:00
|
|
|
;============================
|
2019-12-29 04:20:17 +00:00
|
|
|
init_mockingboard:
|
2019-05-07 00:16:45 +00:00
|
|
|
|
2019-12-29 04:20:17 +00:00
|
|
|
; set up 50Hz interrupt
|
2019-05-07 00:16:45 +00:00
|
|
|
|
2019-12-29 04:20:17 +00:00
|
|
|
jsr mockingboard_init
|
|
|
|
jsr mockingboard_setup_interrupt
|
2019-05-07 00:16:45 +00:00
|
|
|
|
2019-12-29 04:20:17 +00:00
|
|
|
; init the mockingboard
|
2019-05-07 00:16:45 +00:00
|
|
|
|
2019-12-29 04:20:17 +00:00
|
|
|
jsr reset_ay_both
|
|
|
|
jsr clear_ay_both
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
;==================
|
|
|
|
; load first song
|
|
|
|
;==================
|
|
|
|
|
|
|
|
jsr new_song
|
|
|
|
|
|
|
|
;============================
|
|
|
|
; Init Background
|
|
|
|
;============================
|
|
|
|
|
2019-05-16 15:38:57 +00:00
|
|
|
jsr set_gr_page0
|
|
|
|
jsr fire_init
|
|
|
|
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
;============================
|
|
|
|
; Enable 6502 interrupts
|
|
|
|
;============================
|
2019-05-17 16:57:39 +00:00
|
|
|
start_interrupts:
|
2019-05-07 15:33:07 +00:00
|
|
|
cli ; clear interrupt mask
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
;============================
|
|
|
|
; Loop forever
|
|
|
|
;============================
|
|
|
|
main_loop:
|
|
|
|
|
2019-05-16 16:19:20 +00:00
|
|
|
; Do the visualization
|
|
|
|
|
|
|
|
jsr draw_fire_frame
|
2019-05-16 20:37:14 +00:00
|
|
|
jsr put_letters
|
2019-05-16 16:19:20 +00:00
|
|
|
jsr page_flip
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
check_done:
|
2019-06-02 02:32:31 +00:00
|
|
|
lda DONE_PLAYING
|
|
|
|
asl ; bit 7 to carry, bit 6 to bit 7
|
2019-05-07 00:16:45 +00:00
|
|
|
beq main_loop ; if was all zeros, loop
|
2019-06-02 02:32:31 +00:00
|
|
|
bcs main_loop ; if high bit set, paused
|
2019-06-09 04:53:49 +00:00
|
|
|
sei ; disable interrupts
|
2019-06-02 02:32:31 +00:00
|
|
|
bmi minus_song ; if bit 6 set, then left pressed
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
; else, either song finished or
|
|
|
|
; right pressed
|
|
|
|
|
|
|
|
plus_song:
|
|
|
|
jsr increment_file
|
2019-06-09 04:53:49 +00:00
|
|
|
bcc done_play ; branch always
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
minus_song:
|
|
|
|
jsr decrement_file
|
|
|
|
|
|
|
|
done_play:
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
sta DONE_PLAYING
|
|
|
|
|
2019-05-17 16:57:39 +00:00
|
|
|
; clear the flame
|
|
|
|
; FIXME: doesn't matter as we aren't displaying right now
|
2019-05-07 00:16:45 +00:00
|
|
|
|
2019-05-17 16:57:39 +00:00
|
|
|
jsr fire_setline
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
jsr new_song
|
|
|
|
|
2019-05-17 16:57:39 +00:00
|
|
|
; re-enable the flame
|
2019-05-16 16:19:20 +00:00
|
|
|
lda #7
|
|
|
|
jsr fire_setline
|
|
|
|
|
2019-06-01 05:54:28 +00:00
|
|
|
bmi start_interrupts
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-17 15:41:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
;========================================
|
|
|
|
;========================================
|
|
|
|
|
|
|
|
; Helper routines below
|
|
|
|
|
|
|
|
;========================================
|
|
|
|
;========================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-07 00:16:45 +00:00
|
|
|
;=================
|
|
|
|
; load a new song
|
|
|
|
;=================
|
|
|
|
|
|
|
|
new_song:
|
|
|
|
|
|
|
|
;=========================
|
|
|
|
; Init Variables
|
|
|
|
;=========================
|
|
|
|
|
2019-05-17 16:25:37 +00:00
|
|
|
; ?
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
;===========================
|
|
|
|
; Print loading message
|
|
|
|
;===========================
|
|
|
|
|
|
|
|
jsr clear_bottoms ; clear bottom of page 0/1
|
|
|
|
|
|
|
|
lda #0 ; print LOADING message
|
|
|
|
sta CH
|
|
|
|
lda #21
|
|
|
|
sta CV
|
|
|
|
|
|
|
|
lda #<loading_message
|
|
|
|
sta OUTL
|
|
|
|
lda #>loading_message
|
|
|
|
sta OUTH
|
|
|
|
jsr print_both_pages
|
|
|
|
|
|
|
|
|
|
|
|
;===========================
|
2019-05-07 04:28:42 +00:00
|
|
|
; Load in PT3 file
|
2019-05-07 00:16:45 +00:00
|
|
|
;===========================
|
|
|
|
|
|
|
|
jsr get_filename
|
|
|
|
|
|
|
|
lda #8 ; print filename to screen
|
|
|
|
sta CH
|
2019-06-02 02:32:31 +00:00
|
|
|
;lda #21
|
|
|
|
;sta CV
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
lda INL
|
|
|
|
sta OUTL
|
|
|
|
lda INH
|
|
|
|
sta OUTH
|
|
|
|
jsr print_both_pages
|
|
|
|
|
|
|
|
|
|
|
|
; needs to be space-padded $A0 30-byte filename
|
|
|
|
|
|
|
|
lda #<readfile_filename
|
|
|
|
sta namlo
|
|
|
|
lda #>readfile_filename
|
|
|
|
sta namhi
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
ldx #30 ; 30 chars
|
|
|
|
name_loop:
|
|
|
|
lda (INL),Y
|
|
|
|
beq space_loop
|
|
|
|
ora #$80
|
|
|
|
sta (namlo),Y
|
|
|
|
iny
|
|
|
|
dex
|
|
|
|
bne name_loop
|
|
|
|
beq done_name_loop
|
|
|
|
space_loop:
|
|
|
|
lda #$a0 ; pad with ' '
|
|
|
|
sta (namlo),Y
|
|
|
|
iny
|
|
|
|
dex
|
|
|
|
bne space_loop
|
|
|
|
|
|
|
|
done_name_loop:
|
|
|
|
|
|
|
|
; open and read a file
|
2019-05-17 03:09:25 +00:00
|
|
|
; loads to whatever it was BSAVED at (default is $4000)
|
2019-05-07 00:16:45 +00:00
|
|
|
|
2019-05-07 04:28:42 +00:00
|
|
|
jsr read_file ; read PT3 file from disk
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
;=========================
|
|
|
|
; Print Info
|
|
|
|
;=========================
|
|
|
|
|
|
|
|
jsr clear_bottoms ; clear bottom of page 0/1
|
|
|
|
|
2019-05-07 04:28:42 +00:00
|
|
|
; NUL terminate the strings we want to print
|
|
|
|
lda #0
|
|
|
|
sta PT3_LOC+$3E
|
|
|
|
sta PT3_LOC+$62
|
|
|
|
|
2019-05-17 02:38:13 +00:00
|
|
|
upcase:
|
|
|
|
; if Apple II/II+, uppercase the lowercase letters
|
2019-06-09 04:53:49 +00:00
|
|
|
apple_ii_smc:
|
2019-05-17 02:38:13 +00:00
|
|
|
beq no_uppercase
|
|
|
|
|
|
|
|
ldy #$1e
|
|
|
|
upcase_loop:
|
|
|
|
lda PT3_LOC,Y
|
|
|
|
|
|
|
|
cmp #$60
|
|
|
|
bcc not_lowercase ; blt
|
|
|
|
sbc #$20
|
|
|
|
sta PT3_LOC,Y
|
|
|
|
not_lowercase:
|
|
|
|
iny
|
|
|
|
cpy #$63
|
|
|
|
bne upcase_loop
|
|
|
|
|
|
|
|
no_uppercase:
|
2019-05-07 04:28:42 +00:00
|
|
|
; print title
|
|
|
|
|
2019-06-02 02:32:31 +00:00
|
|
|
lda #>(PT3_LOC+$1E) ; point to header title
|
|
|
|
sta OUTH
|
2019-05-07 04:28:42 +00:00
|
|
|
lda #<(PT3_LOC+$1E)
|
2019-05-07 00:16:45 +00:00
|
|
|
sta OUTL
|
|
|
|
|
2019-06-01 05:54:28 +00:00
|
|
|
lda #20 ; VTAB 20: HTAB 4
|
2019-05-17 00:33:12 +00:00
|
|
|
sta CV
|
|
|
|
lda #4
|
|
|
|
sta CH
|
|
|
|
jsr print_both_pages ; print, tail call
|
|
|
|
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
; Print Author
|
2019-05-07 04:28:42 +00:00
|
|
|
|
|
|
|
lda #<(PT3_LOC+$42)
|
|
|
|
sta OUTL
|
|
|
|
|
2019-06-01 05:54:28 +00:00
|
|
|
inc CV ; VTAB 21: HTAB 4
|
2019-05-17 00:33:12 +00:00
|
|
|
jsr print_both_pages ; print, tail call
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
; Print clock
|
2019-05-14 18:25:13 +00:00
|
|
|
|
2019-05-17 00:33:12 +00:00
|
|
|
lda #>(clock_string) ; point to clock string
|
|
|
|
sta OUTH
|
|
|
|
lda #<(clock_string)
|
|
|
|
sta OUTL
|
2019-05-14 18:25:13 +00:00
|
|
|
|
2019-05-17 00:33:12 +00:00
|
|
|
lda #23 ; VTAB 23: HTAB 13
|
|
|
|
sta CV
|
|
|
|
lda #13
|
|
|
|
sta CH
|
|
|
|
jsr print_both_pages ; print, tail call
|
2019-05-14 18:25:13 +00:00
|
|
|
|
2019-05-17 15:41:08 +00:00
|
|
|
|
|
|
|
; Print which file
|
|
|
|
|
|
|
|
; first update with current values
|
|
|
|
|
|
|
|
lda WHICH_FILE
|
|
|
|
adc #$1
|
2019-06-09 04:53:49 +00:00
|
|
|
ldy #0
|
2019-05-17 15:41:08 +00:00
|
|
|
jsr convert_decimal
|
|
|
|
|
|
|
|
lda #NUM_FILES
|
2019-06-09 04:53:49 +00:00
|
|
|
ldy #3
|
2019-05-17 15:41:08 +00:00
|
|
|
jsr convert_decimal
|
|
|
|
|
|
|
|
; now print modified string
|
|
|
|
|
|
|
|
lda #>(which_song_string) ; point to which song string
|
|
|
|
sta OUTH
|
|
|
|
lda #<(which_song_string)
|
|
|
|
sta OUTL
|
|
|
|
|
2019-06-01 05:54:28 +00:00
|
|
|
lda #0 ; HTAB 1
|
2019-05-17 15:41:08 +00:00
|
|
|
sta CH
|
|
|
|
jsr print_both_pages ; print, tail call
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-17 00:33:12 +00:00
|
|
|
; Print MHz indicator
|
2019-05-14 18:25:13 +00:00
|
|
|
|
2019-05-17 00:33:12 +00:00
|
|
|
lda #>(mhz_string) ; point to MHz string
|
|
|
|
sta OUTH
|
|
|
|
lda #<(mhz_string)
|
|
|
|
sta OUTL
|
2019-05-14 18:25:13 +00:00
|
|
|
|
2019-06-01 05:54:28 +00:00
|
|
|
lda #34 ; HTAB 34
|
2019-05-17 00:33:12 +00:00
|
|
|
sta CH
|
|
|
|
jsr print_both_pages ; print, tail call
|
2019-05-07 00:16:45 +00:00
|
|
|
|
2019-05-17 02:16:50 +00:00
|
|
|
; update the MHz indicator with current state
|
|
|
|
|
2019-06-02 02:32:31 +00:00
|
|
|
ldx #'0'+$80
|
2019-06-03 02:57:21 +00:00
|
|
|
lda convert_177_smc1
|
|
|
|
cmp #$18
|
2019-06-02 02:32:31 +00:00
|
|
|
beq done_MHz
|
2019-05-17 02:16:50 +00:00
|
|
|
|
2019-06-02 02:32:31 +00:00
|
|
|
ldx #'7'+$80
|
2019-05-17 02:16:50 +00:00
|
|
|
|
|
|
|
done_MHz:
|
2019-06-02 02:32:31 +00:00
|
|
|
stx $7F4
|
|
|
|
stx $BF4
|
2019-05-17 02:16:50 +00:00
|
|
|
|
2019-05-07 00:16:45 +00:00
|
|
|
; Print Left Arrow (INVERSE)
|
|
|
|
lda #'<'
|
2019-05-17 00:33:12 +00:00
|
|
|
sta $6D0
|
|
|
|
sta $AD0
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
lda #'-'
|
2019-05-17 00:33:12 +00:00
|
|
|
sta $6D1
|
|
|
|
sta $AD1
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
; Print Rright Arrow (INVERSE)
|
2019-05-17 00:33:12 +00:00
|
|
|
sta $6F6
|
|
|
|
sta $AF6
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
lda #'>'
|
2019-05-17 00:33:12 +00:00
|
|
|
sta $6F7
|
|
|
|
sta $AF7
|
2019-05-07 00:16:45 +00:00
|
|
|
|
2019-05-07 04:28:42 +00:00
|
|
|
jsr pt3_init_song
|
2019-05-07 00:16:45 +00:00
|
|
|
|
2019-05-14 18:25:13 +00:00
|
|
|
;=================================
|
2019-05-16 16:19:20 +00:00
|
|
|
; Calculate Length of Song
|
2019-05-14 18:25:13 +00:00
|
|
|
;=================================
|
2019-05-17 03:09:25 +00:00
|
|
|
|
2019-05-17 16:57:39 +00:00
|
|
|
; There's no easy way to do this? (???)
|
|
|
|
; We walk through the song counting frames
|
|
|
|
; We can't even do this quickly, as the number of frames
|
|
|
|
; per pattern can vary, and you have to parse a channel
|
|
|
|
; to see this, and channel data is varying-width and so
|
|
|
|
; you have to parse it all.
|
|
|
|
; Time is just number of frames/50Hz
|
|
|
|
|
|
|
|
|
2019-06-09 04:53:49 +00:00
|
|
|
sta current_pattern_smc+1
|
|
|
|
|
|
|
|
frame_count_loop_store:
|
|
|
|
sta current_line_smc+1
|
|
|
|
sta current_subframe_smc+1
|
2019-05-14 18:25:13 +00:00
|
|
|
|
|
|
|
frame_count_loop:
|
|
|
|
|
2019-06-09 04:53:49 +00:00
|
|
|
lda current_line_smc+1
|
|
|
|
ora current_subframe_smc+1
|
2019-05-14 18:25:13 +00:00
|
|
|
bne fc_pattern_good
|
|
|
|
|
|
|
|
; load a new pattern in
|
|
|
|
jsr pt3_set_pattern
|
|
|
|
|
2019-05-15 18:13:54 +00:00
|
|
|
lda DONE_SONG
|
2019-06-09 04:53:49 +00:00
|
|
|
bne done_counting
|
2019-05-14 18:25:13 +00:00
|
|
|
|
|
|
|
fc_pattern_good:
|
2019-06-09 04:53:49 +00:00
|
|
|
ldx current_subframe_smc+1 ;;ldx #(NOTE_STRUCT_SIZE*0)
|
2019-05-14 18:25:13 +00:00
|
|
|
bne fc_line_good
|
|
|
|
|
2019-05-17 16:57:39 +00:00
|
|
|
; we only calc length of chanel A, hopefully enough
|
|
|
|
|
|
|
|
lda #1
|
2019-06-09 04:53:49 +00:00
|
|
|
sta pt3_pattern_done_smc+1
|
2019-05-17 16:57:39 +00:00
|
|
|
|
|
|
|
; decode_note(&pt3->a,&(pt3->a_addr),pt3);
|
|
|
|
jsr decode_note
|
2019-05-14 18:25:13 +00:00
|
|
|
|
2019-06-09 04:53:49 +00:00
|
|
|
lda pt3_pattern_done_smc+1
|
2019-05-14 18:25:13 +00:00
|
|
|
bne fc_line_good
|
|
|
|
|
2019-06-09 04:53:49 +00:00
|
|
|
inc current_pattern_smc+1 ; increment pattern
|
|
|
|
bne frame_count_loop_store ; branch always
|
2019-05-14 18:25:13 +00:00
|
|
|
|
|
|
|
fc_line_good:
|
2019-06-09 04:53:49 +00:00
|
|
|
inc current_subframe_smc+1 ; subframe++
|
|
|
|
lda current_subframe_smc+1
|
2019-06-03 02:57:21 +00:00
|
|
|
eor pt3_speed_smc+1 ; if we hit pt3_speed, move to next
|
2019-05-14 18:25:13 +00:00
|
|
|
bne fc_do_frame
|
|
|
|
|
|
|
|
fc_next_line:
|
2019-06-09 04:53:49 +00:00
|
|
|
sta current_subframe_smc+1 ; reset subframe to 0
|
2019-05-14 18:25:13 +00:00
|
|
|
|
2019-06-09 04:53:49 +00:00
|
|
|
inc current_line_smc+1 ; and increment line
|
|
|
|
lda current_line_smc+1
|
2019-05-14 18:25:13 +00:00
|
|
|
|
2019-06-01 05:54:28 +00:00
|
|
|
eor #64 ; always end at 64.
|
2019-05-17 03:09:25 +00:00
|
|
|
bne fc_do_frame ; is this always needed?
|
2019-05-14 18:25:13 +00:00
|
|
|
|
|
|
|
fc_next_pattern:
|
2019-06-09 04:53:49 +00:00
|
|
|
sta current_line_smc+1 ; reset line to 0
|
2019-05-14 18:25:13 +00:00
|
|
|
|
2019-06-09 04:53:49 +00:00
|
|
|
inc current_pattern_smc+1 ; increment pattern
|
2019-05-14 18:25:13 +00:00
|
|
|
|
|
|
|
fc_do_frame:
|
2019-06-09 04:53:49 +00:00
|
|
|
inc time_frame_smc+1
|
|
|
|
time_frame_smc:
|
|
|
|
lda #$00
|
2019-06-01 05:54:28 +00:00
|
|
|
eor #50
|
|
|
|
bne frame_count_loop
|
2019-05-14 18:25:13 +00:00
|
|
|
|
2019-06-09 04:53:49 +00:00
|
|
|
sta time_frame_smc+1
|
2019-05-14 18:25:13 +00:00
|
|
|
|
|
|
|
; see if overflow low s
|
2019-06-09 04:53:49 +00:00
|
|
|
ldx $BD0+13+10
|
|
|
|
cpx #'9'+$80
|
2019-05-14 18:25:13 +00:00
|
|
|
bne inc_low_s
|
|
|
|
|
|
|
|
; see if overflow high s
|
2019-06-09 04:53:49 +00:00
|
|
|
ldx $BD0+13+9
|
|
|
|
cpx #'5'+$80
|
2019-05-14 18:25:13 +00:00
|
|
|
bne inc_high_s
|
|
|
|
|
|
|
|
inc $7D0+13+7
|
|
|
|
inc $BD0+13+7
|
|
|
|
|
2019-06-09 04:53:49 +00:00
|
|
|
ldx #'0'+$80-1
|
2019-05-14 18:25:13 +00:00
|
|
|
|
|
|
|
inc_high_s:
|
2019-06-09 04:53:49 +00:00
|
|
|
inx
|
|
|
|
stx $7D0+13+9
|
|
|
|
stx $BD0+13+9
|
2019-05-14 18:25:13 +00:00
|
|
|
|
|
|
|
clear_low_s:
|
2019-06-09 04:53:49 +00:00
|
|
|
ldx #'0'+$80-1
|
2019-05-14 18:25:13 +00:00
|
|
|
|
|
|
|
inc_low_s:
|
2019-06-09 04:53:49 +00:00
|
|
|
inx
|
|
|
|
stx $7D0+13+10
|
|
|
|
stx $BD0+13+10
|
2019-05-14 18:25:13 +00:00
|
|
|
|
|
|
|
inc_done:
|
|
|
|
|
|
|
|
fc_bayern:
|
2019-06-09 04:53:49 +00:00
|
|
|
bne frame_count_loop
|
2019-05-14 18:25:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
done_counting:
|
|
|
|
|
|
|
|
; re-init, as we've run through it
|
|
|
|
lda #0
|
|
|
|
sta DONE_PLAYING
|
2019-06-09 04:53:49 +00:00
|
|
|
sta current_pattern_smc+1
|
2019-05-14 18:25:13 +00:00
|
|
|
|
2019-06-01 05:54:28 +00:00
|
|
|
jmp pt3_init_song
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-17 00:33:12 +00:00
|
|
|
|
|
|
|
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;==================
|
|
|
|
; Get filename
|
|
|
|
;==================
|
|
|
|
; WHICH_FILE holds number
|
|
|
|
; MAX_FILES has max
|
|
|
|
; Scroll through until find
|
|
|
|
; point INH:INL to it
|
|
|
|
get_filename:
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
2019-05-07 04:28:42 +00:00
|
|
|
lda #<song_list ; point to filename
|
2019-05-07 00:16:45 +00:00
|
|
|
sta INL
|
2019-05-07 04:28:42 +00:00
|
|
|
lda #>song_list
|
2019-05-07 00:16:45 +00:00
|
|
|
sta INH
|
2019-06-01 05:54:28 +00:00
|
|
|
ldx WHICH_FILE
|
|
|
|
beq filename_found
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
get_filename_loop:
|
|
|
|
|
|
|
|
inner_loop:
|
|
|
|
iny
|
|
|
|
lda (INL),Y
|
|
|
|
bne inner_loop
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
dex
|
2019-06-01 05:54:28 +00:00
|
|
|
bne get_filename_loop
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
filename_found:
|
|
|
|
tya
|
|
|
|
clc
|
|
|
|
adc INL
|
|
|
|
sta INL
|
2019-06-01 05:54:28 +00:00
|
|
|
bcc skip_inh_inc
|
|
|
|
inc INH
|
|
|
|
skip_inh_inc:
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
;===============================
|
|
|
|
; Increment file we want to load
|
|
|
|
;===============================
|
|
|
|
increment_file:
|
|
|
|
inc WHICH_FILE
|
|
|
|
lda WHICH_FILE
|
2019-06-02 02:32:31 +00:00
|
|
|
eor #NUM_FILES
|
|
|
|
bne done_increment
|
2019-05-07 00:16:45 +00:00
|
|
|
sta WHICH_FILE
|
|
|
|
done_increment:
|
|
|
|
rts
|
|
|
|
|
|
|
|
;===============================
|
|
|
|
; Decrement file we want to load
|
|
|
|
;===============================
|
|
|
|
decrement_file:
|
|
|
|
dec WHICH_FILE
|
|
|
|
bpl done_decrement
|
|
|
|
lda #(NUM_FILES-1)
|
|
|
|
sta WHICH_FILE
|
|
|
|
done_decrement:
|
|
|
|
rts
|
|
|
|
|
2019-05-17 15:41:08 +00:00
|
|
|
|
|
|
|
;=========================
|
|
|
|
; convert_decimal
|
|
|
|
;=========================
|
|
|
|
; convert byte (<100) to tens/ones decimal
|
|
|
|
; this is probably not the optimal way to do this
|
|
|
|
; value in A, output in ASCII+$80 in which_10s:which_1s
|
|
|
|
; trashes X
|
|
|
|
convert_decimal:
|
|
|
|
|
2019-06-01 05:54:28 +00:00
|
|
|
ldx #'0'+$80
|
2019-06-09 04:53:49 +00:00
|
|
|
stx which_1s_smc+1
|
|
|
|
stx which_10s_smc+1
|
2019-05-17 15:41:08 +00:00
|
|
|
|
2019-06-01 05:54:28 +00:00
|
|
|
tax ; special case zero
|
2019-05-17 15:41:08 +00:00
|
|
|
beq conv_decimal_done
|
|
|
|
conv_decimal_loop:
|
2019-06-09 04:53:49 +00:00
|
|
|
inc which_1s_smc+1
|
|
|
|
which_1s_smc:
|
|
|
|
lda #$d1
|
2019-05-17 15:41:08 +00:00
|
|
|
cmp #':'+$80
|
|
|
|
bne conv_decimal_not_10
|
|
|
|
lda #'0'+$80
|
2019-06-09 04:53:49 +00:00
|
|
|
sta which_1s_smc+1
|
|
|
|
inc which_10s_smc+1
|
2019-05-17 15:41:08 +00:00
|
|
|
conv_decimal_not_10:
|
|
|
|
dex
|
|
|
|
bne conv_decimal_loop
|
|
|
|
|
|
|
|
conv_decimal_done:
|
2019-06-09 04:53:49 +00:00
|
|
|
which_10s_smc:
|
|
|
|
lda #$d1
|
|
|
|
sta which_song_string,y
|
|
|
|
lda which_1s_smc+1
|
|
|
|
sta which_song_string+1,y
|
2019-05-17 15:41:08 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-07 00:16:45 +00:00
|
|
|
;==========
|
|
|
|
; filenames
|
|
|
|
;==========
|
|
|
|
|
2019-05-07 04:28:42 +00:00
|
|
|
song_list:
|
2019-05-07 00:16:45 +00:00
|
|
|
|
|
|
|
.include "song_list.inc"
|
|
|
|
|
|
|
|
;=========
|
|
|
|
;routines
|
|
|
|
;=========
|
2019-05-16 15:38:57 +00:00
|
|
|
.include "gr_offsets.s"
|
2019-05-07 00:16:45 +00:00
|
|
|
.include "text_print.s"
|
2019-05-07 04:28:42 +00:00
|
|
|
.include "gr_fast_clear.s"
|
2019-05-16 16:19:20 +00:00
|
|
|
.include "pageflip.s"
|
2019-05-16 15:38:57 +00:00
|
|
|
.include "gr_setpage.s"
|
2019-05-07 00:16:45 +00:00
|
|
|
.include "qkumba_rts.s"
|
2019-05-16 15:38:57 +00:00
|
|
|
.include "keypress_minimal.s"
|
2019-09-11 20:08:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
; pt3_lib stuff
|
|
|
|
.include "pt3_lib_core.s"
|
|
|
|
.include "pt3_lib_init.s"
|
2019-12-29 04:20:17 +00:00
|
|
|
.include "pt3_lib_mockingboard_setup.s"
|
2019-05-07 00:16:45 +00:00
|
|
|
.include "interrupt_handler.s"
|
2019-12-29 04:20:17 +00:00
|
|
|
.include "pt3_lib_mockingboard_detect.s"
|
2019-09-11 20:08:36 +00:00
|
|
|
|
|
|
|
; visualization
|
2019-05-16 15:38:57 +00:00
|
|
|
.include "fire.s"
|
2019-05-16 17:03:33 +00:00
|
|
|
.include "random16.s"
|
2019-05-16 20:37:14 +00:00
|
|
|
.include "gr_putsprite.s"
|
|
|
|
.include "put_letters.s"
|
2019-05-07 04:28:42 +00:00
|
|
|
|
2019-05-07 00:16:45 +00:00
|
|
|
;=========
|
|
|
|
; strings
|
|
|
|
;=========
|
|
|
|
;mocking_message: .asciiz "LOOKING FOR MOCKINGBOARD IN SLOT #4"
|
|
|
|
not_message: .byte "NOT "
|
|
|
|
found_message: .asciiz "FOUND"
|
|
|
|
;done_message: .asciiz "DONE PLAYING"
|
|
|
|
loading_message: .asciiz "LOADING"
|
2019-05-17 00:33:12 +00:00
|
|
|
clock_string: .asciiz "0:00 / 0:00"
|
2019-05-17 02:16:50 +00:00
|
|
|
mhz_string: .asciiz "1.7MHZ"
|
2019-05-17 15:41:08 +00:00
|
|
|
which_song_string: .asciiz "00/00"
|