A murky subject. Yes, the issue is the NMOS bug for opcode $6C -- jump abs indirect. To avoid the bug, the ls byte of a Forth Code Field must not be stored at an address ending in binary 11111111. ie: the CF mustn't straddle a page boundary. Garth's approach goes one step further and ensures that no Code Field straddles a
word boundary -- the CF is never stored at an address ending in binary 1. As a result, he'll sometimes waste a byte unnecessarily, but that's a minor matter, and apparently the $6C bug isn't the only factor he's considering.
FIG's CREATE has a mechanism similar to what Garth described above. FIG's CREATE (see source Screen 50) includes the sequence
DP C@ 0FD = ALLOT just before the Link Field gets laid down. Why 0F
D? Because the goal is to anticipate 0F
F after the Link Field has gotten laid down.
whartung wrote:
You can either add a NOP or a .BYTE $0, doesn't really matter -- it's "lost space", since it's between words, when you do it.
Between words is the logical place -- acceptable, or even preferable. But
that's not how FIG's and Garth's compilers do it. The wasted byte, if any, gets
embedded within the header, after the Name Field. (CREATE is smaller and faster with this behavior. But it could be rewritten to actually put the wasted byte between words as Will says.)
In regard to Forth words produced from assembly source, you have freedom to do
anything that'll prevent Code Fields from straddling a page boundary.
Code:
; The following offset adjusts all code fields to avoid an
; address ending $XXFF. This must be checked and altered on
; any alteration , for the indirect jump at W-1 to operate !
;
; .ORG *+2 ;.ORIGIN *+2
nop
nop
The effect of this is to offset the entire dictionary right from the beginning, and move
all the Code Fields! Not a great solution, since there's a risk that fixing one fault will generate another. (A CF that was previously okay might get moved onto a page boundary.) It seems to me the odds of that happening will be smaller if we place the wasted bytes higher in memory, not at the origin. Also, an automated solution (a Macro) is preferable to this manual tweak.
cheers
Jeff
_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html