SDMC - SCRPAINT Display Manager Compiler
and
SDMR - SCRPAINT Display Manager Runner

SDMC compiler

To compile a text routine and screens together, make sure all the screens and blocks 
are available in the directory, and specify:

	SDMC textfile runfile

where infile is your text and outfile is the SDMR run module, which can be run by 
specifying:

	SDMR runfile

These files may have any extension required, but .S for source and .R for run would 
be one possibility.


GENERAL DESCRIPTION

The SCRPAINT Display Manager routines allow the creation of both simple and 
sophisticated interactive or non-interactive screen displays using the combination of 
SCRPAINT designed screens and a primitive BATch like language. SDMC is used to 
translate an SDM program from source to a tokenised form ready for running, in 
combination with all the associated screens and blocks from SCRPAINT, resulting in 
one much smaller file which can then be run via SDMR.

The language is centred round the display of screens and blocks, and all variables 
are treated as text, converted to numerics as required. Variables are %A through %Z 
(26).

As with the normal DOS batch language, labels within an SDM routine are prefixed 
with a colon (:) and can be any combination of characters of any length.

Comments are lines with the first character of *.

The DISPLAY sequence.

	syntax	-	DISPLAY screenname
			DISPLAY blockname
			DISPLAY NOSCREEN

DISPLAY is the actioning statement for the various preparatory statements described 
below, and can display either a .SCR or .BLK type file. If noscreen is specified, then 
the actions for the preparatory statements will work without a further screen display.

In order to display the screen or block, a series of preparatory instructions can be 
specified as to the screen processing required, before the DISPLAY statement for that 
screen/block is executed, these being the following:

CHOICE statement 

	syntax	-	CHOICE key1,key2,key3 action

The choice statement defines the action to be taken when a key or keys is 
pressed. The key values can be either the character required, ie. A or a, a 
choice sequence number referring to the HILITE sequence, ie. the first HILITE 
chosen would be 1 etc. or the ANSI number for a key ie. 27 for Escape or 13 
for Enter. Certain keys have more symbolic codes as follows:

	@A	Anykey
	@U	Up arrow
	@D	Down arrow
	@L	Left arrow
	@R	Right arrow
	@H	Home
	@E	End
	@T	Top (page up)
	@B	Bottom (page down)

There can be upto 3 keys checked for each choice. The action can be one of 
GOTO, DO, EXIT or RETURN.

eample	CHOICE 1,27,A DO routine 1	If choice 1 is selected or the
						Escape key pressed or the
						upper case A then DO routine 1
		CHOICE 2,@A EXIT		If choice 2 or any other key EXIT

HILITE statement

	syntax	-	HILITE att,srow,scol,erow,ecol

This statement specifies the areas of the screen that will be highlighted for 
menu type selection. ATT specifies the attribute code (as shown in SCRPAINT 
using ALT-A) to be used for the selection bar, SROW the start row, SCOL the 
start column, EROW the end row and ECOL the end column of the highlight. 
There can be upto 30 HILITE statements for any one display.

example	HILITE 1,4,4,4,10		The highlight will be Blue on 
						Black and start at row 4 column
						4 ending at column 10

REPEAT VERTICALLY and REPEAT HORIZONTALLY statements

	syntax -	REPEAT direction times,displacement

The repeat statements will repeat the preceding hilite in the direction 
specified, the number of times specified. Displacement will space the hilites 
by that number of blanks. Repeated HILITES count towards the limit of 30 
hilites per display.

example	HILITE 1,4,4,4,10
		REPEAT VERTICALLY 4,0	Set hilite as before but then
						another 4 vertically below one
						another with no spacing
		HILITE 1,4,4,4,10
		REPEAT HORIZONTALLY 3,1	Set hilite as before but then
						another 3 horizontally across the
						screen, separated by 1 space

NOKEY statement

	syntax	-	NOKEY

Simply specifies that keys will not be processed.

POSITION statement

	syntax	-	POSITION rr,cc

Specifies that the block to be displayed is not redisplayed at its default 
position, as in SCRPAINT, but at the row (rr) and column (cc) specified. Row 
and column should be provided as two digits each.

WAIT statement

	syntax	-	WAIT ss,hh

Specified the number of seconds and hundredths to wait before automatically 
continuing. Will normally be pre-empted by a key depression which will 
terminate the wait unless NOKEY is specified.



DOS command

	syntax	-	DOS command

To execute any DOS command or program, then precede the required 
command/program with the word DOS as follows:-

	DOS copy *.* %d		%d in this case is a directory and drive path
	DOS c:\dos\chkdsk.exe


DO command

	syntax	-	DO :label

The word DO followed by a label will branch execution to the statement following the 
label specified. The label after the DO should not be prefixed with a colon (:). As 
stated previously, a label may consist of absolutely any characters whatsoever. The 
DO command can also be used as the action for a CHOICE statement. DO statements 
differ from GOTO's in that when a subsequent RETURN statement is encountered, 
execution will return to the statement immediately following the last DO.

EXIT command

The word EXIT by itself on a line or following a CHOICE statement will cause 
execution to be terminated immediately.

GOTO command

	syntax	-	GOTO :label

The word GOTO followed by a label will branch execution to the statement following 
the label specified. The label after the GOTO should not be prefixed with a colon (:). 
As stated previously, a label may consist of absolutely any characters whatsoever. 
The GOTO command can also be used as the action for a CHOICE statement.


SAVESCREEN and POPSCREEN commands

These two commands will respectively save and restore copies of the screen. If a 
sequence of displays for screens 1, 2 and 3 were executed, each immediately 
followed by a SAVESCREEN, then subsequent POPSCREEN commands would restore 
first screen 1, then 2 and finally 3.

SAVEDIR and POPDIR commands

These two commands will respectively save and restore the current working DOS 
directory, in the same way as POPSCREEN and SAVESCREEN works for screens.

RETURN command

As previously mentioned in the DO command, RETURN will cause processing to 
return to the statement immediately following the last executed DO command.

SET command

	syntax	-	SET var string

SET is used to set the variables %A to %Z, and should be specified as follows:

	SET %A 23		set %A to 23
	SET %B Fred Smith	set %B to the string 'Fred Smith'
	SET %C %A		set %C to the value of %A ie. 23
	SET %D %A%B	set %C to the combined values of %A and %B
					ie. '23Fred Smith'
					(note no space as none between %A and %B)
	SET %E ?		set %E to a random value from 0 to 32767

GETTEXT command

	syntax	-	GETTEXT var,length,string

This command will wait for input up to a maximum length, with an initial value, and 
place it in the variable specified. ie. to receive text input into %I to a maximum length 
of 6 with an initial output value of XXXX, then specify this command as:
 
	GETTEXT %I,06,XXXX

The length specified should always be 2 characters. The initialisation string could of 
course be another variable, so the following would produce the same result:

	SET %P XXXX
	GETTEXT %I,06,%P		%P will be replaced with XXXX

PUTTEXT command

	syntax 	-	PUTTEXT string

This command will output the following text to the screen at the current cursor 
position in the current colours (see CURSOR and COLOR).

	PUTTEXT Fred Smith		print 'Fred Smith' to the screen
	
	SET %O Fred Smith
	PUTTEXT %O			exactly as above

COLOR command

	syntax	-	COLOR number

The COLOR command sets the color for all subsequent GETTEXT or PUTTEXT 
statements. The color is the standard 0 to 255 values, which if you are not sure of, 
use SCRPAINT's ALT-A to display the required color values.

	COLOR 2		sets color to Green on Black
 
CURSOR command

	syntax	-	CURSOR rr,cc

The CURSOR command positions the cursor for subsequent GETTEXT or PUTTEXT 
commands. Both values supplied should always be 2 digits. Top left is 00,00.

	CURSOR 01,03		position cursor to row 1 column 3
	COLOR 2
	PUTTEXT Hello World	and print 'Hello World' at that position in green

PLAY command
 
	syntax	-	PLAY varstr

Music can be played via SDMC/R by use of the PLAY command. This is followed by a 
series of letters and numbers,  to produce tunes such as the  examples given or just 
simple tones as required.

        PLAY T2O4A10BbF#20P20O+C160O-D80

The tune above would play at a Tempo of 2,  starting at Octave 4,  a note of A for 
10/100 of a second,  B flat for the same period,  F sharp for 20/100,  and then pause 
for 20/100,  before going up an Octave to play a C for 160/100 and then down an 
octave to play a D for 80/100.

CLS command

	syntax	-	CLS

This command is exactly equivalent to DOS. It clears the screen!

IF and ENDIF command

	syntax	-	IF var op var
				statement1
				statement2
				etc....
			ENDIF

This statement will compare the value of two variables, or a variable and a string, 
and if the comparison is true, execute subsequent statements until ENDIF is 
encountered. If the comparison is not true, then all the statements upto the next 
matching ENDIF will be bypassed. IF and ENDIF may be nested.
The comparison operators that are valid are equals, less than, greater than and not 
equal to (respectively =, <, > and !).

	SET %A 23
	IF %A = 23
		PUTTEXT %%A is equal to 23
		IF %B > 4
			PUTTEXT %%B is greater than 4
		ENDIF
	ENDIF

CALCULATE command

	syntax	-	CALCULATE var1 = var2 op var3

CALCULATE will perform one of the 4 basic operations plus, minus, multiply and 
divide (+, -, * and / respectively) on var2 and var3 (which can be variables or number 
strings) and place the result in var1 which must be a variable.

	CALCULATE %A = 23 * 4		Puts 92 in %A

	SET %B 23
	SET %C 4
	CALCULATE %A = %B * %C		Exactly the same

GETENV command

	syntax	-	GETENV var envstring

This command will search the environment for an environment variable which is 
named as in the envstring supplied, and place the value of that variable into var.

	GETENV %V TEMP		Places the value of TEMP into %A

TIME command

	syntax	-	TIME var

Places the current time in HHMMSS format into the variable specified.

	TIME %A			Places current time of day into %A

SUBSTR command

	syntax	-	SUBSTR var(var,start,end)

This command will place the contents of variable var2 between start position and end 
position (the first character is at position 0) into the variable var1.

	SET %A Hello world
	SUBSTR %B(%A,3,6)		sets %B to the string "lo w"

INDEX command

	syntax	-	INDEX var(varstr1,varstr2)

This command will search varstr1 for an exact match on varstr2 and return the index 
at which it finds varstr2 within varstr1, and place it in the variable specified. If no 
match is found then -1 is returned.

	SET %A Hello world
	INDEX %I(%A,lo w)		will put 3 in %I
	INDEX %J(%A,L)		will put -1 into %J 

RANDINIT command

	syntax	-	RANDINIT var

Initialises the pseudo random number generator to a particular value for subsequent 
use with the SET %A ? syntax. If you wish to be random for each execution then use 
the following code:

	TIME %s
	RANDINIT %s
	SET %r ?			random number using time of day as a seed

IFEXISTS command

	syntax	-	IFEXISTS filespec

This is an extension of the IF statement that checks if the specified file or directory 
exists, and if so executes the following statements until the next matching ENDIF.

	IFEXISTS c:\autoexec.bat
		puttext AUTOEXEC.BAT exists!!
		puttext --------------------------------------
	ENDIF

LENGTH command

	syntax	-	LENGTH var1 varstr

This command will place the length of varstr in the variable var1.

	SET %A Hello world
	LENGTH %L %A		sets %L to 11, the length of Hello world

