nyef wrote:
As far as a minimal monitor goes, how about something like this?
http://pygmy.utoh.org/3ins4th.html Very quick to implement a version of for a 6502 or similar, and from there you can do a whole lot as long as you have some RAM.
This is a great idea (I've seen it before), but I think that it really needs to have a handy 65xx assembler in the host Forth as well, and an ability to create CROSS-CODE words on the host that automagically get assembled in to the slave.
You could do something like this:
Code:
HEX
0200 XHERE !
CROSS-CODE SUB1
0 # LDA
CLC
0A # ADC
RTS
END-CROSS-CODE
CROSS-CODE SUB2
SUB1 JSR
END-CROSS-CODE
It essentially makes first class all of the shenanigans that you can see Frank doing in his article (defining the work, calculating the length, "comma'ing it in", etc.).
Essentially, take a stock 65xx assembler, replace HERE with XHERE, C! with XC!, etc. and assemble code. Use the 0200 (in this case) as the origin to the routine (since it sets XHERE). You can have XHERE maintained automatically by the assembler. For example, XHERE is set to 0200 at the start, and updated properly by the CROSS-CODE assembler. Also, SUB1 is set to 0200, and SUB2 would be set to 0206, etc.
Reloading the code assembles it live on the slave. By the time the assembly is done, not only is it assembled, it's already on the board.
You can also make "XALLOT", "XC,", "X,". Mind, you don't need to have a Forth on the slave, you're just using Forth concepts and commands to populate the image. No need to have the inner interpreter, move over words headers, etc. Just Franks simple driver. It's just an interesting, simple, fast cross assembler/loader with an interactive Forth command line.
There's nothing stopping you from setting XHERE manually before each routine.
Code:
HEX
0200 XHERE !
CROSS-CODE SUB1
0 # LDA
CLC
0A ADC
RTS
END-CROSS-CODE
0210 XHERE !
CROSS-CODE SUB2
SUB1 JSR
END-CROSS-CODE
Or something like this.
Code:
0 VARIABLE ORGVAL
: ORG DUP ORGVAL ! XHERE ! ;
: +ORG ORGVAL @ + ORG ;
Now:
Code:
HEX
0200 ORG
CROSS-CODE SUB1
0 # LDA
CLC
0A ADC
RTS
END-CROSS-CODE
10 +ORG
CROSS-CODE SUB2
SUB1 JSR
END-CROSS-CODE
This does a couple of things. First, if you change the origin from 0200 to 0400, well, everything else moves as well.
But even better, if you change the "10 +ORG" to "20 +ORG", then everything else shifts as well.
The point of the individual origins is that it lets you redefine single routines, allowing you to patch tweak them and patch them in place because you have a buffer between routines, so you don't have to reassemble the entire set every single time. Just update one routine, and reload it. Hmm, how does it know to use the same origin the second time? Yea, I don't know either -- guess it needs work, but I'm sure Something Could Be Done.
I know, you could have CROSS-CODE look up and see if SUB2 is already in the dictionary. If it is, just use its existing value and ignore ORG. If you want to reassemble everything, FORGET the start (SUB1 in this case), and reload.
Wow - that was simple. That's down right clever.
So, now you're developing in assembly, ON THE BOARD, in almost real time with effectively zero turn around time.
Pretty neat!