Link here

Forth v4.4 Function Summary

This document provides and overview by way of subject sorted lists of the Forth firmware functions available in v4.4x Forth for the QCard, QScreen Controller, and Handheld Controller.

The firmware functions are described in detail in their appropriate glossaries:

On this page you'll find a categorized list of all library functions (i.e., words) in the V4.4x kernel. Unless otherwise noted, their full definitions are found in the main glossary, Forth V4.4 Function Glossary.

For help in understanding the notation used in the function definitions in the glossaries, consult the description of stack symbols, abbreviations and naming conventions.

If you have been programming the QED Board, Panel-Touch, or QVGA Controllers and are now using this newer v4.4x kernel to program the QCard, Handheld or QScreen controllers, you might want to consult Forth V4.4 Changes from Prior Kernels for a list of differences between this kernel and prior versions.

Software development in v4.4 Forth uses the Mosaic IDE Integrated Development Environment; this is the same IDE used for software development in C. While Forth programmers will not use the IDE's C compiler, the IDE provides a full-featured text editor and customized terminal for rapid Forth code downloads and interactive Forth debugging sessions with the 68HC11 microcontroller board.

 

ARRAY

2ARRAY.FETCH COPY.ARRAY MAX#DIMENSIONS
2ARRAY.STORE DELETED PF.STACK.FRAME
?ARRAY.SIZE DIM.CONSTANT.ARRAY: SWAP.ARRAYS
?DIMENSIONS DIMENSIONED ZERO.ARRAY
ARRAY.PF FILL.ARRAY [0]
ARRAY: BLANK.ARRAY []
 

ASSEMBLER

These words are described in detail in the Forth V4.4 Assembler Glossary.

>ASSM BLT DIR LSLA SBCA
>FORTH BMI ELSE, LSLB SBCB
ABA BNE END-CODE LSLD SEC
ABX BPL END.CODE LSR SEI
ABY BRA ENDIF, LSRA SEV
ADCA BRCLR EORA LSRB STAA
ADCB BRN EORB LSRD STAB
ADDA BRSET EQ LT STD
ADDB BSET EXT MI STOP
ADDD BSR FDIV MUL STS
AGAIN, BVC GE NE STX
ALWAYS BVS GT NEG STY
ANDA CALL HI NEGA SUBA
ANDB CBA HS NEGB SUBB
ANY.BITS.CLR CC IDIV NEVER SUBD
ANY.BITS.SET CLC IF, NOP SWI
ASL CLI IMM ORAA TAB
ASLA CLR INC ORAB TAP
ASLB CLRA INCA PL TBA
ASLD CLRB INCB PSHA TEST
ASR CLV IND,X PSHB THEN,
ASRA CMPA IND,Y PSHX TPA
ASRB CMPB INH PSHY TST
ASSEMBLER CODE INS PULA TSTA
BCC COM INX PULB TSTB
BCLR COMA INY PULX TSX
BCS COMB JMP PULY TSY
BEGIN, CPD JSR REL TXS
BEQ CPX LDAA REPEAT, TYS
BGE CPY LDAB ROL UNTIL,
BGT CS LDD ROLA VC
BHI DAA LDS ROLB VS
BHS DEC LDX ROR WAI
BITA DECA LDY RORA WHILE,
BITB DECB LE RORB XGDX
BLE DES LO RTI XGDY
BLO DEX LS RTS
BLS DEY LSL SBA
 

C DEBUGGING

These words are described in detail in Forth V4.4 Functions for C Debugging.

=CHAR CHAR FP_QtoC MAIN
=FLOAT CHAR* FPtoString PrintFP
=INT DO[] INT
=LONG FLOAT INT*
C$>COUNTED$ FLOAT* LONG
CALL.CFN FP_CtoQ LONG*
 

COMPARISON

< 0= DMAX U< XU<
<> 0> DMIN U> XU>
<= D< DRANGE UMAX
= D<> DU< UMIN
> D= DU> URANGE
>= D> MAX X<>
0< D0<> MIN X=
0<> D0= RANGE XRANGE
 

CONTROL STRUCTURES

+LOOP ENDIFTRUE I+ J\I REPEAT
AGAIN ENDOF IF K THEN
BEGIN EXIT IFTRUE LEAVE UNLOOP
CASE FOR IXN- LOOP UNTIL
DO I IXN+ NEXT URANGE.OF
ELSE I' IXU- OF WHILE
ENDCASE I- IXU+ OTHERWISE
ENDIF I\J J RANGE.OF
 

DEBUG, TRACE, AND BENCHMARK

(BENCHMARK:) DEFAULT.TRACE.ACTION IS.TRACE.ACTION
BENCHMARK: DUMP.REGISTERS SINGLE.STEP
BREAK F*/COUNTER TRACE
DEBUG F+COUNTER
 

DEFINITION

: CODE INTEGER: VARIABLE
; CONSTANT LOCALS{ XADDR:
<DBUILDS DOES> MATRIX: XCONSTANT
<VBUILDS DOUBLE: NO.OP XVARIABLE
2CONSTANT END.CODE REAL:
2VARIABLE END-CODE REDEFINE
ADDR: FCONSTANT REGISTER:
ARRAY: FVARIABLE USER
 

DEVICE DRIVERS

Analog I/O Drivers

(A/D8.MULTIPLE) A/D8.OFF A/D8.SAMPLE
(A/D8.SAMPLE) A/D8.ON
A/D8.MULTIPLE A/D8.RESOURCE
 

Digital I/O Drivers

PORTA PORTD PORTE
PORTA.DIRECTION PORTD.DIRECTION
 

High Current Drivers

CLEAR.HIGH.CURRENT SET.HIGH.CURRENT
 

Keypad and Display Drivers

$>DISPLAY CLEAR.DISPLAY IS.DISPLAY.ADDRESS
(UPDATE.DISPLAY) COMMAND>DISPLAY KEYPAD
?KEYPAD DISPLAY.BUFFER LINES/DISPLAY
?KEYPRESS DISPLAY.HEAP PUT.CURSOR
BUFFER.POSITION DISPLAY.OPTIONS UPDATE.DISPLAY
BYTES>DISPLAY GARRAY.XPFA UPDATE.DISPLAY.LINE
CHAR>DISPLAY INIT.DISPLAY
CHARS/DISPLAY.LINE IS.DISPLAY
 

Real-Time Clock

READ.WATCH SET.WATCH
 

Serial I/O Drivers (See also SERIAL I/O ROUTINES)

#INPUT.CHARS INIT.RS485 SERIAL1.AT.STARTUP
#OUTPUT.CHARS INIT.SERIAL2 SERIAL1.RESOURCE
?KEY1 KEY1 SERIAL2.AT.STARTUP
?KEY2 KEY2 SERIAL2.RESOURCE
BAUD1.AT.STARTUP PARITY TRANSMITTING
BAUD2 PARITY.IN USE.SERIAL1
DISABLE.SERIAL2 PARITY.OUT USE.SERIAL2
EMIT1 RS485.RECEIVE
EMIT2 RS485.TRANSMIT
 

SPI Drivers

BUFFER>SPI SPI.OFF
INIT.SPI SPI.RESOURCE
 

Stepper Motor Drivers

CREATE.RAMP SPEED.TO.DUTY STEP.MANAGER
 

DICTIONARY

' CFA.PTR FORTH NP VOCABULARY
(HERE) CFA>NAME HERE NPAGE VP
, CFA>NFA ID. ON.FORGET WIDTH
?HAS.PFA CFA>PFA LATEST PFA>NAME WORDS
ALLOT CONTEXT LINK PFA>NFA
ANEW CURRENT NFA.FOR V,
ASSEMBLER DEFINITIONS NFA>CFA VALLOT
AXE DP NFA>LFA VC,
C, DPAGE NFA>PFA VFORTH
CFA.FOR FORGET NHERE VHERE
 

FLASH MANAGEMENT

ALL.TO.FLASH PAGE.TO.FLASH TO.FLASH
DOWNLOAD.MAP PAGE.TO.RAM WHICH.MAP
ENABLE.DOWNLOAD STANDARD.MAP
 

FLOATING POINT COMPARISON

F< F= F0<> F0> FMIN
F<> F> F0<= F0>=
F<= F0< F0= FMAX
 

FLOATING POINT CONSTANTS

1/INFINITY 1/PI 360/2PI LOG10(2) SQRT(2)
-1/INFINITY 1/SQRT(2) INFINITY ONE TEN
1/LN(2) 1/TEN -INFINITY PI ZERO
1/LOG10(2) 2PI/360 LN(2) PI/2
 

FLOATING POINT MATH

>DEGREES F** FALOG2 FLOT FTAN
>RADIANS F/ FASIN FNEGATE INT.FLOOR
1/F F^N FATAN FP.ERROR INT.PART
10^N F+ FCOS FP.POP OVERFLOW
DFIXX F2* FINT FP.PUSH RANDOM#
DFLOT F2/ FIXX FRANDOM RANDOM.GAUSSIAN
DINT FABS FLN FRTI UFIXX
DINT.FLOOR FACOS FLOG10 FSCALE UFLOT
F- FALN FLOG2 FSIN UNDERFLOW
F* FALOG10 FLOOR FSQRT
 

FLOATING POINT STRING CONVERSION AND I/O

$>F FILL.FIELD FP&STRING.POP NO.SPACES
ASK.FNUMBER FIXED FP&STRING.PUSH RIGHT.PLACES
F. FIXED. FP.DEFAULTS SCIENTIFIC
F>FIXED$ FLOATING LEFT.PLACES SCIENTIFIC.
F>FLOATING$ FLOATING. MANTISSA.PLACES TRAILING.ZEROS
F>SCIENTIFIC$ FNUMBER NEXT.NUMBER
 

HEADERLESS FUNCTIONS: (See their glossary entries for details)

BUFFER>SPI CALC.CHECKSUM
 

HEAP

.HANDLES CURRENT.HEAP HANDLE.PTR ROOM
?HANDLE.SIZE DEALLOCATED HEAP.PTR START.HEAP
+CURRENT.HEAP DUP.HEAP.ITEM HEAP.STRUCTURE.PF TO.HEAP
+HEAP.HANDLE FREE.HANDLE IS.HEAP TRANSFER.HEAP.ITEM
+HEAP.PAGE FROM.HEAP RECOVER.HANDLE
ALLOCATED H.INSTANCE: RESIZE.HANDLE
 

INTERPRETER AND COMPILER

#FIND ; 2LITERAL EXECUTE QUERY
#TIB ?IMMEDIATE ASCII FIND QUIT
( [ BACKTRACK HAS.PFA RECURSE
(#FIND) [COMPILE] BLK IMMEDIATE SMUDGE
(COMPILE.CALL) \ CALL INTERPRET TIB
(CREATE) ] COMPILE LITERAL UNIQUE.MSG
(EXECUTE) >ASSM COMPILE.CALL LOCALS{ WORD
(FIND) >FORTH CREATE PARSE
: >IN EVALUATE POCKET
 

INTERRUPTS

ATTACH IC1.ID OC4.ID
CLOCK.MONITOR.ID IC2.ID PULSE.EDGE.ID
COP.ID IC3.ID PULSE.OVERFLOW.ID
DISABLE.INTERRUPTS IC4/OC5.ID RTI.ID
ENABLE.INTERRUPTS ILLEGAL.OPCODE.ID SCI.ID
FP&STRING.POP IRQ.ID SPI.ID
FP&STRING.PUSH OC1.ID SWI.ID
FP.POP OC2.ID TIMER.OVERFLOW.ID
FP.PUSH OC3.ID XIRQ.ID
 

LOGICAL

AND OR XOR BOOLEAN COMPLEMENT NOT TRUE FALSE
 

MASS MEMORY

BLOCK LIMIT PREV UFIRST UREAD/WRITE
BUFFER LINK_FILE_IO READ/WRITE ULIMIT USE
FIRST OFFSET SCR UPDATE
 

MATH

- 1XN+ 4XN- DABS SIGNED.D>S XALIGN
* 2- 4XN+ DNEGATE U*/MOD XD-
*/ 2* 8* DSCALE U/ XD+
*/MOD 2/ 8/ LOG2 U/MOD XN-
/ 2+ 8XN+ M* U>D XN+
/MOD 2XN- ABS M/MOD U2/ XU-
|X1-X2|>U 2XN+ D- MOD UD*S XU+
+ 3* D+ NEGATE UM*
1- 4- D>S RANDOM UM/MOD
1+ 4* D>S? RANDOM# UMOD
10* 4/ D2* S>D X1-X2>D
1XN- 4+ D2/ SCALE X1-X2>N
 

MATRIX DIMENSIONING AND ACCESS

?DIM.MATRIX M[] MATRIX->V
?MATRIX.SIZE M[]! PF.STACK.FRAME
DELETED M[]@ REDIMMED
DIM.CONSTANT.MATRIX: MATRIX.PF
DIMMED MATRIX:
 

MATRIX EDITING

COLUMN.CONCATENATE ROW.CONCATENATE ROW/COL.INSERTED
COLUMN.TRUNCATE ROW/COL.DELETED SELECT.COLUMNS
 

MATRIX I/O

LOAD.MATRIX M.. MATRIX
M. M.PARTIAL
 

MATRIX MATH

?DETERMINANT M*MT S*MATRIX
ALL.COLUMNS.SCALED MATRIX- S/MATRIX
ALL.ROWS.SCALED MATRIX* S+MATRIX
COPY.MATRIX MATRIX.ELEMENT* S-MATRIX
FFT MATRIX.ELEMENT/ SOLVE.EQUATIONS
IFFT MATRIX.MAX SWAP.MATRIX
INVERTED MATRIX.MIN TRANSFORM.MATRIX
IS.IDENTITY MATRIX.SUM TRANSPOSED
L.INVERTED MATRIX.VARIANCE U.INVERTED
LEAST.SQUARES MATRIX+ ZERO.MATRIX
LU.BACKSUBSTITUTION MT*M
LU.DECOMPOSITION RANDOMIZED
 

MATRIX ROW/COL OPERATIONS

ROW/COL- ROW/COL.FILL ROW/COL/
ROW/COL* ROW/COL.INSERTED ROW/COL+
ROW/COL*+ ROW/COL.IS.UNITY.LENGTH ROW/COL->V
ROW/COL.ALL= ROW/COL.MAX S.ROW/COL-
ROW/COL.ANY= ROW/COL.MIN S.ROW/COL*
ROW/COL.CENTERED ROW/COL.SUM S.ROW/COL/
ROW/COL.COPY ROW/COL.SWAP S.ROW/COL+
ROW/COL.DELETED ROW/COL.TRANSFORMED S.ROW/COL<
ROW/COL.DOT.PRODUCT ROW/COL.VARIANCE S.ROW/COL>
 

MEMORY

! (EE2!) |2!| CHANGE.BITS MOVE.MANY
(!) (EEC!) |2@| CLEAR.BITS OFF
(@) (EEF!) |F!| CMOVE ON
(+!) (EEX!) |F@| CMOVE.IN.PAGE SET.BITS
(+C!) (F!) |X!| CMOVE.MANY THIS.PAGE
(2!) (F@) |X@| DEFAULT.PAGE TO
(2@) (MOVE) +! ERASE TOGGLE.BITS
(C!) (PAGE.LATCH) +C! F! X!
(C@) (SET.BITS) 2! F@ X@
(CHANGE.BITS) (TOGGLE.BITS) 2@ FILL
(CLEAR.BITS) (X!) BLANK FILL.MANY
(CMOVE) (X@) C! MOVE
(EE!) @ C@ MOVE.IN.PAGE
 

MEMORY MAP

DP S0 USE.PAGE
NP UPAD UTIB
R0 UPOCKET VP
 

MULTITASKING AND TIME-KEEPING

(STATUS) INSTALL.MULTITASKER RESOURCE.VARIABLE:
*100US=TIMESLICE.PERIOD KILL SEND
?GET MAILBOX: SERIAL
?RECEIVE MICROSEC.DELAY SERIAL.ACCESS
?SEND NEXT.TASK SET.WATCH
ACTIVATE PAUSE START.TIMESLICER
ASLEEP READ.ELAPSED.SECONDS STATUS
AWAKE READ.ELAPSED.TIME STOP.TIMESLICER
BUILD.STANDARD.TASK READ.WATCH TASK:
BUILD.TASK RECEIVE TASK'S.USER.VAR
DISK.RESOURCE RELEASE TIMESLICE.COUNT
GET RELEASE.AFTER.LINE UP
HALT RELEASE.ALWAYS
INIT.ELAPSED.TIME RELEASE.NEVER
 

NUMERIC CONVERSION

# BASE FP&STRING.PUSH PAD
#> CONVERT HEX SIGN
#S DECIMAL HOLD
<# DIGIT NEXT.NUMBER
ASK.NUMBER FP&STRING.POP NUMBER
 

OPERATING SYSTEM

#USER.BYTES COLD.ON.RESET RESTORE
((ERROR)) CR.BEFORE.MSG RP!
(ABORT) CUSTOM.ABORT SAVE
(ERROR) CUSTOM.ERROR SET.BOOT.VECTOR
(RP) DEFAULT.REGISTER.INITS STANDARD.RESET
ABORT INIT.VITAL.IRQS.ON.COLD STATE
ABORT" INSTALL.REGISTER.INITS UABORT
AUTOSTART NO.AUTOSTART UERROR
CALC.CHECKSUM NO.VITAL.IRQ.INIT WARM
CLEAR.BOOT.VECTOR PRIORITY.AUTOSTART
COLD R0
 

SERIAL I/O ROUTINES: Character, String, and Number I/O

(see also Serial I/O Drivers in the DEVICE DRIVERS Section)

. D.R QUIET
." DIN RECEIVE.HEX
.R DUMP SPACE
.S DUMP.INTEL SPACES
? DUMP.S1 SPAN
?KEY DUMP.S2 TAB.WIDTH
ASK.FNUMBER EMIT TYPE
ASK.NUMBER EXPECT U.
BEEP ID. U?KEY
CFA>NAME INPUT.STRING UD.R
CHARS/LINE KEY UEMIT
COUNT.TYPE NEXT.WORD UKEY
CR PAUSE.ON.KEY XMIT.DISABLE
D. PFA>NAME
 

SOURCE FORM ROUTINES (SEE SOURCE FORM GLOSSARY)

These utilities are provided as source code. They are described in detail in Forth V4.4 Source-form Functions.

.LINE EMPTY.BUFFERS LOAD
--> FLUSH SAVE.BUFFERS
>L INIT.UREAD/WRITE SUBSTRING
2xN.MATRIX* IS.RAMDISK THRU
3xN.MATRIX* LINE>$
BLOCK.BUFFERS LIST
 

STACK

(SP) 2SWAP DUP>R NDROP SWAP
.S 3 F.OVER.N NEEDED TUCK
?DUP 3DROP F>R NIP X.OVER.N
>< 3DUP F2DROP OVER X>R
>R 4 F2DUP PF.STACK.FRAME X2DROP
0 4DROP FDROP PICK X2DUP
0\0 4DUP FDUP R@ XDROP
1 D.OVER.N FDUP>R R> XDUP
-1 D>R FOVER R>DROP XDUP>R
2 DEPTH FPICK ROLL XOVER
-2 DPICK FR@ -ROLL XPICK
2DROP DR@ FR> ROT XR@
2DUP DR> FR>DROP -ROT XR>
2DUP>R DR>DROP FRAME.DROP S0 XR>DROP
2OVER DROP FROT SP! XROT
2ROT DUP FSWAP STACK.FRAME XSWAP
 

STRING

" ," COUNT SKIP>
$COMPARE /STRING SCAN -TRAILING
$MOVE BL SKIP UPPER.CASE
 

STRUCTURES

+CURRENT.HEAP DEALLOCATED MEMBER-> STRUCTS->
+HEAP.HANDLE DOUBLE-> OR.TYPE.OF: STRUCTURE.BEGIN:
+HEAP.PAGE DOUBLES-> PAGE-> STRUCTURE.END
ADDR-> FIELD REAL-> TYPE.END
ADDRS-> H.INSTANCE: REALS-> TYPE.OF:
ALLOCATED HEAP.STRUCTURE.PF RESERVED V.INSTANCE:
BYTE-> HNDL-> SIZE.OF XADDR->
BYTES-> INT-> STRING-> XADDRS->
D.INSTANCE: INTS-> STRUCT-> XHNDL->
 

VECTOR MATH

2V.TRANSFORM S.V- S.V< V.ANY= V.SWAP
COL->V S.V* S.V> V.COPY V.TRANSFORM
DOT.PRODUCT S.V.ALL= V- V.FILL V/
MATRIX->V S.V.ANY= V* V.MAX V+
ROW/COL->V S.V/ V*+ V.MIN V<
ROW->V S.V+ V.ALL= V.SUM V>
 
This page is about: Subject Sorted Lists of Library Routines, FORTH Words, V4.4 Forth Glossaries – This page provides subject sorted lists of the library routines, called "Words" in FORTH, found in the V4.4 Forth glossaries.
 
 
Navigation