Re: [colorforth] Assembler or machinecode. Was Re: [colorforth] New Linux 4word
- Subject: Re: [colorforth] Assembler or machinecode. Was Re: [colorforth] New Linux 4word
- From: Dr Nick Maroudas <alice@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 09 Apr 2005 15:25:26 -0400
On Apr 8, 2005 07:43 PM, Chris Walton wrote:
You know, bootsectors etc. can be written in forth if
you compile16-bit code (one block different) and just
insert a hard jump
On Apr 8, 08:08 PM, Terry Loveall wrote:
While porting 4word to linux I encountered the above
problem of inline opcode compilation without comments.
(snip)
Rather than putting together a sub-set of an assembler,
I just commented the new inline opcodes with their Intel
memnonics. Maximum efficiency of size and readability.
Old 16-bit definition:
macro : 2* [ $ e0d166 L ] 3, ] ;
New 32-bit definition:
macro : 2* [ $ e0d1 L ( shl eax,1) ] w, ] ;
The really tough discipline is keeping the comments up
to date...
Regards,
Terry Loveall
Nick here: I think Terry's method sufficient for my
own limited purposes:
1. basic understanding of a small Forth stripped down
to expose its intimate relationship to my PC hardware
2. sporadic "onesy" applications, for diverse academic
science papers and hobby projects, for which other
languages seemed to me either too "user friendly" (ie,
blandly restrictive) or too impenetrably "transparent"
(ie, hiding the very details that I needed)
Because of its compactness and clarity I found that FIG,
as soon as I understood some problem (math or hardware)
would enable me to program whatever was needed. A few
comma-compiled opcodes sufficed; as Terry says, the
important thing is to comment for maximum clarity.
CF is FIG for the 21st century, and I don't care whether
it comes with or without assembler, but I would like to
have it more modular.
For instance, I should like to see the boot section
as a module, annotated to show how it relates to the
needs of the CPU and the floppy (or the hard disc or
memstick or whatever, for that particular boot module).
Then we could try to plug in say, Chris Walton's
module (above, if he would kindly write it up). At
present, I am trying to make sense of the present boot
code, but what do floppy disc and Intel CPU want from
each other? (Ray, does this qualify for the most stupid
question?)
Likewise, the video section ought to be a module, with
annotation to show what that code is doing for its
particular grafics system. Which part is relevant to CF
alone, and which to this type of PC display alone?
Likewise the keyboard. I like it: the Dvorak, the
onscreen memnonics, the switchability and the reduced
keyset. But last night I wondered if the keyset could
be reduced to 5 by implementing Terry's one-handed
hacker's coding in software. So I have to ask more
stupid question: what i/o ports detect the simultaneous
pressing of 4 keys? Where does CF translate a keypress
into a character?
Annotated modules might reduce PC incompatability: most
peripheral hangups seem to concern floppy, VDU or KB.
Then we could progress to those exciting core issues
like the relationship between meaning, symbol and
optimal implementation.
Regards,
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com