2

I am trying to understand assembly language instructions, for a DOS Game. I have looked at the following Link :- https://atrevida.comprenica.com/atrtut07.html

reading about how VGA Graphics work in DOS Games. I opened up the main .exe File for the 16 bit DOS Game in IDA Pro Version 5, a freeware version of the program that supports DOS Executables. and did a search for A000 in text I got the following result :-

enter image description here

I then clicked on 6000h and got the following :-

enter image description here

There are 10 Data Segments in the Second image, and in the AC i.e. Aircraft Folder of the Game there are 13 'S' i.e. Shape or Sprite Files. the External Graphics of the WW2 Planes. and 3 other relevant Files. So I think this code is referencing to those Files. I want to make new shape graphics to make new WW2 planes, to put in the game for fun. But I need to decode the structure of the Graphics. I have altered bytes in HxD Hex Editor Program in Little-Endian Format, in one of the 'S' Planes Files, at certain offsets i.e. FW190AS.PAC i.e. the Focke-Wulf 190A, and got altered images, not a new plane as such but coloured lines of different segments, or smaller lines depending on which bytes I alter and what value I change the current value to, the line coming out of the plane.

Is there a way I can decipher exactly, what offsets and bytes correspond to the image i.e. sprite of the plane using IDA PR0 Version 5 ? Can someone explain what the instructions mean exactly. I have looked at a wikipedia Webpage about assembly, but still not sure exactly what the code in the images I posted here mean. I know that DS means Data Segment. Does 2242h mean 2242 in Hex ? What does 22A6h mean in Hex ? are these the specific number of Hex Values for the Sprite, rather than all the bytes in the File ? Here is another image when I open A000h I don't fully understand the code there, SI is Source Index ? :- Here is a dropbox link to the Swotl.exe File. :- https://www.dropbox.com/scl/fi/6pi1osmb8j3fjauqullnb/Swotl.exe?rlkey=dw2x82ivijx10ssjdhqo2ekkt&dl=0

enter image description here

Here are two pictures of the altered Focke-Wulf 190A, i.e. a line coming out of plane in the rear view Mirror shot, with different coloured segments :-

enter image description here

enter image description here

Another thing I have noticed, is that the Hex Value for ds i.e. the Data Segments in 6000h don't match those of the Total Hex Value or Decimal Value when I open the Plane Shape Files in HxD Hex Editor in Windows 10. Do DOS Hex Values for DOS 16 bit Files differ when opened in a modern Hex Editor, than say for a DOS Native Hex Editor ? And if so, how do I obtain the correct value, i.e. how do I convert one value to the other ? I am fairly convinced these Data Segments are the 'S' Shape Files. Also in these two following Pictures, the DB Define Bytes differ in two chosen Data Segments. What do those define Bytes Mean, are they to do with the Bitmap coded in the 'S' Files, there appear to be two different DB Bytes Segments one starting with 80h and one with 27h, either one or the other used for the Data Segments in 6000h. What do the Define Bytes mean here, can someone work it out for me ?

enter image description here

enter image description here

Also I clicked on 2646h in A000h, and got what is shown. Am I right in thinking, 0Fh is where Data Segments i.e. the File is opened ? What else is going on there ? I checked what 2710h i.e. hexadecimal is in Decimal, and it's 10000, what is the significance there ?

enter image description here

Edit:- I clicked on call sub_A7CD in the 6000h segment, and the flow chart there in IDA Pro 7, I think is possibly how the 'S' Files are decoded and where the Bitmap of the Plane is stored in the 'S' Files i.e. there is jmp i.e. jump to cs: code segment Offset when I click on 0FFFEh ? Could someone look at call sub_A7CD Flow Diagram in IDA PRO and tell me what is going on there ?

Also I looked at another Website Page, here is the link :-

https://thiscouldbebetter.wordpress.com/2011/03/17/using-vga-graphics-in-assembly-language/

There is a DisplayPixelDrawXY: part of the VGA Graphics code, which has two pieces of Code I found similar in IDA Pro :-

mov cx, [bp+8]  ; x pos
mov dx, [bp+6]  ; y pos

In the Swotl.exe File, I found :-

 mov ax, [bp+6]
 mov ax, [bp+8]

shown with other code, at loc_49C2 in IDA Pro 7, is that significant ?

Any help and info would be much appreciated.

9
  • 3
    I appreciate the effort you put into writing the question text. Still, it may help if you could add a lead in noting the exact question asked. There should be one (and only one) RC.SE does not really work without or as an interactive forum in general. Otherwise it may help to keep in mind that segment values are run time dependent and only valid after loading/relocation. Either by the OS loader, or in case of loadable data by the program itself - so only valid after the setup needed for that data - and staying valid only for a limited time.
    – Raffzahn
    Commented Sep 5, 2023 at 21:58
  • 1
    DB means defining a byte value what their content means is up to whatever the program wants to do. Also, you're looking at disassemble - this means it's not the source code, but what the disassembler tries to make from the binary - including putting DBs wherever he got no idea what it should mean. Going by those question it might be right to ask what you're level of assembler knowledge really is - the task you're trying is most likely several years beyond entry level.
    – Raffzahn
    Commented Sep 5, 2023 at 22:02
  • 7
    FYI remember there's also a reverse engineering stack - they have tags for DOS ...
    – davidbak
    Commented Sep 5, 2023 at 22:27
  • 1
    @EdwardWinch surprise, DS could as well mean Define Storage ... Let me put it differently. I'm doing assembly since >40 years, including lots of x86 back when DOS was still a thing, nonetheless I would consider above more than a weekend job to be solved by 'clicking' on some static addresses in a highly dynamic environment. As usual YMMV. Maybe there's substantial help to find at reverseengineering.SE as davidbak suggests.
    – Raffzahn
    Commented Sep 5, 2023 at 22:38
  • 3
    I would advise that you try doing some assembly programming for yourself. It'll be a far better way to learn about reverse engineering this stuff, than jumping directly into reverse engineering has been. Once you can understand your own assembly code it'll be a lot easier to understand others'.
    – Sneftel
    Commented Sep 6, 2023 at 11:30

0

Browse other questions tagged .