fixed my dumbassary

This commit is contained in:
2025-06-21 20:45:30 +03:00
parent d59a5c8b39
commit 15311ca7d1
7 changed files with 7 additions and 10 deletions

View File

@@ -18,14 +18,13 @@ clear_heap_block_loop:
mov byte ptr [rdi+rcx], 0 mov byte ptr [rdi+rcx], 0
inc rcx inc rcx
cmp rcx, rsi cmp rcx, rsi
jle clear_heap_block_loop jl clear_heap_block_loop
ret ret
# rdi = size in octets # rdi = size in octets
brk_alloc: brk_alloc:
push rbx push rbx
push r12 push r12
inc rdi # so you get all of the requested space
mov rbx, rdi mov rbx, rdi
mov rax, 12 mov rax, 12

9
main.s
View File

@@ -176,31 +176,24 @@ process_inpt:
# In stack it is # In stack it is
# A = Address to loop back # A = Address to loop back
# C = Cell to check
# AC AC AC AC AC AC AC <- pop here
process_loop_start: process_loop_start:
pop rdi pop rdi
push r11 # Address to loopback push r11 # Address to loopback
push r15 # Cell to check
push rdi push rdi
ret ret
process_loop_end: process_loop_end:
# Gotta get ret value # Gotta get ret value
pop rsi pop rsi
pop rdi # Cell
pop rax # Address pop rax # Address
# if cell is 0 we are done with loop # if cell is 0 we are done with loop
cmp byte ptr [r14+rdi], 0 cmp byte ptr [r14+r15], 0
je 1f je 1f
mov r11, rax mov r11, rax
# Make sure stack isn't caught on fire # Make sure stack isn't caught on fire
push rax push rax
push rdi
push rsi
ret
1: 1:
push rsi push rsi
ret # Discard ret # Discard

2
tests/test1.bf Normal file
View File

@@ -0,0 +1,2 @@
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.

1
tests/test3.bf Normal file
View File

@@ -0,0 +1 @@
++++[>++++[>++++<-]<-]>>++.[<<+>>-]<<.

1
tests/test4.bf Normal file
View File

@@ -0,0 +1 @@
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.

1
welcome.bf Normal file
View File

@@ -0,0 +1 @@
+++++++++[>++++++++>+++++++++++>++++>++++++++++>+++++++++++>++++>+++++++++++<<<<<<<-]>.>++.+++++++..+++.>---.-.>---.>++.<<<---.>>>--.<<<+++.--.>>>++.<<.<+++++++.-----.>.>>--.--.<<<+++++.>>>>+++.<<<<-.>.>>+.<<<-.>>>-.++++++++.+++++.>>+++.<<<<<+++.>>>>>---.<<---.<<.>>--.+++++.<<<-.>>>>>++.<<++++.--.++.>>.<<++.>>.<<--.>+++++.<<<.<+++.>>>.>>++++.<<++..>>----.<<------.<<.>>-----.+++++.<<.<<-------.>>>----.------.<+.>>>>>++++++++++.