I recently decided to try my hand at reverse engineer an old DOS text based game that was coded in QBasic.

I found some info online about old DOS games disassembly but mostly for Wacom compiled C/C++ binaries, but nothing on QBasic. I know that getting the original Basic code is probably impossible, but going disassembling the file with nasm I didn't get any useful info either...

Any pointers?

3 Answers 3

  • debug with DOSBox debug-enabled builds
  • disassemble with IDA
    • try to compile your own empty qbasic EXE, and compare - this will help to telll the compiler code from the actual code of your game. You might do that automatically by creating a FLIRT-like signature of the empty EXE then import in your own EXE in IDA.

Apparently a decompiler for DOS Basic executables already exists.

Going by examples from that page, quite a lot of the code can be recovered. I guess it used some form of P-code, or there was some additional metadata.

Descriptions of the decompiler's error messages can give some hints about various functions implemented by the Basic runtime.


I found the debug-enabled builds a bit unwieldy. But I found the combination of DOSBox and IDA quite nice using idados. It's an IDA Pro plugin which allows you to control the debugger of a debug-enabled DOSBox build from within IDA similar to how you can control a debuggee running one of the other supported remote debuggers.

Given the existing answer by Igor this is of course like using a kitchen knife instead of a scalpel, but I thought I should mention it, as it is a more generic method for reversing DOS programs.

NB: There used to be an even older, but I think unrelated, plugin of the same name which hasn't been maintained by its original author. I still have a copy of it on my disk (at home), but the website seems to no longer exist.

  • Well, the decompiler I mention is not public so there's nothing wrong with the good old debugging.
    – Igor Skochinsky
    Commented Apr 3, 2013 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.