The Complete STOS Reference

 pre-release 0.2 Edited By Dr Phibes

Index

STOS Manual 8: TEXT AND WINDOWS

Text Attributes 
Cursor Functions 
Conversion Functions 
Windows
Character Sets 
Saving Space 
Using A Character Set From A Window
Changing The Default Sets 
Icons 
The Icon Definer 

Text Attributes

PEN n

This command sets the current pen colour to n and is used for textual output not graphics and has a default value of 1 when Stos is booted up. PAPER n Designates the background colour to be used during textual output.

INVERSE ON/OFF

Swaps the text and background colours defined with PEN & PAPER

SHADE ON/OFF

Highlights any new text by lightening its colour with a mask.

UNDER ON/OFF

Causes new text to be underlined as it is being printed.

WRITING e

The writing command has three possible modes when e = 1 Replacement mode (default) 2 OR mode (characters merged on screen with a logical or) 3 XOR mode (characters combined with background using XOR)

Cursor Functions

LOCATE x,y

Used to position the cursor before textual output. x & y can have the following possible values:
mode    x range y range
0       0-39    0-24
1       0-79    0-24
2       0-79    0-24

Conversion Functions

t=XTEXT(x)

Converts a graphic coordinate x to the text x coordinate t.

t=YTEXT(y)

Converts a graphic coordinate y to the text y coordinate t.

If the screen coordinate lies outside the window then a negative value is returned by the above two functions.

g=XGRAPHIC(x)

The XGRAPHIC function takes a text coordinate ranging from 0 to the width of the current window and converts it to absolute screen coordinates g=YGRAPHIC(y) This function is Y coordinate version for the above function.

SQUARE w,h,b

Draws a rectangle w characters wide and h characters high at the cursor position. b represents the border type to be used and can be any of the 16 possible border types. See BORDER for more details. w & h can range from 3 to the size of the current window. After this instruction has been executed, the cursor is placed at the top left corner of the box.

HOME

Moves the cursor to the top left corner of the current window.

CDOWN

Pushes the cursor down one line.

CUP

Pushes the cursor up one line.

CLEFT

Pushes the cursor one place to the left. CRIGHT Pushes the cursor one place to the right.

XCURS

Returns the x coordinate of the text cursor (in text format)

YCURS

As above but for the y coordinate.

SET CURS top,base

This instruction can be used to change the size of the cursor top & base can range from 1 to 8 in low & medium resolution.

CURS ON/OFF

Will stop the flashing of all screen objects drawn with colour 2. TEXT INPUT OUTPUT

CENTRE a$

Prints a$ centred on the screen on the line occupied by the cursor. TAB(n) Moves the cursor n places to the right.

SCRN(x,y)

Returns the Ascii character at position x,y in the current window.

Windows

The WINDOPEN instruction enables a window to be created on the screen, there are three possible formats to this statement with b & s optional:

WINDOPEN n,x,y,w,h[,b][,s]

n is the number of the window to be opened and ranges from 1-13 x,y are the text coordinates to the top left corner of the new window. w,h specify the size in characters of the window (minimum size is 3 X 3). b chooses one of the 16 available border styles. See BORDER s indicates which character set is to be used and can range from 1 to 16 depending on the sets currently installed. The default sets for 1 to 3 are:
set     size    notes
1       8X8     default set for low resolution
2       8X8     default set for medium resolution
3       8X16    default size for high resolution
You can use all of these sets in any resolution. Note that the coordinates x,y and the window size w,h use the new character sizes. The font definition accessory can be used to define character sets and are given numbers from 416. See the section on character sets for more details.

TITLE a$

This command is used to input a title on the current window. If the string is shorter than the width of the window it is centred. This title will now be displayed on the window until it is deleted by using the BORDER command with no parameter.

BORDER(n)

This instruction allows a choice to be made from 16 possible border types. The value of n can range from 1 to 16. These borders are made up from the Ascii characters 192 to 255 and can be readily changed using the FONTS.ACB accessory.

WINDOW n

Sets the current window to the window number n, it then redraws the window along with any contents. This instruction is slower than QWINDOW. QWINDOW n This function is the same as above except that it does not redraw the window.

WINDON

Variable containing the number of the currently active window.

WINDMOVE x,y

Moves the current window and it's contents to a new part of the screen specified by the text coordinates x,y. These coordinates are based on the character size of the window which is to be made.

WINDEL n

Delete window number n and erase it from the screen. If this was the current window then the window with the next lower number becomes the current window, which will be redrawn.

CLW

Erases the contents of the current window.

SCROLL ON/OFF

Turns scrolling of the on and off. When off the cursor goes to the top of the screen when it reaches the bottom of the screen instead of the screen scrolling up.

SCROLL UP

Scrolls the current window above the cursor up one line.

SCROLL DOWN

Scrolls the area below the cursor down one line.

Character Sets

Each STOS basic window can have its own character set. These can be edited using the character definer FONTS.ACB When this is executed the screen consists of a drop down menu, along with two windows. The leftmost window is used to edit a character, and the rightmost window is used to select a character for editing. To select a character for editing move the mouse pointer onto it and click the left button. The character will now appear in the editing window. To set a pixel click on the left mouse button and to clear one click on the right button. When you are happy with the character, move the mouse pointer to the character select window and click the right mouse button over the character you wish to replace. You now have two options, save the entire set to disc using the .MBK extension or using the quit and grab option. This places the set you have defined into bank 5 and then exits back to STOS basic. The system menu allows you to select one of four possible sizes for your characters. Unfortunately, not all of these options are available in all three graphics modes. Look at the following table:
size    modes allowed 
8X8     all
8X16    high and medium
16X8    high resolution only
16X16   high resolution only
Before you can call a user defined character set, you first need to reserve some space and load this set into memory. This is done automatically by the quit & grab option from the font definer. If it is intended to install a number of sets, its easiest to save them to disc, and then incorporate them into a program by hand.

Saving Space

RESERVE AS SET n,len

Reserves bank n of memory len bytes long for a character set. This set can now be loaded with a line like:
load "font1.mbk",n
Note that the bank defined using this command is permanent and will be automatically included with your current program when it is saved to disc. Supposing, for example, you reserve some space for three character sets like so:
reserve as set 6,4000
reserve as set 8,4000 reserve as set 5,4000
These sets would be accessed using the numbers :4 for bank 6, 5 for bank 8, 6 for bank 5. The size of these banks has been set to 4000 bytes.

CHARLEN(n)

This function returns the length of a character set specified by n where n can range from 4 to 16 (1 to 3 reserved for the default sets).

CHARCOPY s TO b

Copies character set s to bank b. Values of 1 to 3 correspond to the system sets, and numbers 4 to 16 denote user defined sets. example:
reserve as set 5,charlen(1):charcopy 1 to 5

Using A Character Set From A Window

1 Find the size of the new set using DIR"*.MBK". Round this up to the nearest 1000 bytes just to be on the safe side. 2 Reserve some space for the set using RESERVE AS SET. 3 Load your file into this bank with a line like LOAD "FILENAME.MBK",n where n is the number of the bank you are using to hold the set. 4 Repeat phases 1 to 3 for each set. 5 Open a window using WINDOPEN. Set the character set number value to 3 plus the number of your set. Note you can avoid stages 1 to 3 when installing a single character set by choosing the Quit & Grab option from the font definer.

Changing The Default Sets

In order to change the default character sets, you need to follow the following procedure: 1 Create your new set using the FONTS.ACB accessory. 2 Load your set into bank 5 of the current program using the Quit & Grab option. 3 Place a copy of the system disc into the drive, and type one of the three lines below, depending on the resolution you normally use. low resolution:
bsave"\STOS\8X8.CR0",start(5) to start(5)+length(5)
med resolution:
bsave"\STOS\8X8,CR1",start(5) to start(5)+length(5)
high resolution:
bsave"\STOS\8X16.CR2",start(5) to start(5)+length(5)
Note that STOS basic can also load up to six supplementary sets as well. These should have th extensions .CR4 to .CR9, and can be accessed using the character set numbers 4 to 9 respectively. Note that the size of these sets is determined when you created them. This means you can readily use them in all three graphic modes.

Icons

ICON$(n)

In order to output an icon to the screen print a chr$(27) character followed by chr$(n), Where n is the number of the icon to be printed. This string can be generated directly using the ICON$ function ie print ICON$(n).

The Icon Definer

This is very similar to the font definer. On startup you are presented with a menu and two windows. The bottom window is used to select an icon to edit. As with the font definer, select an icon with the left mouse button. From this point on the procedure is exactly the same as with the font definer. When you are finished editing the set they can be saved to disc or loaded into bank 2 with the Quit & Grab option.