home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 6
/
Sonderheft_6-96.iso
/
pd
/
libraries
/
sslib51
/
ssmac.doc
< prev
next >
Wrap
Text File
|
1996-11-03
|
7KB
|
189 lines
Special Support Macros
Version 3.4
(c) 1993,1994 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
alignlong - longword-align the variables
get.type from,to - MOVE.type <variable>,<to>
put.type from,to - MOVE.type <from>,<variable>
geta from,to - LEA <variable>,<to>
getad from,via,to - LEA <var>,<via> ; MOVE.L <via>,<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
tpea text - push address of text
### 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 symbol before startup macro, the startup code
will use pointer to global vector passed in A2. This is automatically done
by the system, but not by most debuggers, therefore programs compiled with
this option are hardly debuggable unless you specify the DEBUG option.
Some debuggers set false stderr stream when running debugged program.
This is the reason why start/clistart macros set stderr to stdout if DEBUG
is defined.
Some macros mentioned above store the text data into special text hunk.
This produces many relocatable references or causes loss of one register
(usually A4). There are two solutions of this problem:
(1) Use linker to join the hunks. Very good idea, but some compilers don't
support creation of 16-bit PC-relative references to external symbols.
(2) When doing final compilation of the program, set the GATHERTX symbol
before calling the start macro. Then run TExtract to extract contents
of your text hunk to T:TextHunk.i. Compile again with TEXTRACT symbol
defined (and GATHERTX undefined). The texts will be appended after
the finish macro and all references done using GETA, TLEA or DTL will
be PC-relative. These symbols _must_ be defined before SSMac.h
is included.