Files
damn_simple_architecture/resources/dsa/main.dsa
T
zxq5 3afeafc9d4 - 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
2026-02-03 02:11:30 +00:00

45 lines
722 B
Plaintext

include fib: "./lib/maths/fib.dsa"
include maths: "./lib/maths/core.dsa"
include print: "./lib/io/print.dsa"
dw idt: 0xFFFF0000
dw stack: 0x10000
init:
// setup interrupt handlers
ldw idt, idr
lwi handle_hard_fault, rg0
stw rg0, idr, 4
// set up a stack.
ldw stack, bpr
mov bpr, spr
dw string: "hello world"
start:
lwi 100, rg0
lwi 10, rg1
push rg1
push rg0
call maths::new_divide
pop rg0
pop rg1
hlt
pop rg0
pop zero
push rg0
call print::print_num
pop zero
hlt
// fault handler in case we fail DSA.
dw hard_fault_err: "FATAL: Illegal Instruction or Memory Access!"
handle_hard_fault:
call print::clear
call print::reset
lwi hard_fault_err, rg0
push rg0
call print::print
pop zero
hlt