Compiled BASIC Parameter Passing to MASM ID Number: Q10294
3.x-5.x MS-DOS enduser |
Question: How does a compiled BASIC program link to routines in Assembler?
Response: In compiled BASIC, programs do not “link” to the assembler routines as do other high-level languages such as Pascal or C. Typically, the assembler routine is written, which creates an OBJ file; then, it is linked to produce a relocatable EXE file. BASIC does not handle EXE type files; it prefers files that can be loaded in a fixed location in memory. These files are sometimes called “binary files.” To save this type of file, use the BSAVE command, which needs the following information:
- The segment address of the file
- The name of the file with a .BIN extension (This is not required; do this only if you wish to show that this is a binary file.)
- The offset address of the file
- The length of the file in bytes
This information can be used with the BLOAD command to load the assembly routine from the BASIC program.