QBASIC+Assembly
Home Up QBASIC+Assembly Floating Point Maze Generation Modules Parsing EMS Game Writing

 

1.  It's Just Numbers
2.  CALL ABSOLUTE
3.  Parameters
4.  An Example
5.  ASM Portion

QBASIC is a product Microsoft provides with DOS and with Windows products and they didn't want it competing with their compiler products, so it is a partially disabled version.  Microsoft makes no bones about this fact.   Another point to remember is that the modern versions of QBASIC, those provided with later versions of DOS and Windows, are derivatives of their QB 4.5 compiler tool (with some key features removed.)

Microsoft didn't make it particularly easy to blend assembly coding with QBASIC.  This was by design.  The reasoning is simply that anyone using assembly programming with QBASIC or needing some way to intercept hardware interrupt events is probably doing so for professional use and they should buy the officially sanctioned compiler product.  Of course, there were legacy programs in MSBASIC and QBASIC which depended on DATA statements for assembly language (such as required to talk with the mouse driver interface), so they had no real choice about keeping at least one provision.

CALL ABSOLUTE is the provision.

Do It Right -- Use ML

Writing well organized and readable QBASIC routines is good practice.  And just as important is to write similarly well organized and readable assembly programs to go along with them.  Because of this, I highly recommend that you make the effort to write your assembly programs using the ML assembler from Microsoft.  It is a professional quality tool that supports just about anything you will ever need to do.  It also allows comments and supports some very helpful simplifications that reduce the likelihood of making errors when you write code.  Best of all, it's free.   It's worth the effort.

If you need a copy, you can see my page on getting it (for free) from Microsoft at my PC tools page.

Getting Started

I've written up some short tutorial pages on this subject.  Read those, if you are unfamiliar with what's involved in using assembly code and QBASIC.  They may help some.

I've also written a simple program that runs in QBASIC which can be used to automatically assemble and prepare appropriate DATA statements for use with CALL ABSOLUTE in your own programs.  It's nothing fancy and it only works if you have already downloaded and set up your own copy of Microsoft's ML assembler (which is free) and also have the appropriate linker, too.  I have another page to help you get these tools, if you don't already have them.

ASSEMBLE.ZIP
The ASSEMBLE.BAS program can be used to help you process your assembly langauge into QBASIC DATA statements.  Included is the REVERSE example used in the short tutorial and a terse description for using them.   About 7k bytes.  Good luck!

(QBASIC interfacing, variable types and how to pass them, array motion via garbage collection, safety)

 

Feel free to email me.

Last updated: Sunday, July 11, 2004 11:49