\ Staapl monitor on top of a synchronous serial protocol over the ICSP \ pins, implemented using a PICkit2 programmer/debugger. staapl pic18/prom staapl pic18/route load icsp.f macro : receive icsp-rx ; : transmit icsp-tx ; : rx-handshake icsp-handshake ; : tx-wait-ack icsp-wait-ack ; forth : tx-handshake \ size -- #xFF : tx-handshake-addr \ size addr - icsp-handshake \ 10 to tell the host we're here icsp-tx \ address icsp-tx ; \ size \ No forwarding. This is a stub that allows the target counting code \ to work, which sends a zero length message around the chain by \ picking the highest address 255. : forward-msg icsp-rx drop \ drop size 0 message icsp-handshake icsp-tx \ address 0 icsp-tx tx-wait-ack ; \ Instantiate the interpreter using the definitions above. load interpreter.f \ Enable single-command programming and block clobber inspection to \ avoid large roundtrip delays. load fast-prog.f load fast-chkblk.f \ Initialize and start interpreter when PGD is low = PK2 connected. : warm ' warm init-boot \ boot jumps here init-xs \ execution stack #x80 init-ds \ data stack #x90 init-rs \ retain stack init-chip \ setup outputs and clock icsp-idata low? if interpreter ; \ jump to interpreter if PK2 is there then \ Fall into application.. \ Debugger : quit ack dup init-xs drop interpreter \ init-xs macro kills WREG