Can't believe I've gotten to the point where I'm looking through hex and disassembling code with a table of opcodes and [pseudo]register specs. Never thought I'd get here. Didn't even know that this "here" existed when I was young.

I'm finding this sequence multiple times; part of it or exactly this keeps on appearing in my compiler's output. I think it's performing a modulo by the Q16+8 value 10.0, then converting the number to ASCII then printing it. Part of the Q16+8 decimal print function, I think.
(Also - 0x30 is ASCII '0', not 'H')

Show thread
Follow

Yeah, definitely appears to be part of that function. That's modulo code for sure, too.

Found it, part of my ASCII.s stdlib. Came up with a change, which compiles to about 24 bytes, compared to about 55 bytes, but uses a loop. These print out the tenths, hundredths, and thousandths places of a decimal number; I think I'll keep the former code, since it is branchless, I/O aside, and since I might want to remove the thousandths place anyway (since Q16+8 numbers aren't quite that precise).

Show thread
Sign in to participate in the conversation
Librem Social

Librem Social is an opt-in public network. Messages are shared under Creative Commons BY-SA 4.0 license terms. Policy.

Stay safe. Please abide by our code of conduct.

(Source code)

image/svg+xml Librem Chat image/svg+xml