convert Serpentine demo, save 38kb

This commit is contained in:
Peter Ferrie 2022-06-09 15:05:16 -07:00
parent 1c6c434f7b
commit 88dd89c9f9
5 changed files with 95 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View File

@ -75,7 +75,6 @@ REPTON=Type(06),AuxType(0200),Access(C3)
ROBOTRON.2084=Type(06),AuxType(BF70),Access(C3)
SAMMY.LIGHTFOOT=Type(06),AuxType(BA00),Access(C3)
SERPENTINE=Type(06),AuxType(0300),Access(C3)
SERPENTINE.1=Type(F1),AuxType(0000),Access(C3)
SHORT.CIRCUIT=Type(06),AuxType(0210),Access(C3)
SNAKE.BYTE=Type(06),AuxType(0300),Access(C3)
SNAKE.BYTE.1=Type(F1),AuxType(0000),Access(C3)

78
src/demo/serpentine.a Normal file
View File

@ -0,0 +1,78 @@
;license:MIT
;(c) 2022 by qkumba
!cpu 6502
!to "res/DEMO/SERPENTINE",plain
*=$300
!source "src/constants.a" ; no code in these
!source "src/macros.a"
+READ_RAM2_WRITE_RAM2
jsr EnableAccelerator
reset
+LOAD_FILE_KEEP_DIR serpentine, $43F5, serpentine_dir_e-serpentine_dir_b
+READ_ROM_NO_WRITE
+NEW_RESET_VECTOR reset
lda #<callback1
sta $8C55
lda #>callback1
sta $8C56
jmp $43F5
callback1
stx $00
lda #$20
sta $01
lda #$CF
sta $02
lda #$83
sta $03
lda #<callback2
sta $237
lda #>callback2
sta $238
jmp $8C5A ; decompress
callback2
lda #$4C
sta $96AA
sta $8834
lda #$A9
sta $9702
sta $9707
sta $91B
sta $920
lda #<reset
sta $96AB
sta $8835
lda #0
sta $9703
sta $9708
sta $91C
sta $921
lda #>reset
sta $96AC
sta $8836
lda #$EA
sta $9704
sta $9709
sta $91D
sta $922
lda #$D0
sta $962D
+DISABLE_ACCEL
jmp $800
serpentine
!byte serpentine_e-serpentine_b
serpentine_b
serpentine_dir_b
!text "X/SERPENTINE"
serpentine_dir_e
!text "/SERPENTINE"
serpentine_e
!if * > $3F0 {
!error "code is too large, ends at ", *
}

View File

@ -500,6 +500,23 @@
}
!macro LOAD_FILE_KEEP_DIR .filepath, .addr, .dirlen {
lda #>.addr
sta ldrhi
lda #<.addr
sta ldrlo
ldx #0 ; read to main memory
+LDADDR .filepath
jsr iLoadFileDirect
ldx #.dirlen
stx $BFD0
- lda .filepath,x
sta $BFD0,x
dex
bne -
}
; Macros for demo launchers that need to check whether they should run
; on the current machine. Exit demo if the requirements are not met.
!macro GAME_REQUIRES_JOYSTICK {