2018-02-04 04:58:59 +00:00
|
|
|
; Play the KSP theme, but uncompressed (so pretty huge and slow to load)
|
2018-02-03 18:43:24 +00:00
|
|
|
|
|
|
|
.include "zp.inc"
|
|
|
|
|
|
|
|
;=============================
|
2018-02-04 04:45:38 +00:00
|
|
|
; Print message
|
2018-02-03 18:43:24 +00:00
|
|
|
;=============================
|
|
|
|
jsr HOME
|
|
|
|
jsr TEXT
|
|
|
|
|
2018-02-03 22:50:32 +00:00
|
|
|
lda #0
|
|
|
|
sta DRAW_PAGE
|
|
|
|
sta CH
|
|
|
|
sta CV
|
|
|
|
lda #<mocking_message
|
|
|
|
sta OUTL
|
|
|
|
lda #>mocking_message
|
|
|
|
sta OUTH
|
|
|
|
jsr move_and_print
|
|
|
|
|
|
|
|
;============================
|
|
|
|
; Init the Mockingboard
|
|
|
|
;============================
|
|
|
|
|
|
|
|
jsr mockingboard_init
|
|
|
|
jsr reset_ay_left
|
|
|
|
jsr reset_ay_right
|
2018-02-04 04:45:38 +00:00
|
|
|
jsr clear_ay_left
|
|
|
|
jsr clear_ay_right
|
|
|
|
|
2018-02-03 22:50:32 +00:00
|
|
|
|
|
|
|
;===========================
|
|
|
|
; load pointer to the music
|
|
|
|
;===========================
|
|
|
|
|
|
|
|
lda #<ksptheme
|
|
|
|
sta INL
|
|
|
|
lda #>ksptheme
|
2018-02-04 04:45:38 +00:00
|
|
|
sta INH
|
2018-02-03 22:50:32 +00:00
|
|
|
|
2018-02-04 04:45:38 +00:00
|
|
|
ldx #0
|
|
|
|
frame_loop:
|
|
|
|
ldy #0
|
2018-02-03 22:50:32 +00:00
|
|
|
play_loop:
|
2018-02-04 04:45:38 +00:00
|
|
|
lda (INL),Y
|
|
|
|
tax
|
|
|
|
jsr write_ay_left ; assume 3 channel (not six)
|
|
|
|
jsr write_ay_right ; so write same to both left/write
|
|
|
|
|
|
|
|
iny
|
|
|
|
cpy #13
|
|
|
|
bne play_loop
|
|
|
|
|
|
|
|
; special case, if reg 13 = ff don't write it
|
|
|
|
|
|
|
|
lda (INL),Y
|
|
|
|
cmp #$ff
|
|
|
|
beq was_ff
|
|
|
|
|
|
|
|
jsr write_ay_left ; assume 3 channel (not six)
|
|
|
|
jsr write_ay_right ; so write same to both left/write
|
|
|
|
|
|
|
|
was_ff:
|
|
|
|
; see if at end
|
|
|
|
iny
|
|
|
|
iny
|
|
|
|
lda (INL),Y
|
|
|
|
cmp #$ff
|
|
|
|
beq done_play
|
|
|
|
|
|
|
|
; increment INL:INH by 13
|
|
|
|
|
|
|
|
clc
|
|
|
|
lda INL
|
|
|
|
adc #14
|
|
|
|
sta INL
|
|
|
|
|
|
|
|
lda INH
|
|
|
|
adc #0
|
|
|
|
sta INH
|
2018-02-03 22:50:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
delay_a_bit:
|
|
|
|
|
|
|
|
lda #86
|
|
|
|
jsr WAIT ; delay 1/2(26+27A+5A^2) us
|
|
|
|
; 50Hz = 20ms = 20000us
|
|
|
|
; 40000 = 26+27A+5A^2
|
|
|
|
; 5a^2+27a-39974 = 0
|
|
|
|
; A = 86.75
|
2018-02-04 04:45:38 +00:00
|
|
|
|
|
|
|
jmp frame_loop
|
2018-02-03 22:50:32 +00:00
|
|
|
done_play:
|
2018-02-04 04:45:38 +00:00
|
|
|
|
|
|
|
jsr clear_ay_left
|
|
|
|
jsr clear_ay_right
|
|
|
|
|
|
|
|
|
2018-02-03 22:50:32 +00:00
|
|
|
lda #0
|
|
|
|
sta CH
|
|
|
|
lda #2
|
|
|
|
sta CV
|
|
|
|
lda #<done_message
|
|
|
|
sta OUTL
|
|
|
|
lda #>done_message
|
|
|
|
sta OUTH
|
|
|
|
jsr move_and_print
|
|
|
|
|
|
|
|
|
2018-02-03 18:43:24 +00:00
|
|
|
forever_loop:
|
|
|
|
jmp forever_loop
|
2018-02-03 18:45:32 +00:00
|
|
|
|
2018-02-04 04:58:59 +00:00
|
|
|
;=========
|
2018-02-03 22:50:32 +00:00
|
|
|
;routines
|
2018-02-04 04:58:59 +00:00
|
|
|
;=========
|
2021-01-05 23:24:09 +00:00
|
|
|
.include "../../asm_routines/gr_offsets.s"
|
|
|
|
.include "../../asm_routines/text_print.s"
|
|
|
|
.include "../../asm_routines/mockingboard.s"
|
2018-02-03 22:50:32 +00:00
|
|
|
|
2018-02-04 04:58:59 +00:00
|
|
|
;=======
|
2018-02-03 22:50:32 +00:00
|
|
|
; music
|
2018-02-04 04:58:59 +00:00
|
|
|
;=======
|
2018-02-03 18:45:32 +00:00
|
|
|
.include "ksptheme_uncompressed.inc"
|
2018-02-03 22:50:32 +00:00
|
|
|
|
2018-02-04 04:58:59 +00:00
|
|
|
;=========
|
|
|
|
; strings
|
|
|
|
;=========
|
2018-02-03 22:50:32 +00:00
|
|
|
mocking_message: .asciiz "ASSUMING MOCKINGBOARD IN SLOT #4"
|
|
|
|
done_message: .asciiz "DONE PLAYING"
|