- fixed some clippy lints

- updated comments in compiler codegen
- deleted old dsa compiler outputs
- settings for zed
This commit is contained in:
2026-02-14 11:05:15 +00:00
parent 201b18069b
commit 7ccbd9258f
16 changed files with 138 additions and 641 deletions
-119
View File
@@ -1,119 +0,0 @@
// GENERATED BY DSC COMPILER
// Generated at 2026-02-14 02:44:56
// Imports
include arena: "./lib/memory/arena_alloc.dsa"
include print: "./lib/io/print.dsa"
//
// Globals & Reserved Memory
//
// Entry Point
dw stack: 0x010000
db message: "Process Exited with code:"
_init:
ldw stack, bpr, 0
mov bpr, spr
push zero
call main
call print::print_newline
lwi message, rg0
push rg0
call print::print
pop zero
call print::print_hex_word
pop zero
hlt
// Return
_ret:
mov bpr, spr
pop bpr
return
db str_1: "end"
// fn main() -> u32
main:
push bpr
mov spr, bpr
lli 0, rg0
push rg0
addi spr, 0, rg1
lli 512, rg0
push rg1
// push arg 0
push rg0
call arena::new
pop rg2
lli 32, rg0
push rg2
// push arg 1
push rg0
// push arg 0
push rg2
call arena::alloc
pop rg3
pop zero
lli 32, rg0
ldw spr, rg2, 0
push rg3
stw rg2, spr, 4
// push arg 1
push rg0
// push arg 0
push rg2
call arena::alloc
pop rg4
pop zero
ldw spr, rg0, 4
stw rg0, spr, 4
push rg4
// push arg 0
push rg0
call print::print_hex_word
pop zero
call print::print_newline
ldw spr, rg0, 4
stw rg0, spr, 4
// push arg 0
push rg0
call print::print_hex_word
pop zero
call print::print_newline
ldw spr, rg0, 0
stw rg0, spr, 0
// push arg 0
push rg0
call print::print_hex_word
pop zero
call print::print_newline
ldw spr, rg0, 0
ldw rg0, rg2, 0
stw rg0, spr, 0
// push arg 0
push rg2
call print::print_num
pop zero
call print::print_newline
lli 42, rg2
ldw spr, rg5, 0
stw rg2, rg5, 0
stw rg5, spr, 0
// push arg 0
push rg5
call print::print_hex_word
pop zero
call print::print_newline
ldw spr, rg2, 0
ldw rg2, rg5, 0
stw rg2, spr, 0
// push arg 0
push rg5
call print::print_num
pop zero
call print::print_newline
lwi str_1, rg5
// push arg 0
push rg5
call print::println
pop zero
lli 0, rg5
stw rg5, bpr, 8
jmp _ret
-141
View File
@@ -1,141 +0,0 @@
// GENERATED BY DSC COMPILER
// Generated at 2026-02-10 19:36:18
// Imports
include alloc: "./lib/memory/block_alloc.dsa"
include print: "./lib/io/print.dsa"
//
// Globals & Reserved Memory
//
// Entry Point
dw stack: 0x010000
db message: "Process Exited with code:"
_init:
ldw stack, bpr 0
mov bpr, spr
push zero
call main
call print::print_newline
lwi message, rg0
push rg0
call print::print
pop zero
call print::print_hex_word
pop zero
hlt
// Return
_ret:
mov bpr, spr
pop bpr
return
db str_5: "successful free of ptr"
// fn main() -> u32
main:
push bpr
mov spr, bpr
lli 32, rg0
lli 64, rg1
// push arg 1
push rg0
// push arg 0
push rg1
call alloc::init
pop rg2
pop zero
push rg2
// push arg 0
push rg2
call print::print_hex_word
pop zero
call print::print_newline
ldw spr, rg0 0
stw rg0, spr 0
// push arg 0
push rg0
call alloc::alloc
pop rg1
push rg1
// push arg 0
push rg1
call print::print_hex_word
pop zero
lli 200, rg0
ldw spr, rg1 0
stw rg0, rg1 0
stw rg1, spr 0
call print::print_newline
ldw spr, rg0 4
stw rg0, spr 4
// push arg 0
push rg0
call alloc::alloc
pop rg2
push rg2
// push arg 0
push rg2
call print::print_hex_word
pop zero
call print::print_newline
ldw spr, rg0 4
ldw rg0, rg2 0
stw rg0, spr 4
// push arg 0
push rg2
call print::print_num
pop zero
ldw spr, rg2 4
stw rg2, spr 4
addi spr, 4, rg3
ldw spr, rg2 8
stw rg2, spr 8
// push arg 1
push rg3
// push arg 0
push rg2
call alloc::free
pop zero
pop zero
ldw spr, rg2 8
stw rg2, spr 8
// push arg 0
push rg2
call alloc::alloc
pop rg3
push rg3
call print::print_newline
ldw spr, rg2 0
stw rg2, spr 0
// push arg 0
push rg2
call print::print_hex_word
pop zero
call print::print_newline
ldw spr, rg2 8
stw rg2, spr 8
// push arg 0
push rg2
call print::print_hex_word
pop zero
ldw spr, rg2 8
lli 0, rg4
cmp rg2, rg4
lli 1, rg5
jeq _cmp_end_1
lli 0, rg5
_cmp_end_1:
cmp rg5, zero
jeq _else_3
_then_2:
lwi str_5, rg4
stw rg2, spr 8
// push arg 0
push rg4
call print::print
pop zero
jmp _end_4
_else_3:
nop
_end_4:
lli 0, rg4
stw rg4, bpr 8
jmp _ret
-214
View File
@@ -1,214 +0,0 @@
// GENERATED BY DSC COMPILER
// Generated at 2026-02-03 23:37:16
// Imports
include print: "./lib/io/print.dsa"
// Globals & Reserved Memory
dw heap_start: 196608
dw heap_end: 262144
dw heap_current: 196608
// Entry Point
dw stack: 0x10000
db message: "Process Exited with code:"
_init:
ldw stack, bpr
mov bpr, spr
push zero
call main
call print::print_newline
lwi message, rg0
push rg0
call print::print
pop zero
call print::print_hex_word
pop zero
hlt
// Return
_ret:
mov bpr, spr
pop bpr
return
// Compiled Code Starts...
main:
push bpr
mov spr, bpr
lli 0, rg0
push rg0 // bpr-4: x
subi bpr 4 rg1
lli 512, rg0
push rg1 // bpr-8: y
push rg0 // push arg 0
call arena_create
pop rg2
lli 32, rg0
push rg2 // bpr-12: alloc
push rg0 // push arg 1
push rg2 // push arg 0
call arena_alloc
pop rg3
pop zero
lli 32, rg0
subi bpr 12 rg2
ldw rg2, rg2 // bpr-20: alloc
push rg3 // bpr-16: ptr1
push rg2 // bpr-20: alloc
push rg0 // push arg 1
push rg2 // push arg 0
call arena_alloc
pop rg4
pop zero
subi bpr 20 rg0
ldw rg0, rg0 // bpr-28: alloc
push rg4 // bpr-24: ptr2
push rg0 // bpr-28: alloc
push rg0 // push arg 0
call print::print_hex_word
pop zero
call print::print_newline
subi bpr 16 rg0
ldw rg0, rg0 // bpr-24: ptr1
push rg0 // bpr-32: ptr1
push rg0 // push arg 0
call print::print_hex_word
pop zero
call print::print_newline
subi bpr 24 rg0
ldw rg0, rg0 // bpr-32: ptr2
push rg0 // bpr-36: ptr2
push rg0 // push arg 0
call print::print_hex_word
pop zero
call print::print_newline
subi bpr 36 rg0
ldw rg0, rg0 // bpr-44: ptr2
ldw rg0, rg2
push rg0 // bpr-40: ptr2
push rg2 // push arg 0
call print::print_num
pop zero
call print::print_newline
lli 42, rg2
subi bpr 40 rg5
ldw rg5, rg5 // bpr-48: ptr2
stw rg2, rg5
push rg5 // bpr-44: ptr2
push rg5 // push arg 0
call print::print_hex_word
pop zero
call print::print_newline
subi bpr 44 rg2
ldw rg2, rg2 // bpr-52: ptr2
ldw rg2, rg5
push rg2 // bpr-48: ptr2
push rg5 // push arg 0
call print::print_num
pop zero
call print::print_newline
db str_1: "end"
lwi str_1, rg5
push rg5 // push arg 0
call print::println
pop zero
lli 0, rg5
stw rg5, bpr, 8
jmp _ret
arena_create:
push bpr
mov spr, bpr
ldw bpr, rg0, 8
lli 12, rg1
add rg0, rg1, rg2
ldw heap_current, rg1
add rg1, rg2, rg3
ldw heap_end, rg4
cmp rg3, rg4
lli 0, rg5
jle _cmp_end_2
lli 1, rg5
_cmp_end_2:
cmp rg5, zero
jeq _else_4
_then_3:
lli 0, rg4
stw rg4, bpr, 8
jmp _ret
jmp _end_5
_else_4:
nop
_end_5:
lli 12, rg4
add rg1, rg4, rg5
add rg1, rg2, rg4
stw rg5, rg1
lli 4, rg6
add rg1, rg6, rg7
stw rg5, rg7
lli 8, rg6
add rg1, rg6, rg7
stw rg4, rg7
stw rg3, heap_current
stw rg1, bpr, 8
jmp _ret
arena_alloc:
push bpr
mov spr, bpr
ldw bpr, rg0, 8
ldw bpr, rg1, 12
lli 4, rg2
add rg0, rg2, rg3
ldw rg3, rg2
lli 8, rg3
add rg0, rg3, rg4
ldw rg4, rg3
add rg2, rg1, rg4
cmp rg4, rg3
lli 0, rg5
jle _cmp_end_6
lli 1, rg5
_cmp_end_6:
cmp rg5, zero
jeq _else_8
_then_7:
lli 0, rg5
stw rg5, bpr, 8
jmp _ret
jmp _end_9
_else_8:
nop
_end_9:
lli 4, rg5
add rg0, rg5, rg6
stw rg4, rg6
stw rg2, bpr, 8
jmp _ret
arena_destroy:
push bpr
mov spr, bpr
ldw bpr, rg0, 8
lli 0, rg1
stw rg1, bpr, 8
jmp _ret
reset_all:
push bpr
mov spr, bpr
ldw heap_start, rg0
stw rg0, heap_current
lli 0, rg0
stw rg0, bpr, 8
jmp _ret
-50
View File
@@ -1,50 +0,0 @@
// GENERATED BY DSC COMPILER
// Generated at 2026-02-10 01:04:01
// Imports
include print: "./lib/io/print.dsa"
// Globals & Reserved Memory
// Entry Point
dw stack: 0x10000
db message: "Process Exited with code:"
_init:
ldw stack, bpr
mov bpr, spr
push zero
call main
call print::print_newline
lwi message, rg0
push rg0
call print::print
pop zero
call print::print_hex_word
pop zero
hlt
// Return
_ret:
mov bpr, spr
pop bpr
return
// Compiled Code Starts...
// fn main() -> u32
main:
push bpr
mov spr, bpr
lli 30, rg0
push rg0 // free var:x offset:-8
push rg0 // push arg 0
call print::print_num
pop zero
lli 200, rg0
lli 5, rg1
add rg0, rg1, rg2
jmp _ret
+2 -2
View File
@@ -1,4 +1,4 @@
include print "./lib/io/print.dsa"
include print: "./lib/io/print.dsa"
dw idt: 0xFFFF0000
dw stack: 0x10000
@@ -57,7 +57,7 @@ start:
// test reset cursor pos
call print::reset
// test print string at reset pos
lwi replace, rg0
push rg0