Re: [colorforth] FML
- Subject: Re: [colorforth] FML
- From: Albert van der Horst <albert@xxxxxxxxxxxxxxxxxx>
- Date: Sun, 8 Feb 2004 16:45:37 +0100 (MET)
On Sat, 7 Feb 2004, Howerd Oakford wrote:
> Hi Albert,
>
> [snip]
>
> > If I interpret this correctly, new versions of colorforth come
> > forth from Chuck Moore as a binary image?
> Yes, and assembler files, but other people have made modifications, and
> supply their own versions.
> There are ports from MASM ( which Chuck used ) to NASM and GAS.
> I have tried not to change the binary, but for my next version ( 2.0 ) I am
> changing some of the kernel names, hence my original post.
I see three items here:
1. How to keep pace with Chuck Moore
2. Having the generating of colorforth under control, such as to
have it run on as many PC's as possible
3. Allowing everybody to experiment with their own colorforth's
I think I have a tool to go from MASM to NASM format. (I'm a little
bit surprised that Chuck doesn't use NASM. It is much more "no nonsense".
It probably boils down to history.) 1]
I think accomodating GAS is a waste of time, as far as Intel 86 is
concerned. The folks that use gas are on gnu-linux systems mostly,
and NASM is available on most modern distro's.
(This won't stop anybody from supplying that service though, of
course! It is just not for me.)
> > I have this "reverse engineering" Forth assembler which allows to
> > disassemble a file, then generate an exact same image using the
> > disassembly. (See my site below.)
<SNIP>
> This sounds good! I was trawling the net the other day for a decent 80x86
> dis-assembler. Most were awful!
> I will take a look...
Once you are used to the gas format, IMHO GNU's objdump is reasonable.
There are however no provisions to accumulate disassembly information,
but neither has mine, yet.
My postit-fixup assembler is something to get used to.
A small example might help.
Lets assemble a rol instruction. This goes like
ROL, 1| X| R| AX|
A postit (mostly the assembly mnemonic) advances the HERE pointer (^).
Conceptually, some bits are not yet filled in, left as dots.
The fixups (mostly ending in `|' like in C `or') fix up bits before
the HERE pointer.
^
ROL, (Rotate left ... )
110100.. ..000...
^
1| ( ... over 1 bit ... )
1101000. ..000...
^
X| ( ... xell ... ) (16/32 word, not byte)
11010001 ..000...
^
R| ( ... register ... )
11010001 11000...
^
AX| ( ... A )
11010001 11000000
This scheme can detect all errors: no dots must be left,
X| and AL| conflict, X| and B| conflict, LE| makes no sense
etc.
It can be walked the other way for disassembling, too.
The 6809 assembler using this scheme is 30% shorter than a typical
6809 Forth assembler like the one coming with Camelforth.
(After leaving out facilities not present in the other assembler.)
<SNIP>
> I think this could be very useful to dis-assemble the BIOS...
I would like to do that. In the context of colorforth this would
mean, analyzing the BIOS in order to adapt colorforth automatically
to the PC at hand. All Forth's trying to boot directly would
benefit from this effort. (Including the one I myself am experimenting
with ;-) )
> Regards
> Howerd
Groetjes Albert
1]
Actually I go from a "generic" format by macro's to either MASM,
NASM and GAS, but the latter I didn't try in a long time.
GAS on Intel can't be used for a traditional Forth, practically.
I'd end up with a 64 Mbyte executable for my Forth, instead of 30
Kbyte. (On DEC Alpha it is better.)
Albert van der Horst,Oranjestr 8,3511 RA UTRECHT,THE NETHERLANDS
One man-hour to invent,
One man-week to implement,
One lawyer-year to patent.
albert@xxxxxxxxxxxxxxxxxx http://home.hccnet.nl/a.w.m.van.der.horst
---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com