Identifies the beginning or the continuation of a dummy control section.
| .dsect | Name |
The .dsect pseudo-op identifies the beginning or the continuation of a dummy control section. Actual data declared in a dummy control section is ignored; only the location counter is incremented. All labels in a dummy section are considered to be offsets relative to the beginning of the dummy section. A dsect that has the same name as a previous dsect is a continuation of that dummy control section.
The .dsect pseudo-op can declare a data template that can then be used to map out a block of storage. The .using pseudo-op is involved in doing this.
| Name | Specifies a dummy control section. |
.dsect datal
d1: .long 0
# 1 Fullwordd2: .short 0,0,0,0,0,0,0,0,0,0 # 10 Halfwords
d3: .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 # 15 bytes
.align 3 #Align to a double word.
d4: .space 64 #Space 64 bytes
.csect main[PR]
.using datal,7
l 5,d2
# This will actually load
# the contents of the
# effective address calculated
# by adding the offset d2 to
# that in GPR 7 into GPR 5. .csect foo_data[RW]
.long 0xaa
.short 10
.short 20
.globl .foo_pm[PR]
.csect .foo_pm[PR]
.extern l1
.using TOC[TC0], 2
l 7, T.foo_data
b l1
br
.toc
T.foo_data: .tc foo_data[TC], foo_data[RW] .csect bar_data[RW]
.long 0xbb
.short 30
.short 40
.globl .bar_pm[PR]
.csect .bar_pm[PR]
.extern l1
.using TOC[TC0], 2
l 7, T.bar_data
b l1
br
.toc
T.bar_data: .tc bar_data[TC], bar_data[RW] .dsect data1
d1: .long 0
d2: .short 0
d3: .short 0
.globl .c1[PR]
.csect .c1[PR]
.globl l1
l1: .using data1, 7
l 5, d1
stu 5, t_data[TD](2)
br # this br is necessary.
# without it, prog hangs
.toc
.comm t_data[TD],4extern long t_data;
main()
{
int sw;
sw = 2;
if ( sw == 2 ) {
foo_pm();
printf ( "when sw is 2, t_data is 0x%x\n", t_data );
}
sw = 1;
if ( sw == 1 ) {
bar_pm();
printf ( "when sw is 1, t_data is 0x%x\n", t_data );
}
}as -o foo_pm.o foo_pm.s as -o bar_pm.o bar_pm.s as -o c1.o c1.s cc -o mm mm.c foo_pm.o bar_pm.o c1.o
when sw is 2, t_data is 0xaa when sw is 1, t_data is 0xbb
The .csect pseudo-op, .using pseudo-op.