LX4TH


Table of Contents

HPLX
HPX
MAIN_BATT
BACK_BATT
ENABLE_CHARGING
DISABLE_CHARGING
SET_BATT
SET_CONTRAST
SET_VOLUME
MODE80X25
MODE64X18
MODE40X25
MODE40X16
PORT_INFRARED
PORT_WIRE
PORT_OFF
SET_TIMER
HPLXGR
SetLabel
ClearLabel
DrawTitleBox
DrawShadowBox
PAGE
LargeFont
MediumFont
SmallFont
CR
HorizLine
VertLine
DrawLine
AT-XY
AT-GRXY
GraphicsOn
LoResGraphicsOn
GraphicsOff
Pen
Line
Move
DrawDot
Draw
DrawRectangle
SetFillMask
SetReplacementRule
StoreArea
PlaceArea
Clip
DotRead
LogOrig
EMIT
RAND
RANDOMIZE
RND

Collection of libraries of ForthCMP compiler for programming on HP100/200LX computers.

Pavel Zampach (zampach@volny.cz), 2002

HPLX

HPX

( -- )

Returns TRUE if program runs on HPxxLX

MAIN_BATT

( -- voltage )

Returns voltage (in miliVolts) of main battery

BACK_BATT

( -- voltage )

Returns voltage (in miliVolts) of backup battery

ENABLE_CHARGING

( -- )

Enables charging

DISABLE_CHARGING

( -- )

Disables charging

SET_BATT

( n -- )

n battery type ("Alka" or "NiCd")

Sets battery type

SET_CONTRAST

( c -- )

c contrast of display (0..15)

Sets contrast of display

SET_VOLUME

( v -- )

v volume of beeper (0..3)

Sets volume of beeper

MODE80X25

( -- )

Sets display resolution 80x20

MODE64X18

( -- )

Sets display resolution 64x18

MODE40X25

( -- )

Sets display resolution 40x25

MODE40X16

( -- )

Sets display resolution 40x16

PORT_INFRARED

( -- )

Switches serial port to infrared

PORT_WIRE

( -- )

Switches serial port to standard ("wired")

PORT_OFF

( -- )

Switches off serial port

SET_TIMER

( sec -- )

sec timeout in sec. (max. 3600)

Sets timeout

HPLXGR

Graphic library for HP100/200LX. This is port to FortCMP of original LXGRAPH by Curtis Cameron. Added some routines from J. A. Wrotniak's graphic library.

SetLabel

( n adr -- )

n number of label
adr address of text string

draws a label for function keys

ClearLabel

( n -- )

n number of label

wipes a label for function keys

DrawTitleBox

( x1 y1 x2 y2 adr cl -- )

x1 x-coord of left upper corner
y1 y-coord of left upper corner
x2 x-coord of right bottom corner
y2 y-coord of right bottom corner
adr address of title text string
cl says whether to clear first (boolean)

draws shadow box with title.

DrawShadowBox

( x1 y1 x2 y2 cl -- )

x1 x-coord of left upper corner
y1 y-coord of left upper corner
x2 x-coord of right bottom corner
y2 y-coord of right bottom corner
cl says whether to clear first (boolean)

draws shadow box.

PAGE

( -- )

clears screen and sets medium font.

LargeFont

( -- )

sets large fonts for text output.

MediumFont

( -- )

sets medium fonts for text output.

SmallFont

( -- )

sets small fonts for text output.

CR

( -- )

redefinition of standard Forth procedure.

HorizLine

( x1 y1 x2 -- )

x1 x-coord of origin
y1 y-coord of origin
x2 x-coord of end

draws horizontal line, using pen and line types previously set.

VertLine

( x1 y1 y2 -- )

x1 x-coord of origin
y1 y-coord of origin
y2 y-coord of end

draws verical line, using pen and line types previously set.

DrawLine

( x1 y1 x2 y2 -- )

x1 x-coord of origin
y1 y-coord of origin
x2 x-coord of end
y2 y-coord of end

draws line, using pen and line types previously set.

AT-XY

( x y -- )

redefinition of standard Forth procedure.

AT-GRXY

( x y -- )

is similar to AT-XY, but coords are in pixels.

GraphicsOn

( -- )

turns on 640x200 graphics and clears screen. Switch EMIT into graphic mode.

LoResGraphicsOn

( -- )

turns on HP95 compatible graphics and switch EMIT into graphic mode.

GraphicsOff

( -- )

turns off graphics and switch EMIT to standard console output.

Pen

( n -- )

n WHITE (0) or BLACK (1)

sets pen color.

Line

( n -- )

n 16-bit pattern

lines and rectangles will be drawn with pattern.

Move

( x y -- )

moves pen without drawing anything.

DrawDot

( x y -- )

draws one point.

Draw

( x y -- )

draws from old pen position to (x, y), using pen and line types previously set.

DrawRectangle

( x1 y1 x2 y2 fill -- )

x1 x-coord of left upper corner
y1 y-coord of left upper corner
x2 x-coord of right bottom corner
y2 y-coord of right bottom corner
fill 0=outline, 1=pen fill, 2=pattern fill

draws filled rectangle.

SetFillMask

( addr -- )

addr is pointer to 8 byte pattern

sets fill type for rectangles.

SetReplacementRule

( n -- )

n G_FORCE, G_AND, G_NOT, G_OR, G_XOR, G_FORCETEXT

sets rule for next drawing.

StoreArea

( x1 y1 x2 y2 addr -- )

x1 x-coord of left upper corner
y1 y-coord of left upper corner
x2 x-coord of right bottom corner
y2 y-coord of right bottom corner
addr have to be set to point to memory area large enough to hold the image

stores screen area into memory (in data segment).

PlaceArea

( x y addr repl -- )

x x-coord of left upper corner
y y-coord of left upper corner
addr point to memory
repl G_FORCE, G_AND, G_NOT, G_OR, G_XOR, G_FORCETEXT

places area from memory to screen. This routine has one more parameter then original Cameron's one (repl)!

Clip

( x1 y1 x2 y2 -- )

x1 x-coord of left upper corner
y1 y-coord of left upper corner
x2 x-coord of right bottom corner
y2 y-coord of right bottom corner

sets clip area.

DotRead

( x y -- c )

x x-coord
y y-coord
c color of pixel - WHITE (0) or BLACK (1)

reads the pixel color.

LogOrig

( x y -- )

x x-coord
y y-coord

sets logical origin of coords.

EMIT

( char -- )

This basic text output rutine is redefineted and so it is allowed to use all standard text output routines ( . ." .R ) in graphics mode too. Output is switched by GraphicsOn or LoResGraphicsOn and back by GraphicsOff.

RAND

Library for generating pseudo-random numbers. This file should be included before the application.

Pavel Zampach (zampach@volny.cz), 2002

RANDOMIZE

( -- )

initialize the seed for random numbers

RND

( n -- rnd )

n border of range
rnd pseudo-random number

returns pseudo-random number from range (0, n-1)