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.
[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
[options]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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