Now I've published the source code and changed the description, this is looking like a real project!
Now I've published the source code and changed the description, this is looking like a real project!
!til &virtual-machine I had planned to do a stream today continuing from yesterday, adding more instructions and explaining IO. But, I had a lot to do today so it didn't work out. overall though, I think yesterday's stream was pretty good, even if no one watched 🥲. That concludes my contribution to this year's learning jam and the initial creation of Gepetto. I'll publish the code to my source repo tomorrow and continue development. This was fun!
!til &virtual-machine the 3 categories of instructions needed for a useful system seems to be arithmetic (bitwise, addition, multiplication, etc), control flow (i.e. jmp) and data flow (load, store, mov, etc).
!til &virtual-machine on the topic of IO, there's 3 schemes of communication with external devices: Interrupts, Ports and Memory Mapped IO. One of these is most superior for my use case; I'll reveal which one along with details about all 3 schemes in my livestream
!til &virtual-machine In order for my generic VM to be useful, it needs to be able to handle any computation, meaning Turing Completeness. Only once I have achieved that can I start to worry about MMIO and other devices. So far, the requirements for turing completeness appear to be (a) minimal arithmetic ops like ADD, NOT and XOR, and (b) a loop construct. With those, you can theoretically compute any arithmetic operation. There are some One Instructions Set Computers that achieve Turing Completeness (I'll go on a tangent about them on stream prob), but I want my VM to be tolerable to write ASM for, and enjoyable to program in general, so I think I'll need a few more
!til &virtual-machine Threaded code is a commonly used technique when implementing Forths primarily. It's an interesting strategy that I'll talk about Next Saturday 🙂
!til &virtual-machine In addition to register based machines, which provide memory and dedicated registers, there exists stack based machines which only provide memory and a stack pointer (typically at the end of memory) that is decremented when new values are pushed onto it. Register machines are arguably harder to construct, but produce faster results that can be optimized, whereas stack machines require fewer instructions and are simpler to implement, but are a lot slower. An example of a good stack VM that's so simple it's commonly programmed in it's assembly language is https://wiki.xxiivv.com/site/uxn.html
uxn has the design closest to what I'm looking for, but I'll talk more about that next week
!til &virtual-machine I made a simple lc3 vm in order to test my VM making skills. Unfortunately, I can't get the thing to actually work due to console input nonsense. But, I've learnt what I needed to from it (mainly the general architecture of a VM and their implementations) and I've already spent around 4hours on it. Next up is looking at differing VM designs. I might even program another VM for fun.
!til &virtual-machine Two's complement is the leading way to represent signed numbers in binary, and it's pretty simple. For example, the number 1110 unsigned is 14, but when treated as a signed number with two's complement 1110 means -6. The way we determine that number is pretty interesting. I'll explain on the livestream insha'Allah.
!til &virtual-machine CISC computers lead to simpler assembly but RISC computers are easier to design and implement. For this jam, I'll keep looking into RISC architectures.