home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!wupost!darwin.sura.net!nntp.msstate.edu!emory!sol.ctr.columbia.edu!hamblin.math.byu.edu!arizona.edu!mvb.saic.com!macro32
- From: GAVRON@VESTA.SUNQUEST.COM
- Newsgroups: vmsnet.internals
- Subject: BxxxxW
- Message-ID: <920818101628.73@VESTA.SUNQUEST.COM>
- Date: 18 Aug 92 17:16:28 GMT
- Organization: Macro32<==>Vmsnet.Internals Gateway
- Lines: 83
- X-Gateway-Source-Info: Mailing List
-
- Date sent: 18-AUG-1992 10:08:14
-
-
- Jamie mentioned the use of Macros to do the branching
- when destination is more than a byte away (signed of
- course).
-
- The following is from [v55.driver.lis]dkdriver.lis:
- (pretty clever code actually)
-
- .SBTTL WORD_BRANCHES - Define word displacement branches
- ;+
- ; WORD_BRANCHES
- ;
- ; This macro defines for each Bxxx (conditional branch) instruction an
- equivalent
- ; macro named BxxxW with a word displacement. The macro takes as an argument
- ; a list of tuples, each tuple containing 3 items: 1) a conditional branch
- ; opcode; 2) the opcode with the opposite polarity; and 3) the number of
- ; arguments required by the opcode.
- ;-
- .MACRO WORD_BRANCHES LIST
-
- .MACRO WORD_BRANCHES2, OPCODE1, OPCODE2, ARGCNT
-
- .IF EQ ARGCNT-0
- .MACRO OPCODE1, DST, ?L
- OPCODE2 L
- BRW DST
- L: .ENDM OPCODE1
- .ENDC
-
- .IF EQ ARGCNT-1
- .MACRO OPCODE1, FIELD, DST, ?L
- OPCODE2 FIELD,L
- BRW DST
- L: .ENDM OPCODE1
- .ENDC
-
- .IF EQ ARGCNT-2
- .MACRO OPCODE1, BIT, FIELD, DST, ?L
- OPCODE2 BIT,FIELD,L
- BRW DST
- L: .ENDM OPCODE1
- .ENDC
-
- .ENDM WORD_BRANCHES2
-
- .MACRO WORD_BRANCHES1, OPCODE1, OPCODE2, ARGCNT
-
- WORD_BRANCHES2 'OPCODE1'W, OPCODE2, ARGCNT
- WORD_BRANCHES2 'OPCODE2'W, OPCODE1, ARGCNT
-
- .ENDM WORD_BRANCHES1
-
- .IRP ENTRY, <LIST>
- WORD_BRANCHES1 ENTRY
- .ENDR
-
- .ENDM WORD_BRANCHES
-
- WORD_BRANCHES <-
- <BBC, BBS, 2>,-
- <BBCC, BBSC, 2>,-
- <BBCS, BBSS, 2>,-
- <BCC, BCS, 0>,-
- <BEQL, BNEQ, 0>,-
- <BEQLU, BNEQU, 0>,-
- <BGEQ, BLSS, 0>,-
- <BGEQU, BLSSU, 0>,-
- <BGTR, BLEQ, 0>,-
- <BGTRU, BLEQU, 0>,-
- <BLBC, BLBS, 1>,-
- <BVC, BVS, 0>>
-
-
-
- Ehud
-
- --
- Ehud Gavron (EG76)
- gavron@vesta.sunquest.com
- "The world bores you when you're cool."
-