As a software vendor, you will need to place the data at the beginning of your
program because your abend diagnostics must still display the offset in the
program and address the program eyecatcher. You are still using a base register
but your executable code is outside the USING range for that base register. If
you are not a vendor, it will still be easier to analyze a dump because you can
subtract the base reg from the PSW to get the matching offset in your assembler
listing. If you don't then you will need to manually search for the program
start and subtract that address from the PSW.
SAMPL001 CSECT
SYSSTATE ARCHLVL=2
J BEGIN
@DATA LOCTR ,
DC C'Copyright (C), ccccccccccccccccc'
@EX LOCTR , EX instruction operands
DS 0H Instructions must be halfword aligned
@XXXX LOCTR , If your program uses additional LOCTR's then
establish sequence
@CODE LOCTR ,
BEGIN DS 0H
SAVE (14,12) save regs coming in
LR R12,R15 Base register for program
USING (SAMPL001,BEGIN),R12 Make sure assembler diagnoses
incorrect references now
----- Your code here ----
@DATA LOCTR ,
LTORG , Insert literal pool into 4096 addressable base area
* Your program constants and listerals
1. Don't use SAMPL001 LOCTR (or &SYSECT LOCTR) because it's always the first
location counter. Using &SYSECT CSECT (or &SYSECT &SYSSTYP) is fine because it
resumes using the last LOCTR..
2. If your program uses additional LOCTR's that need to be addressable within
the first 4095 bytes off a base reg, then code a LOCTR for them before the first
@CODE.
3. The USING with a range ensures the assembler diagnoses coding errors now
instead of when @DATA pushes @CODE outside the 4096 limit.
4. Above I added @EX LOCTR that should only be used for EX instruction operands
to ensure instructions are always halfword aligned: You could manually enclose
the executed instruction but my #EX macro below makes it much easier. As a
default, it decrements the register to make it relative to 0 and does a LA to
increment it back to relative to 1 (LA does not affect CC). To call it: #EX
(R1),'MVC 10(0,R2),0(R3)' where first operand is the length register and the
second operand is the quoted instruction to be executed.
MACRO ,
* Copyright Jon Perryman 2012
&LABEL #EX &RELATIVE=1 Specify 0 if reg already relative to 0
AIF ('&LABEL' EQ '').NOLABEL
&LABEL EQU *
.NOLABEL ANOP *
AIF ('&RELATIVE' EQ '0').LEN_OK1
BCTR &SYSLIST(1),0 Relative to 0
.LEN_OK1 ANOP ,
EX &SYSLIST(1),#EX_&SYSNDX
AIF ('&RELATIVE' EQ '0').LEN_OK2
LA &SYSLIST(1),1(&SYSLIST(1)) Relative to 1
.LEN_OK2 ANOP ,
&WORK SETC DEQUOTE('&SYSLIST(2)')
&WORKN SETA INDEX('&WORK',' ')
&WORK2 SETC '&WORK'(&WORKN+1,99)
&WORK2 SETC DCVAL('&WORK2')
&WORK SETC '&WORK'(1,&WORKN-1)
@EX LOCTR , Group #EX
#EX_&SYSNDX &WORK &WORK2
&SYSLOC LOCTR , Back to original location counter
MEXIT ,
MEND ,
Your goal is to keep the program to a single base register so the benefit is
only realized when you don't have to search for a second base register when a
program exceeds 4096 bytes or if and existing program which uses 2 base
registers free's up the register if it's needed.
Jon Perryman
----- Original Message ----
> From: Binyamin Dissen <[email protected]>
> Baseless for code, but you will need a base for data.
>
> I use
>
> @CODE LOCTR ,
> @LITERAL LOCTR ,
> LITERALS DC 0D'0'
> @CODE LOCTR ,
> LARL Rx,LITERALS
> USING LITERALS,Rx
> . @LITERAL LOCTR ,
> LTORG ,
>
> On Wed, 10 Apr 2013 15:06:44 -0700 Scott Ford <[email protected]> wrote:
> :>I am in the process of trying to understand and use baseless Assembler. I
>read through Ed's Jumpify Share presentation so
> :>i am trying to read and learn...I am not asking anyone to write my
>code...just tell me where I am wrong ..
> :>
> :> 000142 0000 0000 00000 210+ L
>15,=AL1(B'00000000',(0),
> :> +
> :> ** ASMA307E No active USING for operand
>=AL1(B'00000000',(0),(229),B'00000000')
> :> ** ASMA435I Record 2422 in SYS1.MACLIB(GETMAIN) on volume: SDRES1