Author Topic: DisASM Code  (Read 5918 times)

0 Members and 1 Guest are viewing this topic.

Offline Donald Darden

  • Sr. Member
  • ****
  • Posts: 363
  • User-Rate: +3/-13
DisASM Code
« on: June 06, 2007, 02:40:41 PM »
There are undoubtedly many assemblers and dissemblers for the x86 chip set.  Additionally, there are other computer designs, each then likely to have its own assembler and dissembler, and these would not be alike.

From my reading, it appears that DisASM is no longer being developed, and that the open source project that replaced it is referred to as BinEditPro.  And from looking at the DisASM source code itself, it does not appear to be finished - in
fact, at several points, it indicates further development is required.  Many case statements and possible translations have been commented out, with no reasons  given.

In the original 8086/8088 chip design, a number of instructions were marked as
"reserved".  Later, as the architecture was expanded in new chip designs, the
"reserved" opcodes (operation codes) could be used to designate whole new classes of instructions, some drastically altering the pattern of interpretation of the remaining bytes of the instruction.  This makes it a real challenge to correctly interpret every possible outcome of the expanded instruction set.

So, while there might be some areas of DisASM that would benefit from further development, that is not my area of specialization.  What I am interested in doing at the moment is to adapt the existing source so that it can compile with PB/CC, rather than require the use of PB/Win.  Once I've done that, and made the adaptation work in the manner I prefer, I will incorporate the ability to have it compile under either PB/CC or PB/Win, and use the best features of each.

I also decided to go ahead and post the present version of DisASM in compiled form to the download section so that those that do not have PB/Win to create it from the source code can still get it and work with it.

Something to know about the DisASM.ZIP file that is available on another thread, is that it includes a bunch of files, and it is not clear what to do with them.  In fact, some files exists as .BAS files, and there is also an .INC file with the same name.  All you need to do is compile DisASM.BAS itself with PB/Win, and you have a DisASM.EXE file for disassembling other .EXE files.

Trying to use DisASM.EXE to process large .EXE files would not really be very advantageous, because the resulting files would be very large and hard to relate to.  You would not have anything like same-name lables and variables to help you in your analysis.  Where reliance on DisASM pays off is when you want to know how PowerBasic translate some bit of code into Assembly language, so that you can work with it more effectively using your own assembly code.  You can also study mission-critical portions of your code to see if the resulting code is as tight and efficient as it might be.  An obvious trick here is to make sure that only integer arithmetic is performed on variables and constants that are integer in nature, as defaulting to floating point representation and calculations, then converting the results back into integer form is extremely inefficient. 
« Last Edit: June 06, 2007, 02:51:45 PM by Donald Darden »

Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 1048
  • User-Rate: +30/-4
  • Gender: Male
    • it-berater
Re: DisASM Code
« Reply #1 on: June 06, 2007, 10:33:15 PM »
Quote
Trying to use DisASM.EXE to process large .EXE files would not really be very advantageous, because the resulting files would be very large and hard to relate to.

Thats a fact. You can't use it for big programms.
I tried it to find some bugs in bigger projects, but it seems not to work on large exe files properly.
Also I have reasons to assume that it doesn't know all mnemonics properly for 100%.

Anyway - if you want to take a quick look what the compiler did out of your code, actually DisASM,
and there the version I posted, seem to be the easiest and quickest way.