First pass on ProDOS-based bank loader

This commit is contained in:
blondie7575 2017-10-01 17:36:09 -07:00
parent 79972bbb52
commit adb74d6fb4
6 changed files with 74 additions and 26 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/GSCats.xcodeproj/xcuserdata/qd.xcuserdatad/xcschemes/GSCats.xcscheme
/gscats.lst
/GSCats.xcodeproj/xcuserdata/qd.xcuserdatad/xcdebugger
/loader.lst

View File

@ -17,23 +17,31 @@ PGM=gscats
MRSPRITE=../MrSprite/mrsprite CODE
PALETTE=00ff00 000000 ffff00 886611 cc9933 eebb44 dd6666 ff99aa 00ff00 ffff00 ffff00 ffff00 ffff00 ffff00 ffff00 ffff00 ffffff
all: $(PGM)
all: loader $(PGM)
$(PGM):
@PATH=$(PATH):/usr/local/bin; $(CL65) -t apple2enh --cpu 65816 --start-addr $(ADDR) -l$(PGM).lst $(PGM).s
java -jar $(AC) -d $(PGM).2mg $(PGM)
java -jar $(AC) -p $(PGM).2mg $(PGM) BIN 0x$(ADDR) < $(PGM)
java -jar $(AC) -d $(PGM).2mg CODEBANK
java -jar $(AC) -p $(PGM).2mg CODEBANK BIN 0x$(ADDR) < $(PGM)
java -jar $(AC) -d $(PGM).2mg SPRITEBANK00
java -jar $(AC) -p $(PGM).2mg SPRITEBANK00 BIN 0x0000 < Art/spritebank00.bin
rm -f $(PGM)
rm -f $(PGM).o
osascript V2Make.scpt $(PROJECT_DIR) $(PGM)
loader:
@PATH=$(PATH):/usr/local/bin; $(CL65) -t apple2enh --cpu 65816 --start-addr $(ADDR) -lloader.lst loader.s
java -jar $(AC) -d $(PGM).2mg $(PGM)
java -jar $(AC) -p $(PGM).2mg $(PGM) BIN 0x$(ADDR) < loader
rm -f loader
rm -f loader.o
clean:
rm -f $(PGM)
rm -f $(PGM).o
rm ~/Library/Application\ Support/Sweet16/Disk\ Images/*
rm -f loader
rm -f loader.o
.PHONY: art
art:

View File

@ -9,6 +9,8 @@ KBDSTROBE = $e0c010
COUT = $fded
VRAM = $e12000
VRAMBANK = $e10000
PRODOS = $bf00 ; MLI entry point
PRODOSRETURN = $300 ; Indirect jump to get back to ProDOS from any bank
; Zero page locations we use (unused by Monitor, Applesoft, or ProDOS)
PARAM0 = $06

Binary file not shown.

View File

@ -7,7 +7,9 @@
.include "macros.s"
.include "equates.s"
.include "loader.s"
.org $800
mainBank2:
SYNCDBR
@ -25,7 +27,7 @@ mainBank2:
quitGame:
CLASSICVIDEO
jml (proDOSLongJump)
jml (PRODOSRETURN)
.include "graphics.s"

View File

@ -6,48 +6,83 @@
; Created by Quinn Dunki on 7/29/17
;
.include "equates.s"
.include "macros.s"
LOADBUFFER = $1000 ; Clear of this loader code
BUFFERSIZE = $8200 ; About max size we can fit between buffer and this loader code
MAINENTRY = $020800
.org $800
main:
OP8 ; We launch in emulation. Stay there for now
; Open the main code file
jsr PRODOS
.byte $c8
.addr fileOpenCode
bne ioError
; Load the code into bank 0
jsr PRODOS
.byte $ca
.addr fileReadCode
bne ioError
; Close the file
jsr PRODOS
.byte $cc
.addr fileCloseCode
NATIVE
; Copy main code that ProDOS 8 loaded into bank 2.
; Bank 2 is our "main" code bank because the GS fast
; graphics path really messes with banks 0 and 1.
; ProDOS 8 doesn't know anything about non-zero banks
; though, so things get loaded here and moved.
; Copy code into bank 2
mainCopyStart:
ldx #0
lda #mainBank2
sta mainCopyDest+1
mainCopyLoop:
lda mainBank2,x
lda LOADBUFFER,x
mainCopyDest:
sta $020800,x
sta MAINENTRY,x
inx
cpx #endMainBank2-mainBank2
inx
cpx #LOADBUFFER+BUFFERSIZE
bne mainCopyLoop
; Set up a long jump into bank 2, and
; a way for game code to get back here to exit
; properly to ProDOS 8
lda #returnToProDOS
sta proDOSLongJump
lda #mainBank2
sta mainLongJump
jml (mainLongJump)
sta PRODOSRETURN
jml MAINENTRY
returnToProDOS:
SYNCDBR
EMULATION
rts
mainLongJump:
.byte 00,08,02
proDOSLongJump:
.byte 00,00,00
ioError:
brk
fileOpenCode:
.byte 3
.addr codePath
.addr $9200 ; 1k below BASIC.SYSTEM
.byte 0 ; Result (file handle)
.byte 0 ; Padding
fileReadCode:
.byte 4
.byte 1 ; File handle (we know it's gonna be 1)
.addr LOADBUFFER
.word BUFFERSIZE
.word 0 ; Result (bytes read)
fileCloseCode:
.byte 1
.byte 1 ; File handle (we know it's gonna be 1)
codePath:
pstring "/GSAPP/CODEBANK"