In this extremely exciting new project we will be coding our own Virtual Machine. That means creating our own virtual CPU with registers and our own simple Assembly language. We will also have virtual memory (a stack and a code segment) and possibly some IO in form of a virtual serial port or a floppy drive.
We will be coding everything from scratch and not make use of any external libraries/dependencies. Except my own. We will barely use the standard C library at all - if we need a function, we make it.
In this episode we will be focusing on moving values into the registers of our virtual CPU. We will also create a FLAGS register and a whole bunch of new instructions to manipulate those registers. The H flag for instance (higher flag) will, if set, move data into the AH (8 bits) instead of the AX which is 16 bit. We use the STH instruction to set the flag, and we clear it using CLH.
This is ep02 in the series.
References
Ep01 - Coding a Virtual machine in C
• Video
#programming #clanguage #advancedc #cprojects #virtualmachine #assemblylanguage #stack