added memory manipulation and syscalls

This commit is contained in:
2024-07-27 16:42:24 +03:00
parent 2d94db0990
commit d1481f2770
2 changed files with 36 additions and 9 deletions

View File

@@ -116,6 +116,30 @@
"cmovg rcx, rdx"
"push rcx")
(defop bel ()
"push bel")
(defop oku ()
"pop rax"
"xor rbx, rbx"
"mov bl, [rax]"
"push rbx")
(defop yaz ()
"pop rbx"
"pop rax"
"mov [rax], bl")
(defop (syscall num) ()
(iter (with call-regs = #("rdi" "rsi" "rdx" "r10" "r8" "r9"))
(initially (:write "pop rax"))
(for i from (- num 1) downto 0)
(:write ("pop ~a" (aref call-regs i)))
(finally (:write "syscall"))))
(defun gen-header (op str)
(format str " ;; -- ~s --~%" op))
(defun gen-code (op str)
(let ((op-fn (gethash (car op) *operations*)))
(if (null op-fn)