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

Re: [colorforth] Back and forth to machine code in blocks.


Wow!! Albert.




On Mon, 10 Jan 2005 00:58:36 +0100, Albert van der Horst
<albert@xxxxxxxxxxxxxxxxxx> wrote:
> Hoy all,
> In behalf of retroforth I have made a tool (parse/unparse)
> that converts machine code in blocks (actually linux files)
> into assembler code and back.
> 
> A similar tool could be had for colorforth, if there is interest.

You bet there's interest :-) 

> An other option is to port the miniassembler to colorforth.
> (it is 6 screens for a 386 assembler without the sib stuff,
> 7 screens with sib.) Then the machine code could be replaced
> in  the colorforth screens by assembler code.

This miniassembler, there is an example at your site?

> 
> I think it will not be necessary to have the assembler permanently
> loaded. It could be used at startup to copy screens with
> assembler code to screens with machine code. 

I'm slow, so save me if I have this wrong. As I'm reading this i'm thinking ...
The front 18 assembler blocks of the colorforth could be converted from
colorforth to assembler with this? 

> So actual usage
> would be the same as in the current situation. This is assuming
> sufficient screens are present. With the switch from floppies to
> USB sticks that should not be a problem.
> 

Is the opposite of this example also do able, where you provide the 
assembler code and it comes out RetroForth? Or am I totally missing the point?



> Example: screen 0 of retroforth
> ---------------------------------------------
> 
> forth : swap [ $0687 2, ] ;
> : drop [ $ad 1, ] ;
> : dup [ $fc4689 3, $fc768d 3, ] ;
> : nip swap drop ;
> : and [ $0623 2, ] nip ;
> : or [ $060b 2, ] nip ;
> : xor [ $0633 2, ] nip ;
> : >> [ $c189 2, $ad 1, $e8d3 2, ] ;
> : not -1 xor ;
> : @ [ $008b 2, ] ;
> : ! [ $c289 2, $ad 1, $0289 2, $ad 1, ] ;
> : c@ @ $ff and ;
> : c! [ $c289 2, ] drop [ $0288 2, ] drop ;
> : + [ $0603 2, ] nip ;
> : * [ $26f7 2, ] nip ;
> : negate -1 * ;
> : - negate + ;
> : / [ $c389 2, $ad 1, $99 1, $fbf7 2, ] ;
> : mod / [ $d089 2, ] ;
> -------------------------------------------------
> 
> forth : swap [ {
>    XCHG, X| AX'| ZO| [SI]
> } ] ;
> : drop [ {
>    LODS, X'|
> } ] ;
> : dup [ {
>    MOV, X| F| AX'| BO| [SI] 0000,00FC B,
>    LEA, SI'| BO| [SI] 0000,00FC B,
> } ] ;
> : nip swap drop ;
> : and [ {
>    AND, X| T| AX'| ZO| [SI]
> } ] nip ;
> : or [ {
>    OR, X| T| AX'| ZO| [SI]
> } ] nip ;
> : xor [ {
>    XOR, X| T| AX'| ZO| [SI]
> } ] nip ;
> : >> [ {
>    MOV, X| F| AX'| R| CX|
>    LODS, X'|
>    SHR, V| X| R| AX|
> } ] ;
> : not -1 xor ;
> : @ [ {
>    MOV, X| T| AX'| ZO| [AX]
> } ] ;
> : ! [ {
>    MOV, X| F| AX'| R| DX|
>    LODS, X'|
>    MOV, X| F| AX'| ZO| [DX]
>    LODS, X'|
> } ] ;
> : c@ @ $ff and ;
> : c! [ {
>    MOV, X| F| AX'| R| DX|
> } ] drop [ {
>    MOV, B| F| AL'| ZO| [DX]
> } ] drop ;
> : + [ {
>    ADD, X| T| AX'| ZO| [SI]
> } ] nip ;
> : * [ {
>    MUL|AD, X| ZO| [SI]
> } ] nip ;
> : negate -1 * ;
> : - negate + ;
> : / [ {
>    MOV, X| F| AX'| R| BX|
>    LODS, X'|
>    CWD,
>    IDIV|AD, X| R| BX|
> } ] ;
> : mod / [ {
>    MOV, X| F| DX'| R| AX|
> } ] ;
> ---------------------------------------------------------------
> X| w/l   F| T| from/to primed register
> R| register  ZO| BO| XO| zero byte w/l offset
> 
> More information in forthassembler.html at the url in my signature.
> 
> --
> 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
> 


This is amazing work. Well done Albert. I can't wait to learn to use
it properly.
Regards
Ray St. Marie
--
Rastm2 At users dot sourceforge dot net
Ray.StMarie AT gmail DOT com
Ray.StMarie AT sbcglobal DOT com
Raystm2 in  irc.freenode.net /join #c4th #c4th-ot #forth #retro

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