The Custom Graphics Engine language is patterend after the Forth-79 Standard:
You can find it by searching or you can look here:
http://www.trs-80.com/trs80-sw.htm
Be careful. There are similar-looking words used in DSAs that are a bit different from the Forth-79 Standard.


Word Definitions:

In these definitions the string <rr> represents a
relative cell name from the following list:
F4L2, F4L1, F4, F4R1, F4R2
F3L2, F3L1, F3, F3R1, F3R2
F2L1, F2, F2R1
F1L1, F1, F1R1
L0L1, F0, F0R1


First the words likely to be used by designers to
draw their own floors, etc.

====================================================
<rr> ( . . . relativeCellNumber)

Fetch the relative Cell number of a cell.
====================================================
<rr>xy ( . . . x-coordinate y-coordinate )

Fetch the x- and y-coordinates of a cell.
====================================================
<rr>Contents ( . . . object )

Get the objectID of the first object in the cell.
====================================================
Return ( . . . )

Terminates current function and returns control
to the caller. The stack is unchanged.
====================================================
CurrentSkin ( . . . skinNumber)

The runtime calls your code for each cell that has
a non-zero skin number. Your code can determine
which skin is being drawn with this word. This
would be handy if you use the same code to draw
several different skins.
====================================================
CurrentCell ( . . . relativeCellNumber)

The runtime calls your code for each cell that has
a non-zero skin number. Your code can determine
which cell being drawn with this word. This
would be handy if you use the same code to draw
several different cells.

====================================================
WallGraphicID ( skinNumber . . . wallGraphicID )

Get the Wall Graphic ID associated with a Skin Number.
====================================================
FloorGraphicID ( skinNumber . . . floorGraphicID )

Get the Floor Graphic ID associated with a Skin Number.
====================================================
MiddleGraphicID ( skinNumber . . . middleGraphicID )

Get the Middle Graphic ID associated with a Skin Number.
====================================================
CeilingGraphicID ( skinNumber . . . ceilingGraphicID )

Get the Ceiling Graphic ID associated with a Skin Number.
====================================================
WallMaskID ( skinNumber . . . wallMaskID )

Get the Wall Mask ID associated with a Skin Number.
====================================================
FloorMaskID ( skinNumber . . . floorMaskID )

Get the Floor Mask ID associated with a Skin Number.
====================================================
MiddleMaskID ( skinNumber . . . middleMaskID )

Get the Middle Mask ID associated with a Skin Number.
====================================================
CeilingMaskID ( skinNumber . . . ceilingMaskID )

Get the Ceiling Mask ID associated with a Skin Number.
====================================================
WallDecorationID ( skinNumber decorationNumber . . . wallDecorationGraphicID )

Get the Graphic ID associated with a particular wall
decoration for a particular skin.
====================================================
DrawCustomGraphic ( graphicID maskID maskNumber . . . )

This is the basic operation for drawing floors, ceilings,
and walls. The graphicID specifies the bitmap to be
sued as a source graphic and the mask specifies what
part of that graphic is to be drawn and where it is to
be drawn in the viewport.
====================================================
DrawCustomDecoration ( decorationGraphicID decorationNum locationNum . . .)

This is the basic operation for drawing 'decoration' graphics.
The decorationGraphicID specifies which graphic to use (for
example, a green pushbutton) and the decoration number
specifies which view of that decoration is to be used (for
example, the view at distance 2). The locationNum specifies
where in the viewport the decoration is to be drawn.
====================================================
BitmapInfo ( BitmapID . . . width height )

Get the size of a bitmap. Width and height are in pixel units.
Height is a derived parameter. All we know is the width and total
size of the graphic. So we compute the height by dividing the
size by the width.
=====================================================


The rest of these words are mostly used for the default drawing
of skin 0. But you will find that some are useful.




====================================================
<rr>DoorRecordIndex ( . . . doorRecordIndex )

Fetch the index of the door record for a cell
====================================================
<rr>DoorState ( . . . doorState )

Fetch the state of a door (open, closed, bashed, etc)
====================================================
StdDoorGraphicsF3 ( . . . 2 )
StdDoorGraphicsF2 ( . . . 1 )
StdDoorGraphicsF1 ( . . . 0 )

Get the doorGraphicIndex for the three
different distances.
====================================================
StdDoorRects<rr> ( . . . doorRectangleIndex )

Get the index of the rectangle used to draw a
door in the various cells.
====================================================
StdDrawSeeThruDoorEdge ( . . . )

Draw a 'See-Through-Walls" hole with a stone
wall on the far side.
====================================================
StdDrawDoor ( doorRecordIndex
doorState
doorGraphicIndex
doorRectangleIndex . . . )

Draw a standard door facing the party.
====================================================
DrawOrder<nnn> ( . . . 0drawingOrder )

A hexadecimal number that specifies in what order
to draw room objects. The digits of the number are
interpreted from lesast significant twoards
most significant. A digit of 1 means the objects
to the far left, 2=far right, 3=near right,
4=near left. A 0 means draw nothing.
====================================================
Alcove ( . . . flag )

flag will be set to 1 if the most recently drawn
wall decorations include an Alcove. Else 0.
====================================================
HasDecoration ( relativeCellNumber sideOfWall . . . flag)

Result is a 1 if the specified cell has any wall decorations
on the specified side (as viewd by party). Side=0 means
right side, 1=side facing party, 2=left side.
Else flag is zero.
====================================================
LeaveMortarJoint ( . . . )

Causes the next wall text to NOT erase the mortar
joint in the wall before drawing the text.
====================================================
SeeThroughWalls ( . . . flag)

Flag is set to 1 if the party can currently see
through walls. Else zero.
====================================================
WallDecorationRight ( . . . 0)
WallDecorationMiddle ( . . . 1)
WallDecorationLeft ( . . . 2)

The index of which side of a wall cell we are talking
about. Right, middle, and left are as seen by the
party. There is no index for the far side.
====================================================
Wall<rr>Front ( . . . relativeWallNumber)
Wall<rr>Right ( . . . relativeWallNumber)
Wall<rr>Left ( . . . relativeWallNumber)

Get the relative wall numbers for the cells
at distances 1, 2, and 3.
====================================================
StdWallBitmap<rr> ( . . . wallBitmapIndex)

Get the internal bitmap index for any of the
various cells at distances 0, 1, 2, and 3.
====================================================
StdWallRectangle<rr> ( . . . wallRectangleIndex)

Get the drawing rectangle index for any of the
various cells at distances 0, 1, 2, and 3.
====================================================
StdFloorPitRectangle<rr> ( . . . floorPitRectangleIndex)

Get the drawing rectangle index for drawing a
pit in any of the cells at distance 0, 1, 2, and 3.
====================================================
StdTeleporterRectangle<rr> ( . . . teleporterRectangleIndex)

Get the drawing rectangle index for drawing a
teleporter in the various cess at distance 0,
1, 2, and 3.
====================================================
FloorDecorationGraphicOrdinal<rr> ( . . . floorGraphicOrdinal)

Get the graphic ordinal for the floor decoration
for any of the various cells. Zero if none.
====================================================
StdStairFacingDownGraphic<rr> ( . . . indexOfStairGraphic )

Get the index of the stairs down graphic for any of
the various cells at distance 0, 1, 2, and 3.
====================================================
StdStairFacingUpGraphic<rr> ( . . . indexOfStairGraphic )

Get the index of the stairs up graphic for any of
the various cells at distance 0, 1, 2, and 3.
====================================================
StdStairFacingDownRectangle<rr> ( . . . indexOfStairRectangle)

Get the index of the drawing rectangle for drawing
stairs going down in any of the various cells.
====================================================
StdStairFacingUpRectangle<rr> ( . . . indexOfStairRectangle)

Get the index of the drawing rectangle for drawing
stairs going up in any of the various cells.
====================================================
StdStairEdgeGraphic<rr> ( . . . stairGraphicNumber )

Get graphic number of stair graphic for a stairway
seen on edge in the various cells.
====================================================
StdStairEdgeRect<rr> ( . . . indexOfStairRectangle )

Get the index of the rectangle used to draw a stairway
as seen on edge in the various cells.
====================================================
StdDoorFacingTopTrackBitmap<rr> ( . . . indexOfDoorBitmap )

Get the index of a door bitmap for drawing the top
frame of a door seen at F1 or F2.
====================================================
StdDoorFacingTopTrackRect<rr> ( . . . indexOfDoorRectangle )

Get the index of a door Rectangle for drawing the
top of the door frame at distances 1 or 2.
====================================================
StdDoorEdgeFrameRectF0 ( . . . indexOfDoorRectangle )

Get the index of a door rectangle used to draw the
door edge at F0.
====================================================
StdDoorFacingFrameLeftBitmap<rr> ( . . . indexOfDoorBitmap )

Get the index of a door bitmap used to draw the
left side of the door frame for various cells
at distance 1, 2, and 3.
====================================================
StdDoorEdgeFrameBitmapF0 ( . . . indexOfDoorBitmap)

Get the index of a door bitmap used to draw
the door frame seen on edge in cell F0.
====================================================
StdDoorFacingFrameRect<rr> ( . . . indexOfDoorRectangle)

Get the index of a door rectangle used to draw
a doorframe in the various cells at
distances 1, 2, and 3.
====================================================
StdBltShapeToViewport ( indexOfBitmap indexOfRectangle . . . )

Draw the specified bitmap using the specified rectangle
to determine the drawing location. Use the transparent
color as a mask.
====================================================
StdMirrorShapeToViewport ( indexOfBitmap indexOfRectangle . . .)

Draw a mirror image of the specified bitmap using the
specified rectangle to determine the drawing location.
Use the transparent color as a mask.
====================================================
StdGraphicToViewport

Draw the specified bitmap using the specified rectangle
to determine the drawing location. No transparency.
====================================================
StdMirrorGraphicToViewport ( graphicNumber indexOfRectangle . . . )

Draw a mirror image of the graphic using the rectangle
to determine the drawing location. No transparency.
====================================================
GetDecoration0 ( relativeCellNumber . . . flag )

Get the status of special cells:
Pit - zero means pit is open
Teleporter - zero means teleporter is not visible
Stairs - zero means stairs go down.
====================================================
DoorSwitch ( relativeCellNumber . . . flag)

Get status of door cell.
flag set non-zero if the door has a switch.
====================================================
StdDrawDoorSwitch ( 1 0 . . . ) // Draw switch at F3R1
StdDrawDoorSwitch ( 1 2 . . . ) // Draw switch at F2
StdDrawDoorSwitch ( 1 3 . . . ) // Draw switch at F1

Draw a switch on a door. (Don't ask questions!).
====================================================
StdDrawTeleporter ( indexOfTeleporterRectangle indexOfWallRectangle . . .)

Draw a teleporter.
====================================================
StdDrawRoomObjects ( firstObject x y relativeCellNumber drawingOrder . . .)

Draw the objects contained in a cell. Use the drawing order
to determine which positions will be drawn. For example,
when drawing a door you should draw the far objects, then
the door, then the near objects.
====================================================
StdDrawCeilingPit ( relativeCellNumber x y ... )

Draw a pit in the ceiling of the cell. This word
first determines if a pit exists and if not then
it does nothing. So you cannot draw a pit where none
exists. Sorry, that would require an extension.
====================================================
StdDrawFloorDecoration ( relativeCell floorGraphicOrdinal ... )

Draw the floor decoration for a cell.
====================================================
StdDrawWallText (relativeCellNumber
wallDecorationPos
relativeWallNumber ... )

Draw the wall text. The wallDecoration pos is
wallDecorationRight, Front, or Left as seen
by the party. RelativeWallNumber is Wall<rr>Right, Middle,
or Left.
====================================================
StdDrawWallDecoration (relativeCellNumber
wallDecorationPos
relativeWallNumber ... )

Draw the wall decoration. The wallDecoration pos is
wallDecorationRight, Front, or Left as seen
by the party. RelativeWallNumber is Wall<rr>Right, Middle,
or Left.
====================================================
StdBltShape // (bitmap rectangle ... )

The bitmap is drawn at the location specified by
the rectangle with transparency.
====================================================
StdAllocateDerivedGraphic ( derivedGraphicNum . . . )

Memory space is allocated for the specified graphic number.
====================================================
StdBitmapViewport ( . . . indexOfTheViewportBitmap )

Get the index of the bitmap representing the viewport
itself. This is sometimes used to copy things from
the viewport.
====================================================
StdSeeThruWallsRect ( . . . indexOfRectangle )
StdSeeThruWallsRect2 ( . . . indexOfRectangle )
StdSeeThruWallsRectUByte4 ( . . . Byte4 )
StdSeeThruWallsRectUByte6 ( . . . Byte6 )

Get the index of the rectangles used to draw the
'See-Through-Walls' effect. Also, two words to
get values from the rectangles. Byte4 is x
offset and Byte6 is the y-offset.
====================================================
StdBltToDerivedGraphic ( indexOfSourceBitmap
derivedGraphicNumber
indexOfDestinationRectangle
sourceX
sourceY
sourceWidth
destinationWidth
transparentColor . . . )

Move pixels from a bitmap to a derived bitmap
with transparency. If the transparent color is
minus one then there is no transparency. This
function is the basic pixel-handling function
in DM/CSB and almost all other functionis depend on
it to do the dirty work of moving bits around.
====================================================
StdBltFromDerivedGraphic ( derivedGraphicNumber
indexOfDestinationBitmap
indexOfDestinationRectangle
sourceX
sourceY
sourceWidth
destinationWidth
transparentColor . . . )

Actually implemented with the same function as
StdBltToDerivedGraphic but reversing the source/destination
type.
====================================================
StdDeleteDerivedGraphic ( derivedGraphicNumber . . .)

Delete a derived graphic when you are done with it.
====================================================
StdHoleInWallBitmap ( . . . indexOfHoleInWallBitmap )

The bitmap used to draw the See-Through-Wall effect.
====================================================