Hand Assembling for the VAX..
Keith Edwards
keith at stratus.UUCP
Sun Apr 3 02:06:15 AEST 1988
>/***** ubc-bdcvax:comp.unix.wizards / e!kishore / 4:10 am Mar 19, 1988*/
>The question I had is : given a BRW instructionthat looks like
>BRW 1040 (Branch Word) what does the bit pattern look
>like? (assuming the 1040 is in hex). Also BRW seems to allow a maximum
>displacement of 16 bits. What does one use to make bigger jumps?
> Also if I obtain the address of a function bar using nlist, the actual
>function seems to starts a few bytes after the value returned by nlist. These
>few bytes are probably used to hold some status info. I've been trying to
>figure out the exact size of this area.
Here's the output for a brw #^x1040
page 1
0000 00000000 1 .entry _main,0
00000002 2
1040 8f 31 00000002 3 brw #^x1040
00000006 4
00000006 5 .end _main
00000006 6
The Vax puts the more significant byte of each word at the higher addresses.
You can use the JMP instruction, which allows a 32-bit address target for
branches of longer that 16 bits.
The first 16-bit word of each function is a register mask which specifies
the registers which are to be saved on the stack when the procedure is
called. The top 4 registers (PC, SP, AP, and FP) get saved automatically,
and you can't save r0 or r1 (which are used for function-returned values).
So to save all the registers you can save, use a register mask of ^x0ffc.
Hope this helps!
-keith
More information about the Comp.unix.wizards
mailing list