====== NITROS-9 EOU LEVEL 2 WINDOWING SYSTEM MANUAL ====== 2020-06-05 FIXME Work in progress - just started formatting NitrOS-9 EOU Level 2 Windowing System Manual The NitrOS-9 EOU Project [[http://www.lcurtisboyle.com/nitros9/nitros9.html]] The NirtOS-9 project: [[http://sourceforge.net/projects/nitros9/]] The NitrOS-9 EOU Level 2 Windowing System Manual ===== Revision History ===== Revision 0.2 Date May 19, 2020 0.1 June 4, 2004 Comment Updated to reflect changes to NitrOS-9 over time and specifically to cover changes related to the EOU (“Ease of Use”) project. Created Acknowledgements: 2004 revision by: Bob Emery and Boisy Pitre. 2020 revision additions and corrections by: L. Curtis Boyle and Jay Searle ===== Table Of Contents ===== The NitrOS-9 EOU Level 2 Windowing System Manual NitrOS-9 EOU Level 2 Windowing System Manual.....................................................................1 Table Of Contents....................................................................................................................3 Chapter 1. The NitrOS-9 Level 2 Windowing System..................................................................5 Device Windows.......................................................................................................................6 Opening a Device Window...................................................................................................6 Overlay Windows......................................................................................................................9 Opening an Overlay Window...............................................................................................9 Chapter 2. Overview of Commands and Parameters.................................................................10 Parameters.............................................................................................................................10 Chapter 3. General Commands.................................................................................................13 Bcolor.....................................................................................................................14 BoldSw...................................................................................................................15 Border....................................................................................................................16 CWArea.................................................................................................................17 DefColr...................................................................................................................18 DfnGPBuf...............................................................................................................19 DWEnd..................................................................................................................22 DWProtSw.............................................................................................................23 DWSet...................................................................................................................24 FColor....................................................................................................................26 Font........................................................................................................................27 GCSet....................................................................................................................30 GetBlk....................................................................................................................31 GPLoad..................................................................................................................32 KilBuf.....................................................................................................................33 LSet.......................................................................................................................34 OWEnd..................................................................................................................36 OWSet...................................................................................................................37 Palette....................................................................................................................39 PropSw..................................................................................................................41 PSet.......................................................................................................................42 PutBlk....................................................................................................................45 ScaleSw.................................................................................................................46 Select.....................................................................................................................47 TCharSw................................................................................................................48 Chapter 4. Drawing Commands.................................................................................................49 Arc3P.....................................................................................................................50 Bar.........................................................................................................................51 RBar.......................................................................................................................51 Relative Draw Bar..................................................................................................51 Box.........................................................................................................................52 RBox......................................................................................................................52 Circle......................................................................................................................53 Ellipse....................................................................................................................54 FFill........................................................................................................................55 FCircle...................................................................................................................56 FEllipse..................................................................................................................57 Line........................................................................................................................58 Rline.......................................................................................................................58 LineM.....................................................................................................................59 RLineM..................................................................................................................59 Point.......................................................................................................................60 RPoint....................................................................................................................60 PutGC....................................................................................................................61 SetDPtr..................................................................................................................62 RSetDPtr................................................................................................................62 Chapter 5. Text Commands........................................................................................................63 Alphabetical Index......................................................................................................................64 FIXME STOPPED HERE ===== Chapter 1 ===== The NitrOS-9 EOU Level 2 Windowing System Manual The NitrOS-9 Level 2 Windowing System One of NitrOS-9 Level 2’s advanced features is its built-in Windowing System. The Win- dowing System allows you to lay one or more rectangular areas, called windows, on top of your existing screen display. These smaller areas can take up a portion of the screen, or utilize an entire screen area. With these windows, you can watch several tasks perform at the same time. For exam- ple, suppose you are writing a business letter using a word processor in one window. You can go to a spreadsheet program in another window, get a price quote you need, return to the word processor, and include the price in the letter. In yet another win- dow, a terminal program connected to a modem could be downloading a program or data file. There are a number of options that windows give to your application and work environ- ments: they can be text only or contain a combination of text and graphics. Separate text, drawing and background colors can be selected as well to provide a particular color style. The ability to customize your window to suite your working environment and preferences is easy to do and puts the power of windowing at your fingertips. The Windowing System allows as many windows as your computer's memory can sup- port, with a maximum of 32 available at one time, including overlay windows. Support for the windowing system comes from several modules:  CoGrf – Handles the parsing of display codes for window creation and manipula- tion.  CoWin – Performs the same functions as CoGrf, but also adds in enhanced win- dow border and mouse control functionality (use only CoGrf or CoWin in your sys- tem, not both!)  GrfDrv – This module is located in the CMDS directory of your boot disk and is re- sponsible for carrying out the actual drawing and bitmap manipulation functions. It is automatically loaded as needed by NitrOS-9. 5 The NitrOS-9 EOU Level 2 Windowing System Manual In NitrOS-9, there are two types of windows: device windows and overlay windows. Device Windows A device window is one that can run a program or utility. This is the type of window you would use in the word processor/spreadsheet example given above. Each device win- dow acts as an individual terminal. The device windows are designated as devices /w1 - /w15. You open a device window as you do any other NitrOS-9 device and specify the window's parameters, including whether the window is for text or graphics. If you want to run a process in the window, you can start an execution environment, such as a shell, on the window. (See "Opening a Device Window," later in this chapter, and the DWSet command in Chapter 3.) Note: If you want only to send output to the device window without running a process in the window, do not start a shell on the window. Device windows cannot overlay each other, and their boundaries cannot overlap. Opening a Device Window To open a device window, follow these steps: 1. First, we must allocate memory for the window. Use NitrOS-9's iniz command to initialize window 7 in this example. Type: iniz /w7 ENTER 2. Next, send an escape sequence to the window that tells it the parameters you want. These parameters include the screen type, size, and colors. For example: wcreate /w7 -s=2 20 10 40 10 01 00 00 ENTER OR display 1b 20 2 14 0a 28 0a 01 00 00>/w7 ENTER 6 The NitrOS-9 EOU Level 2 Windowing System Manual sends the DWSet command escape sequence to the /w7 window. The wcreate command insists that you use decimal numbers, while the display command can take both decimal and hexadecimal numbers. The functions of the codes, as used in the wcreate command, are as follows: 2 20 10 40 10 01 00 00 Sets a screen type of 80 x 24 (text only) Starts the window at character/column 20 Starts the window at line/row 10 Sets a window size of 40 characters Sets a window height of 10 lines Sets the foreground color to blue Sets the background color to white Sets the border color to white If you do not send escape sequences, NitrOS-9 uses default descriptors for the windows. The window size defaults are: Window Number Term 1 2 3 Screen Type (chars/line) 40 (text) 80 (text) 80 (text) 80 (text) Starting Position (horizontal, vertical) 0,0 0,0 0,0 0,0 Size (columns, rows) 40,25 80,25 80,25 80,25 7 The NitrOS-9 EOU Level 2 Windowing System Manual 4 5 6 7 8 9 10 11 12 13 14 15 80 (text) 80 (text) 80 (text) 80 (text) 80 (text) 80 (text) 80 (text) 80 (text) 80 (text) 80 (text) 80 (text) 80 (text) 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 80,25 80,25 80,25 80,25 80,25 80,25 80,25 80,25 80,25 80,25 80,25 80,25 3. Use NitrOS-9's shell command to fork a shell to the window. Type: shell i=/w7& ENTER The i= parameter creates an immortal shell. Creating an immortal shell protects the window and its shell from being destroyed if you accidentally exit the shell using CTRL BREAK. You now have a window that can run its own tasks. Information displayed in that win- dow is automatically scaled to the window's size. 8 The NitrOS-9 EOU Level 2 Windowing System Manual Overlay Windows An overlay window is a window that you open on top of a device window. (You can place overlay windows over other overlay windows, but there must always be a device window at the bottom of the stack.) The purpose of overlay windows is to display com- puter dialog. You cannot fork a shell to an overlay window; however, you can run a shell in an overlay window. Overlay windows assume the screen type of the device windows they overlay. Opening an Overlay Window To open an overlay window, use the Overlay Window Set function. (See OWSet in Chapter 3., “General Commands”) 9 The NitrOS-9 EOU Level 2 Windowing System Manual Chapter 2. Overview of Commands and Parameters The windowing commands are divided among three chapters, based on their functions. Chapter 3. describes the general commands. These commands let you create windows and buffers, access buffers, set switches, and maintain the window environment. Chapter 4. describes the drawing commands. Besides letting you draw all kinds of im- ages (circles, ellipses, arcs, and boxes, to name a few), these commands also enable you to color areas or to fill them with patterns. Chapter 5. describes the text commands. Use these commands to manipulate the text cursor and the text attributes. Text commands operate on hardware text screens (screen types 1 and 2) and graphics windows if a font is selected. Each command description lists the command's name, code, and parameters. To call a Windowing System command using NitrOS-9's display command, type display, followed by the command code and the values you want to supply for the parameters. Parameters The following is a complete list of the parameter abbreviations used in Chapters 3, 4, and 5. All parameters represent a single byte of information. Parameter HBX LBX HBY LBX HBXo LBXo HBYo LBYo HBR LBR Description high order byte of x value low order byte of x value high order byte of y value low order byte of y value high order byte of x-offset value (relative) low order byte of x-offset value (relative) high order byte of y-offset value (relative) low order byte of y-offset value (relative) high order byte of radius low order byte of radius 10 The NitrOS-9 EOU Level 2 Windowing System Manual HBL LBL HSX LSX HSY LSY HBRx LBRx GRP BFN LCN PRN CTN FNM CPX CPY STY SVS SZX SZY XDR YDR BSW high order byte of length low order byte of length high order byte of size in x direction low order byte of size in x direction high order byte of size in y direction low order byte of size in y direction high order byte of radius in x direction low order byte of radius in x direction GET/PUT buffer group number (1-254) GET/PUT buffer number (1-255) logic code number palette register number (0-15, wraps mod 16) color table number (0-63, wraps mod 64) font number character position x (0-xmax) character position y (0-ymax) screen type save switch (0 = no save, 1 = save area under overlay) size in x (columns) size in y (rows) dimension ratio x used with YDR as YDR/XDR dimension ratio y binary switch (0 = off, 1 = on) 11 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. Table Of Contents 13 BoldSw Bold Switch Code: 1B 3D Parameters: BSW Function: Enables or disables boldfacing for text on graphics screens. If boldface is on, the screen displays subsequent characters in bold. If boldface is off, the screen displays subsequent characters in the regular font. BSW = switch 00 = off (Default) 01 = on Notes:  You can use BoldSw with any font.  Boldface is not supported on hardware text screens (screen types 1 and 2). Table Of Contents 15 Border Screen Color Code: 1B 34 Parameters: PRN Notes: Function: Lets you change the palette register used for the screen border. See the Pal- ette command for setting up the actual colors.  You set the border by selecting a palette register to use for the border register. When the actual color is changed in the palette register selected by the com- mand, the color of the screen border changes to the new color. In general, the border register usually matches the background palette register. Table Of Contents 16 Function: Lets you alter the working area of the window. Normally, the system uses this call for high-level windowing, but you can use it to restrict output to a smaller area of the window. CWArea Change Working Area Code: 1B 25 Notes: Parameters: CPX CPY SZX SZY  You cannot change a window's working area to be larger than the predefined-area of the window as set by DWSet or OWSet.  All drawing and window updating commands are done on the current working area of a window. The working area defaults to the entire size of the window. Scaling, when in use, is also performed relative to the current working area of a window. The CWArea command allows users to restrict the working area of a window to smaller than the full window size. Functions that might be performed by opening a non-saved overlay window to draw or clear an image and then closing the overlay can be accomplished by using this command to shorten execution time where an actual overlay window is not needed. Table Of Contents 17 DefColr Default Color Code: 1B 30 Parameters: None Notes: plays. Function: Sets the palette registers back to their default values. The actual values of the palette registers depend on the type of monitor you are using. (See montype in NitrOS-9 Commands Reference.)  The default color definitions apply only to high-resolution graphics and text dis-  The system sets the palette registers to a proper compatibility mode when switch- ing to screens using the older VDG emulation modes. See the table below: Window System Color Modes VDG-Compatible Modes Palette 00 & 08 01 & 09 02 & 10 03 & 11 04 & 12 05 & 13 06 & 14 07 & 15 Color White Blue Black Green Red Yellow Magenta Cyan P# Color 00 Green 01 Yellow 02 Blue 03 Red 04 Buff 05 Cyan 06 Magenta 07 Orange P# Color 08 Black 09 Green 0A Black 0B Buff 0C Black 0D Green 0E Black 0F Orange  The SetStat call lets you change the default color palette definition when using the windowing system. Default colors in the VDG-Compatible Mode cannot be changed. See the NitrOS-9 Technical Reference manual for information on SetStat.  The system's default colors are used whenever you create a new window. Table Of Contents 18 DfnGPBuf Define GET/PUT Buffer Function: Lets you define the size of the GET/PUT buffers for the system. Once you allo- cate a GET/PUT buffer, it remains allocated until you use the KilBuf command to delete it. NitrOS-9 allocates memory for GET/PUT buffers in 8K blocks that are then divided into the different GET/PUT buffers. Buffers are divided into buffer groups. Therefore, all commands dealing with GET/PUT buffers must specify both a group number and a buf- fer number within that group. Code: 1B 29 Parameters: GRP BFN HBL LBL Technical: The buffer usage map is as follows: Group Number 0 1-199 200-254 255 Buffer Number1 1-255 1-255 1-255 1-255 Use Internal use only (returns errors) General use by applications2 Reserved Internal use only for overlay windows (returns errors) Note: The names, buffer groups, and buffer numbers are defined in the assembly defini- tion file. The decimal number you use to call these are in parentheses next to the name. For example, to select the Arrow pointer, Grp_Ptr and Ptr_Arr, you use 202,1 as the group/buffer number. The standard group numbers are defined as follows: 1 Buffer Number 0 is invalid and cannot be used. 2 The application program should request its user ID via the GETID system call to use as its group number for buffer allocation. Table Of Contents 19 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 A complete list of current fonts can be found in dd/sys/fontlist.txt The standard fonts are in the file SYS/StdFonts. Grp_Clip(201) = clipboarding group (for Multi-Vue) 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. The standard pointers are in the file SYS/StdPtrs. 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 Table Of Contents 20 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. 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: merge SYS/StdFonts ENTER sends the standard font to standard output which may be redirected to another device if the current output device is not a window 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 processes in the system. NitrOS-9 EOU Beta 2 and up specific: By default, the EOU preloads all fonts for you, so you have access to all of them in your programs. Table Of Contents 21 Function: Ends a current device window. DWEnd closes the display window. If the win- dow was the last device window on the screen, DWEnd also deallocates the memory used by the window. If the window is an interactive window, NitrOS-9 automatically switches you to a new device window, if one is available. DWEnd Device Window End Code: 1B 24 Parameters: None Notes:  DWEnd is only needed for windows that have been attached via the iniz utility or the I$Attach system call. Non-attached windows have an implied DWEnd com- mand that is executed when you close the path. Table Of Contents 22 DWProtSw Device Window Protect Switch Function: Disables and enables device window protection. By default, device windows are protected so that you cannot overlay them with other device windows. This type of protection helps avoid the possibility of destroying the contents of either or both win- dows. Code: 1B 36 Parameters: BSW Notes: BSW = switch 00=off 01 = on (Default)  We recommend that you not turn off device window protection. If you do, how- ever, use extreme discretion because you might destroy the contents of the win- dows. NitrOS-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 win- dow.  GShell uses this command to create an underlying, non-protected device window underneath it's resizable protected device windows, to allow you to position mul- tiple device windows on the same screen, and you can use this technique as well. Table Of Contents 23 DWSet Device 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 Notes: Parameters: STY CPX CPY SZX SZY PRN1 PRN2 PRN3 PRN 1 = Foreground PRN2 = Background PRN3 = Border (if STY >= 1)  The iniz and display commands open paths to the device window.  When using DWSet in a program, you must first open the device. If you are changing the window type of your current window, you must issue a DWEnd first.  Output to a new window is ignored until NitrOS-9 receives a DWSet command, unless defaults are present in the device descriptor (/w1-/w15). If defaults are present in the device descriptors, NitrOS-9 automatically executes DWSet, using those defaults.  When NitrOS-9 receives the DWSet command, it allocates memory for the win- dow, and clears the window to the current background color. If the standard font is already in memory, NitrOS-9 assigns it as the default font. If the standard font is not in memory, you must execute a font set (Font) command after loading the fonts to produce text output on a graphics window. If you do not have a font loaded, all characters will show as periods '.'  Use the Screen Type code (STY) to define the resolution and color mode of the new screen. If the screen type code is zero, NitrOS-9 opens the window on the process's currently selected screen. If the code is 255 ($FF), NitrOS-9 opens the window on the currently displayed screen. If the code is non-zero, NitrOS-9 allo- cates a new screen for the window. Table Of Contents 24 The following describes the acceptable screen types: Colors Memory Type Code 255 00 01 02 05 06 07 08 Screen Size Current Displayed Screen3 Process's Current Screen 40 x 25 80 x 25 640 x 200 320 x 200 640 x 200 320 x 200 8 & 8 8 & 8 2 4 4 16 2000 4000 16000 16000 32000 32000 Text Text Graphics Graphics Graphics Graphics Note: The GIME has a bug and will only show 199 lines in modes 05-08, but the 200th line is there and will show up when scrolling upwards.  The location of the window on the physical screen is determined 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 col- ors. 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, NitrOS-9 maintains palette registers and border register numbers for the entire screen and foreground and background registers numbers for each individ- ual window.  NitrOS-9 deallocates memory for a screen when you terminate the last window on that screen. 3 Use the Current Displayed Screen option only in procedure files to display several win- dows on the same physical screen. All programs should operate on that process' current screen. Table Of Contents 25 FColor Foreground Color Code: 1B 32 Parameters: PRN Function: Lets you select a color palette register for the foreground color. See the Palette command for setting the actual colors. Table Of Contents 26 Font Select Font Code: 1B 3A Parameters: GRP BFN Notes: Function: Lets you select/change the current font. Before you can use this command, the font must be loaded into the specified GET/PUT group and buffer (using GPLoad). See the GPLoad command for information on loading font buffers.  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 de- fines the next pixel, and so on. For example, the letter "A" would be represented like this: Byte $10 $28 $44 $44 $7C $44 $44 $00 Pixel Representation . . . # . . . . . . # . # . . . . # . . . # . . . # . . . # . . . # # # # # . . . # . . . # . . . # . . . # . . . . . . . . . . Note that 6x8 fonts ignore the last 2 bits per byte.  For fonts with 128 characters or less, the fonts are ordered with characters in the following ranges: $00-$1F $20-$7F International characters (see mapping below) Standard ASCII characters Table Of Contents 27 International characters or any characters in the font below character $20 (hex) are printed according to the following table: Character position in font Char2 $00 $01 $02 $03 $04 $05 $06 $07 $08 $09 $0A $0B $0C $0D $0E $0F $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 $1A $1B $1C $1D $1E $1F Char1 or $C1 $C2 $C3 $C4 $C5 $C6 $C7 $C8 $C9 $CA $CB $CC $CD $CE $CF $D0 $D1 $D2 $D3 $D4 $D5 $D6 $D7 $D8 $D9 $DA $AA $AB $AC $AD $AE $AF $E1 $E2 $E3 $E4 $E5 $E6 $E7 $E8 $E9 $EA $EB $EC $ED $EE $EF $F0 $F1 $F2 $F3 $F4 $F5 $F6 $F7 $F8 $F9 $FA $BA $BB $BC $BD $BE $BF Table Of Contents 28 For 224 character fonts,    Character positions $00 to $1F in the font map to character codes $E0 to $FF, and character positions $20 to $DF are the same character code as their position. Table Of Contents 29 GCSet Graphics Cursor Set Code: 1B 39 Parameters: GRP BFN Notes: cursor. Function: Creates a GET/PUT buffer for defining the graphics cursor that the system dis- plays. You must use GCSet to display a graphic cursor.  To turn off the graphics cursor, specify GRP as 00.  A system standard buffer or a user-defined buffer can be used for the graphics Table Of Contents 30 GetBlk Get Block Code: 1B 2C 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 com- mand. Parameters: GRP BFN HBX LBX HBY LBY HSX LSX HSY LSY HBX/LBX = x-location of block (upper left corner) HBY/LBX = y-location of block HSX/LSX = x-dimension of block HSY/LSY = y-dimension of block 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 creates it. If the buffer is de- fined, the data must be equal to or smaller than the original size of the buffer.  Original OS-9 Level 2 had a limit of not being able to do a GetBlk that was the full width of the screen. This is fixed in NitrOS-9. NitrOS-9 EOU Beta 4 and up specific: You are now allowed to use GetBlk/PutBlk with hardware text screens. When doing this, you specify the X,Y start positions and sizes by character, not pixel. You can also get and put between windows, but the window types and sizes currently MUST be the same type and size. It will also currently wrap on the right hand side to one line lower on the left side.  It is recommended, for your own programs, to use the group number that corre- sponds to your process ID, so that you don't overwrite another programs buffers by accident. Since some older programs do not clean up buffers themselves, you may also want to do a KilBuf for your group number with buffer 0 (Kill all get/put buffers) at the start of your program. Table Of Contents 31 GPLoad GET/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. Parameters: GRP BFN STY HSX LSX HSY LSY HBL LBL (Data...) STY = format HSX/LSX = x-dimension of stored block HSY/LSY = y-dimension of stored block HBL/LBL = number of bytes in data Code: 1B 2B Notes:  Buffers are maintained in a linked list system.  Buffers to be used most should be allocated last to minimize the search time in finding the buffers.  When loading a Font GET/PUT Buffer, the parameters are as follows: GRP BFN STY HSX LSX HSY LSY HBL LBL (Data...) GRP = 254 (note: not enforced, but HIGHLY recommended) STY = 5 HSX/LSX = x-dimension size of Font (6 or 8) HSY/LSY = y-dimension size of Font (8) HBL/LBL = size of first data (not including this header information) See the Font command for more information on font data. Table Of Contents 32 Function: Deallocates the buffer specified by the group and buffer number. To deallo- cate the entire group of buffers, set the buffer number to 0. KilBuf Kill GET/PUT Buffer Code: 1B 2A Parameters: GRP BFN Notes:  KilBuf 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.  It is recommended that you use the same group number as your process ID num- ber, so that you don't change get/put buffers in other processes. It is also recom- mended that you Kill the entire group at the start of your program, since some older programs did not clean up buffers after they were exited. Table Of Contents 33 LSet Logic Set Code: 1B 2F Parameters: LCN Function: Lets you create special effects by specifying the type of logic used when stor- ing 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. 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:  The following tables summarize logic operations in bit manipulations: AND Result OR Result First Operand 1 1 0 0 First Operand 1 1 0 0 Second Operand 1 0 1 0 Second Operand 1 0 1 0 1 0 0 0 1 1 1 0 34 Table Of Contents XOR Result First Operand 1 1 0 0 Second Operand 1 0 1 0 0 1 1 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 exam- ple: Palette # 0 1 2 3 Color White Blue Black Green Alternative Order Black Blue Green White Table Of Contents 35 OWEnd Overlay Window End Code: 1B 23 Parameters: None Function: Ends a current overlay window. OWEnd closes the overlay window and deallo- cates memory used by the window. If you opened the window with a save switch value of hexadecimal 01, NitrOS-9 restores the area under the window. If you did not, NitrOS- 9 does not restore the area and any further output is sent to the next lower overlay win- dow or to the device window, if no overlay window exists. Table Of Contents 36 OWSet Overlay Window Set Function: Use OWSet to create an overlay window on an existing device window. Ni- trOS-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 , nor clear it. 01 = Save area overlayed and restore at close PRN1 = foreground palette register PRN2 =background palette register Notes:  If you set SVS to zero, any writes to the new overlay window destroy the area un- der 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 NitrOS-9 Technical Reference manual for in- formation on the SS.ScSiz GETSTAT call.  Overlay windows can be created on top of other overlay windows; however, you can only write to the top most window. 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. Table Of Contents 37  Stacked overlay windows do not need to reside directly on top of underlying over- lay windows. However, all overlay windows must reside within the boundaries of the underlying device window. Table Of Contents 38 Palette Change Palette Code: 1B 31 Parameters: PRN CTN Notes: Function: Lets you change the color associated with each of the 16 palette registers.  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 register, the border color also changes. See the Border command for more infor- mation.  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 0 1 2 3 4 5 6 7 Color Blue low Green low Red low Blue high Green high Red high unused 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 Black Standard Blue Standard Green Standard Red : 00111111 = $3F (all color bits set) : 00000000 = $00 (no color bits set) : 00001001 = $09 (both blue bits set) : 00010010 = $12 (both green bits set) : 00100100 = $24 (both red bits set) Table Of Contents 39 • 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. Table Of Contents 40 Function: Enables and disables the automatic proportional spacing of characters. Nor- mally, characters are not proportionally spaced. PropSw Proportional Switch Code: 1B 3F Parameters: BSW Notes: spaced. BSW = switch 00 = off (Default) 01 = on  Any standard software font used in a graphics screen can be proportionally  Proportional spacing is not supported on hardware text screens. Table Of Contents 41 PSet Pattern Set Code: 1B 2E Parameters: GRP BFN Notes: 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).  The pattern array is a 32 x 8 pixel representation of graphics 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 number of bytes as described by the following table are used: Color Mode Size of Pattern Array 2 4 16 4 bytes x 8 = 32 bytes (1 bit per pixel) 8 bytes x 8 = 64 bytes (2 bits per pixel) 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.  The following example creates a two color pattern of vertical lines. A two color pattern is made up of 1’s and 0’s. The diagram below shows the bit set pattern (note that one pixel is equal to one bit): 10101010101010101010101010101010 10101010101010101010101010101010 10101010101010101010101010101010 10101010101010101010101010101010 10101010101010101010101010101010 10101010101010101010101010101010 Table Of Contents 42 10101010101010101010101010101010 10101010101010101010101010101010 When the binary for the 2x8 pixel data is compressed into byte data, notice that each row consists of four bytes of data. The pattern now looks like this: $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 $55 = 01010101 To load the pattern in the system, use the GPLoad command. To load this particu- lar pattern into Group 2 and Buffer 1, the command would be: display 1b 2b 02 01 00 20 00 08 00 20 55 55 … 55 32 times number of bytes (32) y size of pattern (8) x size of pattern (32) buffer number group number GPLoad command  When making a pattern using four colors, a pixel is made up of two bits instead of one. This means that the pattern consists of 64 bytes instead of 32. The diagram below shows the bit set pattern for the same vertical pattern using 4 colors: 1100110011001100110011001100110011001100110011001100110011001100 1100110011001100110011001100110011001100110011001100110011001100 1100110011001100110011001100110011001100110011001100110011001100 1100110011001100110011001100110011001100110011001100110011001100 1100110011001100110011001100110011001100110011001100110011001100 1100110011001100110011001100110011001100110011001100110011001100 1100110011001100110011001100110011001100110011001100110011001100 1100110011001100110011001100110011001100110011001100110011001100 Table Of Contents 43 When the binary for the 4x8 pixel data is compressed into byte data, notice that each row consists of 8 bytes of data. The pattern now looks like this: $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC $CC = 11001100 To load the pattern in the system, use the GPLoad command as described for the 2 color example, but specify $40 (64) bytes instead of $20 (32).  When making a pattern using 16 colors, a pixel is made up of four bits instead of one. This means that the pattern consists of 128 bytes. Each line in the bit pattern would look like this: 11110000…(repeat pattern for 16 total sets)…11110000 When the binary for the 8x8 pixel data is compressed into byte data, the pattern is a series of $F0. To load the pattern in the system, use the GPLoad command and specify $80 (128) bytes as the size. Table Of Contents 44 PutBlk Put Block Code: 1B 2D Notes: Function: Moves a GET/PUT buffer, previously copied from the screen or loaded with GPLoad, to an area of the screen. Parameters: GRP BFN HBX LBX HBY LBY HBX/LBX = x-location of block (upper left corner) HBY/LBY = y-location of block  The dimensions of the block were saved in the GET/PUT buffer when you created it. NitrOS-9 uses these dimensions when restoring the buffer.  The screen type conversion is automatically handled by the PutBlk routine in the driver. Please note that PutBlk will slow down noticeably if screen type conversion is required.  GET/PUT buffers cannot be scaled. The image will be clipped if it does not fit within the window. Table Of Contents 45 ScaleSw Scale Switch Code: 1B 35 Parameters: BSW Notes: a figure and text. coordinates: Scaling enabled: Function: Disables and enables automatic scaling. Normally, automatic scaling is en- abled. When scaling is enabled, coordinates refer to a relative location in a window that is proportionate to the size of the window. When scaling is disabled, coordinates passed to a command will be the actual coordinates for that type of screen relative to the origin of the window. BSW = switch 00 = off 01 = on (Default)  A useful application of disabled scaling is the arrangement of references between  All coordinates are relative to the window's origin (0,0). The valid range for the y = 0-199 for 25 line screens 0-191 for 24 lines or less screens x = 0-639 Scaling disabled: y = 0-size of y - 1 x = 0-size of x - 1 Table Of Contents 46 Function: Causes the current process's window to become the active (display) window. You can select a different window by using the form: display 1B 21>/wnumber 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 be- comes the interactive window, and the other window becomes passive. Select Window Select 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 that 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 infor- mation that is displayed on the interactive window and any other window on the same screen as the interactive window. Table Of Contents 47 TCharSw Transparent Character Switch Function: Defines the character mode to be used when putting characters on the graph- ics 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. NitrOS-9 EOU Beta 2 and up specific: Now works on hardware text screens. This will allow you to change the foreground color, underline and blink attributes while leaving the background color alone. Code: 1B 3C Parameters: BSW BSW = switch 00 = off (Default) 01 = on Table Of Contents 48 Chapter 4. Drawing Commands All drawing commands relate to an invisible point of reference on the screen called the draw pointer. Originally, the draw pointer is at position 0,0. You can change the position by using the SetDPtr and RSetDPtr commands described in this chapter. In addition, some draw commands automatically update the draw pointer. For example, the LineM command draws a line from the current draw pointer position to the specified end coordinates and moves the draw pointer to those end coordinates. The Line command draws a line but does not move the pointer. Also, note that all draw commands are affected by the pattern and logic commands described in Chapter 3. Do not confuse the draw pointer with the graphics cursor. The graphics cursor is the graphic representation of the mouse/joystick position on the screen. In this chapter, commands that use relative coordinates (offsets) are listed with their counterparts that use absolute coordinates. For example, RSetDPtr is listed with Set- DPtr. Table Of Contents 49 Arc3P Draw Arc Code: 1B 52 Notes: Function: Draws an arc with its midpoint at the current draw pointer position. You spec- ify the curve by both the X and Y dimensions, as you do an ellipse. In this way, you can draw either elliptical or circular arcs. The arc is clipped by a line defined by the (X01,Y01) - (X02,Y02) coordinates. These coordinates are signed 16 bit values and are relative to the center of the ellipse. The draw pointer remains in its original position. Parameters: HBRx LBRx HBRy LBRy HX01 LX01 HY01 LY01 HX02 LX02 HY02 LY02  The resulting arc depends on the order in which you specify the line coordinates. Arc3P first draws the line from Point 1 to Point 2 and then draws the ellipse in a clockwise direction.  The coordinates of the screen are as follows: -X +X -Y +Y 50 Table Of Contents Function: Draws and fills a rectangle that is defined by the diagonal line from the cur- rent draw pointer position to the specified position. The box is drawn in the current foreground color. The draw pointer returns to its original location. Bar Draw Bar Code: 1B 4A Parameters: HBX LBX HBY LBY RBar Relative Draw Bar Function: Draws and fills a rectangle that is defined by the diagonal line from the cur- rent draw pointer to the point specified by the offsets. The box is drawn in the current foreground color. The draw pointer returns to its original location. This is a relative com- mand. Code: 1B 4B Parameters: HBXo LBXo HBYo LBYo Table Of Contents 51 Function: Draws and fills a rectangle that is defined by the diagonal line from the cur- rent draw pointer position to the specified position. The box is drawn in the current foreground color. The draw pointer returns to its original location. Box Draw Box Code: 1B 48 Parameters: HBX LBX HBY LBY RBox Relative Draw Box Function: Draws and fills a rectangle that is defined by the diagonal line from the cur- rent draw pointer point specified by the offsets. The box is drawn in the current fore- ground color. The draw pointer returns to its original location. This is a relative com- mand. Code: 1B 48/1B 49 Parameters: HBX LBX HBY LBY/HBXo LBXo HBYo LBYo Table Of Contents 52 Circle Draw Circle Code: 1B 50 Parameters: HBR LBR Function: Draws a circle of the specified radius with the center of the circle at the cur- rent draw pointer position. The circle is drawn in the current foreground color. The draw pointer remains in its original location. Table Of Contents 53 Ellipse Draw Ellipse Function: Draws an ellipse with its center at the current draw pointer position. The X value specifies the horizontal radius, and the Y value specifies the vertical radius. The el- lipse is drawn in the current foreground color. The draw pointer remains in its original location. This is a relative command. Code: 1B 51 Parameters: HBRx LBRx HBRy LBRy Table Of Contents 54 FFill Flood Fill Code: 1B 4F Parameters: None Function: Fills the area where the background is the same color as the draw pointer. Fill- ing starts at the current draw pointer position, using the current foreground color. The draw pointer returns to its original location. This is a relative command. Table Of Contents 55 FCircle Draw filled circle Code: 1B 53 Parameters: HBR LBR Function: Draws a filled circle of the specified radius with the center of the circle at the current draw pointer position. The filled circle is drawn in the current foreground color. The draw pointer remains in its original location. Table Of Contents 56 FEllipse Draw Filled Ellipse Function: Draws an filled ellipse with its center at the current draw pointer position. The X value specifies the horizontal radius, and the Y value specifies the vertical radius. The filled ellipse is drawn in the current foreground color. The draw pointer remains in its original location. This is a relative command. Code: 1B 54 Parameters: HBRx LBRx HBRy LBRy Table Of Contents 57 Function: Draws a line from the current draw pointer position to the specified point, us- ing the current foreground color. The draw pointer returns to its original location. Line Draw Line Code: 1B 44 Parameters: HBX LBX HBY LBY Rline Relative Draw Line Function: Draws a line from the current draw pointer position to the point specified by the x,y offsets, using the current foreground color. The draw pointer returns to its origi- nal location. This is a relative command. Code: 1B 45 Parameters: HBXo LBXo HBYo LBYo Table Of Contents 58 Function: Draws a line from the current draw pointer position to the specified point, us- ing the current foreground color. The draw pointer stays at the new location. LineM Draw Line and Move Code: 1B 46 Parameters: HBX LBX HBY LBY RLineM Relative Draw Line and Move Function: Draws a line from the current draw pointer position to the point specified by the offsets, using the current foreground color. The draw pointer stays at the new loca- tion. This is a relative command. Code: 1B 47 Parameters: HBXo LBXo HBYo LBYo Table Of Contents 59 Point Draw Point Code: 1B 42 Parameters: HBX LBX HBY LBY RPoint Relative Draw Point Code: 1B 43 Parameters: HBXo LBXo HBYo LBYo Function: Draws a pixel at the specified coordinates, using the current foreground color. Function: Draws a pixel at the location specified by the offsets, using the current fore- ground color. This is a relative command. Table Of Contents 60 PutGC Put Graphics Cursor Code: 1B 4E Parameters: HBX LBX HBY LBY Function: Puts and displays the graphics cursor at the specified location. The coordi- nates passed to this command are not window relative. The horizontal range is 0 to 639. The vertical range is 0 to 191. The default position is 0,0. This command is useful for applications running under CoGrf so that you can display a graphics cursor even if you don't want mouse control of the cursor. Table Of Contents 61 Function: Sets the draw pointer to the specified coordinates. The new draw pointer po- sition is used as the beginning point in the next draw command if other coordinates are not specified. Function: Sets the draw pointer to the specified in the offsets. The new draw pointer po- sition is used as the beginning point in the next draw command if other coordinates are not specified. This is a relative command. SetDPtr Set Draw Pointer Code: 1B 40 Parameters: HBX LBX HBY LBY RSetDPtr Relative Set Draw Pointer Code: 1B 41 Parameters: HBXo LBXo HBYo LBYo Table Of Contents 62 Chapter 5. Text Commands The text commands let you control the cursor's position and movement and also the way text prints on the display. These commands can be used on either text or graphics windows. Code Description 01 02 03 04 05 20 05 21 06 07 08 09 0A 0B 0C 0D 1F 20 1F 21 1F 22 1F 23 1F 24 1F 25 1F 30 1F 31 1B 3C BSW 1B 3D BSW 1B 3F BSW Homes the cursor. Positions cursor to X/Y. Specify coordinates as (x + $20) and (y + $20). Erases the current line. Erases from the current character to the end of the line. Turns off the cursor. Turns on the cursor. Moves the cursor right one character. Rings the bell. Moves the cursor left one character. Moves the cursor up one line. Moves the cursor down one line. Erases from the current character to the end of the screen. Erases the entire screen and homes the cursor. Sends a carriage return. Turns on reverse video Turns off reverse video Turns on underlining. Turns off underlining. Turns on blinking. Turns off blinking.4 Inserts a line at the current cursor position. Deletes the current line. See TCharSw5 See BoldSw in Chapter 36 See PropSw in Chapter 36 4 Blink is not supported for text on graphics screens. 5 See TCharSw description for how this works between hardware text and graphics screens. 6 These characteristics are supported for text on graphics screens only. Table Of Contents 63 The NitrOS-9 EOU Level 2 Windowing System Manual Alphabetical Index Arc3P...................................................................................................................50 Bar.......................................................................................................................51 BoldSw...........................................................................................................15, 63 Border......................................................................................................16, 24, 39 box....................................................................................................................51p. Box.......................................................................................................................52 circle..............................................................................................................53, 56 Circle....................................................................................................................53 CWArea...............................................................................................................17 DefColr.................................................................................................................18 device window.......................................................................6, 9, 22pp., 36pp., 47 Device Window...........................................................................................6, 22pp. DfnGPBuf.............................................................................................................19 DWEnd................................................................................................................22 DWProtSw...........................................................................................................23 DWSet.................................................................................................6p., 17, 24p. ellipse.......................................................................................................50, 54, 57 Ellipse............................................................................................................54, 57 FCircle.................................................................................................................56 FColor..................................................................................................................26 FFill......................................................................................................................55 fill………………………………………………………………………………………...10 Fill........................................................................................................................55 font..................................................................10p., 15, 20p., 24, 27pp., 32, 41, 48 Font..........................................................................................................24, 27, 32 GCSet..................................................................................................................30 GetBlk..................................................................................................................31 GPLoad.........................................................................................21, 27, 32, 43pp. GrfDrv....................................................................................................................5 GrfInt................................................................................................................5, 61 KilBuf.......................................................................................................19, 31, 33 line.................................................................7, 20, 25, 27, 44, 46, 49pp., 58p., 63 Line.............................................................................................................49, 58p. LineM.............................................................................................................49, 59 LSet..................................................................................................................34p. overlay window.......................................................................................9, 17, 36p. Overlay Window............................................................................................9, 36p. 64 The NitrOS-9 EOU Level 2 Windowing System Manual OWEnd.............................................................................................................36p. OWSet.......................................................................................................9, 17, 37 Palette.................................................................................14, 16, 18, 25p., 35, 39 Point...............................................................................................................50, 60 PropSw....................................................................................................27, 41, 63 PSet.....................................................................................................................42 PutBlk.........................................................................................................31p., 45 PutGC..................................................................................................................61 RBar.....................................................................................................................51 RBox....................................................................................................................52 Relative Draw Box...............................................................................................52 Relative Draw Line...............................................................................................58 Relative Draw Line and Move..............................................................................59 Relative Draw Point.............................................................................................60 Relative Set Draw Pointer....................................................................................62 Rline.....................................................................................................................58 RLineM................................................................................................................59 RPoint..................................................................................................................60 RSetDPtr........................................................................................................49, 62 ScaleSw...............................................................................................................46 Select.............................................................................................................27, 47 SetDPtr..........................................................................................................49, 62 system..............................................................5, 17pp., 30, 32p., 37, 40, 43p., 48 System...................................................................................................1, 5, 10, 18 TCharSw..............................................................................................................48 WindInt...................................................................................................................5 65 ===== RTS ===== Return to [[NitrOS-9 Ease of Use]] :: [[:Tandy Color Computer:]]