- compiler works for basic maths expressions and functions
- basic pointers and reading values from pointers works - writing to pointers not yet implemented (looks painful so a problem for tomorrow) - updated print library. the compiler has this hardcoded in all programs for now
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
|
||||
// GENERATED BY DSC COMPILER
|
||||
// Generated at 2026-02-03 02:08:02
|
||||
|
||||
// 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...
|
||||
main:
|
||||
push bpr
|
||||
mov spr, bpr
|
||||
|
||||
lli 5, rg0
|
||||
db str_1: "Hello world"
|
||||
lwi str_1, rg1
|
||||
db str_2: "test"
|
||||
lwi str_2, rg2
|
||||
push rg0
|
||||
push rg1
|
||||
push rg2
|
||||
db str_3: "hello world 2 electric boogaloo"
|
||||
lwi str_3, rg3
|
||||
push rg3
|
||||
call print::println
|
||||
pop zero
|
||||
pop rg2
|
||||
pop rg1
|
||||
pop rg0
|
||||
push rg0
|
||||
push rg1
|
||||
push rg2
|
||||
lli 213, rg3
|
||||
push rg3
|
||||
call print::print_num
|
||||
pop zero
|
||||
pop rg2
|
||||
pop rg1
|
||||
pop rg0
|
||||
jmp _ret
|
||||
|
||||
Reference in New Issue
Block a user