Initially, I used the same letters as those used in the z80 ref
docs, but it makes the different assemblers harder to use than they
should. Having consistent "argtype" rules across assemblers should
help.
Previously, recipes that began spitting binary contents before
loading block 282 would end up with VARIABLE code in their binary,
thus breaking them. We fix this by making this loading process
2-part.
Shadowing core "I" is too messy. As soon as ed is loaded in memory,
nothing else that isn't "i-aware" can be loaded anymore.
I guess that's why "contexts" exist in Starting Forth, but adding
this concept just for allowing the shadowing of core words seems
overkill to me. Renaming I to i in ed seems better.
This commit adds ?DUP IF guards to MOVE and MOVE- that make them exit
when u is 0. Without these guards a DO loop was executed 65535 times
instead of 0.
In particular, this fixes a crash when "105 LOAD I " is executed
immediately after boot. Block editor word "I" passes IBUF length (0)
to MOVE- and MOVE in this case, causing a crash.
(well, not PC@ and PC!, but I'm not even sure what would be the role
of these in a PC/AT. they're only used in drivers on the z80 front,
so they will not be immediately needed. todo... )
Now comes the fitting part.
Instead of having wordref point to core word routines, I made them
into word 4 word types. It liberates space into the stable ABI and
should make porting to other arches easier.
I'm also thinking of combining word type with the namelen field
for precious bytes saving, but not now...
It was useful when we still had the relinker, but now it has no use.
I was waiting a bit to see if the distinction would be useful again,
but it seems like it won't.
Documentation in block 100 says a number followed by a space or return
lists the contents of the block. However, typing any other character
does this too, because _pdacc returns -1 in this case.
This is annoying because typing "n" instead of "N" immediately after
jumping to some block was bringing you to block 0. Now "n" is ignored
instead.
This commit changes the condition for printing to explicitly check for
the value of 1, which means whitespace according to _pdacc documentation
in block 355.
I'm not sure yet where I'm going, but I'm not going to build the
8086 port from the ground up like I did with the z80, that is,
making is sustain itself and eventually merge its forth code with
core words. That would be too much work which would then be thrown
out (all those words I'll initially have to implement in asm which
are already implemented in Forth).
What I *think* I can do is build a mirror version of z80 boot code
and cross-compile it from the z80. This means it has to follow z80
stable ABI.
Nope, I'm not sure where I'm going...
Unless I misunderstood, this is supposed to set CS. This would make
all SREG have the same value. This allows us to remove BIN( offset
from os.bin.
I've tried booting to offset 0, but it didn't seem to work. Let's
settle for 0x8000. 512kb of system RAM is way more than we need
anyways.
There wasn't much of a reason to leave a loop early on 0x0d or null.
The idea was that once you have a CR or null, the rest is garbage
and you shouldn't see it.
However, it brought a problem: In VE, you couldn't insert characters
past that limit. It would be written, but never displayed. So let's
get rid of this logic and simply always display a 64x16 grid.
Make F search from curpos+1 so that it's possible to search the
same word we've just found a second time. Previously, it would find
the word under the cursor.
Also, improve docs a bit.
Previously, it would keep the old buffer displayed why typing over
it. I had kept it thus because I didn't want to erase the buffer
right away because the behavior is that when we type nothing, we
keep the buffer as-is and repeat the action.
Now, the behavior of I and F is much better. It keeps the buffer
displayed until the first non-return keystroke and then erases it.
Also, fixed PSP leak in _type and fixed PSP overuse in successful
_F (they balanced out).
Also, I've run VE on the TRS-80 for the first time! It doesn't work
well though. Screen is mostly blank all the time.
I removed instructions from the recipe which became obsolete when
Collapse OS became 100% bootstrapped. Also, I've updated instructions
to change the NL override which is necessary for blkup to work.
The indicator is going to be empty most of the time and will be
emitted by the mode changer directly. That's going to the upper-right
corner and the status bar avoids emitting in that area.
Also, add insert and find buffers to the header, making it 3 lines
high.
Also, fix the "I" overshadowing word which wasn't operating on the
proper RSP level.
Also, fix I which didn't mark the block as dirty.
I'm not sure why I chose null-terminated initially. Probably because
the z80asm version had null-terminated strings.
Length-prefixes strings are the traditional form of strings in Forth
and it's a bit easier to work with them with traditional forth words
when they're under this form.
Now that the boot binary is fully cross-compiled, there's no use for
the linker anymore. Theoretically, it could still be useful, but I
can't think of a real use case.
Let's take it out of the picture. If it's ever needed again, I'll
know where to find it.
I'm planning on going back to 8-bit branching. 16-bit br cells incur
a non-negligible penalty and, while at first 64 words (128 bytes
forward or backward) seemed a bit limiting, I now don't see why one
would ever construct such a big branch. It would be un-forthy.
Also, I looked at using BC instead of IY to hold IP and the transition
would be a lot easier with 8-bit branching.
In this commit, all I do is add overflow checks in IF. The mechanic
below doesn't change. I'll give myself some time to think it over so
that I avoid yet another back and forth.
Prebiously, when encountering an error during a : ; definition from
input buffer, because the input buffer wasn't flushed, we would continue
interpreting and quit the whole program when encountering ;.
Use EXX instead of the stack for HL protection and remove all
spurious uses of chkPS,
I wanted to inline chkPS in next because of its "tight loop" status,
but for reasons I don't understand, doing so breaks Collapse OS.
Later...
Will change to IF, .. THEN, but I need a way to easily reverse a
BR op. But from this commit, the translation of sms/kbd/ps2ctl.asm
is complete! perfect binary match!