moved loc

This commit is contained in:
2026-02-13 21:42:59 +00:00
parent 75ad04cf95
commit d66baf6f99
5 changed files with 317 additions and 148 deletions
+107 -109
View File
@@ -1,121 +1,119 @@
// GENERATED BY DSC COMPILER // GENERATED BY DSC COMPILER
// Generated at 2026-02-05 00:42:40 // Generated at 2026-02-10 19:26:10
// Imports // Imports
include print: "./lib/io/print.dsa" include print: "./lib/io/print.dsa"
include arena: "./lib/memory/arena_alloc.dsa" include arena: "./lib/memory/arena_alloc.dsa"
//
// Globals & Reserved Memory // Globals & Reserved Memory
//
// Entry Point // Entry Point
dw stack: 0x10000 dw stack: 0x010000
db message: "Process Exited with code:" db message: "Process Exited with code:"
_init: _init:
ldw stack, bpr ldw stack, bpr 0
mov bpr, spr mov bpr, spr
push zero push zero
call main call main
call print::print_newline call print::print_newline
lwi message, rg0 lwi message, rg0
push rg0 push rg0
call print::print call print::print
pop zero pop zero
call print::print_hex_word call print::print_hex_word
pop zero pop zero
hlt hlt
// Return // Return
_ret: _ret:
mov bpr, spr mov bpr, spr
pop bpr pop bpr
return return
db str_1: "end"
// Compiled Code Starts... // fn main() -> u32
main: main:
push bpr push bpr
mov spr, bpr mov spr, bpr
lli 0, rg0
lli 0, rg0 push rg0
push rg0 // bpr-4: x addi spr, 0, rg1
subi bpr 4 rg1 lli 512, rg0
lli 512, rg0 push rg1
push rg1 // bpr-8: y // push arg 0
push rg0 // push arg 0 push rg0
call arena::new call arena::new
pop rg2 pop rg2
lli 32, rg0 lli 32, rg0
push rg2 // bpr-12: alloc push rg2
push rg0 // push arg 1 // push arg 1
push rg2 // push arg 0 push rg0
call arena::alloc // push arg 0
pop rg3 push rg2
pop zero call arena::alloc
lli 32, rg0 pop rg3
subi bpr 12 rg2 pop zero
ldw rg2, rg2 // bpr-20: alloc lli 32, rg0
push rg2 // bpr-16: alloc ldw spr, rg2 0
push rg3 // bpr-20: ptr1 stw rg2, spr 0
push rg0 // push arg 1 push rg3
push rg2 // push arg 0 // push arg 1
call arena::alloc push rg0
pop rg4 // push arg 0
pop zero push rg2
subi bpr 16 rg0 call arena::alloc
ldw rg0, rg0 // bpr-24: alloc pop rg4
push rg4 // bpr-24: ptr2 pop zero
push rg0 // bpr-28: alloc ldw spr, rg0 4
push rg0 // push arg 0 push rg4
call print::print_hex_word stw rg0, spr 8
pop zero // push arg 0
call print::print_newline push rg0
subi bpr 20 rg0 call print::print_hex_word
ldw rg0, rg0 // bpr-28: ptr1 pop zero
push rg0 // bpr-32: ptr1 call print::print_newline
push rg0 // push arg 0 ldw spr, rg0 4
call print::print_hex_word stw rg0, spr 4
pop zero // push arg 0
call print::print_newline push rg0
subi bpr 24 rg0 call print::print_hex_word
ldw rg0, rg0 // bpr-32: ptr2 pop zero
push rg0 // bpr-36: ptr2 call print::print_newline
push rg0 // push arg 0 ldw spr, rg0 0
call print::print_hex_word stw rg0, spr 0
pop zero // push arg 0
call print::print_newline push rg0
subi bpr 36 rg0 call print::print_hex_word
ldw rg0, rg0 // bpr-44: ptr2 pop zero
ldw rg0, rg2 call print::print_newline
push rg0 // bpr-40: ptr2 ldw spr, rg0 0
push rg2 // push arg 0 ldw rg0, rg2 0
call print::print_num stw rg0, spr 0
pop zero // push arg 0
call print::print_newline push rg2
lli 42, rg2 call print::print_num
subi bpr 40 rg5 pop zero
ldw rg5, rg5 // bpr-48: ptr2 call print::print_newline
stw rg2, rg5 lli 42, rg2
push rg5 // bpr-44: ptr2 ldw spr, rg5 0
push rg5 // push arg 0 stw rg2, rg5 0
call print::print_hex_word stw rg5, spr 0
pop zero // push arg 0
call print::print_newline push rg5
subi bpr 44 rg2 call print::print_hex_word
ldw rg2, rg2 // bpr-52: ptr2 pop zero
ldw rg2, rg5 call print::print_newline
push rg2 // bpr-48: ptr2 ldw spr, rg2 0
push rg5 // push arg 0 ldw rg2, rg5 0
call print::print_num stw rg2, spr 0
pop zero // push arg 0
call print::print_newline push rg5
db str_1: "end" call print::print_num
lwi str_1, rg5 pop zero
push rg5 // push arg 0 call print::print_newline
call print::println lwi str_1, rg5
pop zero // push arg 0
lli 0, rg5 push rg5
stw rg5, bpr, 8 call print::println
jmp _ret pop zero
lli 0, rg5
stw rg5, bpr 8
jmp _ret
+10
View File
@@ -32,3 +32,13 @@ handle_hard_fault:
call print::print call print::print
pop zero pop zero
hlt hlt
trigger:
push bpr
mov spr, bpr
int 0x01
mov bpr, spr
pop bpr
return
+130 -39
View File
@@ -1,50 +1,141 @@
// GENERATED BY DSC COMPILER // GENERATED BY DSC COMPILER
// Generated at 2026-02-04 01:44:06 // Generated at 2026-02-10 19:36:18
// Imports // Imports
include alloc: "./lib/memory/block_alloc.dsa"
include print: "./lib/io/print.dsa" include print: "./lib/io/print.dsa"
include fib: "./lib/maths/fib.dsa" //
// Globals & Reserved Memory // Globals & Reserved Memory
//
// Entry Point // Entry Point
dw stack: 0x10000 dw stack: 0x010000
db message: "Process Exited with code:" db message: "Process Exited with code:"
_init: _init:
ldw stack, bpr ldw stack, bpr 0
mov bpr, spr mov bpr, spr
push zero push zero
call main call main
call print::print_newline call print::print_newline
lwi message, rg0 lwi message, rg0
push rg0 push rg0
call print::print call print::print
pop zero pop zero
call print::print_hex_word call print::print_hex_word
pop zero pop zero
hlt hlt
// Return // Return
_ret: _ret:
mov bpr, spr mov bpr, spr
pop bpr pop bpr
return return
db str_5: "successful free of ptr"
// Compiled Code Starts... // fn main() -> u32
main: main:
push bpr push bpr
mov spr, bpr mov spr, bpr
lli 32, rg0
lli 6, rg0 lli 64, rg1
push rg0 // bpr-4: x // push arg 1
push rg0 // push arg 0 push rg0
call fib::fib_n // push arg 0
pop rg1 push rg1
push rg1 // bpr-8: y call alloc::init
push rg1 // push arg 0 pop rg2
call print::print_num pop zero
pop zero push rg2
jmp _ret // 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
+50
View File
@@ -0,0 +1,50 @@
// 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
+20
View File
@@ -0,0 +1,20 @@
include print: "./lib/io/print.dsa";
fn main() -> u32 {
let x: u32 = 30;
print::print_num(x);
200 + 5;
let p: Point = Point {
x: 10,
y: 20,
test: [2, 3, 4]
};
}
struct Point {
x: u32,
y: u32,
test: [u32; 3],
}