4cade/src/demo/gumball.a

99 lines
2.0 KiB
Plaintext

;license:MIT
;(c) 2021 by Frank M.
!cpu 6502
!to "res/DEMO/GUMBALL",plain
*=$210
!source "src/constants.a" ; no code in these
!source "src/macros.a"
+READ_RAM2_WRITE_RAM2
jsr EnableAccelerator
;+LOAD_FILE_KEEP_DIR
ldx #0 ; read to main memory
stx ldrhi
stx ldrlo
+LDADDR title
jsr iLoadFileDirect
ldx #10-1 ; we also need to copy the length byte
- lda newpath,x
sta $BFD0,x
dex
bpl -
lda #$60
sta $851
jsr $800 ; load "DOS"
lda #$20
sta $B21E
lda #<callback1
sta $B21F
lda #>callback1
sta $B220
+DISABLE_ACCEL
jmp $B2F1 ; stage 1 (title screen and credits)
callback1
lda #$A5 ; restore original code so callback
sta $B21E ; won't be called more than once
lda #$5F
sta $B21F
lda #$0A
sta $B220
lda #$4C
sta $0DFB
lda #0
sta $0DFB+1
lda #1
sta $0DFB+2 ; exit on button press or keypress
lda #<callback2
sta $0FD0+1
lda #>callback2
sta $0FD0+2 ; continue to demo stage 2 after end of demo stage 1
lda $5F
asl
bne +
dec $E09
+ rts
callback2
lda #$4C
sta $B22B
lda #<callback3
sta $B22B+1
lda #>callback3
sta $B22B+2
jmp $E02
callback3
lda #$4C
sta $0DF6
sta $12F6
lda #0
sta $0DF6+1
sta $12F6+1
lda #1
sta $0DF6+2
sta $12F6+2 ; stage 2 (demo play) - set exits
jmp $31F9
newpath
!byte 9
!text "X/GUMBALL"
title !byte x_e-x_b
x_b !text "X/GUMBALL/GUMBALL"
x_e
!if * > $300 {
!error "code is too large, ends at ", *
}