dos33fsprogs/xmas_2018/xmas2018.s

233 lines
3.8 KiB
ArmAsm
Raw Normal View History

2018-12-10 18:06:21 +00:00
; VMW Productions 2018 XMAS Demo
;
; by deater (Vince Weaver) <vince@deater.net>
.include "zp.inc"
.include "hardware.inc"
2018-12-19 15:40:03 +00:00
xmas2018_start:
;===================
; Check for Apple II and patch
;===================
; lda $FBB3 ; IIe and newer is $06
; cmp #6
; beq apple_iie
2018-12-19 15:40:03 +00:00
; lda #$54 ;
2018-12-10 18:06:21 +00:00
; sta ce_patch+1
apple_iie:
;===================
; Init RTS disk code
;===================
jsr rts_init
;===================
; Load graphics
;===================
2018-12-21 14:55:06 +00:00
reload_everything:
; load WREATH.LZ4 to $a000
2018-12-19 15:40:03 +00:00
; then decompress it to $2000 (HGR PAGE0)
lda #<wreath_filename
2018-12-19 15:40:03 +00:00
sta OUTL
lda #>wreath_filename
2018-12-19 15:40:03 +00:00
sta OUTH
jsr opendir_filename ; open and read entire file into memory
; size in ldsizeh:ldsizel (f1/f0)
clc
lda #<($a000)
sta LZ4_SRC
adc ldsizel
sta LZ4_END
lda #>($a000)
sta LZ4_SRC+1
adc ldsizeh
sta LZ4_END+1
; lda #<($a000+4103-8) ; skip checksum at end
; sta LZ4_END
; lda #>($a000+4103-8) ; skip checksum at end
; sta LZ4_END+1
lda #<$2000
sta LZ4_DST
lda #>$2000
sta LZ4_DST+1
jsr lz4_decode
2018-12-19 15:40:03 +00:00
; load MERRY.LZ4 to $4000
; then decompress it to $6000
lda #<merry_filename
sta OUTL
lda #>merry_filename
sta OUTH
jsr opendir_filename ; open and read entire file into memory
; size in ldsizeh:ldsizel (f1/f0)
clc
lda #<($4000)
sta LZ4_SRC
adc ldsizel
sta LZ4_END
lda #>($4000)
sta LZ4_SRC+1
adc ldsizeh
sta LZ4_END+1
lda #<$6000
sta LZ4_DST
lda #>$6000
sta LZ4_DST+1
jsr lz4_decode
;===================
; Load music
;===================
2018-12-19 15:40:03 +00:00
; load MUSIC.LZ4 to $4000
lda #<music_filename
2018-12-19 15:40:03 +00:00
sta OUTL
lda #>music_filename
2018-12-19 15:40:03 +00:00
sta OUTH
jsr opendir_filename ; open and read entire file into memory
; decompress to $8000
2018-12-19 15:40:03 +00:00
; decompress from $4000
; size in ldsizeh:ldsizel (f1/f0)
2018-12-19 15:40:03 +00:00
clc
lda #<($4000)
sta LZ4_SRC
2018-12-19 15:40:03 +00:00
adc ldsizel
sta LZ4_END
2018-12-19 15:40:03 +00:00
lda #>($4000)
sta LZ4_SRC+1
adc ldsizeh
sta LZ4_END+1
lda #<$8000
sta LZ4_DST
lda #>$8000
sta LZ4_DST+1
jsr lz4_decode
2018-12-17 19:50:40 +00:00
; load BALL.IMG to $4000
2018-12-17 19:50:40 +00:00
lda #<ball_filename
2018-12-19 15:40:03 +00:00
sta OUTL
2018-12-17 19:50:40 +00:00
lda #>ball_filename
2018-12-19 15:40:03 +00:00
sta OUTH
jsr opendir_filename ; open and read entire file into memory
;==================
; Init mockingboard
;==================
lda #0
sta MB_PATTERN
lda #$0
sta MB_FRAME
jsr mockingboard_init
;===================
; set graphics mode
;===================
jsr HOME
2018-12-19 05:10:06 +00:00
forever:
bit PAGE0
2018-12-10 18:06:21 +00:00
jsr wreath
2018-12-12 17:33:05 +00:00
jsr ball
2018-12-12 20:38:30 +00:00
jsr merry
; wait 5s before restarting
ldx #20
wait_at_merry:
lda #255
jsr WAIT
dex
bne wait_at_merry
2018-12-21 14:55:06 +00:00
2018-12-21 20:59:26 +00:00
sei ; disable music interrupt
jsr mockingboard_mute
2018-12-21 14:55:06 +00:00
jmp reload_everything
2018-12-19 05:10:06 +00:00
;==================
; Game over
;==================
; we never get here
;game_over_man:
; jmp game_over_man
; Things included here should be aligned
; as they are called during cycle-counting
.align $100
2018-12-10 18:06:21 +00:00
.include "wreath.s"
2018-12-21 15:49:17 +00:00
.include "gr_putsprite.s"
.include "gr_offsets.s"
2018-12-21 15:49:17 +00:00
.include "gr_fast_clear.s"
2018-12-21 16:49:44 +00:00
.include "vapor_lock.s"
.align $100
.include "play_music.s"
2018-12-21 15:49:17 +00:00
.include "delay_a.s"
.include "gr_scroll.s"
.include "mockingboard.s"
2018-12-21 18:09:42 +00:00
.align $100
.include "scroll.table"
2018-12-21 16:49:44 +00:00
.include "ball.s"
2018-12-21 15:49:17 +00:00
; Things here alignment doesn't matter
2018-12-21 15:49:17 +00:00
.include "gr_hline.s"
.include "wait_keypress.s"
.include "merry.s"
.include "lz4_decode.s"
.include "rts.s"
2018-12-21 15:49:17 +00:00
greets:
.incbin "greets.raw.lz4t"
greets_end:
; filename to open is 30-character Apple text:
2018-12-19 15:40:03 +00:00
wreath_filename: ; .byte "WREATH.LZ4",0
.byte 'W'|$80,'R'|$80,'E'|$80,'A'|$80,'T'|$80,'H'|$80,'.'|$80,'L'|$80
.byte 'Z'|$80,'4'|$80,$00
2018-12-19 15:40:03 +00:00
merry_filename: ;.byte "MERRY.LZ4",0
.byte 'M'|$80,'E'|$80,'R'|$80,'R'|$80,'Y'|$80,'.'|$80,'L'|$80,'Z'|$80
.byte '4'|$80,$00
2018-12-17 19:50:40 +00:00
2018-12-19 15:40:03 +00:00
ball_filename: ;.byte "BALL.IMG",0
.byte 'B'|$80,'A'|$80,'L'|$80,'L'|$80,'.'|$80,'I'|$80,'M'|$80,'G'|$80
.byte $00
2018-12-17 19:50:40 +00:00
2018-12-19 15:40:03 +00:00
music_filename: ;.byte "MUSIC.LZ4",0
.byte 'M'|$80,'U'|$80,'S'|$80,'I'|$80,'C'|$80,'.'|$80,'L'|$80,'Z'|$80
2018-12-19 15:40:03 +00:00
.byte '4'|$80,$0