
                             Special Support Macros

                                  Version 3.0

              (c) 1993 MJSoft System Software, SinSoft and PCSoft

================================================================================

### Typical structure of program which uses the macros: ###

;DEBUG	set	1		; Set only when debugging and your
				; debugger doesn't pass the arguments
				; correctly (see StartupInit doc)

	include	"ssmac.h"	; include the macros
	[tbase	a4]		; define text base register if you want
	start			; or clistart if you want only CLI
; here is automatically defined the "go" label

	; here is your program

	tags			; start of tag list
	; here are your tags
	finish			; end of tag list
	end


### Universal macros ###

push	r/m		- store register/memory onto stack
pop	r/m		- get register/memory from stack
mpush	reglist		- store register list onto stack
mpop	reglist		- get register list from stack
rptr	label		- store relative pointer to specified label

### Variable definition macros ###

dv.size	name		- define variable, size={b,w,l}
dbuf[.size]	name,nritems	- define buffer of nritems items size={b,w,l},
			  default=byte
get.type	from,to		- MOVE.type <variable>,<to>
put.type	from,to		- MOVE.type <from>,<variable>
geta	from,to		- LEA <variable>,<to>
clv.type	dest		- CLR.type <variable>
tsv.type	src		- TST.type <variable>

### Variable manipulation macros ###

vpush	var		- push longword variable onto stack
vpop	var		- pop longword variable from stack

  - following macros are clones of standard instructions manipulating with
    variables. 'v' on the left means that source is a variable, 'v' on the right
    means that destination is a variable:

negv.size	to
notv.size	to
stv.size	to
clrv.size	to
seqv.size	to
snev.size	to
sccv.size	to
scsv.size	to
tstv.size	from
bchgv	bitnr,byte
bclrv	bitnr,byte
bsetv	bitnr,byte
btstv	bitnr,byte
subqv.type	nr,byte
addqv.type	nr,byte
vpea	var
eorv.type	src,dest
divsv	src,dest
divuv	src,dest
mulsv	src,dest
muluv	src,dest
addv.type	src,dest
vadd.type	src,dest
andv.type	src,dest
vand.type	src,dest
cmpv.type	src,dest
vcmp.type	src,dest
movev.type	src,dest
vmove.type	src,dest
orv.type	src,dest
vor.type	src,dest
subv.type	src,dest
vsub.type	src,dest
vlea	src,dest
vmovev.type	src,dest
movemv.type	src,dest
vmovem.type	src,dest

### Text macros ###

tbase	basereg		- define text base register, must be before START
dt.[c][l]	[label,]text	- define a text in text section
				l = put NL character after the text
				c = don't put 0 character after the text
gett	textlabel,areg	- get address of text to <areg>
tlea	textlabel,areg	- same as above
dtl	text,areg	- define text and load its address

### System interface ###

call	[base,]name	- call function <name> of specified library
			  if no library is specified, it will use current
			  contents of A6 as the base
jump	[base,]name	- jump to function <name> ... see CALL

### Startup and exit ###

start			- perform standard startup and open ss.library
clistart			- START with no respect to WorkBench
tags			- start final declaration of tags
finish			- end of tag list, inserts size of variables

### Startup tags ###

wbconsole			- open console window when started from WorkBench
template	<template>	- set template, followed by dv.l <name> for each
			  argument
exitrout	routine		- <routine> will be called before exit
errrout	routine		- <routine> will be called for error messages
			  (see SSLib.doc/ReportError)
library	name,version	- open library and define variable containing
			  its base; error if not available;
trylib	name,version	- same as LIBRARY, but doesn't fail if not available
cputype	min,max		- require CPU 680<min>0 to 680<max>0, max=-1 for
			  no limit
fputype	min,max		- require FPU in specified range, see SS.i
sysver	min,max		- require kickstart version min..max, max=-1...
diserr	flags		- disable error messages specified by flags
			  (it's a bit field with the same format as
			  sv_errors)
wbconname	name		- open console window with specified name when
			  started from WorkBench
usrtrk	tablelabel	- define user tracker types (see UserTrkTypes)
extrahelp	[<string>]	- define extra help string. If no argument is
			  given, you should continue with sequence of
			  DC.Bs ended by ENDHELP
endhelp			- end of extra help string (see EXTRAHELP)

### Text output macros ###

write	<text>		- write text to standard output
writeln	<text>		- write text followed by NL to standard output
printfs[.L]	<text>		- write formatted text to std. output
			  parameters are stored on the stack, .L=newline
printfr[.L]	<text>,reg	- write formatted register contents
printfv[.L]	<text>,variable	- write formatted variable contents
printfl[.L]	<text>,reglist	- write formatted register list contents
			  you can supply number of registers you have
			  passed as the 3rd parameter, it will simplify
			  the code generated by this macro
err	<text>		- write text and exit with error return code
doserr	<text>		- write text + dos error text and exit
errc.condition	<text>		- if <condition> is false, write text and exit

### NOTES ###

   If you define the _GlobVec symbols before startup macro, the startup code
generated will use pointer to global vector passed in A2. This is automatically
done by the system, but not by most debuggers, therefore programs compiled
using this option are hardly debuggable unless you specify the DEBUG option.
