12

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?

Ange
  • 6,694
  • 3
  • 28
  • 62
ricardojoaoreis
  • 121
  • 1
  • 3

3 Answers3

9
  • 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.
Ange
  • 6,694
  • 3
  • 28
  • 62
9

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.

Igor Skochinsky
  • 36,553
  • 7
  • 65
  • 115
5

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.

0xC0000022L
  • 10,908
  • 9
  • 41
  • 79