4cade/src/demo/gumball.a

79 lines
1.7 KiB
Plaintext

;license:MIT
;(c) 2021-2022 by Frank M., qkumba
!cpu 6502
!to "build/DEMO/GUMBALL#060210",plain
*=$210
!source "src/constants.a" ; no code in these
!source "src/macros.a"
+READ_RAM2_WRITE_RAM2
jsr EnableAccelerator
+LOAD_FILE_KEEP_DIR gumball, gumball_dir_e-gumball_dir_b
lda #$60
sta $851
jsr $800 ; load "DOS"
ldx #3-1
- lda patch2,x
sta $B21E,x
dex
bpl -
+DISABLE_ACCEL
jmp $B2F1 ; stage 1 (title screen and credits)
callback1
ldx #3-1
- lda patch3,x ; restore original code so callback
sta $B21E,x ; won't be called more than once
lda patch4,x
sta $0DFB,x ; exit on button press or keypress
lda patch5,x
sta $0FD0,x ; continue to demo stage 2 after end of demo stage 1
dex
bpl -
lda $5F
asl
bne +
dec $E09
+ rts
callback2
ldx #3-1
- lda patch,x
sta $B22B,x
dex
bpl -
jmp $E02
patch !byte $4C,<callback3,>callback3
callback3
ldx #3-1
- lda patch4,x
sta $0DF6,x
sta $12F6,x ; stage 2 (demo play) - set exits
dex
bpl -
jmp $31F9
patch2 !byte $20,<callback1,>callback1
patch3 !byte $A5,$5F,$0A
patch4 !byte $4C,$00,$01
patch5 !byte $4C,<callback2,>callback2
gumball !byte gumball_e-gumball_b
gumball_b
gumball_dir_b
!text "X/GUMBALL"
gumball_dir_e
!text "/GUMBALL"
gumball_e
!if * > $300 {
!error "code is too large, ends at ", *
}