mirror of
https://github.com/a2-4am/4cade.git
synced 2025-01-12 14:30:29 +00:00
shave some bytes
This commit is contained in:
parent
532ce58a16
commit
68bb9e0454
@ -7,7 +7,7 @@
|
||||
;
|
||||
; LC RAM BANK 1
|
||||
; D000..E908 - persistent data structures (gGlobalPrefsStore, gGamesListStore)
|
||||
; E912..FFF1 - main program code
|
||||
; E92D..FFF1 - main program code
|
||||
; FFF2..FFF9 - API functions and global constants available for main program
|
||||
; code, prelaunchers, transition effects, &c.
|
||||
; (Wait/UnwaitForVBL, MockingboardStuff, MachineStatus)
|
||||
|
12
src/macros.a
12
src/macros.a
@ -114,8 +114,9 @@
|
||||
}
|
||||
|
||||
; compare a 16-bit value in A (low) and Y (high) to an absolute address
|
||||
; zeroes A!
|
||||
!macro CMP16ADDR .addr {
|
||||
cmp .addr
|
||||
eor .addr
|
||||
bne +
|
||||
cpy .addr+1
|
||||
+
|
||||
@ -221,15 +222,6 @@
|
||||
bit $C082
|
||||
}
|
||||
|
||||
!macro LOW_ASCII_TO_LOWER {
|
||||
cmp #$41
|
||||
bcc +
|
||||
cmp #$5B
|
||||
bcs +
|
||||
ora #$20
|
||||
+
|
||||
}
|
||||
|
||||
; requires setting zpCharMask in zero page to #$FF or #$DF before use
|
||||
!macro FORCE_UPPERCASE_IF_REQUIRED {
|
||||
cmp #$E1
|
||||
|
25
src/okvs.a
25
src/okvs.a
@ -231,7 +231,7 @@ okvs_append
|
||||
; out: if C clear, record was found
|
||||
; A/Y = lo/hi address of key (okvs_find) or value (okvs_get)
|
||||
; $WINDEX = index of found record (word)
|
||||
; if C set, keyrecord was not found and all registers are clobbered
|
||||
; if C set, keyrecord was not found and X/Y are clobbered, A=0
|
||||
; all other flags clobbered
|
||||
; $00/$01 clobbered
|
||||
; $02/$03 clobbered
|
||||
@ -268,15 +268,13 @@ okvs_get
|
||||
iny
|
||||
sty KEYLEN
|
||||
@matchRecordLoop
|
||||
lda PTR+1
|
||||
sta DEST+1
|
||||
lda PTR
|
||||
+LD16 PTR
|
||||
clc
|
||||
adc #2
|
||||
sta DEST
|
||||
bcc +
|
||||
inc DEST+1 ; DEST -> key of this record
|
||||
+ ldy #0
|
||||
iny ; DEST -> key of this record
|
||||
+ +ST16 DEST
|
||||
ldy #0
|
||||
@matchKeyLoop
|
||||
lda (SRC),y
|
||||
cmp (DEST),y
|
||||
@ -302,7 +300,7 @@ KEYLEN = *+1
|
||||
cmp WCOUNT
|
||||
bne @matchRecordLoop
|
||||
lda WINDEX+1
|
||||
cmp WCOUNT+1
|
||||
eor WCOUNT+1
|
||||
bne @matchRecordLoop
|
||||
@fail sec
|
||||
rts
|
||||
@ -338,7 +336,6 @@ okvs_next
|
||||
+LD16 WINDEX
|
||||
+CMP16ADDR WCOUNT
|
||||
bne +
|
||||
lda #0
|
||||
sta WINDEX
|
||||
sta WINDEX+1
|
||||
+
|
||||
@ -367,13 +364,13 @@ okvs_nth
|
||||
jmp @next
|
||||
- jsr derefptr
|
||||
@next
|
||||
dec SAVE
|
||||
lda SAVE
|
||||
cmp #$FF
|
||||
dec SAVE
|
||||
tay
|
||||
bne -
|
||||
dec SAVE+1
|
||||
lda SAVE+1
|
||||
cmp #$FF
|
||||
dec SAVE+1
|
||||
tay
|
||||
bne -
|
||||
jsr incptr2
|
||||
+LD16 PTR
|
||||
@ -473,7 +470,7 @@ okvs_iter_values
|
||||
lda #2 ; for iter, skip length = 2
|
||||
@branch bne + ; SMC (iter_values puts a BIT here, so no branch)
|
||||
; for iter_values, skip length = length(key) + 2 + 1
|
||||
ldy #2
|
||||
tay ;;ldy #2
|
||||
lda (PTR),y ; A = length of key
|
||||
clc
|
||||
adc #3 ; skip over pointer to next record (2 bytes) + key length (1 byte)
|
||||
|
@ -132,7 +132,6 @@ pref_get
|
||||
+ !word $FDFD ; SMC
|
||||
bcc + ; found key, continue
|
||||
.useDefaultValue ; did not find key, use first key in passed store as a default value
|
||||
lda #0
|
||||
sta WINDEX
|
||||
sta WINDEX+1
|
||||
+
|
||||
|
@ -99,9 +99,9 @@ TextRankCallback
|
||||
+ST16 zpword
|
||||
ldy #0
|
||||
lda (zpstring),y
|
||||
sec
|
||||
sbc #1
|
||||
cmp InputLength
|
||||
tax
|
||||
dex
|
||||
cpx InputLength
|
||||
bcc ++
|
||||
sta gamelength
|
||||
sty runningscore
|
||||
@ -110,11 +110,11 @@ TextRankCallback
|
||||
sty startat
|
||||
- sty i
|
||||
lda (zpword),y
|
||||
+LOW_ASCII_TO_LOWER
|
||||
jsr tolower
|
||||
sta tmp
|
||||
ldy startat
|
||||
-- lda (zpstring),y
|
||||
+LOW_ASCII_TO_LOWER
|
||||
jsr tolower
|
||||
cmp tmp
|
||||
beq +
|
||||
cpy gamelength
|
||||
@ -165,7 +165,7 @@ TextRankCallback
|
||||
pha
|
||||
ldy #1
|
||||
lda (zpstring),y
|
||||
+LOW_ASCII_TO_LOWER
|
||||
jsr tolower
|
||||
sta firstletter
|
||||
pla
|
||||
ldx InputBuffer
|
||||
@ -208,3 +208,11 @@ TextRankCallback
|
||||
bne -
|
||||
lda num1
|
||||
rts
|
||||
|
||||
tolower
|
||||
cmp #$41
|
||||
bcc +
|
||||
cmp #$5B
|
||||
bcs +
|
||||
ora #$20
|
||||
+ rts
|
||||
|
@ -28,9 +28,9 @@ Home
|
||||
; bits 1-4 reserved
|
||||
; bit 0 = 1 -> disable bank latch
|
||||
sta NEWVIDEO
|
||||
lda #$F0
|
||||
sta TBCOLOR ; white text on black background
|
||||
lda #$00
|
||||
ldy #$F0
|
||||
sty TBCOLOR ; white text on black background
|
||||
lsr
|
||||
sta CLOCKCTL ; black border
|
||||
sta CLOCKCTL ; set twice for VidHD
|
||||
@noSHR
|
||||
|
@ -23,11 +23,11 @@ Credits
|
||||
!word $8000
|
||||
-- jsr ForceHGRMode
|
||||
jsr ClearOffscreen
|
||||
lda OffscreenPage
|
||||
ldx #0
|
||||
- lda OffscreenPage
|
||||
ror ; draw on offscreen page
|
||||
+LDADDR $8000
|
||||
tax
|
||||
- jsr DrawPage ; draw credits
|
||||
jsr DrawPage ; draw credits
|
||||
jsr ShowOtherPage ; show credits
|
||||
jsr WaitForKeyFor30Seconds; wait
|
||||
bit CLEARKBD ; don't care about key
|
||||
@ -64,8 +64,5 @@ Help
|
||||
!word kHelpTextFile
|
||||
!word $8000
|
||||
jsr LoadHelpOffscreen ; load fancy backdrop
|
||||
lda OffscreenPage
|
||||
ror ; draw on offscreen page
|
||||
+LDADDR $8000
|
||||
ldx #7
|
||||
bne - ; always branches
|
||||
|
Loading…
x
Reference in New Issue
Block a user