diff --git a/helper.s b/helper.s index 84ebb93..f8a9933 100644 --- a/helper.s +++ b/helper.s @@ -18,14 +18,13 @@ clear_heap_block_loop: mov byte ptr [rdi+rcx], 0 inc rcx cmp rcx, rsi - jle clear_heap_block_loop + jl clear_heap_block_loop ret # rdi = size in octets brk_alloc: push rbx push r12 - inc rdi # so you get all of the requested space mov rbx, rdi mov rax, 12 diff --git a/main.s b/main.s index e425782..43ee130 100644 --- a/main.s +++ b/main.s @@ -176,31 +176,24 @@ process_inpt: # In stack it is # A = Address to loop back -# C = Cell to check -# AC AC AC AC AC AC AC <- pop here process_loop_start: pop rdi push r11 # Address to loopback - push r15 # Cell to check push rdi ret process_loop_end: # Gotta get ret value pop rsi - pop rdi # Cell pop rax # Address # if cell is 0 we are done with loop - cmp byte ptr [r14+rdi], 0 + cmp byte ptr [r14+r15], 0 je 1f mov r11, rax # Make sure stack isn't caught on fire push rax - push rdi - push rsi - ret 1: push rsi ret # Discard diff --git a/tests/test1.bf b/tests/test1.bf new file mode 100644 index 0000000..067b2de --- /dev/null +++ b/tests/test1.bf @@ -0,0 +1,2 @@ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++. diff --git a/test.bf b/tests/test2.bf similarity index 100% rename from test.bf rename to tests/test2.bf diff --git a/tests/test3.bf b/tests/test3.bf new file mode 100644 index 0000000..521b257 --- /dev/null +++ b/tests/test3.bf @@ -0,0 +1 @@ +++++[>++++[>++++<-]<-]>>++.[<<+>>-]<<. diff --git a/tests/test4.bf b/tests/test4.bf new file mode 100644 index 0000000..8fa0f72 --- /dev/null +++ b/tests/test4.bf @@ -0,0 +1 @@ +++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++. diff --git a/welcome.bf b/welcome.bf new file mode 100644 index 0000000..ecbf2c1 --- /dev/null +++ b/welcome.bf @@ -0,0 +1 @@ ++++++++++[>++++++++>+++++++++++>++++>++++++++++>+++++++++++>++++>+++++++++++<<<<<<<-]>.>++.+++++++..+++.>---.-.>---.>++.<<<---.>>>--.<<<+++.--.>>>++.<<.<+++++++.-----.>.>>--.--.<<<+++++.>>>>+++.<<<<-.>.>>+.<<<-.>>>-.++++++++.+++++.>>+++.<<<<<+++.>>>>>---.<<---.<<.>>--.+++++.<<<-.>>>>>++.<<++++.--.++.>>.<<++.>>.<<--.>+++++.<<<.<+++.>>>.>>++++.<<++..>>----.<<------.<<.>>-----.+++++.<<.<<-------.>>>----.------.<+.>>>>>++++++++++.