2 / 2 6 / 2 0 0 2 2 : 0 6 P M 2 / 2 6 / 2 0 0 2
1 6 3
N M I L - 5 0 0 0 1 - C H A N N E L S E R I A L C O M M U N I C A T I O N
F O R T H S A M P L E C O D E
COLD
HEX
: IS CONSTANT ;
FFE0 IS BASE-ADDR ( set card addresses )
0 BASE-ADDR + IS DATA
1 BASE-ADDR + IS STATUS
2 BASE-ADDR + IS CMMAND
3 BASE-ADDR + IS CNTROL
: INIT ( control command -- )
0 STATUS C! ( program reset )
CMMAND C! ( set command register )
CNTROL C! ( set control register )
;
: TDREADY? STATUS C@ 10 AND ; ( check if you can send )
: RDREADY? STATUS C@ 08 AND ; ( check if you've received )
: S-EMIT ( char -- )
BEGIN TDREADY? UNTIL ( wait until last char is done )
DATA C! ( send next char )
;
: S-KEY ( -- char )
BEGIN RDREADY? UNTIL ( wait until a char is here )
DATA C@ ( get it )
;
: S-?TERMINAL RDREADY? ; ( is a char here now ? )
: S-TYPE ( ca -- ) ( send a string )
COUNT ?DUP IF
( ca+1 n ) 0 DO
( ca+i ) COUNT S-EMIT LOOP
THEN
( ca+i ) DROP
;
: ~S-CR? ( CHAR -- CHAR 0 | 1 )
DUP 0D = IF SPACE 0 ELSE DROP 1 THEN ;
: S-BS ( ca ca+i -- ca f )
OVER SWAP U< IF
8 EMIT THEN 0 ;
: S-CHAR? ( ca+u ca' char -- ca+u ca'+1 f )
( ca+u ca' char ) DUP EMIT ( display char )
( ca+u ca' char ) OVER C! ( save char in buffer )
( ca+u ca' ) 1+ ( bump pointer )
( ca+u ca'+1 ) 2DUP U< ; ( buffer full ? )
Summary of Contents for NMIY-0031
Page 1: ...2 2 6 2 0 0 2 2 0 6 P M 1 NMIY 0031 Single Board Computer Covers NMIY 0031 V1 0 4 22 96 ...
Page 2: ...2 2 6 2 0 0 2 2 0 6 P M 2 ...
Page 6: ...2 2 6 2 0 0 2 2 0 6 P M 6 ...
Page 8: ...2 2 6 2 0 0 2 2 0 6 P M 8 ...
Page 14: ...2 2 6 2 0 0 2 2 0 6 P M 1 4 ...
Page 30: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 3 0 ...
Page 32: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 3 2 ...
Page 50: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 5 0 ...
Page 52: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 5 2 ...
Page 54: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 5 4 ...
Page 56: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 5 6 ...
Page 58: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 5 8 ...
Page 60: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 6 0 ...
Page 62: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 6 2 ...
Page 68: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 6 8 ...
Page 70: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 7 0 ...
Page 72: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 7 2 ...
Page 76: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 7 6 ...
Page 82: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 8 2 ...
Page 84: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 8 4 ...
Page 86: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 8 6 ...
Page 88: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 8 8 ...
Page 90: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 9 0 ...
Page 102: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 0 2 ...
Page 108: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 0 8 ...
Page 110: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 1 0 ...
Page 114: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 1 4 ...
Page 118: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 1 8 ...
Page 126: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 2 6 ...
Page 128: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 2 8 ...
Page 134: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 3 4 ...
Page 148: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 4 8 ...
Page 150: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 5 0 ...
Page 152: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 5 2 ...
Page 154: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 5 4 ...
Page 156: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 5 6 ...
Page 168: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 6 8 ...
Page 170: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 7 0 ...
Page 172: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 7 2 ...
Page 174: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 7 4 ...
Page 178: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 7 8 ...