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

  1. Xref: sparky comp.os.misc:997 comp.os.vms:20321
  2. Newsgroups: comp.os.misc,comp.os.vms
  3. Path: sparky!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!casbah.acns.nwu.edu!jweiss
  4. From: jweiss@casbah.acns.nwu.edu (Jerry Weiss)
  5. Subject: Re: Help on RT-11 macro language
  6. Message-ID: <1993Jan5.020012.13695@news.acns.nwu.edu>
  7. Followup-To: vmsnet.pdp-11
  8. Keywords: RT-11, macro
  9. Sender: usenet@news.acns.nwu.edu (Usenet on news.acns)
  10. Nntp-Posting-Host: unseen1.acns.nwu.edu
  11. Organization: Northwestern University, Evanston Illinois.
  12. References: <93Jan04.223305.29354@acs.ucalgary.ca>
  13. Date: Tue, 5 Jan 1993 02:00:12 GMT
  14. Lines: 87
  15.  
  16. In article <93Jan04.223305.29354@acs.ucalgary.ca> morrow@cns.ucalgary.ca (Bill Morrow) writes:
  17. >Hello all you old fellows,
  18. >
  19. >I have been forced to update some of the PDP-11 assembler acquisition
  20. >software running on our old RT-11 system. Of course,
  21. >there are no comments in the source, to save on disk space.
  22. >A week ago, I knew absolutely nothing about PDP-11 macro language.
  23. >I have been wading through the "Orange Wall", but
  24. >I'm a bit confused by the unconditional branch instruction -
  25. >where does this code end up after the 'BR 10$+2' step?
  26. >
  27. >DR3INT: 0
  28. >    BR    10$+2        <--- branch to where ?
  29. >    BR    20$+2
  30. >10$:    MOV    #107,DMACSR
  31. >    TST    ADCO        <--- here ?
  32. >    BEQ    11$
  33. >    MOV    #113,KWREG
  34. >11$:    MOV    DR3INT+4,DR3INT
  35. >    TR            <--- or here ?
  36. >12$:    et cetera ad nauseum
  37. >
  38.  
  39. This is definitely brain damaged Macro-11 from where I sit, but I won't make
  40. any claims to be a Macro-11 guru.  There's not enough to make a complete
  41. diagnosis, but here is a try.
  42.  
  43. DR3INT: appears to be a the head of a table with 3 (word) entries.  Entries
  44. two and three appear to references to labels 10$ and 20$ with a 2 byte
  45. adjustment.  The code at 11$, moves the third element into the first
  46. element.  This makes it self modifying code at element 0. Element 0 is
  47. intended to be executed directly, while elements 1 and 2 are the data for
  48. element 0. This is nearly always a bad thing, except in real time interrupt
  49. code, when it is still a bad thing except when it saves the project and
  50. becomes a good thing.  Now if the machine tries to execute at label DR3INT:
  51. it executes a branch instruction (relative to the pc).  The real hack here
  52. is that the branch instructions have an additional two byte offset added.
  53. This is okay for the first entry, because it is effectively moved two bytes
  54. backward to put it in the DR3INT: postion.  This makes it an effective BR
  55. 10$.  The second entry is completely strange because it really needs a 4
  56. byte offset (provided it is ever "mov"ed to DR3INT).  Otherwise it will
  57. branch to a location 2 bytes short of 20$.  Since I don't see that section
  58. here, I can't guess what would happen.  Since instructions are either 2,4
  59. or more bytes. It could even miss its intended location and try to execute
  60. some instruction arguments as instructions instead.
  61.  
  62.  
  63.  
  64.  
  65.  
  66. >My intuitive guess is that it ends up at 'TST ADCO',
  67. >but the manual seems to be telling me it branches to
  68. >the indicated address.
  69.  
  70. No.  I know its confusing for a novice, but it probably goes to the 
  71. 10$:    MOV    #107,DMACSR
  72. I suspect this is code to enable interupts on the device and tries to
  73. initialize a dma transfer.  Then it tests ADCO for errors (A/D complete?).
  74.  
  75. >
  76. >While you're here, does the 'MOV' instruction at 11$ really move
  77. >the label 'DR3INT' to the same address as 10$? Why is the 
  78. >'BR 20$+2' there then?
  79. >
  80. Well,  a problem here is that the original contents of DR3INT: are not
  81. initialized, so the flow of the code has to take it to 11$ first or
  82. something else will have to take care of setting up DR3INT:
  83.  
  84.  
  85. >What does 'TR' do? I can't find it in the instruction set
  86. >or the macro language reference manual.
  87. >
  88.  
  89. Got me, perhaps its a defined macro.  Check the macro or source librarys.
  90.  
  91.  
  92. If you want more help, you might want to tell us the hardware involved
  93. (dma and A/d Boards).  I would suggest posting followups to vmsnet.pdp-11
  94. if possible.
  95.  
  96.  
  97.  
  98.  
  99.  
  100. -- 
  101. Jerry S. Weiss      "If you can't stand the heat, stay out of the antimatter!"
  102. j-weiss@nwu.edu    Dept. Medicine, Northwestern Univ. Medical School
  103.