[retroforth] Milestone: Dictionary and code separation

  • From: Charles Childers <charles.childers@xxxxxxxxx>
  • To: RetroForth Mailing List <retroforth@xxxxxxxxxxxxx>
  • Date: Fri, 28 Jan 2005 20:22:57 -0500

A major milestone has been reached! In RetroForth 8, the dictionary
headers and code are separated. The nice thing is that I can still do
things like:

code 'swap', _swap
  xchg eax, [esi]
next

Except that the dictionary entry is now compiled to a different area
of memory than the code. At this point, I have a "core.dict" file
that's generated from core.asm and rf.asm. (In 8.0 the file layout is
different than in 7.x; I'll explain the new organization soon). There
are "fdef", "mdef", and "vdef" macros that are used by the core.dict
file. (These actually set up the dictionary; the "code", "mcode", and
"var" macros are used to derive the entries by a shell script.)

The shell script follows:

#!/bin/bash
grep code\ \' source/core.asm | sed 's/code/fdef/' | grep -v mfdef\ \' 
grep code\ \' source/rf.asm | sed 's/code/fdef/' | grep -v mfdef\ \'
grep var\ \' source/core.asm | sed 's/var/vdef/'
grep var\ \' source/rf.asm | sed 's/var/vdef/'
grep mcode\ \' source/core.asm | sed 's/mcode/mdef/'
grep mcode\ \' source/rf.asm | sed 's/mcode/mdef/'

I named this "make-dict" and use it like this:

./make-dist >source/core.dict

This only has to be done after a change of the assembly files. (You
can edit the core.dict file by hand if you prefer; the shell script
just makes the entire process easier)

I'll share the macros themselves a little later. I need to do a bit
more cleanup first.

-- 
Charles Childers
http://www.retroforth.org

Other related posts: