When the vm starts, it starts executing code at 0x00000000
0xF00000000x0003E800VGA buffer
0xF10000000x000007D0Text video buffer
0xF20000000x00000010video card control registers
0xF30000000x00000002keyboard control registers


A total of 16 32bit registers including 14 general purpose registers (r0-r13), a stack pointer (r14) and an instruction pointer (r15). There is also a Flags register that is not directly accessible. The format of the Flags register is:
Z (zero)c (carry)i (ints enabled)e (exception)

No floating points nor signed integers. Only the "CMP" instruction modifies Z and C flags The assembler recognizes the format: {label:} mnemonic{.condition} {operand1}{,operand2}. Each instruction is (very inneficiently) encoded on 64bit:

8-12operand1 register if applicable
13-17operand2 register if applicable
32-6432bit int for op1 or op2 if applicable

Conditional execution

Every instruction have the ability to be conditionally executed with the following suffixes


Instructions set



1Undefined instruction
2Invalid operands
3Divide by zero
4Illegal memory access


At the end of an instruction, and after r15 has been updated, the CPU checks if a device has any pending IRQ if and only if the "i" flag is set. if an IRQ is pending, the CPU will check if a handler was registered for that IRQ with the "ireg" instruction. If a handler is found, the following occurs:

A handler should return using the "iret" instruction. The iret instruction restore the general register bank and pop the flags out of the stack


to switch video mode, write a 8bit value to 0xF2000000. A value of 0 will switch to vga mode 320x200 (the default) and a value of 1 will switch to 80x25 text mode.


The keyboard will trigger an IRQ #1 when a key is pressed. So a consumer must register a handler with the "ireg" instruction to receive those interrupts and the "i" flag must be set using the "sti" instruction. Once the consumer is ready to process the event, the key can be read from address 1 of the keyboard control memory. After a key is read from the buffer, the buffer will be updated with the new key if any. Failure to at address 1 will make the keyboard driver continue to raise IRQ 1 continuously.