#0f — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #0f, aggregated by home.social.
-
@vanja in noodle, there's routines to convert a string to a byte too, if you don't need a short:
https://git.sr.ht/~rabbits/noodle/tree/main/item/src/noodle.tal#L1657@sbyte ( str* -- byte ) LDAk ,chex JSR #40 SFT STH INC2 LDA ,chex JSR STHr ADD JMP2r
@chex ( c -- val|ff ) LIT "0 SUB DUP #09 GTH JMP JMP2r #27 SUB DUP #0f GTH JMP JMP2r POP #ff JMP2rIn Adelie there's a nice one too:
https://git.sr.ht/~rabbits/adelie/tree/main/item/src/adelie.tal#L638 -
@jameschip When you would normally use MOD ( DIVk MUL SUB ) you can sometimes use AND with the boundary-1:
#01 AND -> 2 MOD
#03 AND -> 4 MOD
#07 AND -> 8 MOD
#0f AND -> 16 MOD
#1f AND -> 32 MODetc..
It's a good trick
-
@neauoire Yes. In the real computing hardware I'm familiar with it is extremely common to map hardware registers/device memories into the "main" memory. The double meaning of #0f as both 'the halt port' and 'a word in the zero page' was extremely confusing as a result, especially when the TAL examples all write the System struct at #00 which sorta implies it has a memory layout as other structs would.