[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

486.0. "Help aliasing registers?" by JON::SANTIAGO (aka Gator) Tue Jun 02 1987 11:01

    Is there a way to equate a variable name to a register in VAX
    MACRO? Specifically, what I'm trying to do is something like:       
    
    mem_base	=	r8
    
    which would allow me to do
    
    		movx	data,offset(mem_base)
    
    I'm a newcomer to VAX MACRO, so this may be a stupid question,
    but nobody around here knows, nor does the MACRO manual.
    
    -Ed
T.RTitleUserPersonal
Name
DateLines
486.1ALBANY::KOZAKIEWICZYou can call me Al...Tue Jun 02 1987 15:0315
The way I handle this situation is something like this:

	.PSECT	DATA,.....

VARIABLE::	.BLKL	256.	;Data area
JUNK::		.LONG	0

	.PSECT	CODE,.....

		.
		.
	MOVAL	VARIABLE, R5	;Put starting address in R5
	MOVL	JUNK, 12(R5)	;Move JUNK to VARIABLE+12

Hope this answers your question.
486.2JON::SANTIAGOaka GatorTue Jun 02 1987 15:247
    That's pretty much what I'm doing, but my question was if there's
    any way to say "base_addr" or "start" instead of "R7". I learned
    back in my TOPS-20 days that doing that is a much more readable
    form of doing exactly the same thing, and now I'm in VMSland and
    wanted to use my old coding practices. Thanks anyhoo.
    
    And BTW, why the 2 colons after the labels?
486.3TLE::BRETTTue Jun 02 1987 16:425
    Aliasses : No
    
    2 Colons => Global Symbol, 1 Colon => Local Symbol
    
    /Bevin                                       
486.4You can do it on PDP-11s but it isn't a good idea3363::HERBERTTue Jun 02 1987 17:175
    The MACRO-11 assembler lets you define your own symbol names instead
    of the standard names, but I consider it to be a very confusing
    practice and would not recommend that anyone use it.
    
    Kevin
486.5ALBANY::KOZAKIEWICZYou can call me Al...Tue Jun 02 1987 17:4314
re: -1

	Yeah, I seem to remember that the string %r (where r is the register
number, e.g. %5) was the "real" symbol for a register.  The assembler (RSX)
did the old:	R0 == %0
		   .
		   .
		R5 == %5
		SP == %6
		PC == %7

for you.  I have never tried this on a VAX.  Now I understand what .0
meant by "aliasing".  But hey, for a real challenge, try to emulate the 
DECsystem 10/20 SKIP instructions! Ha, ha!
486.6VINO::RASPUZZIMichael RaspuzziTue Jun 02 1987 20:148
    But we all know that the KL's SKIP instruction does not skip and
    the JUMP instruction does not jump!
    
    I don't know why, but they are no-ops. There are of course flavors
    of SKIP and JUMP that do real work. SKIPA Always skips and JUMPA
    always jumps.
    
    Mike
486.7ERIS::CALLASI have nothing to say, but it's okayWed Jun 03 1987 12:126
    You cannot alias registers. This is a feature, not a bug; MACRO32 was
    written that way on purpose. Given that the VAX has many instructions
    with register side-effects (e.g. MOVC3), it would be asking for a *lot*
    of trouble to alias registers. 
    
    	Jon
486.8I use SAVIPL(R1) as name instead of SAVIPLVIDEO::OSMANtype video::user$7:[osman]eric.sixFri Jun 05 1987 11:0649
Dejavu city !  I wanted to do *exactly* the same thing.

I was implementing a bunch of routines in macro.  For instance, one
called

	MACRO_DEVICELOCK

This routine takes a bunch of input parameters in registers, which is
an efficient interface.  The parameters are known as

	LOCKADDR, SAVIPL, CONDITION

The code is much less readable if it says R1 all over the place instead
of LOCKADDR, R2 instead of SAVIPL etc.

I implemented a macro call PARAMS.  So I start my routine with

	MACRO_DEVICELOCK::
		PARAMS LOCKADDR, SAVIPL, CONDITION

So, if there were a way to assign the name LOCKADDR to R1, SAVIPL, to R2,
CONDITION to R3, I'd design the PARAMS macro to do that.

But, as you say, there doesn't seem to be.

So, I've settled for next best, which is, I pass the parameters on the stack
instead.  The PARAMS macro defines LOCKADDR as 4, SAVIPL as 8, CONDITION
as 12.

My routines all start out like the DEVICE_LOCK one, like this:

	MACRO_DEVICELOCK::
		PARAMS LOCKADDR, SAVIPL, CONDITION
		MOVAL SP, R1		; Use R1 as access to params
		...
		MOVL SAVIPL(R1),R3	; for example

So, to refer to a parameter, for instance SAVIPL, instead of just saying
"SAVIPL", I have to say "SAVIPL(R1)".  Plus I need that one extra instruction
at the beginning of the routine.

I've found this to be second best to true register naming.  Anyone like
this idea ?  Or have a better idea ?

/Eric

p.s.	The reason I just don't say "SAVIPL(SP)" is that sometimes things
	are pushed on stack, which would screw up the offsets

486.9use BLISSS ?PASTIS::MONAHANSat Jun 20 1987 22:471