Skip to content

opt libload (inline ti.CpHLDE)#690

Merged
mateoconlechuga merged 1 commit intomasterfrom
opt_libload_2
Feb 4, 2026
Merged

opt libload (inline ti.CpHLDE)#690
mateoconlechuga merged 1 commit intomasterfrom
opt_libload_2

Conversation

@ZERICO2005
Copy link
Contributor

@ZERICO2005 ZERICO2005 commented Jan 31, 2026

Proof for the push af \ add hl, 15 \ pop af stuff:
#648 (comment)

        ; Original
        ld      de, Y
        ld      hl, X
        or      a, a
        sbc     hl, de  ; HL = X -  Y, DE = Y
        add     hl, de  ; HL = X     , DE = Y

        ex      de, hl  ; HL = Y     , DE = X
        ld      de, 15  ; HL = Y     , DE =     15
        add     hl, de  ; HL = Y + 15, DE =     15
        ex      de, hl  ; HL =     15, DE = Y + 15
        pop     hl      ; HL =      ?, DE = Y + 15

        ; Optimized
        ld      de, Y
        ld      hl, X
        or      a, a
        sbc     hl, de  ; HL = X -  Y, DE = Y

        ld      hl, 15  ; HL =     15, DE = Y
        add     hl, de  ; HL = Y + 15, DE = Y
        ex      de, hl  ; HL =      Y, DE = Y + 15
        pop     hl      ; HL =      ?, DE = Y + 15

@mateoconlechuga
Copy link
Member

The flags are changed, are they not? That's what the push af is for. Just need some more proof

@ZERICO2005 ZERICO2005 changed the title Opt libload 2 opt libload (inline ti.CpHLDE) Feb 3, 2026
@mateoconlechuga mateoconlechuga merged commit b0592ce into master Feb 4, 2026
9 checks passed
@mateoconlechuga mateoconlechuga deleted the opt_libload_2 branch February 4, 2026 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants