Commit 02ca84eb authored by bp's avatar bp

Further simulator enhancements


git-svn-id: https://www.forth-ev.de/repos/b16@221 3b8d8251-53f3-0310-8f3b-fd1cb8370982
parent 3e47659b
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
Variable Inst Variable Inst
Variable P Variable P
Variable A Variable A
0 Value T
0 Value N
Variable c Variable c
Variable sp here &10 cells dup allot erase 2 sp ! Variable sp here &10 cells dup allot erase 2 sp !
Variable rp here 8 cells dup allot erase Variable rp here 8 cells dup allot erase
...@@ -43,12 +45,12 @@ $10000 allocate throw Value RAM RAM $10000 erase ...@@ -43,12 +45,12 @@ $10000 allocate throw Value RAM RAM $10000 erase
\ Stack access \ Stack access
: T ( -- n ) sp @ 1+ cells sp + @ ; : 3rd ( -- n ) sp @ 1+ cells sp + @ ;
: R ( -- n ) rp @ 1+ cells rp + @ ; : R ( -- n ) rp @ 1+ cells rp + @ ;
: ?sp ( -- ) sp @ &10 u> abort" Stack wrap" ; : ?sp ( -- ) sp @ 7 and sp ! ;
: ?rp ( -- ) rp @ 8 u> abort" Rstack wrap" ; : ?rp ( -- ) rp @ 8 u> abort" Rstack wrap" ;
: pop ( -- n ) T -1 sp +! ?sp ; : pop ( -- n ) T N to T 3rd to N -1 sp +! ?sp ;
: push ( n -- ) 1 sp +! ?sp sp @ 1+ cells sp + ! ; : push ( n -- ) 1 sp +! ?sp N sp @ 1+ cells sp + ! T to N to T ;
: rpop ( -- n ) R -1 rp +! ?rp ; : rpop ( -- n ) R -1 rp +! ?rp ;
: rpush ( n -- ) 1 rp +! ?rp rp @ 1+ cells rp + ! ; : rpush ( n -- ) 1 rp +! ?rp rp @ 1+ cells rp + ! ;
...@@ -331,8 +333,8 @@ b16-asm also Forth ...@@ -331,8 +333,8 @@ b16-asm also Forth
IP @ >r prog r@ RAM + IP @ r@ - r> program ; IP @ >r prog r@ RAM + IP @ r@ - r> program ;
: eval ( >defs -- ) : eval ( >defs -- )
IP @ >r comp r@ exec r> org &20 wait ?in ; IP @ >r comp r@ exec r> org &20 wait ?in ;
: sim ( >defs -- ) : sim ( >defs -- ) rp off
IP @ >r prog r@ P ! ['] run catch r> org ; IP @ >r prog r@ P ! ['] run catch r> org throw ;
: asm-load ( -- ) b16-asm definitions include forth definitions ; : asm-load ( -- ) b16-asm definitions include forth definitions ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment