Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 alpha 4/15/85; site cbosgd.UUCP Path: utzoo!watmath!clyde!cbosgd!db From: db@cbosgd.UUCP (Dave Bursik) Newsgroups: net.micro.mac Subject: Re: Adding Assembly Language routines to Microsoft BASIC V2.0 Message-ID: <1077@cbosgd.UUCP> Date: Wed, 24-Apr-85 02:17:15 EST Article-I.D.: cbosgd.1077 Posted: Wed Apr 24 02:17:15 1985 Date-Received: Thu, 25-Apr-85 02:57:56 EST References: <1740@decwrl.UUCP> Organization: AT&T Bell Laboratories, Columbus, Oh Lines: 36 Summary: More on machine language with MBASIC In addition to the documentation available from Microsoft (undoubtably the "right way" to do it), the quick-and-dirty approach to calling user-supplied machine language routines from BASIC V2.0 as described in the manual (putting the binary into an array and CALLing it) works fairly well once you realize that the parenthesis in the middle of the calling- sequence example is supposed to be a comma and that the VARPTR value for the entry point MUST be stored as a 4-byte quantity. However, should you run into problems and get the bomb box in your ML routine, I don't know of any straightforward way to get more information using BASIC alone. I recently acquired Aztec C (commercial version) and was pleasantly surprised to get a register dump from the shell when my BASIC program bombed. At first, I suspected that I might be seeing the interpreter's registers (which wouldn't do me much good), but, having made a little more progress, I became convinced that I was getting the Right Stuff. So far, I have found that Aztec package and MS-BASIC V2.0 complement one another fairly well. I haven't done much with the compiler itself, but the assembler, shell, and Z (vi) editor are all pretty nice to use, and have relieved most of my occasional frustrations with the Finder (e.g., waiting for the desktop to appear, not being able to grep or diff files, etc.). Getting the hex off the assembly listing is infinitely preferable to hand-assembly, which I've found to be rather error-prone. My only complaint about using the Aztec assembler to get the hex to insert in BASIC programs is that it seems to always generate the long form of the branch instruction and doesn't fill in the displacement, even though the target address is within the same source module and well within the short branch range. Perhaps there's a way to force the assembler to optimize a bit (:-)), but I haven't tumbled to it yet. Dave Bursik/..cbosgd!db [The Disclaimer: I have no financial interest in any of these companies above and beyond the dollars I shelled out for their products.]