EtchedPixels / Fuzix-Compiler-Kit

Fuzix C Compiler Project
Other
49 stars 14 forks source link

support6800/makebool.s tsta/b is 1 byte shorter than cmpa/b #0. #128

Closed zu2 closed 1 month ago

zu2 commented 1 month ago

tsta/b is 1 byte shorter than cmpa/b #0. It can be made even shorter by switching the collation order of AccA and B.

--- ../Fuzix-Compiler-Kit/support6800/makebool.s    2024-10-13 22:57:57
+++ support6800/makebool.s  2024-10-14 07:04:09
@@ -27,13 +27,11 @@
 ;  is appropriately set
 ;

-__notc:
-   cmpb    #0
-   bra booleq
 __not:
-   cmpa    #0
+   tsta
    bne ret0
-   cmpb    #0
+__notc:
+   tstb
 booleq:
    bne ret0
 ret1:
@@ -41,13 +39,11 @@
    ldab    #1
    rts

-__boolc:
-   cmpb    #0
-   bra boolne
 __bool:
-   cmpa    #0
-   bne boolne
-   cmpb    #0
+   tsta
+   bne ret1
+__boolc:
+   tstb
 boolne:
    bne ret1
 ret0:
@@ -81,7 +77,7 @@
 boolule:
    beq ret1
 boolult:           ; use C flag
-   ldaa    #0
-   ldab    #0
-   rolb
+   bcc ret0
+   clra
+   clrb
    rts
zu2 commented 1 month ago
--- ../Fuzix-Compiler-Kit/support6800/__notl.s  2024-10-13 22:57:57
+++ support6800/__notl.s    2024-10-10 17:37:23
@@ -5,7 +5,7 @@
    orab    @hireg
    orab    @hireg+1
    bne false
-   cmpa    #0
+   tsta
    bne false
    clra
    ldab    #1
EtchedPixels commented 1 month ago

Thanks

zu2 commented 2 weeks ago

Sorry, my typo.

--- ../Fuzix-Compiler-Kit/support6800/makebool.s    2024-10-26 08:56:57
+++ support6800/makebool.s  2024-11-07 21:23:34
@@ -77,7 +77,7 @@
 boolule:
    beq ret1
 boolult:           ; use C flag
-   bcc ret0
+   bcs ret1
    clra
    clrb
    rts
EtchedPixels commented 2 weeks ago

thanks