home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / vms / 20370 < prev    next >
Encoding:
Internet Message Format  |  1993-01-05  |  2.7 KB

  1. Path: sparky!uunet!stanford.edu!agate!ucbvax!COLLOQUIUM.CO.UK!ILINE
  2. From: ILINE@COLLOQUIUM.CO.UK
  3. Newsgroups: comp.os.vms
  4. Subject: RE: Help on RT-11 macro language
  5. Message-ID: <9301051818.AA23508@ucbvax.Berkeley.EDU>
  6. Date: 5 Jan 93 16:40:00 GMT
  7. Sender: daemon@ucbvax.BERKELEY.EDU
  8. Distribution: world
  9. Organization: The Internet
  10. Lines: 74
  11.  
  12. I used to be pretty reasonable at Macro-11/RT-11, so (from memory) here 
  13. goes...
  14.  
  15. > I'm a bit confused by the unconditional branch instruction -
  16. > where does this code end up after the 'BR 10$+2' step?
  17. > DR3INT: 0
  18. >     BR    10$+2        <--- branch to where ?
  19. >     BR    20$+2
  20. > 10$:    MOV    #107,DMACSR
  21. >     TST    ADCO        <--- here ?
  22. >     BEQ    11$
  23. >     MOV    #113,KWREG
  24. > 11$:    MOV    DR3INT+4,DR3INT
  25. >     TR            <--- or here ?
  26. > 12$:    et cetera ad nauseum
  27.  
  28. This code is not confidence inspiring. Firstly, use of '10$+2' is clumsy - 
  29. unless there's a reason I'm missing; Secondly, it's using the 'wrong' 
  30. addressing mode to access the CSR (DMACSR); Thirdly - unless I'm missing 
  31. something - it won't work. Here's why:-
  32.  
  33. 10$:    mov #107,dmacsr
  34.  
  35. expands to the following 16-bit words in octal:
  36.  
  37. 10$:    012767
  38. 10$+2:    000107
  39. 10$+4:    an offset to dmacsr
  40.     .
  41.     .
  42.     .
  43.  
  44.  
  45. 'br    10$+2' branches to the word 000107 - without my PDP-11 handbook, I 
  46. can't figure out what that will do, but quite possibly not what you want. 
  47. However, it is possible the programmer has done something subtle & kludgey 
  48. here.
  49.  
  50. > My intuitive guess is that it ends up at 'TST ADCO',
  51. > but the manual seems to be telling me it branches to
  52. > the indicated address.
  53.  
  54. I reckon it branches into the middle of the instruction at 10$
  55.  
  56. > While you're here, does the 'MOV' instruction at 11$ really move
  57. > the label 'DR3INT' to the same address as 10$? Why is the 
  58. > 'BR 20$+2' there then?
  59.  
  60. This code is 'self-modifying' - another black mark. What this instruction 
  61. does is to move the word 'BR 20$+2' to DR3INT. However, because the BR 
  62. instruction is a relative branch, it effectively becomes 'BR 20$-2' in the 
  63. process. Incidentally, the '0' at DR3INT (don't you need .word ?) would 
  64. halt the machine if executed. This doesn't make much sense to me... Unless 
  65. an earlier instruction moves the 'BR 10$+2' to DR3INT, making it 'BR 10$' 
  66. in the process, because the branch is relative. This seems inkeeping with 
  67. the style of the rest of the code.
  68.  
  69. > What does 'TR' do? I can't find it in the instruction set
  70. > or the macro language reference manual.
  71.  
  72. Pass. Probably a macro.
  73.  
  74. > Thanks for the help.
  75.  
  76. Good luck.
  77. > __________________________________________________________
  78. > Bill Morrow                    voice: (403) 220-6275
  79. > Clinical Neurosciences         fax: (403) 283-4740
  80. > University of Calgary          e-mail: morrow@cns.ucalgary.ca
  81.  
  82. Mark Iline, Mech Eng UCL UK
  83. iline@colloquium.co.uk or system@meng.ucl.ac.uk
  84.  
  85.