Elian Kamal
Elian Kamal

Reputation: 552

How to run 32 bit TASM compiled program on DosBox

I am currently writing assembly programs which are compiled with TASM and linked with Turbo Linker I am looking for a way to compile and link the program as a 32-bit assembly instead of a 16-bit. I saw that there is a switch /3 for the TLINK command (which calls the Turbo Linker in 32-bit mode) but I can't seem to be able to find a way to compile the program as 32-bit with TASM.

In short: I want to know how can I compile a simple 32-bit program through the DosBox environment using TASM and TLINK.

Upvotes: 1

Views: 3712

Answers (1)

Ross Ridge
Ross Ridge

Reputation: 39601

You can't. MS-DOS, and thus DOSBox, can only run 16-bit real mode MS-DOS executables directly. You can create 32-bit Windows executables with TASM and a 32-bit version of TLINK, but these executables will only work under Windows. (You don't need to pass any special options with TASM, just use 32-bit USE32 segments in your assembly.)

In order to run 32-bit code under MS-DOS you need to use a 32-bit DOS extender. These extenders allow the execution of protected mode programs under MS-DOS by providing protected mode interfaces to the real mode interfaces provided by MS-DOS and the BIOS. Normally these DOS extenders used to produce a file that contains a 16-bit MS-DOS executable that loads the DOS extender which loads the 32-bit program.

How you would use such a DOS extender to create a 32-bit program using TASM that would run under DOSBox depends on the particular DOS extender. You're probably at least going to have use a different linker, one that create whatever form of executable the DOS extender can load. Some might not work with TASM at all.

Upvotes: 4

Related Questions