This section documents a number of the words in the Quartus Forth library.
OpenResDB ( creator-id. type. -- DbOpenRef. )
Open a resource database with the specified creator ID and type; returns a database
handle.
use-resources ( creator-id. type. -- )
Opens a resource database with the specified creator-id and type; aborts with
an error if the resource database isn’t available. This is used to make external
resources available during compilation.
backlight ( bool -- )
A true argument will switch the backlight on; false switches it
off.
backlight? ( -- bool )
Returns the current on/off status of the backlight.
assert-level ( addr -- )
assert0( ( "…)" -- )
assert1( ( "…)" -- )
assert2( ( "…)" -- )
assert3( ( "…)" -- )
assert( ( "…)" -- ) \ alias for assert1(
Used as follows:
needs assert 1 assert-level ! : divide ( a b – a/b ) assert( dup 0 <> ) / ;
An assertion acts as a comment unless its assertion level (0, 1, 2, or 3) is less-than or equal-to the current value of assert-level. This gives you the ability to compile with assertions while developing and debugging, and ship with some or all assertions not present in the code.
The code within an assertion must have no side-effects, and no net effect on the stack contents.
itemid ( &event. -- itemid )
When passed the absolute address of an event structure, returns the item ID
of the event (button/control number, menu item, etc.)
coords@ ( -- y x )
Returns the pen coordinates of the last received event.
CreateDB ( resDB? type. creator. &zname zlen -- )
Creates a new database with the name, type, and creator specified. If resDB?
is true, the resulting database will be a ‘resource’ database. The string
at &zname must be zero-delimited.
CloseDB ( dbr. -- )
Close the database specified by the database handle dbr.
OpenDB ( mode zaddr len -- dbr. )
Open a database by name, with a specified access mode. The string at zaddr
must be zero-delimited.
UseCard ( n -- )
Set OpenDB to use a different memory card. This defaults to 0 and can
normally be left unchanged.
dm* ( d n -- d*n )
Multiply d by n. Returns a double-cell value.
dm/ ( d +n -- d/n )
Divide d by +n. Returns a double-cell value.
ud/mod ( ud1 ud2 -- udr udq )
Divides ud1 by ud2, returning the double-cell values udr
(remainder) and udq (quotient).
dmod ( d +n -- +m )
Returns a single-cell value +m, which is the remainder of the division
of d by +n.
admod ( d +n -- +m)
Like dmod, but m=n when result=0.
FieldFocus ( fieldid -- )
Gives focus to the field specified by fieldid.
string>Field ( c-addr u fieldID -- Err )
Puts the string specified by c-addr u into the field specified by fieldID.
Return non-zero on failure.
Field>string ( c-addr fieldID -- len )
Copies the contents of the field specified by fieldID into memory at
c-addr. The buffer at c-addr must be large enough to hold the
field contents. Returns len, the number of characters copied.
FlushQueue ( -- )
Flushes the event queue by processing any stored events. The Fld* PalmOS
systraps used by Field>string, etc. generate events which will fill
the event queue unless processed. Words requiring this handling call FlushQueue
themselves.
PopupForm ( formID -- )
Display the specified form as a popup over the current form.
until-drawn ( formID -- )
Returns when the specified form has been drawn on the screen.
SetLabel ( &string. controlid -- )
Sets the control specied by controlid to have the label specified by
the zero-delimited string at the absolute address &string.
SetControlValue ( flag controlid -- )
Sets the control specified by controlid (e.g. a checkbox or other object)
to the value of flag.
GetControlValue ( controlid -- flag )
Returns the current value of the control specified by controlid.
GetObjectPtr ( objectid -- ptr. )
Given an object ID, returns the object pointer.
GetObjectIndex ( objectid -- index )
Given an object ID, returns the object index.
place ( a1 n1 a2 -- )
Places the string a1 n1 as a counted string at a2. Counted strings
have their length in the their first character.
place, ( a1 n1 -- )
Places the string at a1 n1 at here.
bounds ( a n -- a+n a )
Computes the loop bounds for a string.
>lower ( C -- c )
Converts a character to lower-case.
>upper ( c -- C )
Converts a character to upper-case.
append ( at ut as us -- at ut+us )
Appends string s to the end of string t.
array ( cells <name> -- )
Defines array words; allocates cells space. The defined array words have
the stack picture ( index – addr ).
under+ ( n1 x1 n2 -- n1+n2 x1 )
Adds n2 to n1.
enum ( n "name" -- )
Used to create enum structures, as follows:
0 enum Item Item Apple Item Orange Item Grape
Orange . 1 ok Apple . 0 ok Grape . 2 ok
[end] ( -- )
Skips the rest of a file.
[defined] ( "name" – flag )
Checks to see if name is a defined word; returns flag accordingly.
Used with [if], [else], and [then].