aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRatakor <ratakor@disroot.org>2023-11-02 14:30:02 +0100
committerRatakor <ratakor@disroot.org>2023-11-02 14:30:02 +0100
commitd713d0fa9d6a3d6241cdcfec9149b8abaf9c5c2a (patch)
tree516d12a7ae8baad9ebdbc8971e78ed82f372adba
parent3d16629a0533b2a78f6e0692c51c5425153ea342 (diff)
Fix bf.s for LostKingdomHEADmaster
-rw-r--r--src/bf.s6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/bf.s b/src/bf.s
index 2d904e6..b989afa 100644
--- a/src/bf.s
+++ b/src/bf.s
@@ -14,7 +14,8 @@ default rel
%define SYS_exit 0x3c
section .rodata
- max_codesize equ 32768 ; must be an integral multiple of the page size
+ ; max_codesize must be an integral multiple of the page size
+ max_codesize equ 528 * 4096
error_input_str db "usage: bf file.b", 0x0a
error_input_str_len equ $ - error_input_str
error_open_failed db "bf: failed to open file", 0x0a
@@ -57,7 +58,7 @@ _start:
mov rdx, 0x1 ; prot = PROT_READ
mov rsi, max_codesize ; length
xor rdi, rdi ; addr = 0
- mov rax, SYS_mmap ; no munmap because rbp is used until exit
+ mov rax, SYS_mmap ; no munmap because the file is used until exit
syscall
mov rbp, rax ; rbp = instructions
@@ -69,6 +70,7 @@ _start:
.main_loop:
; switch [instruction]
+ ; TODO: use a jump table instead
.case1:
cmp bl, '>'