Commit Graph

10 Commits

Author SHA1 Message Date
Clanmaster21
9cddaf1b59 String functions optimised (#86)
* String functions optimised

A few functions have been tweaked, but the biggest changes are in strlen, strskip and toWS, which take around two third of the cycles they used to (although strskip has more overhead). 10 bytes saved total.
toWS had two bytes added inlining the isWS call, and a jump to unsetZ was inlined too, saving a byte. This saved 29 cycles, with the original function being 90 cycles. I looked at other uses of isWS and it's difficult to inline it effectively in every situation, so I haven't inlined it elsewhere.
rdWS had a byte and two cycles saved by inlining a jump to unsetZ.
strskip is the same size, with the loop cut down from 35 cycles to 21 cycles, but 18 cycles are added outside the loop. I expect one character strings are in the minority, so this should save cycles overall.
strlen had 8 bytes saved, with the loop cut down from 38 cycles to 21 cycles, and 18 cycles removed outside the loop.

* Fixed strskip

Strskip wasn't preserving a properly. The new code uses the shadow af register, so whilst a byte and 4 cycles have been added outside the loop, it's safer and cleaner. The flags register isn't affected, but since the search goes for up to 64Kb I think it's safe to say the end of the string will always be reached.

* Remove inlining of isWS
2020-01-09 20:10:27 -05:00
Virgil Dupras
346bcc3d3d zasm: don't use lib/args
This unit is being removed.
2019-12-29 20:56:13 -05:00
Virgil Dupras
4c07639808 basic: make cmd table more compact
This shaves off quite a few bytes from the binary.
2019-11-30 21:36:34 -05:00
Virgil Dupras
1b01f13105 lib/expr: refactor for easier operator addition 2019-11-22 14:45:12 -05:00
Virgil Dupras
3f3dd9141e basic: allow multiple args in print 2019-11-20 21:02:11 -05:00
Virgil Dupras
f5b04fc02f basic: add expression support to print
Again, same thing as in zasm.
2019-11-18 15:52:44 -05:00
Virgil Dupras
0bd58fd178 basic: parse hex, binary and char literals
Same thing as in zasm.
2019-11-18 15:22:09 -05:00
Virgil Dupras
1cea6e71e0 basic: add a print cmd
It can only print a decimal literal. But still, that's a big step because
I hadn't implemented decimal formatting yet.
2019-11-18 13:40:23 -05:00
Virgil Dupras
8d46895dd3 lib/parse: decimal ending with a whitespace are now valid
Also, make empty strings be parsed as invalid by parseDecimal.
2019-11-13 22:10:06 -05:00
Virgil Dupras
eefadc3917 ed: add support for 'a' and 'i' 2019-07-14 17:35:21 -04:00