Download 6 - Forth

Transcript
r*********
** byte-array
*************
:class byte-array <super ldarray
\ Initialize the array
:m init:
(n--)
1 setsize: self
allocate: self
\ Set the element size
\ Allocate space
\ Return value at index location
:m get:
( i -- val )
\ Check bounds
idx-check: self
\ Start of array
array-addr: self
+
\ Add index
\ Fetch
c@
\ Set value at index location
:m put:
( val i -- )
\
idx-check: self
\
array-addr: self
\
+
\
c!
\ Fill the array with value
:m fill:
( val -- )
array-addr: self
#elems: self
rot fill
Check bounds
Start of array
Add index
Store
\ Get address
\ # of elements
\ Do it
\ Clear the array
:m clear:
( -- )
0 fill: self
\ Set initialization method
I
\ ** word-array
\ *************
:class word-array <super byte-array
\ Initialize the array
:m init:
(n--)
2 setsize: self
allocate: self
\ Set the element size
\ Allocate space
\ Return value at index location
:m get:
( i -- val )
\ Check bounds
idx-check: self
\ Index -> offset
2*
\ Start of array
array-addr: self
+
\ Add index
\ Fetch
@
Forth Dimensions
41
learns
expertasystem
person'sevaluates
habits. The
its
inputs to determine what
action is needed: a gentle
prompting, a phone call for
help, etc. I don't rhink George
Orwell would have cared
much for this system, but it
certainly canbe instrumental
in helping an elderly person
to be more self sufficient.
Thank you, Tim, not just for
your presentation and software, but also for your recent neural network articles
in Forth Dimensions.
Plenty of treats were to
be had for the hardwired
Forthers. BRAD RODRIGUEZ
discussed his PISC-I (Pathetic Instruction Set Computer), which uses 1976 'ITL
technology, has a mere 2100
gates, and implements Forth
in microcode. PISC-1 adds a
whole new dimension to the
phrase "lean and mean."
showed us how
DR.TING
we can create our own chip
at the kitchen table by using
the National Security
Agency's public-domain
CMOSN rnauo cell library.
So where's the DIP?Well, Dr.
Ting showed us that, too, by
using the library to create a
40-pin Data Comparator
Chip. With plenty of hand
waving, which he promised
R~LE
us in his paper, JOHN
discussed
his
QS2
(Quicksand 2) project proposal for a graduate-level
VLSI design project at the
University of California at
Santa Cmz. It is a 16-bit rnicroprocessor with classical
RISC features, which has,
among other things, a hardware-based threaded-code
interpreter.
CHUCK
MOOREdemonstrated his MuP20 chip emulator software which displayed each layer of the chip
in a different color. Using the
seven-button interface, he
scrolled through the chip,
March 1992 April