home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / program / books / 68k_book / arp_src / prg_2br.asr < prev    next >
Text File  |  1985-11-20  |  3KB  |  57 lines

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