GWBasic/QuickBasic/QBasic/Visual Basic repository

By Na Than Assh Antti for archiving purposes download at your own risk

Return to the Index

Compiling and Linking with BASCOM 1.0 and 2.0

By Na Than Assh Antti (na_th_an)


Wee! Congratulations for downloading and actually trying to use BASCOM v.1.0 or 2.0. It has been one of the most masochistic acts you've done in your life, and it qualifies you to the status of Total MS Basic Geek. Don't be ashamed for this, I am even more masochistic and geek 'cause of the simple fact that I wrote this article.

Let's place ourselves in the escenario. We are in front of a small compiler written around 1982 for XT computers. You were lucky if your machine had 256 Kb of system RAM and a graphics card. BASCOM 1.0 and 2.0 support up to SCREEN 2, that leaves little to chose: only the good ol' SCREEN 0 text mode, SCREEN 1 320x200x2bits CGA mode, and SCREEN 2 640x200x1bit CGA mode. You have to use line numbers. DO:LOOP, SELECT CASE, block IFs, SUBs or FUNCTIONs are not available. Do you still want to use this? Yes? Damn! Ok, then I go on. Let's put ourselves to work.

Developing Environment Description

Yeah, I missed "Integrated" on purpose. 'Cause our Developing Environment is not integrated at all. No IDE, that's all. All you have is your runtime libraries, the old IBMCOM.OBJ communication library, the compiler, the linker and you're done.

The first thing we're gonna do is creating a small .BAT file to compiler and link. Plug your favourite text editor, copy and paste this text:

BASCOM %1/O,,%2;

Now save it as COMPILE.BAT. The BASCOM line takes your BAS and generates an OBJ. The /O switch is to make a standalone EXE (after LINK) that does not require the runtime library BASRUN.EXE. The LINK command links your OBJ together with IBMCOM.OBJ in case you want to use ON COM stuff in your program. If you don't, leave the last line as "LINK %1;" and you'll save 3 Kb in the EXE file (Wow!).

The batch file is used passing your BAS file name without extension and then extra parameters for BASCOM, for example:


That will compile and link MYPROG.BAS generating MYPROG.EXE. Read the next section to find out what does each command line option for BASCOM. If you find that you always use the same command line options, just add them to COMPILE.BAT just where %2 lies.

Developing Environment Description

I have no manual so this info comes from the very little amount of info that I've been able to google. Anyhow, this is enough, I presume:


The /C option is followed by ":xxxx" where "xxxx" is a number, for example /C:4096. This is used to specify the size of the receive buffer for communication programs. I can't tell more, I never used Basic for communications. This is just a buffer. If you do communications you should know that the bigger the buffer, the more data can be received in a packet. If you are not gonna use BASCOM for communication programs, forget this option.


Use this option if you added ON ERROR and RESUME commands to your program. This makes the compiler to generate the constant checks that are needed to see if a error occured to jump to the service routine. If you didn't use ON ERROR just don't use this function and your program will be faster and smaller.


As explained before, this option is used to make your program standalone. If you don't use this function you'll have to copy BASRUN.EXE along with your EXE file 'cause it will be needed. This may seem stupid, but back then it was better to have just one runtime if eight EXE files had to fit in a 160 K diskette.


This option is called "don't pack strings". If not used, BASCOM keeps track of every string in your program in memory so when it finds a new string it checks if that string has been used not to have duplicated strings in your EXE file (I.E., if you used "HELLO WORLD" 10 times, it will be only stored once) thus reducing the EXE file size. The drawback is that this eat memory when compiling, so if you have memory problems use this function and the compiler will just include in the OBJ file each string it finds in your source without attemting to pack them.


Use this option if you used ON KEY or ON COM statements in your BASIC program. Remember as well to link with IBMCOM.OBJ if you used ON COM statements.

The End!

Congratulations! Now you know all I know about BASCOM! I hope this was useful for you and you write a nifty game using this compiler. What for? For the challenge, of course. Well, farewell and good night!