Specifications
-*■ ldd #filename ;P1 just the stack. Note we CALL the paramet-
+ jsr openf_ ers in their natural order, P1 and P2, but
+ leas 2,s the macro gets the nasty chore of putting
the parameters on the stack in inverse or
der, and of putting P1 into the D register. We begin to see the drudgery we can
avoid with CALL MACRO. The next example shows it even more clearly.
Here, we have one more parm, so pcount_ is set twice, in {5} and {7}; since only
the last setting counts, we are O.K. Also note there is no limit to the complex-
; PI P2 P3 ity of the parameters you pass;
CALL FPRIHTF_,([3»X])»#STRIHG,(TEHP+80,Y) the macro spits them out with an
+
pcount_
set 2
LDD prefix. One warning: if any
+
pcount set 4 of the parms reference things already on the stack,
+ ldd
temp+80,y
remember that the stack is adjusted by the PSHS in
+
pshs
d
the macro, so you’ll have to give the stack offsets
+
ldd
//string accordingly. Last, a note: if you've forgotten, the
+
pshs d parentheses left, above, let us pass commas or even
+
ldd C3,x] semicolons in a parameter, as we do in P1 and P3,
+
jsr
fprintf_ above. Note the amount of code which the macro will
+
leas
4,3 write for you from one line in your program.
CALL MACRO is designed, obviously, to handle calls to SuperPET system routines.
It may be shortened if you usually handle fewer than six parms, with an increase
in speed. This macro should be put on disk, and brought into play with a state-
ment at the beginning of your code ;include <call macro>
{1}
call macr Call routine, parm 1, parm 2...parm n.
{2}
pcount
__
set 0
Set stack space to release to zero.
(3)
ifnc .,\1. Test for first parameter.
{4}
ifnc .,\2. Test for second parameter.
{5}
pcount
__
set 2
Two bytes stack space for second parm.
{6}
ifnc .,\3.
Test for third parm.
{7}
pcount set 4
Four bytes stack space for 2nd and 3rd parm
{8} ifnc .,\4. Test for fourth parm.
{9}
pcount
__
set 6
Six bytes stack space for parms 2 thru 4.
{10}
ifnc .,\5.
Test for fifth parm.
{11}
pcount
__
set 8
Eight bytes stack space for parms 2 thru 5.
{12}
ifnc .,\6.
Test for sixth parm.
{13}
pcount
__
set 10
Ten bytes stack space for parms 2 thru 6.
{14}
ifnc .,\7.
See if given too many parms. Six is maximum
{15}
fail Yes, warn of too many parms.
{16}
endc
{17}
ldd \6 Load sixth parameter,
(18}
pshs d
and push it onto the stack.
{19}
endc
{20}
ldd \5
Load fifth parameter,
{21}
pshs d
and push onto stack.
{22} endc
{23}
ldd \4
Load fourth parameter, etc.
{24}
pshs d
{25}
endc
{26}
ldd \3 Load third parameter, etc.
{27}
pshs d
{28}
endc
SuperpPET Gazette, Vol.I No.11 -160-
December 1983/January 1984










