Operating System - OpenVMS
Showing results for 
Search instead for 
Did you mean: 

Vax macro to Alpha macro

Go to solution
selahattin okur
Occasional Advisor

Vax macro to Alpha macro

We are trying to create .obj of a macro, which is now running on vax/vms V5.5-2H4(vax v4200) , on an alpha vms 7.3(DS20-e).

When I compile the macro on VMS 7.3 I get this :
L2S::RASIT.OKUR>macro /migrat/diagn=a.a/lis pcount

%AMAC-E, unrecognized statement
at line number 88 in file DSA0:[ERDEMIR.RASIT.OKUR]PCOUNT.MAR;5

movzbl @sf$l_save_ap(fp),r0
%AMAC-E, undefined symbol SF$L_SAVE_AP
at line number 97 in file DSA0:[ERDEMIR.RASIT.OKUR]PCOUNT.MAR;5

%AMAC-E, previous errors prevent further analysis
at line number 99 in file DSA0:[ERDEMIR.RASIT.OKUR]PCOUNT.MAR;5
On vax system in starlet.mlb I can see the the $sfdef with lib/lis command but on VMS 7.3 I couldnt find these entries in mlb.

I am attaching the source of macro and the mlb files.

Thanks in advance.
Honored Contributor

Re: Vax macro to Alpha macro

This code uses VAX architecture features. Specifically, this code is rummaging around in the VAX call frames, looking at the arguments.

The call frames and the calling standard are among the areas that have seen some of the most significant implementation changes among the architectures.

Start by reading the application porting manuals, if you've not already done so.

Some of the interesting stuff is here:

Some is here:

And start with these two documents:

This code pokes around in the VAX stack frames, which means you'll need to figure out exactly what the code is really doing with the saved argument pointer in the stack frame, and migrate it. There are some LIB$ calls that might be of use here, that allow you to more easily navigate the call frames. But whether you can use those depends on what the code is doing.

PCOUNT.MAR implies you're looking at the program counter (PC), and that sort of thing is specific to the platform. On recent OpenVMS Alpha and OpenVMS I64 versions, there are SDA extensions that can be used to track the PC addresses, as well as traceback and other routines. Put another way, there may well be replacement code available in OpenVMS itself; you may need to rework the existing code to use these routines, rather than the more direct work to re-implement what the code was doing.

selahattin okur
Occasional Advisor

Re: Vax macro to Alpha macro

Pcount.mar has been used for the parameter count of the subroutine, where pcount itsel has been called.
Robert Gezelter
Honored Contributor

Re: Vax macro to Alpha macro


Most likely, MACRO-32 code that dates to VAX/VMS 5.5-2 will require other changes in the declaritives.

The AMACRO compiler is rather strict about what it will allow.

My recommendation is to read the manual on porting VERY carefully, and work through all of the code making the required changes. It is far more frustrating to work one diagnostic at a time.

- Bob Gezelter, http://www.rlgsc.com
Jess Goodman
Esteemed Contributor

Re: Vax macro to Alpha macro

You can't call routine B from routine A to get the number of arguments passed to routine A on an Alpha, like you could on a VAX.

Instead you have to use a language extension to get the number of arguments to a routine in that routine itself.

In the routine is in Fortran just use the IARGCOUNT intrinsic. It's return value is the number of arguments of the calling routine:

In C/C++ use:
I have one, but it's personal.
Honored Contributor

Re: Vax macro to Alpha macro

Ok. I've unrar'd that archive and had a look at the code. (First time I've seen a rar archive in this corner of the programming universe, too.)

Here's what matters from within the rar...

.entry pcount,^m<>
movzbl @sf$l_save_ap(fp),r0

Here's some related reading...


And here's the detailed and serious reading around the code here...


Here's some very serious example source code...


Or yes, do use the language-specific constructs for whatever language is in use here. And if you're using a language that has this argument count extension, this approach will be the easiest way.