90 likes | 406 Views
2. Referencing the Location Counter. The location counter (in the PSW) always points at the next instruction.Can directly reference the location counter in commands, using *E.g., * 8 would refer to 8 bytes past the current location counter.Can actually use the location counter directly for bra
E N D
1. 1 Using the Location Counter
2. 2 Referencing the Location Counter The location counter (in the PSW) always points at the next instruction.
Can directly reference the location counter in commands, using *
E.g., * + 8 would refer to 8 bytes past the current location counter.
Can actually use the location counter directly for branching...
3. 3 Referencing the Location Counter CLI 0(R1), C' '
BE *+12
LA R1,1(R1)
B *-12
…
add arrows???
Check address
4. 4 Referencing the Location Counter Advantage: avoids cluttering program with unnecessary labels.
Disadvantage: must be very careful about later inserting commands that would change the spacing between the referenced locations.
Unless you have a very good reason to use this, don’t.
5. 5 ORG Command Doesn't just reference location counter value; actually alters it.
Allows you to reuse/redefine areas of storage (like REDEFINES in COBOL).
ORG command at end is highly recommended to reset to the location counter again; omitting this is a common cause of problems.
6. 6 ORG Command location
counter
000280 INPUT DS CL80
ORG INPUT
000280 TYPE DS CL1
000281 NAME DS CL40
0002A9 STREET DS CL39
ORG INPUT+1 (or NAME)
000281 CITY DS CL20
000295 STATE DS CL20
0002A9 ZIP DS CL10
0002B3 CNTRY DS CL20
ORG important!
002D0 ...…
7. 7 ORG Command
8. 8 ORG Command location
counter
000280 INPUT DC CL80
ORG INPUT
000280 TYPE DS CL1
000281 NAME DS CL40
0002A9 STREET DS CL39
ORG INPUT+1 (or NAME)
000281 CITY DS CL20
000295 STATE DS CL20
0002A9 ZIP DS CL10
0002B3 CNTRY DS CL20
ORG
002D0 ...…