diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-12-26 18:12:10 +0100 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-12-26 18:12:10 +0100 |
| commit | e8e9e921f30beb38de7edb0f2cb709584b586d9f (patch) | |
| tree | f4754cb3cbb52843604cc46843570f421e83dfc8 /bfc.S | |
| parent | 4ab02f56cd1009df3e85ac7db49a405f18b82f8a (diff) | |
add l_compile_move_left
Diffstat (limited to 'bfc.S')
| -rw-r--r-- | bfc.S | 59 |
1 files changed, 54 insertions, 5 deletions
@@ -69,12 +69,61 @@ l_read_loop: cmp $0, %rax je l_read_loop_end - mov $SYS_WRITE, %rax - mov $1, %rdi - mov $v_input_char, %rsi - mov $1, %rdx - syscall + mov $v_input_char, %rbx + mov (%rbx), %rax + cmp $'<', %rax + je l_compile_move_left + cmp $'>', %rax + je l_compile_move_right + cmp $'+', %rax + je l_compile_inc + cmp $'-', %rax + je l_compile_dec + cmp $'[', %rax + je l_compile_loop_start + cmp $']', %rax + je l_compile_loop_end + cmp $'.', %rax + je l_compile_write + cmp $',', %rax + je l_compile_read + jmp l_read_loop + +l_compile_move_left: + mov $v_buffer_cursor, %rbx + mov (%rbx), %rsi + add $3, %rsi + call f_check_buffer + + mov $v_buffer_cursor, %rbx + mov (%rbx), %rax + movl $0xc0ff48, (%rax) + add $3, %rax + mov %rax, (%rbx) + + jmp l_read_loop + +l_compile_move_right: + jmp l_read_loop + +l_compile_inc: + jmp l_read_loop + +l_compile_dec: + jmp l_read_loop + +l_compile_loop_start: jmp l_read_loop + +l_compile_loop_end: + jmp l_read_loop + +l_compile_write: + jmp l_read_loop + +l_compile_read: + jmp l_read_loop + l_read_loop_end: call f_close_files |