dos33fsprogs/mockingboard/ksp_theme_uncompressed.s

130 lines
1.9 KiB
ArmAsm
Raw Normal View History

; 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
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
;===========================
; load pointer to the music
;===========================
lda #<ksptheme
sta INL
lda #>ksptheme
2018-02-04 04:45:38 +00:00
sta INH
2018-02-04 04:45:38 +00:00
ldx #0
frame_loop:
ldy #0
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
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
done_play:
2018-02-04 04:45:38 +00:00
jsr clear_ay_left
jsr clear_ay_right
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
;=========
;routines
;=========
.include "../asm_routines/gr_offsets.s"
.include "../asm_routines/text_print.s"
.include "../asm_routines/mockingboard.s"
;=======
; music
;=======
.include "ksptheme_uncompressed.inc"
;=========
; strings
;=========
mocking_message: .asciiz "ASSUMING MOCKINGBOARD IN SLOT #4"
done_message: .asciiz "DONE PLAYING"