mirror of
https://github.com/a2-4am/4cade.git
synced 2024-12-21 02:30:27 +00:00
shave some bytes
This commit is contained in:
parent
b0d96bad23
commit
6ffc9c7aac
8
Makefile
8
Makefile
@ -137,10 +137,10 @@ index: md asmfx asmprelaunch
|
|||||||
# create gSearchStore indexes
|
# create gSearchStore indexes
|
||||||
#
|
#
|
||||||
[ -f build/DISPLAY.CONF ] || (bin/builddisplaynames.py < build/GAMES.CONF > build/DISPLAY.CONF)
|
[ -f build/DISPLAY.CONF ] || (bin/builddisplaynames.py < build/GAMES.CONF > build/DISPLAY.CONF)
|
||||||
[ -f build/SEARCH00.IDX ] || (grep "^00" < build/DISPLAY.CONF | cut -d"," -f2 | bin/buildokvs.sh > build/SEARCH00.IDX)
|
[ -f build/SEARCH00.IDX ] || (grep "^00" < build/DISPLAY.CONF | bin/buildsearch.sh > build/SEARCH00.IDX)
|
||||||
[ -f build/SEARCH01.IDX ] || (grep "^0" < build/DISPLAY.CONF | cut -d"," -f2 | bin/buildokvs.sh > build/SEARCH01.IDX)
|
[ -f build/SEARCH01.IDX ] || (grep "^0" < build/DISPLAY.CONF | bin/buildsearch.sh > build/SEARCH01.IDX)
|
||||||
[ -f build/SEARCH10.IDX ] || (grep "^.0" < build/DISPLAY.CONF | cut -d"," -f2 | bin/buildokvs.sh > build/SEARCH10.IDX)
|
[ -f build/SEARCH10.IDX ] || (grep "^.0" < build/DISPLAY.CONF | bin/buildsearch.sh > build/SEARCH10.IDX)
|
||||||
[ -f build/SEARCH11.IDX ] || (cat build/DISPLAY.CONF | cut -d"," -f2 | bin/buildokvs.sh > build/SEARCH11.IDX)
|
[ -f build/SEARCH11.IDX ] || (bin/buildsearch.sh < build/DISPLAY.CONF > build/SEARCH11.IDX)
|
||||||
#
|
#
|
||||||
# create a sorted list of game filenames, without metadata or display names
|
# create a sorted list of game filenames, without metadata or display names
|
||||||
#
|
#
|
||||||
|
@ -12,11 +12,12 @@ source=$(mktemp)
|
|||||||
dhgr=$(echo "$key" | cut -c3) # 'has DHGR title screen' flag (0 or 1)
|
dhgr=$(echo "$key" | cut -c3) # 'has DHGR title screen' flag (0 or 1)
|
||||||
cheat=$(echo "$key" | cut -c4) # 'cheat category' (0..5)
|
cheat=$(echo "$key" | cut -c4) # 'cheat category' (0..5)
|
||||||
key=$(echo "$key" | cut -d"," -f2)
|
key=$(echo "$key" | cut -d"," -f2)
|
||||||
echo "!byte ${#key}+${#value}+4" # OKVS record length
|
echo "!byte ${#key}+${#value}+5" # OKVS record length
|
||||||
echo "!byte ${#key}" # OKVS key length
|
echo "!byte ${#key}" # OKVS key length
|
||||||
echo "!text \"$key\"" # OKVS key
|
echo "!text \"$key\"" # OKVS key
|
||||||
echo "!byte ${#value}+1" # OKVS value length
|
echo "!byte ${#value}" # OKVS value length
|
||||||
echo "!text \"$value\"" # OKVS value
|
echo "!text \"$value\"" # OKVS value
|
||||||
|
echo "!byte 1"
|
||||||
echo "!byte $((dhgr*128))+$cheat"
|
echo "!byte $((dhgr*128))+$cheat"
|
||||||
done < "$records") > "$source"
|
done < "$records") > "$source"
|
||||||
|
|
@ -386,11 +386,12 @@ CopyDevs
|
|||||||
jsr stepptr
|
jsr stepptr
|
||||||
+LD16 PTR ; (PTR) points to free space after the OKVS data structure we just created
|
+LD16 PTR ; (PTR) points to free space after the OKVS data structure we just created
|
||||||
+ST16 gGamesListStore ; save pointer to free space for next store
|
+ST16 gGamesListStore ; save pointer to free space for next store
|
||||||
|
|
||||||
jsr LoadFile ; load games list file into $8200
|
jsr LoadFile ; load games list file into $8200
|
||||||
!word kRootDirectory
|
!word kRootDirectory
|
||||||
!word @kGameListConfFile
|
!word @kGameListConfFile
|
||||||
- !word $8200
|
- !word $8200
|
||||||
|
lda #$EA
|
||||||
|
sta AddValueDuringAppend
|
||||||
jsr ParseGamesList ; parse games list into OKVS data structure in LC RAM bank
|
jsr ParseGamesList ; parse games list into OKVS data structure in LC RAM bank
|
||||||
!word gGamesListStore
|
!word gGamesListStore
|
||||||
!word -
|
!word -
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
; YE OLDE GRAND UNIFIED MEMORY MAP
|
; YE OLDE GRAND UNIFIED MEMORY MAP
|
||||||
;
|
;
|
||||||
; LC RAM BANK 1
|
; LC RAM BANK 1
|
||||||
; D000..E2F8 - persistent data structures (gGlobalPrefsStore, gGamesListStore)
|
; D000..DFDE - persistent data structures (gGlobalPrefsStore, gGamesListStore)
|
||||||
; ...unused...
|
; ...unused...
|
||||||
; EA2A..FFEE - main program code
|
; EA23..FFEE - main program code
|
||||||
; FFEF..FFF9 - API functions and global constants available for main program
|
; FFEF..FFF9 - API functions and global constants available for main program
|
||||||
; code, prelaunchers, transition effects, &c.
|
; code, prelaunchers, transition effects, &c.
|
||||||
; (LoadFileDirect, Wait/UnwaitForVBL, MockingboardStuff, MachineStatus)
|
; (LoadFileDirect, Wait/UnwaitForVBL, MockingboardStuff, MachineStatus)
|
||||||
|
@ -210,6 +210,7 @@ okvs_append
|
|||||||
tay
|
tay
|
||||||
lda (SRC),y ; no max, use actual length instead
|
lda (SRC),y ; no max, use actual length instead
|
||||||
tax
|
tax
|
||||||
|
AddValueDuringAppend
|
||||||
+ inx
|
+ inx
|
||||||
tay
|
tay
|
||||||
- lda (SRC),y
|
- lda (SRC),y
|
||||||
|
@ -61,12 +61,8 @@ ParseGamesList
|
|||||||
bvc @skipLine ; game requires 128K but we only have 64K, so ignore entire line
|
bvc @skipLine ; game requires 128K but we only have 64K, so ignore entire line
|
||||||
@parseDHGRTitle
|
@parseDHGRTitle
|
||||||
jsr IncAndGetChar ; get third character ('1' if game has DHGR title)
|
jsr IncAndGetChar ; get third character ('1' if game has DHGR title)
|
||||||
and #$01
|
|
||||||
pha
|
|
||||||
@parseCheatsAvailable
|
@parseCheatsAvailable
|
||||||
jsr IncAndGetChar ; get fourth character (cheat category, int)
|
jsr IncAndGetChar ; get fourth character (cheat category, int)
|
||||||
and #CHEAT_CATEGORY
|
|
||||||
pha
|
|
||||||
@swallowComma
|
@swallowComma
|
||||||
jsr IncAndGetChar
|
jsr IncAndGetChar
|
||||||
@gatherKey
|
@gatherKey
|
||||||
@ -86,19 +82,7 @@ ParseGamesList
|
|||||||
jsr IncAndGetChar
|
jsr IncAndGetChar
|
||||||
cmp #$0A ; CR ends the value
|
cmp #$0A ; CR ends the value
|
||||||
bne @gatherValue
|
bne @gatherValue
|
||||||
; beq @endValue
|
|
||||||
; sta gVal,x
|
|
||||||
; inx
|
|
||||||
; bpl @gatherValue
|
|
||||||
@endValue
|
@endValue
|
||||||
pla ; pop cheat category
|
|
||||||
sta gVal,x ; store after game display name
|
|
||||||
pla ; pop has-DHGR-title flag
|
|
||||||
lsr
|
|
||||||
ror
|
|
||||||
ora gVal,x
|
|
||||||
sta gVal,x ; store in bit 7 of same byte as cheat category
|
|
||||||
inx
|
|
||||||
stx gValLen
|
stx gValLen
|
||||||
tya
|
tya
|
||||||
pha ; okvs functions clobber everything but we need Y
|
pha ; okvs functions clobber everything but we need Y
|
||||||
|
@ -32,17 +32,17 @@ Help
|
|||||||
|
|
||||||
jsr LoadIndexedFile
|
jsr LoadIndexedFile
|
||||||
!word kGameHelpFile
|
!word kGameHelpFile
|
||||||
!word $8000
|
!word $800
|
||||||
@indexRecordPtr
|
@indexRecordPtr
|
||||||
!word $FDFD ; SMC
|
!word $FDFD ; SMC
|
||||||
|
|
||||||
clc
|
clc
|
||||||
bcc .clearAndDisplayHelp ; always branches
|
bcc .clearAndDisplayHelp ; always branches
|
||||||
|
|
||||||
@global jsr LoadFile ; load help text into $8000
|
@global jsr LoadFile ; load help text into $800
|
||||||
!word kRootDirectory
|
!word kRootDirectory
|
||||||
!word kHelpTextFile
|
!word kHelpTextFile
|
||||||
!word $8000
|
!word $800
|
||||||
|
|
||||||
jsr LoadHelpOffscreen ; load fancy backdrop
|
jsr LoadHelpOffscreen ; load fancy backdrop
|
||||||
ldx #7
|
ldx #7
|
||||||
@ -57,10 +57,10 @@ Help
|
|||||||
; all other flags and registers clobbered
|
; all other flags and registers clobbered
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
Credits
|
Credits
|
||||||
jsr LoadFile ; load credits text into $8000
|
jsr LoadFile ; load credits text into $800
|
||||||
!word kRootDirectory
|
!word kRootDirectory
|
||||||
!word kCreditsFile
|
!word kCreditsFile
|
||||||
!word $8000
|
!word $800
|
||||||
.clearAndDisplayHelp
|
.clearAndDisplayHelp
|
||||||
jsr ForceHGRMode
|
jsr ForceHGRMode
|
||||||
jsr ClearOffscreen
|
jsr ClearOffscreen
|
||||||
@ -68,7 +68,7 @@ Credits
|
|||||||
.displayHelp
|
.displayHelp
|
||||||
lda OffscreenPage
|
lda OffscreenPage
|
||||||
ror ; draw on offscreen page
|
ror ; draw on offscreen page
|
||||||
+LDADDR $8000
|
+LDADDR $800
|
||||||
+ST16 PTR
|
+ST16 PTR
|
||||||
;DrawPageInternal inlined here
|
;DrawPageInternal inlined here
|
||||||
;
|
;
|
||||||
|
@ -83,18 +83,20 @@ LoadOffscreenFromAY
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
LoadGameTitleOffscreen
|
LoadGameTitleOffscreen
|
||||||
; in: gGameToLaunch = index into gGamesListStore (word)
|
; in: gGameToLaunch = index into gSearchStore (word)
|
||||||
jsr GetGameToLaunch
|
+LD16 gGameToLaunch
|
||||||
|
+ST16 WINDEX
|
||||||
|
+LDADDR gSearchStore
|
||||||
|
jsr okvs_nth ; A/Y -> key (game filename) in gSearchStore
|
||||||
+ST16 @fname
|
+ST16 @fname
|
||||||
bit MachineStatus ; if < 128K, don't bother checking for DHGR title
|
bit MachineStatus ; if < 128K, don't bother checking for DHGR title
|
||||||
bvc @hgr
|
bvc @hgr
|
||||||
jsr okvs_get_current
|
jsr okvs_get_current
|
||||||
; (PTR) -> game display name + bitfield of game info
|
jsr okvs_get_current_PTR_is_already_set
|
||||||
|
; (PTR) -> length-prefixed game info bitfield
|
||||||
; Y = 0
|
; Y = 0
|
||||||
lda (PTR),y ; A = game display name length + 1
|
iny ; Y = 1
|
||||||
sta SAVE
|
lda (PTR), y ; A = game info bitfield
|
||||||
tay
|
|
||||||
lda (PTR),y ; A = game info bitfield
|
|
||||||
;;and #HAS_DHGR_TITLE
|
;;and #HAS_DHGR_TITLE
|
||||||
bmi @dhgr
|
bmi @dhgr
|
||||||
@hgr
|
@hgr
|
||||||
|
@ -122,21 +122,22 @@ DrawUI
|
|||||||
sta gPathname ; hack, used by first RedrawForDHGR which follows
|
sta gPathname ; hack, used by first RedrawForDHGR which follows
|
||||||
; Draw40Chars which doesn't set gPathname
|
; Draw40Chars which doesn't set gPathname
|
||||||
|
|
||||||
jsr GetGameToLaunch ; get current game, if any
|
jsr AnyGameSelected ; get index number of current game, if any
|
||||||
bcs @doneWithLine2 ; if no game, nothing more to do on UI line 2
|
bcs @doneWithLine2 ; if no game, nothing more to do on UI line 2
|
||||||
+ST16 @fname
|
+ST16 WINDEX
|
||||||
jsr okvs_get_current
|
+LDADDR gSearchStore
|
||||||
iny ; Y = 1
|
jsr okvs_nth ; A/Y -> key of current game (in gSearchStore)
|
||||||
|
jsr okvs_get_current ; (PTR) -> display name of current game
|
||||||
|
; Y = 0
|
||||||
|
lda (PTR), y
|
||||||
|
tay
|
||||||
|
iny
|
||||||
|
sty SAVE
|
||||||
|
iny
|
||||||
lda (PTR), y ; A = game info bitfield
|
lda (PTR), y ; A = game info bitfield
|
||||||
sta gGameToLaunchInfo
|
sta gGameToLaunchInfo
|
||||||
jsr okvs_get
|
|
||||||
!word gSearchStore
|
|
||||||
@fname !word $FDFD ; SMC
|
|
||||||
+ST16 PTR
|
|
||||||
ldy #0
|
ldy #0
|
||||||
lda (PTR), y
|
|
||||||
sta SAVE
|
|
||||||
inc SAVE
|
|
||||||
- iny
|
- iny
|
||||||
@printCursor
|
@printCursor
|
||||||
lda #$FD ; SMC
|
lda #$FD ; SMC
|
||||||
@ -197,7 +198,7 @@ DrawUI
|
|||||||
ldy #0
|
ldy #0
|
||||||
@dotloop
|
@dotloop
|
||||||
iny
|
iny
|
||||||
lda (PTR),y ; (PTR) still points to game display name + game info bitfield
|
lda (PTR),y ; (PTR) still points to game display name
|
||||||
ora #$20 ; force lower-case always
|
ora #$20 ; force lower-case always
|
||||||
cmp InputBuffer,x
|
cmp InputBuffer,x
|
||||||
bne +
|
bne +
|
||||||
|
Loading…
Reference in New Issue
Block a user