Skip to content

Commit

Permalink
Use ldxy/inxy/stxy macro in a few more places to shave bytes
Browse files Browse the repository at this point in the history
Saves a whopping 8 bytes in DeskTop's Aux bank, but it's the thought
that counts, right?

No functional changes.
  • Loading branch information
inexorabletash committed Oct 2, 2023
1 parent 585328e commit 5619977
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
8 changes: 6 additions & 2 deletions desktop/main.s
Original file line number Diff line number Diff line change
Expand Up @@ -14162,7 +14162,9 @@ measure:
ldy #0
lda (ptr),y
sta len
add16 ptr, #1, txt
ldxy ptr
inxy
stxy txt
MGTK_CALL MGTK::TextWidth, txt
cmp16 result, #kProgressDialogPathWidth
rts
Expand Down Expand Up @@ -14736,7 +14738,9 @@ done: rts

;; Compute text width
pha ; A = flags
add16_8 ptr, #1, textptr
ldxy ptr
inxy
stxy textptr
ldax ptr
jsr AuxLoad
sta textlen
Expand Down
8 changes: 6 additions & 2 deletions lib/alert_dialog.s
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,9 @@ END_PARAM_BLOCK
ldy #0
lda (a_shortcut),y
sta tw_params::textlen
add16_8 a_shortcut, #1, tw_params::textptr
ldxy a_shortcut
inxy
stxy tw_params::textptr
MGTK_CALL MGTK::TextWidth, tw_params

sub16_8 rect+MGTK::Rect::x2, #kButtonTextHOffset-2, pos+MGTK::Point::xcoord
Expand All @@ -706,7 +708,9 @@ END_PARAM_BLOCK
ldy #0
lda (a_label),y
sta tw_params::textlen
add16_8 a_label, #1, tw_params::textptr
ldxy a_label
inxy
stxy tw_params::textptr
MGTK_CALL MGTK::TextWidth, tw_params

add16 rect+MGTK::Rect::x1, rect+MGTK::Rect::x2, pos+MGTK::Point::xcoord
Expand Down
16 changes: 12 additions & 4 deletions toolkits/btk.s
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ END_PARAM_BLOCK
lda (a_label),y
beq :+
sta dt_params::textlen
add16_8 a_label, #1, dt_params::textptr
ldxy a_label
inxy
stxy dt_params::textptr
MGTK_CALL MGTK::DrawText, dt_params
: rts
.endproc ; _DrawLabel
Expand All @@ -284,7 +286,9 @@ END_PARAM_BLOCK
rts
:
sta tw_params::textlen
add16_8 a_label, #1, tw_params::textptr
ldxy a_label
inxy
stxy tw_params::textptr
MGTK_CALL MGTK::TextWidth, tw_params
ldax tw_params::width
rts
Expand All @@ -301,7 +305,9 @@ END_PARAM_BLOCK
lda (a_shortcut),y
beq :+
sta dt_params::textlen
add16_8 a_shortcut, #1, dt_params::textptr
ldxy a_shortcut
inxy
stxy dt_params::textptr
MGTK_CALL MGTK::DrawText, dt_params
: rts
.endproc ; _DrawShortcut
Expand All @@ -323,7 +329,9 @@ END_PARAM_BLOCK
rts
:
sta tw_params::textlen
add16_8 a_shortcut, #1, tw_params::textptr
ldxy a_shortcut
inxy
stxy tw_params::textptr
MGTK_CALL MGTK::TextWidth, tw_params
ldax tw_params::width
rts
Expand Down
8 changes: 6 additions & 2 deletions toolkits/letk.s
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,9 @@ data .addr
length .byte
END_PARAM_BLOCK

add16_8 a_buf, #1, text_params::data
ldxy a_buf
inxy
stxy text_params::data
ldy #0
lda (a_buf),y
sta text_params::length
Expand Down Expand Up @@ -700,7 +702,9 @@ END_PARAM_BLOCK
lda (a_buf),y
beq :+
sta dt_params::textlen
add16_8 a_buf, #1, dt_params::textptr
ldxy a_buf
inxy
stxy dt_params::textptr
MGTK_CALL MGTK::DrawText, dt_params
:

Expand Down

0 comments on commit 5619977

Please sign in to comment.