2022-08-03

Having a lot of fun building the balanced ternary virtual machine. I have made a "word" (trword?) data type. I will definitely need to refactor all of this once I'm done drafting, but that's alright. As I'm learning this language as I'm writing this it's natural I discover better ways to do things as I'm coding... Oh! Also! Comments, yes. Need to add lots of comments.


balanced ternary words

The ISA I'm designing for the BaTeViMa uses 18-trit words. Why? It just made sense to me as an equivalent to 32-bits. There are 4 bits in a nybble and 4 bytes in 32 bits; so i figure, there are 3 trits in a trybble (ternary nibble, half a tryte) and 3 trytes in 18 trits.

Additional designs will come, as I hope to build a physical balanced ternary computer as well and I dont hate myself. Something very small I'm thinking, maybe 3 trits? which means also making decisions about how to pare-down the instruction set.

comments should at length explain how balanced ternary numbers work as well as what the code is doing. explaining both will make it easier to understand how it works later.


balanced ternary unicode

unicode characters are stored on 2 unsigned bytes. this represents the range from 0 to 65535 inclusive. I only expect to use the Basic Latin block, which goes from 0x0000 to 0x00FF (0~255: 256 items). 5 trits, can represent 243 unique items. Thats 13 items shy of the whole Basic Latin Block. One trit more, a tryte can represent 729 unique items. 473 more than strictly needed. So I have 473 fun "extra" unicode characters to encode in ternary. These can be the "negative" characters (of which there will be 364) and the final 109 "positive" characters. So 0 from 255 will be direct analogues to the Basic Latin unicode block.


return home
Content under 4.0 Creative Commons Attribution Non-Commercial No-Derivatives License