Address Objectcode Line Sourcetext RYES_PNO.S Assembled in Relocatable mode 000000 : 1 ; Program Name: RYES_PNO.S 000000 : 2 000000 : 3 ; Assembly Instructions: 000000 : 4 000000 : 5 ; The algorithms in this program can be assembled in Relocatable or 000000 : 6 ; PC-relative mode. But when they are assembled in PC-relative mode, the 000000 : 7 ; code is not always what we want. 000000 : 8 000000 : 9 ; Experiment 1. 000000 : 10 000000 : 11 ; Shows that a pointer, declared in the data section, to a variable 000000 : 12 ; declared in the bss section will contain the correct address when 000000 : 13 ; assembly is in Relocatable mode; but when assembled in PC-relative mode, 000000 : 14 ; the pointer will contain the location at which the variable resided 000000 : 15 ; during the assembly process. 000000 : 16 000000 :20790000003A 17 movea.l _variable, a0 ; A pointer to a variable is loaded into 000006 : 18 ; an address register. 000006 : 19 ; End of Experiment 1. 000006 : 20 000006 : 21 ; Experiment 2. 000006 : 22 000006 : 23 ; Illustrates that the instructions 000006 : 24 000006 : 25 ; move.l #label, -(sp) 000006 : 26 ; move.l #label, An 000006 : 27 000006 : 28 ; are not compatible with assembly in the PC-relative mode, and that 000006 : 29 ; the following instructions must be used instead. 000006 : 30 000006 : 31 ; pea label 000006 : 32 ; lea label. 000006 : 33 000006 :2F3C00000036 34 move.l #label_1, -(sp) 00000C :207C00000036 35 move.l #label_1, a0 000012 :2F3C0000003E 36 move.l #label_2, -(sp) 000018 :227C0000003E 37 move.l #label_2, a1 00001E : 38 00001E :487900000036 39 pea label_1 000024 :41F900000036 40 lea label_1, a0 00002A :48790000003E 41 pea label_2 000030 :43F90000003E 42 lea label_2, a1 000036 : 43 000036 : 44 ; End of Experiment 2. 000036 : 45 000036 : 46 data 000036 :00000001 47 label_1: dc.l 1 00003A :00000042 48 _variable: dc.l variable ; _variable is a pointer to variable. 00003E : 49 bss 00003E : ^ 4 50 label_2: ds.l 1 000042 : ^ 4 51 variable: ds.l 1 ; During loading, we want the address of 000046 : 52 ; this variable to be stored in the 000046 : 53 ; location addressed by the pointer. 000046 : 54 end