23.10.2013 Views

FAST Forth Native-Language Embedded Computers

FAST Forth Native-Language Embedded Computers

FAST Forth Native-Language Embedded Computers

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

'1<br />

Listing Five. Include descriptive diagrams with a text editor.<br />

(<br />

(<br />

(<br />

(<br />

(<br />

(<br />

(<br />

COL COL COL COL COL COL COL COL COL COL COL COL COL COL COL COL<br />

1 1 2 1 3 1 4 1 1 2 1 3 1 4 1 1 2 1 3 1 4 1 1 2 1 3 1 4<br />

ROW 1<br />

ROW 2<br />

ROW 3 ROW 4<br />

rnsb lsb<br />

<br />

1<br />

1<br />

)<br />

)<br />

1<br />

1<br />

(<br />

(<br />

(<br />

(<br />

(<br />

(<br />

(<br />

(<br />

(<br />

(<br />

(<br />

(<br />

(<br />

(<br />

(<br />

ROW1<br />

PA3<br />

ROW2<br />

PA2<br />

ROW3<br />

PA1<br />

ROW4<br />

PA0<br />

COLl<br />

PA7<br />

BIT<br />

15<br />

BIT<br />

11<br />

BIT<br />

7<br />

BIT<br />

3<br />

COL2<br />

PA6<br />

BIT<br />

14<br />

BIT<br />

10<br />

BIT<br />

6<br />

BIT<br />

2<br />

COL3<br />

PA5<br />

BIT<br />

13<br />

BIT<br />

9<br />

BIT<br />

5<br />

BIT<br />

1<br />

COL4<br />

PA4<br />

BIT<br />

12<br />

BIT<br />

8<br />

BIT<br />

4<br />

BIT<br />

0<br />

)<br />

1<br />

1<br />

1<br />

Keyboard front view, with row )<br />

and column labels. 1<br />

Keyboard is a 4x4 matrix. )<br />

Normally all the rows are held )<br />

low, and when a key is pressed,)<br />

one of the columns gets pulled )<br />

down, which also pulls the IRQ )<br />

[CAI] down [true] to assert the)<br />

IRQ to tell the pP to see which)<br />

key was pressed. Actually, we )<br />

are not using keypad interrupts)<br />

(<br />

(<br />

(<br />

at this time, but the hardware )<br />

is there should we want to in )<br />

the future. )<br />

8000 CONSTANT "KEY ( up arrow<br />

0800 CONSTANT vKEY ( down arrow<br />

0008 CONSTANT MENUKEY<br />

0004 CONSTAPJT YESKEY<br />

0001 CONSTANT NOKEY<br />

CREATE KEY#TBL<br />

4000 , 1 C, 0100 , 6 C,<br />

2009 , 2 C, 0040 , 7 C,<br />

1000 , 3 C, 0020 , 8 C,<br />

0400 , 4 C, 0010 , 9 C,<br />

0200 , 5 C, 0002 , 0 C,<br />

to compiling it (if necessary), to trying it on the target-<br />

all without leaving, suspending, or even backgrounding<br />

the editor. It is set up so no code changes are needed to<br />

make the transition from RAM to ROM for the finished<br />

system. It's very simple, and the only hardware and<br />

software required has been out for years. It's a natural for<br />

<strong>Forth</strong>. (That will be material for another article. In spite of<br />

its simplicity, I haven't found anyone else who has heard<br />

of such a thing, so evidently it does deserve an article.)<br />

Use a text editor where possible, so you have lots of<br />

room for comments, and so you can use more of the<br />

special characters and have short descriptive names like<br />

loon, OC, $LIFE, or +2%. GO ahead-use A for ang-<br />

(<br />

(<br />

(<br />

h<br />

1 2 3<br />

(<br />

(<br />

4 5 6<br />

( v<br />

(<br />

(<br />

(<br />

(<br />

7 8 9<br />

(<br />

0<br />

(<br />

(<br />

MENU YES<br />

NO<br />

( ENTER EXIT<br />

( CONTINUE<br />

stroms. You can replace (xA2+yA2 ) A 1 /2 with d (x2+y2)<br />

without any of those hidden word processor control codes<br />

that are hostile toward compilers.<br />

The only drawback is that you may have to modify<br />

L>NAME (or another <strong>Forth</strong> word that takes a CFA or LFA<br />

to find the NFA). This is because it typically backs up until<br />

it encounters the first byte whose high bit is set. This<br />

drawback is minor, since if you don't make the modification,<br />

the only effect you will probably notice is that WORDS<br />

or decompiling words will print the names with special<br />

characters wrong. Just in case the high bit is set in an actual<br />

character of the name itself, L>NAME needs to see if the<br />

length indicated by the five least-significant bits agrees<br />

<strong>Forth</strong> Dimensions 23 March 1994 April

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!