1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-08 11:18:05 +11:00
collapseos/apps/lib
Clanmaster21 927d5f2392 Reworked parseHexadecimal and parseDecimal, other minor tweaks (#85)
I've tweaked nearly every function in this file, so I'll go through them one by one.
parseDecimal has been reworked a little so that `a` can be used instead of `b` for checking for overflow. I had originally intended to redo it to work like the old parseDecimal, but I think the current method (once reworked a little) is cleaner and smaller, and should be just as fast. 7 bytes and 27 cycles saved.
parseHexadecimal has been changed to load hex digits into `b` `d` `c` `e` from the right (so all the digits move along to the left so the new digit can be inserted on the right), and then only at the end is any shifting done, using the faster `add a, a` to do left shifts. 9 bytes saved and 78 cycles saved inside the loop, and then 49 cycles added after the loop. 
parseBinaryLiteral had a few instructions moved around, saving two bytes and 5 cycles inside the loop, and a further 15 cycles saved on error.
parseLiteral has been reworked slightly, the isDigit call has been replaced with an inline parseDecimalDigit, saving a byte and around 20-30 cycles, with around 16 more cycles saved if the number is a decimal. The .char routine has been reduced by a byte, and 6 cycles saved on success, but 5 cycles added on error.
isDigit has been reduced by 4 bytes and 10 cycles on success, with a few more cycles saved on fail (hard to estimate due to branching).
2020-01-08 16:12:40 -05:00
..
ari.asm lib/expr: refactor for easier operator addition 2019-11-22 14:45:12 -05:00
expr.asm lib/expr: make EXPR_PARSE "tail" HL 2019-12-30 19:24:53 -05:00
fmt.asm recipes/rc2014/zasm: use BASIC shell 2019-12-11 13:01:51 -05:00
parse.asm Reworked parseHexadecimal and parseDecimal, other minor tweaks (#85) 2020-01-08 16:12:40 -05:00
README.md apps/ed: add (dummy) line number processing 2019-07-13 11:53:30 -04:00
util.asm zasm: don't use lib/args 2019-12-29 20:56:13 -05:00

Common code used by more than one app, but not by the kernel.