minor optimizations

This commit is contained in:
4am 2018-03-30 13:19:14 -04:00
parent 3fb8c990ef
commit 979cfc8635
8 changed files with 18 additions and 38 deletions

View File

@ -26,7 +26,7 @@
it look easy." The answer is Barsap. it look easy." The answer is Barsap.
[versions] [versions]
R87.DEPROT.Z3=Release elease 87 / Serial number 860904 R87.DEPROT.Z3=Release 87 / Serial number 860904
R63.DEPROT.Z3=Release 63 / Serial number 850916 R63.DEPROT.Z3=Release 63 / Serial number 850916
[options] [options]

View File

@ -84,7 +84,6 @@ LaunchInterpreter
jsr LoadInterpreter jsr LoadInterpreter
bcs .playError bcs .playError
; change prefix to folder of file we want the interpreter to open
jsr ResetPath jsr ResetPath
+LDADDR kGameRootDirectory +LDADDR kGameRootDirectory
jsr AddToPath jsr AddToPath
@ -92,30 +91,21 @@ LaunchInterpreter
jsr okvs_get jsr okvs_get
!word gGlobalPrefsStore !word gGlobalPrefsStore
!word kLastPlayed !word kLastPlayed
+STAY +
jsr AddToPath jsr AddToPath
jsr SetPrefix jsr SetPrefix ; set ProDOS prefix to game directory
!word gPathname !word gPathname
bcs .playError bcs .playError
; put just the filename at $2006 jsr okvs_get
+LDAY addrVersions !word gGlobalPrefsStore
+STAY $00 + !word $FDFD ; SMC
ldy #0 jsr SetStartupPath ; store game filename at $2006
- lda ($00),y
cmp #$BD ; '='
beq .doneBuildingFilename
iny
and #$7F
sta $2006,y
bra -
.doneBuildingFilename
sty $2006
; shut down WeeGUI and transfer control to interpreter jsr ExitWeeGUI ; shut down WeeGUI
jsr ExitWeeGUI jsr SetInterpreterOptions ; set options struct at $300
jsr SetInterpreterOptions jmp kSystemAddress ; exit via interpreter
jmp kSystemAddress
LoadInterpreter LoadInterpreter
jsr ResetPath jsr ResetPath
@ -125,7 +115,6 @@ LoadInterpreter
jsr LoadFile jsr LoadFile
!word gPathname !word gPathname
!word kSystemAddress !word kSystemAddress
!word $2000
!word kProDOSFileBuffer !word kProDOSFileBuffer
rts rts
.interpreterFilename .interpreterFilename

View File

@ -53,7 +53,6 @@ LoadGameInfo
jsr LoadFile jsr LoadFile
!word gPathname !word gPathname
!word $0800 !word $0800
!word $1400
!word kProDOSFileBuffer !word kProDOSFileBuffer
lda #$FF lda #$FF

View File

@ -20,7 +20,6 @@ LoadGameList
jsr LoadFile ; load prefs file at $2000 jsr LoadFile ; load prefs file at $2000
!word .gamesListFilename !word .gamesListFilename
.handle !word $2000 .handle !word $2000
!word $2000
!word kProDOSFileBuffer !word kProDOSFileBuffer
jsr ParseKeyValueText ; parse contents into games list store jsr ParseKeyValueText ; parse contents into games list store

View File

@ -54,7 +54,6 @@ LoadGlobalPreferences
jsr LoadFile ; load prefs file at $2000 jsr LoadFile ; load prefs file at $2000
!word .globalPrefsFilename !word .globalPrefsFilename
.handle !word $2000 .handle !word $2000
!word $2000
!word kProDOSFileBuffer !word kProDOSFileBuffer
jsr ParseKeyValueText ; parse contents into global prefs store jsr ParseKeyValueText ; parse contents into global prefs store

View File

@ -12,6 +12,8 @@
; - gPathname ; - gPathname
; ;
gPathname = $3F00
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ResetPath ; ResetPath
; reset gPathname to length 0 ; reset gPathname to length 0
@ -74,6 +76,3 @@ SetStartupPath
bpl - bpl -
rts rts
} }
gPathname
!fill 65 ; enough zeroes for any ProDOS pathname

View File

@ -37,11 +37,10 @@ PRODOSMLI = $BF00 ; [callable] MLI entry point
; LoadFile ; LoadFile
; load a file into memory all at once, using ProDOS MLI calls ; load a file into memory all at once, using ProDOS MLI calls
; ;
; in: stack contains 8 bytes of parameters: ; in: stack contains 6 bytes of parameters:
; +1 address of pathname ; +1 address of pathname
; +3 address of data buffer (to receive file contents) ; +3 address of data buffer (to receive file contents)
; +5 [word] maximum length of data to read ; +5 address of ProDOS file buffer
; +7 address of ProDOS file buffer
; out: if C set, load failed and A contains error code ; out: if C set, load failed and A contains error code
; from open or read ; from open or read
; if C clear, load succeeded and ($02) contains ; if C clear, load succeeded and ($02) contains
@ -52,7 +51,7 @@ PRODOSMLI = $BF00 ; [callable] MLI entry point
;------------------------------- ;-------------------------------
!zone { !zone {
LoadFile LoadFile
+PARAMS_ON_STACK 8 +PARAMS_ON_STACK 6
ldy #$01 ldy #$01
lda (PARAM),y ; lo byte of pathname lda (PARAM),y ; lo byte of pathname
@ -60,7 +59,7 @@ LoadFile
iny iny
lda (PARAM),y ; hi byte of pathname lda (PARAM),y ; hi byte of pathname
sta mliparam+2 sta mliparam+2
ldy #$07 ldy #$05
lda (PARAM),y ; lo byte of ProDOS file buffer lda (PARAM),y ; lo byte of ProDOS file buffer
sta mliparam+3 sta mliparam+3
iny iny
@ -77,11 +76,8 @@ LoadFile
iny iny
lda (PARAM),y ; hi address of data buffer lda (PARAM),y ; hi address of data buffer
sta mliparam+3 sta mliparam+3
iny lda #$FF
lda (PARAM),y ; lo data length sta mliparam+4 ; max data length (unlimited, YOLO)
sta mliparam+4
iny
lda (PARAM),y ; hi data length
sta mliparam+5 sta mliparam+5
pla ; pull file reference number pla ; pull file reference number
jsr _readfile jsr _readfile

View File

@ -153,7 +153,6 @@ HandleKey
jsr LoadFile jsr LoadFile
!word gPathname !word gPathname
!word kSystemAddress !word kSystemAddress
!word $2000
!word kProDOSFileBuffer !word kProDOSFileBuffer
bcs .xyzzyError bcs .xyzzyError
jsr ExitWeeGUI jsr ExitWeeGUI