Added subtract and calling
This commit is contained in:
parent
1ade055e09
commit
c9aea0c4e6
3 changed files with 101 additions and 3 deletions
15
tests/call.asm
Normal file
15
tests/call.asm
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
include "fvm.inc"
|
||||
|
||||
org 0x4000000000000000
|
||||
start:
|
||||
MovI64 r95, UART_TX
|
||||
call function
|
||||
MovI64 r2, 0x69
|
||||
St8 r2, r95
|
||||
MovI64 r2, 0x0a
|
||||
St8 r2, r95
|
||||
Halt
|
||||
function:
|
||||
MovI64 r2, 0x48
|
||||
St8 r2, r95
|
||||
Ret
|
||||
|
|
@ -13,7 +13,8 @@ define r9 9
|
|||
define r10 10
|
||||
define r11 11
|
||||
define r12 12
|
||||
define r13 13 define r14 14
|
||||
define r13 13
|
||||
define r14 14
|
||||
define r15 15
|
||||
define r16 16
|
||||
define r17 17
|
||||
|
|
@ -217,6 +218,12 @@ macro MovI64 dst, val
|
|||
_dq_be val
|
||||
end macro
|
||||
|
||||
macro Mov64 dst, src
|
||||
db 0x94
|
||||
db dst
|
||||
db src
|
||||
end macro
|
||||
|
||||
macro Ld8 dst, addr
|
||||
db 0x93
|
||||
db dst
|
||||
|
|
@ -230,7 +237,13 @@ macro St8 dst, addr
|
|||
end macro
|
||||
|
||||
macro AddR64 dst, src
|
||||
db 0x60
|
||||
db 0x6E
|
||||
db dst
|
||||
db src
|
||||
end macro
|
||||
|
||||
macro SubR64 dst, src
|
||||
db 0x6F
|
||||
db dst
|
||||
db src
|
||||
end macro
|
||||
|
|
@ -278,6 +291,21 @@ macro JmpIZ addr
|
|||
JmpRIZ 127
|
||||
end macro
|
||||
|
||||
macro callR addr
|
||||
db 0x46
|
||||
db addr
|
||||
end macro
|
||||
|
||||
macro call val
|
||||
MovI64 127, val
|
||||
db 0x46
|
||||
db 127
|
||||
end macro
|
||||
|
||||
macro Ret
|
||||
db 2
|
||||
end macro
|
||||
|
||||
macro Halt
|
||||
db 0
|
||||
end macro
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue