new ui, control panel kinda works, display works, framebuffer works, serial write works. widget for registers works. next is serial input and the editor
This commit is contained in:
+47
-2
@@ -3,7 +3,7 @@
|
||||
|
||||
include print "./print.dsa"
|
||||
|
||||
// "print hello world"
|
||||
// "prints first 16 fibonacci numbers"
|
||||
db program: "++++++++++++++++++++++++++++++++++++++++++++
|
||||
>++++++++++++++++++++++++++++++++
|
||||
>++++++++++++++++
|
||||
@@ -35,6 +35,7 @@ db program: "++++++++++++++++++++++++++++++++++++++++++++
|
||||
<<++..."
|
||||
|
||||
db error: "Invalid Instruction!"
|
||||
dh counter: 0xFF
|
||||
dw stack: 0x10000
|
||||
dw input: 0x30000
|
||||
resb data: 1024
|
||||
@@ -44,11 +45,15 @@ _init_stack:
|
||||
ldw stack, bpr
|
||||
mov bpr, spr
|
||||
|
||||
init:
|
||||
ldw counter, rg7
|
||||
|
||||
start:
|
||||
call bf_reset
|
||||
|
||||
// load the start of the program into rg0
|
||||
lwi program, rg0
|
||||
lwi data, rg1
|
||||
|
||||
// rg0 is our instruction pointer
|
||||
// rg1 is our data pointer
|
||||
// rg2 is the value at the data pointer
|
||||
@@ -98,7 +103,16 @@ loop_start:
|
||||
pop rg1
|
||||
pop rg0
|
||||
|
||||
db success: "Success!"
|
||||
end:
|
||||
call print::newline
|
||||
lwi success, rg0
|
||||
push rg0
|
||||
call print::print
|
||||
pop zero
|
||||
|
||||
subi rg7, 1
|
||||
jnz rg7, start
|
||||
hlt
|
||||
|
||||
loop_end:
|
||||
@@ -225,3 +239,34 @@ close_left:
|
||||
// push zero to the stack
|
||||
push zero
|
||||
jmp _traverse_left
|
||||
|
||||
|
||||
// ------------------------------------------
|
||||
// reset interpreter
|
||||
// clears screen, resets cursor and clears data buffer.
|
||||
bf_reset: func
|
||||
push rg0
|
||||
push rg1
|
||||
|
||||
// clear screen and reset cursor
|
||||
call print::clear
|
||||
call print::reset
|
||||
|
||||
// clear data buffer (resb data: 1024 = 256 words)
|
||||
lli 256, rg0
|
||||
lwi data, rg1
|
||||
_bf_reset_clear_data:
|
||||
subi rg0, 1, rg0
|
||||
stw zero, rg1
|
||||
addi rg1, 4, rg1
|
||||
igt rg0, zero, rg4
|
||||
jnz rg4, _bf_reset_clear_data
|
||||
|
||||
pop rg1
|
||||
pop rg0
|
||||
|
||||
// reload interpreter state
|
||||
lwi program, rg0
|
||||
lwi data, rg1
|
||||
lli 0, rg2
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user