fix
This commit is contained in:
parent
999883d2b6
commit
43b2030e2d
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
target/
|
||||
*.s
|
||||
*.o
|
|
@ -11,23 +11,22 @@ pub fn compile_x86_64_nasm(_asm_gen: &mut AsmGen, tokens: Vec<Token>, bw: &mut B
|
|||
writeln!(bw, "BITS 64")?;
|
||||
|
||||
writeln!(bw, "section .bss")?;
|
||||
writeln!(bw, " memory resb 30000")?;
|
||||
writeln!(bw, " memory_ptr resb 1")?;
|
||||
writeln!(bw, " memory: resb 30000")?;
|
||||
writeln!(bw, " mem_ptr: resq 1")?;
|
||||
|
||||
writeln!(bw, "section .data")?;
|
||||
writeln!(bw, " input db 0")?;
|
||||
// writeln!(bw, "section .data")?;
|
||||
// writeln!(bw, " input db 0")?;
|
||||
|
||||
writeln!(bw, "section .text")?;
|
||||
writeln!(bw, "_start:")?;
|
||||
|
||||
writeln!(bw, " mov rdi, memory")?;
|
||||
writeln!(bw, " mov [memory_ptr], rdi")?;
|
||||
|
||||
for t in tokens {
|
||||
match t.typ {
|
||||
|
||||
TokenType::Add => {
|
||||
writeln!(bw, " inc byte [rdi]")?;
|
||||
writeln!(bw, " mov rax, memory")?;
|
||||
writeln!(bw, " add rax, [mem_ptr]")?;
|
||||
writeln!(bw, " inc byte [rax]")?;
|
||||
}
|
||||
|
||||
ut => todo!("{ut:?}")
|
||||
|
|
Loading…
Reference in New Issue
Block a user