mirror of
https://github.com/blondie7575/GSCats.git
synced 2024-09-22 19:07:23 +00:00
Improvements to bank loader
This commit is contained in:
parent
adb74d6fb4
commit
145b969d97
4
Makefile
4
Makefile
@ -21,9 +21,9 @@ all: loader $(PGM)
|
|||||||
|
|
||||||
|
|
||||||
$(PGM):
|
$(PGM):
|
||||||
@PATH=$(PATH):/usr/local/bin; $(CL65) -t apple2enh --cpu 65816 --start-addr $(ADDR) -l$(PGM).lst $(PGM).s
|
@PATH=$(PATH):/usr/local/bin; $(CL65) -t apple2enh --cpu 65816 --start-addr 0000 -l$(PGM).lst $(PGM).s
|
||||||
java -jar $(AC) -d $(PGM).2mg CODEBANK
|
java -jar $(AC) -d $(PGM).2mg CODEBANK
|
||||||
java -jar $(AC) -p $(PGM).2mg CODEBANK BIN 0x$(ADDR) < $(PGM)
|
java -jar $(AC) -p $(PGM).2mg CODEBANK BIN 0x0000 < $(PGM)
|
||||||
java -jar $(AC) -d $(PGM).2mg SPRITEBANK00
|
java -jar $(AC) -d $(PGM).2mg SPRITEBANK00
|
||||||
java -jar $(AC) -p $(PGM).2mg SPRITEBANK00 BIN 0x0000 < Art/spritebank00.bin
|
java -jar $(AC) -p $(PGM).2mg SPRITEBANK00 BIN 0x0000 < Art/spritebank00.bin
|
||||||
rm -f $(PGM)
|
rm -f $(PGM)
|
||||||
|
BIN
gscats.2mg
BIN
gscats.2mg
Binary file not shown.
2
gscats.s
2
gscats.s
@ -8,7 +8,7 @@
|
|||||||
.include "macros.s"
|
.include "macros.s"
|
||||||
.include "equates.s"
|
.include "equates.s"
|
||||||
|
|
||||||
.org $800
|
.org $0000
|
||||||
|
|
||||||
|
|
||||||
mainBank2:
|
mainBank2:
|
||||||
|
88
loader.s
88
loader.s
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
LOADBUFFER = $1000 ; Clear of this loader code
|
LOADBUFFER = $1000 ; Clear of this loader code
|
||||||
BUFFERSIZE = $8200 ; About max size we can fit between buffer and this loader code
|
BUFFERSIZE = $8200 ; About max size we can fit between buffer and this loader code
|
||||||
MAINENTRY = $020800
|
MAINENTRY = $020000
|
||||||
|
|
||||||
.org $800
|
.org $800
|
||||||
|
|
||||||
@ -27,29 +27,46 @@ main:
|
|||||||
; Load the code into bank 0
|
; Load the code into bank 0
|
||||||
jsr PRODOS
|
jsr PRODOS
|
||||||
.byte $ca
|
.byte $ca
|
||||||
.addr fileReadCode
|
.addr fileRead
|
||||||
bne ioError
|
bne ioError
|
||||||
|
|
||||||
; Close the file
|
; Close the file
|
||||||
jsr PRODOS
|
jsr PRODOS
|
||||||
.byte $cc
|
.byte $cc
|
||||||
.addr fileCloseCode
|
.addr fileClose
|
||||||
|
|
||||||
NATIVE
|
NATIVE
|
||||||
|
|
||||||
; Copy code into bank 2
|
; Copy code into bank 2
|
||||||
mainCopyStart:
|
ldx fileReadLen
|
||||||
ldx #0
|
lda #2
|
||||||
|
jsr copyBytes
|
||||||
|
|
||||||
mainCopyLoop:
|
EMULATION
|
||||||
lda LOADBUFFER,x
|
|
||||||
|
|
||||||
mainCopyDest:
|
; Open the sprite bank file
|
||||||
sta MAINENTRY,x
|
jsr PRODOS
|
||||||
inx
|
.byte $c8
|
||||||
inx
|
.addr fileOpenSprites
|
||||||
cpx #LOADBUFFER+BUFFERSIZE
|
bne ioError
|
||||||
bne mainCopyLoop
|
|
||||||
|
; Load the compiled sprites into bank 0
|
||||||
|
jsr PRODOS
|
||||||
|
.byte $ca
|
||||||
|
.addr fileRead
|
||||||
|
bne ioError
|
||||||
|
|
||||||
|
; Close the file
|
||||||
|
jsr PRODOS
|
||||||
|
.byte $cc
|
||||||
|
.addr fileClose
|
||||||
|
|
||||||
|
NATIVE
|
||||||
|
|
||||||
|
; Copy sprites into bank 3
|
||||||
|
ldx fileReadLen
|
||||||
|
lda #3
|
||||||
|
jsr copyBytes
|
||||||
|
|
||||||
; Set up a long jump into bank 2, and
|
; Set up a long jump into bank 2, and
|
||||||
; a way for game code to get back here to exit
|
; a way for game code to get back here to exit
|
||||||
@ -66,6 +83,37 @@ returnToProDOS:
|
|||||||
ioError:
|
ioError:
|
||||||
brk
|
brk
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; copyBytes
|
||||||
|
; Copy data from read buffer in bank 0 to
|
||||||
|
; bottom of any other bank. Must be in native mode.
|
||||||
|
;
|
||||||
|
; X = Length of data in bytes
|
||||||
|
; A = Bank number of destination
|
||||||
|
;
|
||||||
|
copyBytes:
|
||||||
|
phx
|
||||||
|
BITS8
|
||||||
|
sta copyBytesDest+3
|
||||||
|
BITS16
|
||||||
|
plx
|
||||||
|
dex
|
||||||
|
dex
|
||||||
|
|
||||||
|
copyBytesLoop:
|
||||||
|
lda LOADBUFFER,x
|
||||||
|
|
||||||
|
copyBytesDest:
|
||||||
|
sta $010000,x
|
||||||
|
dex
|
||||||
|
dex
|
||||||
|
bpl copyBytesLoop
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
fileOpenCode:
|
fileOpenCode:
|
||||||
.byte 3
|
.byte 3
|
||||||
.addr codePath
|
.addr codePath
|
||||||
@ -73,16 +121,26 @@ fileOpenCode:
|
|||||||
.byte 0 ; Result (file handle)
|
.byte 0 ; Result (file handle)
|
||||||
.byte 0 ; Padding
|
.byte 0 ; Padding
|
||||||
|
|
||||||
fileReadCode:
|
fileRead:
|
||||||
.byte 4
|
.byte 4
|
||||||
.byte 1 ; File handle (we know it's gonna be 1)
|
.byte 1 ; File handle (we know it's gonna be 1)
|
||||||
.addr LOADBUFFER
|
.addr LOADBUFFER
|
||||||
.word BUFFERSIZE
|
.word BUFFERSIZE
|
||||||
|
fileReadLen:
|
||||||
.word 0 ; Result (bytes read)
|
.word 0 ; Result (bytes read)
|
||||||
|
|
||||||
fileCloseCode:
|
fileClose:
|
||||||
.byte 1
|
.byte 1
|
||||||
.byte 1 ; File handle (we know it's gonna be 1)
|
.byte 1 ; File handle (we know it's gonna be 1)
|
||||||
|
|
||||||
|
fileOpenSprites:
|
||||||
|
.byte 3
|
||||||
|
.addr spritePath
|
||||||
|
.addr $9200 ; 1k below BASIC.SYSTEM
|
||||||
|
.byte 0 ; Result (file handle)
|
||||||
|
.byte 0 ; Padding
|
||||||
|
|
||||||
codePath:
|
codePath:
|
||||||
pstring "/GSAPP/CODEBANK"
|
pstring "/GSAPP/CODEBANK"
|
||||||
|
spritePath:
|
||||||
|
pstring "/GSAPP/SPRITEBANK00"
|
||||||
|
Loading…
Reference in New Issue
Block a user