Chapter 3

General Commands


The general commands let you set up and customize windows.
They also let you set up and access image buffers and select
colors for the screen.

3-1
OS-9 Windowing System

BColorBackground Color

Function: Lets you choose a color palette register to use as the
background color. See the Palette command for setting up the
actual colors.
Code: 1B 33
Parameters: PRN

3-2
General Commands / 3

BoIdSW Bold Switch

Function: Enables or disables boldfacing for text on graphics
screens. If boldface is on, the screen displays subsequent char
acters in bold. If boldface is off, the screen displays subsequent
characters in the regular font.

Code: 1B 3D

Parameters: BSW





Notes:

· You can use BoldSw with any font.




3-3
OS-9 Windowing System

Border soraer Color

Function: Lets you change the palette register used for the


Code: 1B 34

Parameters: PRN

Notes:


3-4
General Commands / 3











'~ use, is also performed relative to the current working area








3-5
OS-9 Windowing System

DefCoIrDefault Color

Function: Sets the palette registers back to their default val

ues. The actual values of the palette registers depend on the

type of monitor you are using. (See montype in OS-9 Level
Two Commands.)

Code: 1B 30
Parameters: None
Notes:






















3-6
























-- number.

3=7
OS-9 Windowing System

Grp-Fnt(200) = font group for system fonts
Fnt-S8x8(1) = standard 8x8 font
Fnt_S6x8(2) = standard 6x8 font
Fnt-G8x8(3) = standard graphics font




Grp-Clip(201) = clipboarding group (for Multiview)

Grp_Ptr(202) = graphics cursor (pointer) group
Ptr_Arr(1) = arrow pointer (hp = 0,0)
Ptr-Pen(2) = pencil pointer (hp = 0,0)
Ptr_LCH(3) = large cross hair pointer
(hp = 7,7)
Ptr_Slp(4) = sleep indicator (hourglass)
Ptr_Ill(5) = illegal indicator
Ptr-Txt(6) = text pointer (hp = 3,3)
Ptr_SCH(7) = small cross hair pointer
(hp = 3,3)

hp

hit point, the coordinates
of the actual point on the
object at which the cursor
should be centered.




Grp-Pat2(203) = two color patterns _

Grp_Pat4(204) = four color patterns
Grp_Pat6(205) = sixteen color patterns

Pat_Dot(1) = dot pattern
Pat_Vrt(2) = vertical line pattern
Pat_Hrz(3) = horizontal line pattern
Pat_XHtc(4) = cross hatch pattern
Pat_LSnt(5) = left slanted lines
Pat_RSnt(6) = right slanted lines
Pat_SDot(7) = small dot pattern
Pat_BDot(8) = large dot pattern

Each pattern is found within each of the
pattern groups.

Standard patterns are in the files
SYS/StdPats_2, SYS/StdPats_4, and
SYS/StdPats-16.

3-8


All files have GPLoad commands imbedded in file, along with

the data. To load fonts, pointers, or patterns, simply merge them

to any window device: For example:




sends the standard font to standard output which may be redi

rected to another device if the current output device is not a win

dow device (such as when term is a VDG screen).


You only need to load fonts once for the entire system. Once a

Get/Put buffer is loaded, it is available to all devices and pro

cesses in the system.


3-9
OS-9 Windowing System

DWEndDevice Window End

Function: Ends a current device window. DWEnd closes the

display window. If the window was the last device window on

the screen, DWEnd also deallocates the memory used by the

window. If the window is an interactive window, OS-9 auto

matically switches you to a new device window, if one is

available.


Code: 1B 24

Parameters: None

Notes:


3-10
General Commands / 3

DWProtSW Device Window Protect Switch

Function: Disables and enables device window protection. By

default, device windows are protected so that you cannot over

lay them with other device windows. This type of protection

helps avoid the possibility of destroying the contents of either

or both windows.


Code: 1B 36

Parameters: BSW





Notes:

We recommend that you not turn off device window protec

tion. If you do, however, use extreme discretion because you

might destroy the contents of the windows. OS-9 does not

return an error if you request that a new window be placed

over an area of the screen which is already in use by an

unprotected window.


3-11
OS-9 Windowing System

DWSetDevice Window Set

Function: Lets you define a window's size and location on the

physical screen. Use DWSet after opening a path to a device

window.

Code: 1B 20
Parameters: STY CPX CPY SZX SZY PRN1 PRN2 PRN3





Notes:













Code Screen Size Colors Memory Type

FF Current Displayed Screen'
00 Process's Current Screen
01 40 x 24 8 & 8 2000 Text
02 80 x 24 8 & 8 4000 Text
05 640 x 192 2 16000 Graphics
06 320 x 192 4 16000 Graphics
07 640 x 192 4 32000 Graphics
08 320 x 192 16 32000 Graphics

' Use the Current Displayed Screen option only in proce
dure files to display several windows on the same physical
screen. All programs should operate on that process's cur
rent screen.
The location of the window on the physical screen is deter
mined by the diagonal line defined by:
(CPX,CPY) and (CPX + SZX, CPY + SZY)

The foreground, background, and border register numbers

(PRN1, PRN2, and PRN3) define the palette registers used

for the foreground and background colors. See the Palette

command in this chapter for more information.


When an implicit or explicit DWSet command is done on a

window, the window automatically clears to the background

color.


All windows on the screen must be of the same type (either

text or graphics).


values in the palette register affect all windows on the

screen. However, you can choose which register to use for

foreground and background for each window. That is, OS-9

maintains palette registers and border register numbers for

the entire screen and foreground and background registers

numbers for each individual window.


OS-9 deallocates memory for a screen when you terminate

the last window on that screen.


3-13
OS-9 Windowing System

FColorForeground Color

Function: Lets you select a color palette register for the fore
ground color. See the Palette command for setting the actual
colors.

Code: 1B 32

Parameters: PRN

3-14
General Commands / 3

Font Select Font

$00-$1F
$20-$7F

Function: Lets you select/change the current font. Before you

can use this command, the font must be loaded into the speci

fied GET/PUT group and buffer (using GPLoad). See the

GPLoad command for information on loading font buffers.


Code: 1B 3A

Parameters: GRP BFN

Notes:

· You can select proportional spacing for the font by using
PropSw.

· All font data is a 2-color bit map of the font.

· Each character in the font data consists of 8 bytes of data.

The first byte defines the top scan line, the second byte

defines the second scan line, and so on. The high-order bit

of each byte defines the first pixel of the scan line, the next

bit defines the next pixel, and so on. For example, the letter

"A" would be represented like this:





28 . . #. #
44 . #. . . #.







Note that 6x8 fonts ignore the last 2 bits per byte.

0 The fonts are ordered with characters in the following
ranges:

International characters (see mapping below)
Standard ASCII characters

3-15
OS-9 Windowing System










































3-is
General Commands / 3

GCSetGraphics Cursor Set

Function: Creates a GET/PUT buffer for defining the graphics
cursor that the system displays. You must use GCSet to dis
play a graphic cursor.

Code: iB 39

Parameters: GRP BFN

Notes:

· To turn off the graphics cursor specify GRP as 00.




r-

3-17
OS-9 Windowing System

GetBlkGet Block

Function: Saves an area of the screen to a GET/PUT buffer.
Once the block is saved, you can put it back in its original
location or in another on the screen, using the PutBlk
command.

Code: 1B 2C

Parameters: GRP BFN HBX LBX HBY LBY HSX LSX HSY
LSY






Notes:

The GET/PUT buffer maintains information on the size of
the block stored in the buffer so that the PutBlk command
works more automatically.

If the GET/PUT buffer is not already defined, GetBlk cre
ates it. If the buffer is defined, the data must be equal to or
smaller than the original size of the buffer.

3-18


GPLoadGET/PUT Buffer Load

Function: Preloads GET/PUT buffers with images that you

can move to the screen later, using PutBlk.


If the GET/PUT buffer is not already created, GPLoad creates

it.


If the buffer was previously created, the size of the passed

data must be equal to or smaller than the original size of the

buffer. Otherwise, GPLoad truncates the data to the size of

the buffer.


Code: 1B 2B









· Buffers are maintained in a linked list system.












OS-9 Windowing System

KilBufKill GET/PUT Buffer

Function: Deallocates the buffer specified by the group and
buffer number. To deallocate the entire group of buffers, set
the buffer number to 0.

Code: 1B 2A

Parameters: GRP BFN

Notes:

    0 Ki1Buf returns memory used by the buffer to a free list.

    When an entire block of memory has been put on the free

    list, the block is returned to the system.


3-20
General Commands / 3

      LSetLogic Set


      Function: Lets you create special effects by specifying the

        type of logic used when storing data, which represents an

        image, to memory. The specified logic code is used by all draw

        commands until you either choose a new logic or turn off the

        logic operation. To turn off the logic function, set the logic code

        to 00.


      Code: 1B 2F


      Parameters: LCN


              LCN = logic code number

                    00 = No logic code; store new data on

                        screen

                  01 = AND new data with data on

                  screen

                  02 = OR new data with data on screen

                  03 = XOR new data with data on screen


      Notes:


        0 The following tables summarize logic operations in bit

          manipulations:


AND First Second Result
Operand Operand
1 1 1
1 0 0
0 1 0
0 0 0
OR First Second Result
Operand Operand
1 1 1
1 0 1
''-` 0 1 1
0 0 0

                                    3-21

OS-9 Windowing System

    XOR First Second Result

    Operand Operand

    1 1 0

    1 0 1

    0 1 1

    0 0 0


    0 Data items are represented as palette register numbers in

    memory. Since logic is performed on the palette register

    number and not the colors in the registers, you should

    choose colors for palette registers carefully so that you

    obtain the desired results. You may want to choose the

    colors for the palette registers so that LSet appears to and,

    or, and xor the colors rather than the register numbers. For

    example:


    Palette # Color Alternative Order

    0 White Black

    1 Blue Blue

    2 Black Green

      3 Green White


3-22
                      General Commands / 3


OWE nd Overlay Window End

Function: Ends a current overlay window. OWEnd closes the

overlay window and deallocates memory used by the window.

If you opened the window with a save switch value of hexadec

imal 01, OS-9 restores the area under the window. If you did

not, OS-9 does not restore the area and any further output is

sent to the next lower overlay window or to the device window,

if no overlay window exists.


Code: 1B 23

Parameters: None

3-23
OS-9 Windowing System

        Overlay Window Set


Function: Use OWSet to create an overlay window on an exist

ing device window. OS-9 reconfigures current device window

paths to use a new area of the screen as the current logical

device window.


Code: 1B 22

Parameters: SVS CPX CPY SZX SZY PRN1 PRN2

        SVS = save switch

            00 = Do not save area overlayed

                01 = Save area overlayed and restore at

                  close

            PRN1 = background palette register

                PRN2 = foreground palette register


Notes:

    · If you set SVS to zero, any writes to the new overlay win

    dow destroy the area under the window. You might want to

    set SVS to zero if your system is already using most of its

    available memory. You might also set SVS to zero whenever

    it takes relatively little time to redraw the area under the

    overlay window once it is closed.


    · If you have ample memory, specify SVS as 1. Doing this

    causes the system to save the area under the new overlay

    window. The system restores the area when you terminate

    the new overlay window. (See OWEnd.)


The size of the overlay window is specified in standard

characters. Use the same resolution (number of characters)

as the device window that will reside beneath the overlay

window. Have your program determine the original size of

the device window at startup (using the SS.ScSiz GETSTAT

call), if the device window does not cover the entire screen.

See the OS-9 Level Two Technical Reference manual for

information on the SS.ScSiz GETSTAT call.


    3-24

General Commands / 3

Overlay windows can be created on top of other overlay

windows; however, you can only write to the top most win

dow. Overlay windows are "stacked" on top of each other

logically. To get back down to a given overlay, you must

close (OWEnd) any overlay windows that reside on top of

the desired overlay window.


Stacked overlay windows do not need to reside directly on

top of underlying overlay windows. However, all overlay

windows must reside within the boundaries of the underly

ing device window.


3-25
OS-9 Windowing System

Palette change Palette

Function: Lets you change the color associated with each of

the 16 palette registers.


Code: 1B 31

Parameters: PRN CTN

Notes:

    · Changing a palette register value causes all areas of the

    screen using that palette register to change to the new

    color. In addition, if the border is set to that palette regis

    ter, the border color also changes. See the Border command

    for more information.


    · Colors are made up by setting the red, green, and blue bits

    in the color byte which is inserted in the palette register.

    The bits are laid out as follows:


      Bit Color

      0 Blue low

      1 Green low

      2 Red low

      3 Blue high

      4 Green high

      5 Red high

      6 unused

      7 unused


    By using six bits for color (2 each for red, green and blue)

    there is a possibility of 64 from which to choose. Some of

    the colors are defined as shown:


    White : 00111111 = $3F (all color bits set)

    Black : 00000000 = $00 (no color bits set)

    Standard Blue : 00001001 = $09 (both blue bits set)

    Standard Green : 00010010 = $12 (both green bits set)

    Standard Red : 00100100 = $24 (both red bits set)


3-26
                  General Commands / 3


Note: These colors are for RGB monitors. The composite

monitors use a different color coding and do not directly

match pure RGB colors. To get composite color from the

RGB colors, the system uses conversion tables. The colors

were assigned to match the RGB colors as close as possible.

There are, however, a wider range of composite colors, so

the colors without direct matches were assigned to the clos

est possible match. The white, black, standard green, and

standard orange are the same in both RGB and composite.


3- 27
OS-9 Windowing System

PropSwProportional Switch

Function: Enables and disables the automatic proportional
spacing of characters. Normally, characters are not proportion
ally spaced.

Code: 1B 3F

Parameters: BSW

        BSW = switch

        00 = off (Default)

        01 = on


Notes:

    · Any standard software font used in a graphics screen can

    be proportionally spaced.


    Proportional spacing is not supported on hardware text

    screens.


3-28
                      General Commands l 3


PSetPattern Set

Function: Selects a preloaded GET/PUT buffer as a pattern

RAM array. This pattern is used with all draw commands

until you either change the pattern or turn it off by passing a
parameter of 00 as GRP (Group Number).
Code: 1B 2E
Parameters: GRP BFN
Notes:

    · The pattern array is a 32 x 8 pixel representation of graph

    ics memory. The color mode defines the number of bits per

    pixel and pixels per byte. So, be sure to take the current

    color mode into consideration when creating a pattern

    array.


    · The GET/PUT buffer can be of any size, but only the num

    ber of bytes as described by the following table are used:


      Color

      Mode Size of Pattern Array

      2 4 bytes x 8 = 32 bytes (1 bit per pixel)

      4 8 bytes x 8 = 64 bytes (2 bits per

      pixel)

      16 16 bytes x 8 = 128 bytes (4 bits per

      pixel)


The buffer must contain at least the number of bytes
required by the current color mode. If the buffer is larger
than required, the extra bytes are ignored.
To turn off patterning, set GRP to 00.

3-29
      apo3 peold-D

      jaquznu dnojB

      .ioqLunu iajjnq

      (Zg) ujajpd ,lo azts x

      (g) uzalpd jo azts S

      (ZE) sa4Sq jo iaqLunu

      sauztl ZE


    b31N3 SS' ' ' SS SS 02 00 80 00 02 00 L0 20 q2 q L Aejds tp

    aq plnom puuuzuzoo all I T .zajng

    pu-e Z dno.zD oluz u.zall-ed .zeln3pa-ed sttp peol oZ -pu-euz

    -uzo3 peold-D atl4 asn Iuza4sSs aup ut wall-ed auj peol oj,


20 90 90 90
90 90 90 90
90 90 90 90
_ 90 90 90 90
TOTOTOTO = 90 90 90 20 20
22$ 20 90 20
20 99$ 90 20
99$ 99$ 99$ 99$

    :stul 931!1 sNool mou walled auZ

    -ujup ,lo sajSq t jo slsisuo3 moa Thva Imp a3pou `ujup alSq

    olut passaaduzo3 si P4-ep laxid gxZ aill .zoj Sa-euiq all uauAk


                OTOTOTOTOTOTOTOTOTOTOTOTOTOTOTOT

                OTOTOTOTOTOTOTOTOTOTOTOTOTOTOTOT

                OTOTOTOTOTOTOTOTOTOTOTOTOTOTOTOT

                OTOTOTOTOIOTOTOTOTOTOTOTOTOTOTOT

                OTOTOTOTOTOTOTOTOTOTOTOTOTOTOTOT

                OTOTOTOTOTOTOTOIOTOTOTOTOTOTOTOT

                OTOTOTOTOTOTOTOTOTOTOTOTOTOTOTOT

                OTOIOTOTOIOTOTOTOTOTOIOTOTOTOTOT


                                  (Iiq auo of lenba st laxld


- auo I-eZll ajou) unpud jas jtq au4 smotls molaq uzva2ulp
    aU 's,0 puu SIT p do apeuz st uaal4ud joloo oml V -sautl

    lu3tjaan p ujajjvd jolo;) onm4 P salvax) alduzuxa Bulnmolloj au,,


                        wals,cs .gu?nopuUt s-s0

T~ E

azts auI sle salgq (gZT) Og$ Xjjaads pu-e pueuz

-LUOD peorId-D OT asn `uza4sXs auj ui u.za44pd au4 peol oZ


' 0a$ jo saijas -e st u.zallvd atll `ul-ep alXq

oiui passaaduzoo si -el-ep laxid gxg auk ,zol X.z-eutq azll uaum


    0000 T T T T "' f slas P101 g T .zoj unp-ed ~~ada,z~0000 T T T T


:stuff a~tj

31001 pjnom unpud jjq azll ui autl ilmea s;alxq gZT jo spts

-uo3 u.zallud auj Imp su-eauz stzlj 'auo ,lo pealsui s4iq .znoj jo

do apeuz st laxtd `s-10103 gT Butsn u.zall-ed a ButNvuz uauA


'(~E) 0Z$ ,lo ppapui sajXq (fg)

0f,$ Xji3ads 1nq alduztxa aolo3 z auj .zol paqt.z3sap SIB puULu

-uzo3 peorId-D auk asn 'uza4sXs auk ui wall-ed au4 peol oZ


Do$ Do$ Do$ Do$ DO$ Do$ Do$ Do$
Do$ 00$ Do$ DO$ Do$ Do$ Do$ Do$
Do$ Do$ Do$ Do$ Do$ oo$ oo$ oo$
OOT T = Do$ Do$ Do$ Do$
Do$ Do$ Do$ Do$ Do$ Do$ Do$ Do$
Do$ Do$ Do$ 00$ 00$ Do$ Do$ Do$
00$ 00$ Do$ Do$ Do$ Do$ Do$ Do$
Do$ Do$ Do$ Do$ Do$ Do$ Do$ Do$
:sIT 93111 s31ool mou uzajpd auj,

--elup ,lo salgq g jo slstsuo3 Mo.z u3ea Imp a3ijou `-el-ep ajXq

olul passajduzo3 st -epp laxtd gxt, aui ,ioj,9-muiq auj uauAk


    OOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOII

    OOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOII

    OOIIOOIIOOIIOOIIOOITOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOII

    OOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOII

    OOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOII

    OOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOII

    OOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOII

    OOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOIIOOII


                            s.zolo3


f, Buisn uzallpd ju3pzan owes au1 .zoj uaallud jas Itq azll
smoxjs molaq uzvjBvtp aqjL o Zg ,lo pealsut sa4,gq tg p s1sts-~`"
-uo3 u.zap-ed ails jui1l su-eauz SIT

        4j 'auo jo pealsui sjjq oml jo

do ap-euz st laxid -e `s.zolo3 ;, 2uisn u.zall-ed L, 2utNuuz uaqM

l SPU DW Wo,g ? 'DjauaD
OS-9 Windowing System

PutBlkPut Block

Function: Moves a GET/PUT buffer, previously copied from the
screen or loaded with GPLoad, to an area of the screen.
Code: 1B 2D
Parameters: GRP BFN HBX LBX HBY LBY

        HBX/LBX = x-location of block

        (upper left corner)

        HBY/LBY = y-location of block


Notes:

The dimensions of the block were saved in the GET/PUT
buffer when you created it. OS-9 uses these dimensions
when restoring the buffer.

The screen type conversion is automatically handled by the
PutBlk routine in the driver.

GET/PUT buffers cannot be scaled. The image will be
clipped if it does not fit within the window.

3-32
General Commands / 3

ScaleSwScale Switch

Function: Disables and enables automatic scaling. Normally,

automatic scaling is enabled. When scaling is enabled, coordi

nates refer to a relative location in a window that is propor

tionate to the size of the window. When scaling is disabled,

coordinates passed to a command will be the actual coordi

nates for that type of screen relative to the origin of the

window.


Code: 1B 35

Parameters: BSW

        BSW = switch

        00=off

        01 = on (Default)


Notes:

0 A useful application of disabled scaling is the arrangement
    of references between a figure and text.


0 All coordinates are relative to the window's origin (0,0).
    The valid range for the coordinates:


    Scaling enabled:


      y = 0-191

      x = 0-639


    Scaling disabled:


      y = 0-size of y - 1

      x = 0-size of x - 1


3-33
OS-9 Windowing System

Select Window Select

Function: Causes the current process's window to become the

active (display) window. You can select a different window by

using the form:


    d i 5 p 1 ay 1 B 21 > lw number


where number is the desired window number. If the process

that executes the select is running on the current interactive

(input/display) window, the selected window becomes the

interactive window, and the other window becomes passive.


Code: 1B 21

Parameters: None

Notes:

    · The keyboard is attached to the process's selected window

    through the use of the CLEAR key. This lets you input data

    from the keyboard to different windows by using the CLEAR

    key to select the window.


    All display windows that occupy the same screen are also

    displayed.


    · The device window which owns the keyboard is the current

    interactive window. The interactive window is always the

    window being displayed. Only one process may receive

    input from the keyboard at a time. Many processes may be

    changing the output information on their own windows;

    however, you can only see the information that is displayed

    on the interactive window and any other window on the

    same screen as the interactive window.


3-34
            General Commands / 3


TCharSW Transparent Character Switch

Function: Defines the character mode to be used when putting
characters on the graphics screens.

In the default mode (transparent off), the system uses block
characters that draw the entire foreground and background for
that cell.

When in transparent mode, the only pixels that are changed
are the ones where the character actually has pixels set in its
font. When transparent mode is off, all pixels in the character
block are set: foreground or font pixels in the foreground color
and others in the background color.
Code: 1B 3C
Parameters: BSW

          BSW = switch

          00 = off (Default)

          01 = on


3-35