OK all of you Macro gurus, I have a macro that I want to specify a valid
register pair (to potentially be used for a divide instruction in the
macro). I've come up with:
MACRO
&LABEL LOADK &STG,®,&SCALE=1000
.*
LCLC ®1,®2
LCLA &X
.*
.* VALIDATE REQUIRED PARAMETERS PRESENT
.*
AIF ('&STG' EQ '').ERR1
AIF ('®' EQ '').ERR1
AIF ('®'(1,1) NE '(').ERR2
&X SETA INDEX('®',')')
AIF (&X EQ 0).ERR2
®1 SETC '®'(2,&X-2)
AIF ('®1'(1,1) NE 'R').CHKEVN
®1 SETC '®1'(2,*)
.CHKEVN ANOP
&X SETA ®1
AIF (&X GT 15).ERR3
AIF (((&X/2)*2) NE &X).ERR2
®1 SETC SIGNED(&X)
®2 SETC SIGNED(&X+1)
.*
...
MEND
which works great for me (yeah, I know the assembler will check for a
closing paren but, what the heck). This finds (R14), (14), and flags (R15),
(15), and (16). But doesn't catch (RA) (i.e. register 10) or anything like
(VALUE) (where VALUE EQU 14).
The 'SIGNED' function seems awkward but the other things I tried are:
®1 SETC '&X'
®2 SETC '&X+1' (sets ®2 to '14+1' for example which works,
but looks funny, i.e generates L 14+1,AREA)
and
®1 SETC '&X'
&X SETA &X+1
®2 SETC '&X' (sets ®2 to '15' for example which works,
but needs the extra SETA)
Anyway, what I'm wondering is if anyone has come up with a better solution.
Thanks for looking,
Mark Hammack
Senior Technical Specialist
Systemware, Inc.