home .. forth .. colorforth mail list archive ..

Re: [colorforth] Assembler or machinecode.


Dr Nick Maroudas wrote:

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

If   we put an assembler into colorForth  it should be an
edit time aid  that is an extension of the editor.
As yellow assembler words are executed they are inserted
at the edit cursor as comments with the   machine code.

Entering:
: 2*    [ shl eax,1] ;
would appear as:
: 2*    [ $ e0d1 L ( shl eax,1) ] w,  ;
in the source.

The  assembler is optional in the editor  and is not needed at load time.
The assembler is just a programming aid and not need if implemented this way.

Robert



---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com