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

[colorforth] Prefix versus color legenda for ascii color screens.


Hi,

In behalf of reassembling color screens that are still expressed
as ascii text I have made the following translations

prefix  color    type of attached data            my association
:       red      colorname                        define
,       any      number in current code base      data, copout
]       green    colorname                        compile
[       yellow   colorname                        execute
^       cyan     colorname                        postpone
?       violet   variable                         content
(       white    colorname (3 modes)              comment
+       white    colorname                        comment
#       yellow   number in decimal                execute number
]#      green    number in decimal                compile number
]$      d.green  number in hex                    compile number
%$      brown    number in hex                    no idea

All prefixes have implied commaing. So after the vocabulary EDIT-TIME
is in effect   ``#17'' expresses what without would be ``#17 , ''
( # is Marcel Hendrix's prefix for decimal numbers.)

And this is what it is all about, these are no prefixes.
{       none     none                             start assembly
}       none     none                             stop assembly

Remark 1
$ is missing, but could easily be accomodated:
$       d.yellow number in hex                    execute number

Remark 2
( followed by blank is comment to the assembler, and is not assembled.

Remark 3
On some rare occasions disassmbly makes no sense, e.g. with plte.
Note that the thing works, and works well, even if my associations
and/or the naming of the colors are an appaling demonstration of my
misunderstanding of colorforth.

This is the output of the first two screens.
I have suppressed the comment that shows the addresses.
The screens are lifted from COLOR.COM, an actual disassembly has
screen numbers #18 and #24.
----------------------------------------------------------------
BITS-32
0  ORG

INCLUDE colorname.frt
1,0000 CODE-LENGTH !
0  0 SEGMENT DEFAULT:
#0 400 * DUP SEGMENT SCR0    EDIT-TIME
(colorf +orth (Jul3 +1
(Chuc +k (Moore (Publ
+ic (Domain #24 [load
#26 [load #28 [load
#30 [load
:dump ]#32 ]load ];
:icons ]#34 ]load ];
:print ]#38 ]load ];
:file ]#44 ]load ];
:north ]#46 ]load ];
:colors ]#56 ]load ];
[mark [empty

    PREVIOUS


#6 400 * DUP SEGMENT SCR6    EDIT-TIME
[macro
:swap     {
   MOV, X| T| DX'| ZO| [SI]     }
    {
   MOV, X| F| AX'| ZO| [SI]
   MOV, X| T| AX'| R| DX|     }
];
:0 ^?dup     {
   XOR, X| F| AX'| R| AX|     }

];
:if     {
   J, Z| Y| 0 (RB,)     }
]here
];
:-if     {
   J, S| N| 0 (RB,)     }
]here
];
:a ^?dup     {
   MOV, X| T| AX'| R| DX|     }

];
:a! ]?lit ]if     {
   MOVI|X, DX| 0 IL, -4 AS-ALLOT    }
], ]; ]then     {
   MOV, X| T| DX'| R| AX|     }
^drop ];
:2*     {
   SHL, 1| X| R| AX|     }
];
:a, ]2* ]2* ],
];
:@ ]?lit ]if ^?dup
{
   MOV, X| T| AX'| MEM| 0 L, -4 AS-ALLOT    }
^a, ];
]then     {
   MOV, X| T| AX'| ZO|    [MEM +4* AX] 0 L, -4 AS-ALLOT    }
]0
], ];
:! ]?lit ]if ]?lit
]if     {
   MOVI, X| MEM| 0 L, 0 IL, -8 AS-ALLOT    }
]swap
^a, ], ]; ]then
{
   MOV, X| F| AX'| MEM| 0 L, -4 AS-ALLOT    }
^a, ^drop
]; ]then ^a!     {
   MOV, X| F| AX'| ZO|    [MEM +4* DX] 0 L, -4 AS-ALLOT    }
]0 ], ^drop ];
:nip     {
   LEA, SI'| BO| [SI] 4 B,     }
];
:+ ]?lit ]if     {
   ADDI|A, X'| 0 IL, -4 AS-ALLOT    }
], ]; ]then     {
   ADD, X| T| AX'| ZO| [SI]     }
^nip ];
:or ]$633 :binary ]?lit
]if ]swap ]#2 ]+
]1, ], ]; ]then
]2, ^nip ];
:and ]$623 ^binary ];
:u+ ]?lit ]if     {
   ADDI, X| ZO| [SI] 0 IL, -4 AS-ALLOT    }
], ]; ]then     {
   ADD, X| F| AX'| BO| [SI] 4 B,     }
^drop ];
:? ]?lit     {
   TESTI|A, X'| 0 IL, -4 AS-ALLOT    }

], ];

    PREVIOUS
----------------------------------------------------------------

Looking at

:+ ]?lit ]if     {
   ADDI|A, X'| 0 IL, -4 AS-ALLOT    }
], ]; ...

I see a chance to plug my PostIt FixUp principle.

What you see here is an assembly of a dummy long as immediate data for
the addition, then a retraction of that dummy value by allotting back
in the assembler.
PostIt FixUp assemblers accomodate incomplete instructions so the above
becomes

:+ ]?lit ]if   { ADDI|A, X'| }   ], ]; ...


Groetjes Albert




--
Albert van der Horst,Oranjestr 8,3511 RA UTRECHT,THE NETHERLANDS
Economic growth -- like all pyramid schemes -- ultimately falters.
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