64 Bit Assembly Intel compiler
-
I work on a assembly compiler on fuze !
Asm Intel 64 bitFirst images:
Like the assembler, I reproduced the 64 bit registers !
-
Nice to see more people interested in this field. Nice work!
-
@LucasJG25 Thanks you ! I work ! i work !
-
Update:
Added JMP = Jump on a instruction
Added CMP command to conditional event for jump
With :JE, JA, JB, JBE, JG, JLE, JNE
Added INC = increment
Added ADD to add
Added SUB to substractAdded PUSH and POP
Added new kernel command
Basically I'll finish it today or tomorrow
-
Are you interpreting the assembly as is or translating it to bytecode?
-
I interpret the assembler. I simulate the registers in an array and we can write the code in a string the character string is processed by conditions which look at the commands type and do what the instruction does
-
Ah ok. Sounds like a good plan. Looking forward to trying it out!
-
ASSEMBLY INTERPRETOR
Share Code : NDFYADND9PExemple
Want to make a simple hello world ?
First make variables with the hello world message
with this syntax :variable: db ValueOrText
db for store simple element text or value
So in first we must write this :
message: db Hello World!
Now for draw this message on the screen we need system function
controled by registers.Registers are useful for storing data temporarily and are used for function parameters
We can modify their value with MOVarg1 arg2
=arg1 = arg2
The Print Function:
mov rax 1 ; 1 = print mov rdi 1 ; 1 = stdout mov rsi message ; a variable with the string or the value mov rdx lenMsg ; lenght of the message
For the lenght of the message it's easy :
msgLen: len message
and now you can write a SYSCALL for execute the function
message: db Hello World! msgLen: len message mov rax 1 mov rdi 1 mov rsi message mov rdx lenMsg syscall
Documentation
Basic textual function:
Print :
mov rax 1 ; 1 = print
mov rdi 1 ; 1 = stdout
mov rsi message ; a variable with the string or the value
mov rdx lenMsg ; lenght of the messageGetUserInput :
mov rax 1 ; 1 = print with STDIN print in rsi
mov rdi 2 ; 1 = stdinThe input is in rsi register
ClearScreen :
mov rax 2 ; clear the screen
ClearScreenEx :
mov rax 3 ; clear the screen with color
mov rdi R ; Red
mov rsi G ; Green
mov rdx B ; BlueInk :
mov rax 4 ; change the text color
mov rdi R ; Red
mov rsi G ; Green
mov rdx B ; BlueInformation Treatment Function
getTextLen:
mov rax 10 ; Get the lenght of a String
mov rdx text :The text to get the lenghtRecovered the text lenght in rsi.
getButtonPressed:
mov rax 11
Recovered in rdi.0 = A
1 = B
2 = Y
3 = X
4 = LEFT
5 = RIGHT
6 = UP
7 = DOWN
8 = L
9 = R
10 = zl
11 = zrMath Function
RANDOM:
mov rax 20 ; generate random number
mov rdi number ; Maximal value of the random numberRecovered in rsi.
FLOOR:
mov rax 21 ; floor
mov rsi Value ; Number to floorRecovered in rdi
Graphics Function
drawText:
mov rax 40 ; drawText
mov rdi X ; X position
mov rsi Y ; Y position
mov rdx SIZE ; size of the text
mov r8 R ; Red Color
mov r9 G ; Green Color
mov r10 B ; Blue Color
mov r11 message ; text to display
mov r12 lenText ; lenght of the textdrawBox:
mov rax 41 ; drawBox
mov rdi X ; X position
mov rsi Y ; Y position
mov r8 width ; width
mov r9 height ; height
mov r10 R ;
mov r11 G ; --Color
mov r12 B ;/
mov r13 mode ; 0 fill 1 not filldrawCircle:
mov rax 42 ; drawCircle
mov rdi X ; X position
mov rsi Y ; Y position
mov r8 radius ; radius
mov r9 numPoint ; numpoint
mov r10 R ;
mov r11 G ; --Color
mov r12 B ;/
mov r13 mode ; 0 fill 1 not filldrawLine:
mov rax 42 ; drawLine
mov rdi X ; X position
mov rsi Y ; Y position
mov r8 x2
mov r9 y2
mov r10 R ;
mov r11 G ; --Color
mov r12 B ;/EXIT SUCCESS FUNCTION
mov rax 60 ;exit success
-
And too there is all assembleur command :
mov arg1 arg2 add arg1 arg2 sub arg1 arg2 inc arg1 jmp arg1 cmp arg1 arg2 etc