working program in 02 lang!!
This commit is contained in:
parent
e3ccf5d976
commit
66496d98c4
2 changed files with 12 additions and 11 deletions
19
02/in01
19
02/in01
|
@ -140,7 +140,7 @@ unused padding
|
||||||
|
|
||||||
it's not a label definition. let's check if it's a number
|
it's not a label definition. let's check if it's a number
|
||||||
;im;18;8d;00;00;00;00;00;00 '#' << 10 | '#' << 3
|
;im;18;8d;00;00;00;00;00;00 '#' << 10 | '#' << 3
|
||||||
;cm;jn;cd;cd;cd;cd
|
;cm;jn;c2;01;00;00
|
||||||
|
|
||||||
it's a hex number
|
it's a hex number
|
||||||
let's read it one byte at a time, storing the full number in RBP
|
let's read it one byte at a time, storing the full number in RBP
|
||||||
|
@ -222,9 +222,9 @@ unused padding
|
||||||
;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00
|
;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00
|
||||||
;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00
|
;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00
|
||||||
|
|
||||||
it's not an immediate. let's check if it's a label
|
it's not a number let's check if it's a label
|
||||||
;im;68;b5;00;00;00;00;00;00 '-' << 10 | '-' << 3
|
;im;68;b5;00;00;00;00;00;00 '-' << 10 | '-' << 3
|
||||||
;cm;jn;cd;cd;cd;cd
|
;cm;jn;dd;00;00;00
|
||||||
|
|
||||||
absolute label
|
absolute label
|
||||||
read the label name.
|
read the label name.
|
||||||
|
@ -273,7 +273,7 @@ unused padding
|
||||||
;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00
|
;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00
|
||||||
|
|
||||||
;im;68;e9;00;00;00;00;00;00 ':' << 10 | '-' << 3
|
;im;68;e9;00;00;00;00;00;00 ':' << 10 | '-' << 3
|
||||||
;cm;jn;cd;cd;cd;cd
|
;cm;jn;c8;01;00;00
|
||||||
|
|
||||||
relative label
|
relative label
|
||||||
|
|
||||||
|
@ -320,17 +320,18 @@ look in the label table
|
||||||
;im;00;00;42;00;00;00;00;00
|
;im;00;00;42;00;00;00;00;00
|
||||||
;+B
|
;+B
|
||||||
;BA
|
;BA
|
||||||
;lq
|
;ld
|
||||||
;BA
|
;BA
|
||||||
subtract current address
|
subtract current address
|
||||||
;AR
|
;AR
|
||||||
;nA;+B
|
;nA;+B
|
||||||
|
;RA store relative address in rbp
|
||||||
|
|
||||||
now we want to write eax to the output file.
|
now we want to write eax to the output file.
|
||||||
start by putting it at address 0x4000a8
|
start by putting it at address 0x4000a8
|
||||||
;im;a8;00;40;00;00;00;00;00
|
;im;a8;00;40;00;00;00;00;00
|
||||||
;BA
|
;BA
|
||||||
;AR
|
;AR put relative address in rax
|
||||||
;sd
|
;sd
|
||||||
|
|
||||||
now write
|
now write
|
||||||
|
@ -343,10 +344,10 @@ now write
|
||||||
;im;01;00;00;00;00;00;00;00 write
|
;im;01;00;00;00;00;00;00;00 write
|
||||||
;sy
|
;sy
|
||||||
|
|
||||||
;jm;cd;cd;cd;cd skip to newline
|
;jm;66;01;00;00 skip to newline
|
||||||
|
|
||||||
unused padding
|
unused padding
|
||||||
;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00
|
;00;00;00;00;00;00;00;00;00;00;00;00;00;00
|
||||||
;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00
|
;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00
|
||||||
;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00
|
;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00
|
||||||
;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00
|
;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00
|
||||||
|
@ -370,7 +371,7 @@ it's not a label or a number. let's look it up in the instruction table.
|
||||||
;DA number of bytes to write (used for syscall if no error)
|
;DA number of bytes to write (used for syscall if no error)
|
||||||
;BA
|
;BA
|
||||||
;zA
|
;zA
|
||||||
;cm;jn;cd;cd;cd;cd check if # of bytes is 0, if not, skip outputting error
|
;cm;jn;54;00;00;00 check if # of bytes is 0, if not, skip outputting error
|
||||||
|
|
||||||
bad command!
|
bad command!
|
||||||
;im;02;00;00;00;00;00;00;00 stderr
|
;im;02;00;00;00;00;00;00;00 stderr
|
||||||
|
|
4
02/in02
4
02/in02
|
@ -1,3 +1,3 @@
|
||||||
::hw
|
::hw
|
||||||
##37cab123abcdef12.
|
jm
|
||||||
|
:-hw
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue