\ Do not use this file except in compliance with the License. You may \ obtain a copy of the License at http://www.microcore.org/License/ \ Software distributed under the License is distributed on an "AS IS" basis, \ WITHOUT WARRANTY OF ANY KIND, either express or implied. \ See the License for the specific language governing rights and limitations \ under the License. \ \ The Original Code is: MONITOR.FS \ \ Last change: KS 27.01.2014 15:50:39 \ \ The Initial Developer of the Original Code is Klaus.Schleisiek AT hamburg.de. \ Extensions by Ulrich.E.Hoffmann AT xlerb.de \ \ MicroCore monitor for the debugger interface \ hardware must be configured with an appropriate bidirectional debug interface \ Macro: in@ ( -- w ) T DEBUG_REG @ H ; Macro: out! ( w -- ) T DEBUG_REG ! H ; : ?in@ ( -- w ) BEGIN CALL pause #f_break flags@ and ?GOTO debugService \ umbilical removed, restart debug loop #f_debug flags@ and UNTIL in@ ; : monitor ( -- ) BEGIN 0 out! ?in@ execute REPEAT ;noexit Variable tmpStatus : debugger ( -- ) \ main debugger loop called via break instruction status@ tmpStatus ! #breakpoint out! r> 1- out! ['] monitor nop BRANCH ;noexit : clear ( ? -- ) dsp@ [ #dstack 1- ] Literal invert and dsp! ; : rclear ( r: ? -- ) r> rsp@ [ #rstack 1- ] Literal or rsp! >r ; : debugService ( -- ) rclear clear ?in@ drop BEGIN #warmboot out! ?in@ $5F5 xor 0= UNTIL BEGIN $505 out! ?in@ 0= UNTIL \ synchronise Host <-> Target communication ['] monitor nop BRANCH ;noexit : nextstep ( -- ) rdrop in@ >r tmpStatus @ status! ; \ call and jump (modified via >r) : message ( n -- ) dup out! \ transfer message number to host 0< IF clear ['] monitor nop BRANCH THEN ; : depth ( -- depth ) dsp@ [ #dstack 1- ] Literal and ; : copyds ( -- ) depth dup out! dup ?FOR swap r> swap >r >r NEXT ?FOR r> r> swap >r dup out! NEXT ; : \out! out! ; : \in@ in@ ; : \@ @ ; : \! ! ;