First Byte-Code Executed

I made the first (hand-written) byte-codes running inside my virtual-machine :-D.
Concurrency works pretty well, too :-)

Here are the two first test programs:

; Print(1 + 2*(3 - 4))
MOV i0, 3       ; i0 = 3
MOV i1, 4       ; i1 = 4
SUB i0, i1      ; i0 = i0 - i1
MOV i1, 2       ; i1 = 2
MUL i0, i1      ; i0 = i0 * i1
INC i0          ; i0++
CALL 0x03ffff20 ; SysCall for 'Print' (currently just for debugging)
STOP            ; Stop program execution
; int i  while i < 100 { Print(i++) }
MOV i1, 100     ; i1 = 100
XOR i0, i0      ; i0 = 0
CALL 0x03ffff20 ; SysCall for 'Print' (currently just for debugging)
INC i0          ; i0++
CMP i0, i1      ; Compare i0 with i1
JL 0x00000002   ; Jump-If-Less to address 2
STOP            ; Stop program execution

Leave a Reply