Path: utzoo!utgpu!water!watmath!clyde!ima!johnl From: johnl@ima.ISC.COM (John R. Levine) Newsgroups: comp.sys.ibm.pc Subject: Re: Microsoft Assembler Summary: Yes, dumb. Keywords: assembler, branch optimization Message-ID: <864@ima.ISC.COM> Date: 27 Jan 88 16:40:46 GMT References: <1428@homxb.UUCP> Reply-To: johnl@ima.UUCP (John R. Levine) Organization: Not enough to make any difference Lines: 28 In article <1428@homxb.UUCP> gemini@homxb.UUCP (Rick Richardson) writes: >We have a need to convert 8088 assembler code from an assembler >that operates like most UNIX assemblers to the Microsoft Assembler. >... >The question is: is it possible to get [branch optimization] from the >Microsoft 5.0 assembler? is it possible to write a macro to do this? >or is it just plain not possible with the Microsoft tools? Generally speaking, you can't do it. MS assemblers have always done simple branch optimization for backward unconditional branches, but not forward ones. As a cruel joke, the 5.0 assembler puts out a warning "Jump within short distance" when it notices a forward jump that it should have made short. You're then supposed to stick a "short" keyword into the source code and reassemble. It gives you no help at all on conditional branches. I believe you could write macros to optimize backward conditional branches, but you're out of luck again for forward ones. It will, of course, give you an error message if you try to branch too far with a conditional jump, but it's up to you to fix the code. Perhaps you could write a program which iteratively assembles a routine, then looks at the error messages and adjusts the branches in the source code and assembles it again until the error messages go away (up to some limit, there are cases where the warning is unavoidable.) -- John R. Levine, IECC, PO Box 349, Cambridge MA 02238-0349, +1 617 492 3869 { ihnp4 | decvax | cbosgd | harvard | yale }!ima!johnl, Levine@YALE.something Gary Hart for President -- Let's win one for the zipper.