My name is AOI. I am a small dragon. I live in an enchanted forest next to a big red tree. I blog about my life and projects here. Welcome!
Sign my guestbook!
I'm headed back into school for Fall Term. I'm finally taking Differential Equations. Differential Equations have a lot of interesting applications! As well, I am taking a History of Modern Science course. I'm excited!
Recently, I have been playing with a Commodore Amiga emulator. I found a really interesting interactive fiction game for it. It's called "A Mind Forever Voyaging". More on that when I finish it.
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.
The balanced ternary virtual machine has a name now. It is BaTeViMa (pronounced /ˈbaˌtɛ.vi.mə/). So far about 100 lines of Haskell and 50 lines of markdown including both the code and the ISA specification. Barely getting started, but I'm proud. I think working on this website is helping me focus. Excellent news because focus has always been something I've struggled with. Also why am I even trying to write fiction? I don't even really read fiction.
I'm basing the ISA on RISC-V. I knew I wanted it to be a RISC architecture, and RISC-V is open-source. I'm changing it significantly and really just using the most barebones implementation. I'm calling it RISC-VI after the number of trits in a tryte. Additionally, I've written a data type for trits and defined basic three-valued logic. Next is the more challenging task of defining balanced ternary arithmetic. This work will function later as a sort of troubleshooting tool; I imagine; for the later work with the emulated processor. Ultimately, I should find a way to express each arithmetic operation with three-valued logic gates.
From this website alone it looks like there isnt much here. Like I just started all this yesterday. The truth is I've been working on stuff like this for at least a decade. I just never focused on one thing. Never had anything to ground me in my work. As well when you put impossible expectations on yourself you can't really accomplish anything. Nothing is ever good enough. So this is all just for me really. If you are anything like me you will like it too, so I guess its for you too. It really doesn't matter in the end. You move with history or history moves you. And the eventual heat death will choak us in the end anyway. Breathe your happiest breaths.
Most of my work is nonfictional. I work in real things. Don't get me wrong, I appreciate fiction and art tremendously. I just don't read stories really. I watch shows and movies, sure. But written fiction is a whole other medium. Why do I write fiction if I don't read it? I think for me writing fiction is a way for me to explore spaces and situations in my head. I'm just playing around for one part of it. The other is just refining words to practice writing. That part doesn't feel any different than writing nonfiction to me. I know on some level that my fiction will never be good because I don't have the solid foundation of a fiction reader, but I don't (and can't) write it to write something good. I write fiction to go on an adventure and then... edit and revise it into an even better adventure.
On that note, the first circuit of Fluid Circuitry will be a complete story by itself. As it stands, Fluid Circuitry will be most like a collection of short stories of the cyberpunk variety with all anthropomorphic animal characters. The first circuit is a revenge story following a black cat named Iron. So far theres definitely a few pages of finished story. I think I'm about... 20% done. There's still a lot of editing/revision to do. No E.T.A. still because most of my time recently has been spent on developing BaTeViMa.
Learning Me a Haskell for Great Good
I've decided that I will use Haskell to build the virtual machine. Over the years, I've become less and less interested in using imperative programming. Functional makes much more sense to me. I suppose that should make sense given I am a math person.
I started getting into functional programming with LISP and scheme. As much as I love writing scheme code, after playing around with haskell a little, I think I will get more done with haskell. It seems like it takes less code to write in Haskell than in scheme for one. It's also quite a bit easier to read—and I love s-expressions, so this is a little painful to admit.
So, yeah, the BTVM will be written in Haskell. :)
The Cool Soviet Calculator
As I skim through some books on haskell, I've found myself becoming more interested in mechanical calculators again. Especially the pinwheel variety. Oh the gratifying sound of those gears all crunching in unison as they dumbly compute! Fell asleep so nicely last night just recalling the beautiful sound of these machines. In particular, I've become fascinated by the Soviet-made Felix calculator.
In 1924, Felix Dzerzhinsky, founder of the Cheka, started production of these new calculators. Ostensibly, this manufacturing endeavor was undertaken to give the young people of the new Soviet Republic something to do. The calculators themselves were based on the design of the 1873 Odhner calculator—but with zinc alloy gears (instead of brass) to improve operation!
Felix calculators were made as cheaply as possible. Other machines could be fancy, but the Felix machines were made to reach the people who needed them. Despite their low-cost, the simplicity of construction and operation made these calculators exceptionally tough and reliable. And they did end up quite cheap: By the 70's, these machines cost 13 rubles. (That's about 11 USD today according to this routimentary historical currency converter. Take this calculation with a grain of salt. Inflation adjustment calculations are hard enough without also having to consider currency conversions.)
Interestingly, these same pinwheel calculators continued to be manufactured right up to 1978 with just a few dozen design updates. This is interesting to me beacuse the USSR's calculator industry—despite everything—advanced at much the same pace as in richer western nations. I believe it was produced for so long because Felix Dzerzhinsky was a national hero. There are streets named after him. It would make sense that there was some fondness for the outdated machine because it bore his name, but I cannot be sure. A year after the 100th anniversary since the birth of Felix Dzerzhinsky, the calculator was discontinued. :(
Anyway, mechanical calculators are rad, and especially this one because it was made and used in the first socialist country in the world! Read more about Felix calculator at these pages: xnumber's history of soviet calculators, russian language wikipedia entry with basic information about the device, has lots of references to Russian language sources about it, xnumber page for the felix calculator in particular, Jaap Scherphuis' page about the calculator (has lots of pictures!), and this video by Scherphuis showing the basic operation of the device.
Keep it weird.
For a couple years now, I've been playing with the idea of building a balanced ternary processor. It's actually been done before—a few different times, almost exclusively in the Soviet Union. In 1958, the Setun ternary computer was designed at Moscow State University. I think it's really cool. Read more about the Setun computers here.
The advantage of ternary over binary is clear. The important thing is that I think its cool, so I want to design and build a balanced ternary computer like the Setun. There are quite a few problems in the way to achieving this what must be overcome.
Primarily, the digital electronics world is built around binary. Binary is ubiquitous. So in building this, I'd have to go from the ground up. No integrated circuits. That is, unless I implement BCT (binary coded ternary). It would be much easier to use BCT, so naturally, it was very tempting to just do that. But in the end, I've decided I'd rather have a genuine ternary system through and through.
I wasn't sure how to begin. I've decided to begin by exploring the logic of a balanced ternary system, so I'm going to begin work on a full virtual machine. When complete, I'm hoping it will guide the development of a physical version of the computer. Meanwhile, I will be playing with electronics to try and design basic ternary logic circuits. Kind of attacking it both from the highest and lowest levels at the same time.
In other news, the first chapter of Fluid Circuitry has been drafted. Unknown how long revision will take. More on that later. The chapters of Fluid Circuitry will be released as they are completed.
Have a good day and keep it weird.