It now makes more sense to use XT_EXIT to return control back to the host application which also needs to save and restore impacted registers shared with amForth code. Two modes are being tested, interactive across a network (network usart mode) and XT byte code (XTC) execution.
Regards, John S On Fri, Jan 9, 2026 at 11:57 AM John Sarabacha <[email protected]> wrote: > Hi AmForth-ers, > The testing of amForth in a mixed program & network environment > isn't as challenging as it seems: > 1) an additional macro was added to macros.s > .macro XTC address > .p2align 2,0x55 > .word \address > .set idxcode, idxcode+1 > .equ IDX_\address,idxcode # code index > .endm > > 2) amForth.s to include the line > .include "amForth-idx-codes.s" > > 3) amForth-idx-codes.s (contents): > .set idxcode, 0 > IDX_ADDR: # starting address in flash - host application > needs that > XTC XT_MINUS > XTC XT_1MINUS > XTC XT_QDUP > XTC XT_NIP > XTC XT_RP > XTC XT_NEGATE > XTC XT_J > XTC XT_COLD > : > : > : > 4) The host application looks at this as an array of addresses (starting > at IDX_ADDR) , the index to the array references an amForth dictionary > address (for word), the host application passes this > address to the amForth ITC VM and after it completes execution, the NEXT > word will return it back to the host application which will look for the > result on the tos (top of stack). > > 5) For networking to another remote amForth on any device or > implementation on a larger system, as long as you have the same > amForth-idx-codes.s file built into the image the idx code acts like a > pcode. The CH32X033 implementation of amForth used the hifive1 words as a > starting point for a amForth dictionary, this generated 250 addresses in > the array above (a byte code can reference the word address), not all of > them are needed. By passing a stream of these byte codes to another amForth > (having this array of addresses) you can have remote execution of a forth > program (sounds like Java - but more interactive if you want). > > Regards, > John S > > PS: Will now watch more closely what I pass in email responses, didn't > realize the whole chain was being propagated. Sorry about that! > > _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ [email protected] https://lists.sourceforge.net/lists/listinfo/amforth-devel
