More tweaking on forth
This commit is contained in:
parent
42e0191be3
commit
b14c5e73af
|
@ -22,6 +22,8 @@ def Reset_lilith():
|
||||||
def Step_lilith():
|
def Step_lilith():
|
||||||
global Current_IP
|
global Current_IP
|
||||||
Current_IP = vm.step_lilith()
|
Current_IP = vm.step_lilith()
|
||||||
|
global Count
|
||||||
|
Count = Count + 1
|
||||||
return
|
return
|
||||||
|
|
||||||
def Set_Memory(address, value):
|
def Set_Memory(address, value):
|
||||||
|
@ -172,4 +174,5 @@ def get_footer():
|
||||||
Current_IP = 0
|
Current_IP = 0
|
||||||
Current_Page = 0
|
Current_Page = 0
|
||||||
Watchpoints = {0}
|
Watchpoints = {0}
|
||||||
|
Count=0
|
||||||
Reset_lilith()
|
Reset_lilith()
|
||||||
|
|
|
@ -35,9 +35,9 @@
|
||||||
LOADUI R11 $NEXT ; Get Address of Next
|
LOADUI R11 $NEXT ; Get Address of Next
|
||||||
FALSE R10 ; Current state is Interpreting
|
FALSE R10 ; Current state is Interpreting
|
||||||
LOADUI R9 $CR_Entry ; Get Address of last defined function
|
LOADUI R9 $CR_Entry ; Get Address of last defined function
|
||||||
# LOADUI R8 $HEAP ; Get Address of HEAP
|
LOADUI R8 $HEAP ; Get Address of HEAP
|
||||||
# LOADUI R0 0x1100 ; Need number to engage tape_01
|
LOADUI R0 0x1100 ; Need number to engage tape_01
|
||||||
# FOPEN_READ ; Load Tape_01 for Reading
|
FOPEN_READ ; Load Tape_01 for Reading
|
||||||
MOVE R7 R0 ; Make Tape_01 Default IO
|
MOVE R7 R0 ; Make Tape_01 Default IO
|
||||||
LOADUI R13 $Quit_Code ; Intialize via QUIT
|
LOADUI R13 $Quit_Code ; Intialize via QUIT
|
||||||
JSR_COROUTINE R11 ; NEXT
|
JSR_COROUTINE R11 ; NEXT
|
||||||
|
@ -60,16 +60,17 @@
|
||||||
;; Jumps to updated current
|
;; Jumps to updated current
|
||||||
;; Affects only Next and current
|
;; Affects only Next and current
|
||||||
:NEXT
|
:NEXT
|
||||||
LOAD R12 R13 0 ; Get Address stored which is pointed at by next
|
COPY R12 R13 ; Preserve Current Pointer
|
||||||
|
LOAD R0 R13 0 ; Get Address stored which is pointed at by next
|
||||||
ADDUI R13 R13 4 ; Increment Next
|
ADDUI R13 R13 4 ; Increment Next
|
||||||
JSR_COROUTINE R12 ; Jump to next thing
|
JSR_COROUTINE R0 ; Jump to next thing
|
||||||
|
|
||||||
;; DOCOL Function
|
;; DOCOL Function
|
||||||
;; The Interpreter for DO COLON
|
;; The Interpreter for DO COLON
|
||||||
;; Jumps to NEXT
|
;; Jumps to NEXT
|
||||||
:DOCOL
|
:DOCOL
|
||||||
PUSHR R13 R15 ; Push NEXT onto Return Stack
|
PUSHR R13 R15 ; Push NEXT onto Return Stack
|
||||||
ADDUI R13 R13 4 ; Update NEXT to point to the instruction after itself
|
ADDUI R13 R12 4 ; Update NEXT to point to the instruction after itself
|
||||||
JUMP @NEXT ; Use NEXT
|
JUMP @NEXT ; Use NEXT
|
||||||
|
|
||||||
;; Some Forth primatives
|
;; Some Forth primatives
|
||||||
|
@ -717,6 +718,7 @@
|
||||||
CMPSKIP.LE R15 R1 ; While Return stack isn't empty
|
CMPSKIP.LE R15 R1 ; While Return stack isn't empty
|
||||||
JUMP @Clear_Return ; Keep looping to clear it out
|
JUMP @Clear_Return ; Keep looping to clear it out
|
||||||
:RETURN_Done
|
:RETURN_Done
|
||||||
|
MOVE R15 R1 ; Ensure underflow is corrected
|
||||||
JSR_COROUTINE R11 ; NEXT
|
JSR_COROUTINE R11 ; NEXT
|
||||||
|
|
||||||
;; Parameter stack operations
|
;; Parameter stack operations
|
||||||
|
|
Loading…
Reference in New Issue