home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!stanford.edu!agate!ucbvax!COLLOQUIUM.CO.UK!ILINE
- From: ILINE@COLLOQUIUM.CO.UK
- Newsgroups: comp.os.vms
- Subject: RE: Help on RT-11 macro language
- Message-ID: <9301051818.AA23508@ucbvax.Berkeley.EDU>
- Date: 5 Jan 93 16:40:00 GMT
- Sender: daemon@ucbvax.BERKELEY.EDU
- Distribution: world
- Organization: The Internet
- Lines: 74
-
- I used to be pretty reasonable at Macro-11/RT-11, so (from memory) here
- goes...
-
- > I'm a bit confused by the unconditional branch instruction -
- > where does this code end up after the 'BR 10$+2' step?
- >
- > DR3INT: 0
- > BR 10$+2 <--- branch to where ?
- > BR 20$+2
- > 10$: MOV #107,DMACSR
- > TST ADCO <--- here ?
- > BEQ 11$
- > MOV #113,KWREG
- > 11$: MOV DR3INT+4,DR3INT
- > TR <--- or here ?
- > 12$: et cetera ad nauseum
-
- This code is not confidence inspiring. Firstly, use of '10$+2' is clumsy -
- unless there's a reason I'm missing; Secondly, it's using the 'wrong'
- addressing mode to access the CSR (DMACSR); Thirdly - unless I'm missing
- something - it won't work. Here's why:-
-
- 10$: mov #107,dmacsr
-
- expands to the following 16-bit words in octal:
-
- 10$: 012767
- 10$+2: 000107
- 10$+4: an offset to dmacsr
- .
- .
- .
-
-
- 'br 10$+2' branches to the word 000107 - without my PDP-11 handbook, I
- can't figure out what that will do, but quite possibly not what you want.
- However, it is possible the programmer has done something subtle & kludgey
- here.
-
- > My intuitive guess is that it ends up at 'TST ADCO',
- > but the manual seems to be telling me it branches to
- > the indicated address.
-
- I reckon it branches into the middle of the instruction at 10$
-
- > While you're here, does the 'MOV' instruction at 11$ really move
- > the label 'DR3INT' to the same address as 10$? Why is the
- > 'BR 20$+2' there then?
-
- This code is 'self-modifying' - another black mark. What this instruction
- does is to move the word 'BR 20$+2' to DR3INT. However, because the BR
- instruction is a relative branch, it effectively becomes 'BR 20$-2' in the
- process. Incidentally, the '0' at DR3INT (don't you need .word ?) would
- halt the machine if executed. This doesn't make much sense to me... Unless
- an earlier instruction moves the 'BR 10$+2' to DR3INT, making it 'BR 10$'
- in the process, because the branch is relative. This seems inkeeping with
- the style of the rest of the code.
-
- > What does 'TR' do? I can't find it in the instruction set
- > or the macro language reference manual.
-
- Pass. Probably a macro.
-
- > Thanks for the help.
-
- Good luck.
- > __________________________________________________________
- > Bill Morrow voice: (403) 220-6275
- > Clinical Neurosciences fax: (403) 283-4740
- > University of Calgary e-mail: morrow@cns.ucalgary.ca
-
- Mark Iline, Mech Eng UCL UK
- iline@colloquium.co.uk or system@meng.ucl.ac.uk
-
-