Skip to content

Figure out the exact set of compiler flags used to produce Diablo.exe (1.09b) #111

@mewmew

Description

@mewmew

This issue tracks the effort to figure out the complier flags used to produce Diablo.exe (version 1.09b). It may be considered a subtask of #11, as given information about compiler flags, we can ensure that the same input source code produce the same output object code.

From what I can tell, it seems like /O1 is used rather than /O2. This is based on the padding between functions.

/O2 produces (given that #110 has been merged):

  401000:	e9 0b 00 00 00       	jmp    0x401010
  401005:	90                   	nop
  401006:	90                   	nop
  401007:	90                   	nop
  401008:	90                   	nop
  401009:	90                   	nop
  40100a:	90                   	nop
  40100b:	90                   	nop
  40100c:	90                   	nop
  40100d:	90                   	nop
  40100e:	90                   	nop
  40100f:	90                   	nop
  401010:	a1 28 b1 40 00       	mov    eax,ds:0x40b128
  401015:	a3 84 1a 41 00       	mov    ds:0x411a84,eax
  40101a:	c3                   	ret    
  40101b:	90                   	nop
  40101c:	90                   	nop
  40101d:	90                   	nop
  40101e:	90                   	nop
  40101f:	90                   	nop
  401020:	8b 44 24 04          	mov    eax,DWORD PTR [esp+0x4]
  401024:	85 c0                	test   eax,eax
  401026:	74 0f                	je     0x401037
  401028:	6a 00                	push   0x0
  40102a:	6a ff                	push   0xffffffff
  40102c:	68 40 d0 40 00       	push   0x40d040
  401031:	50                   	push   eax
  401032:	e8 69 0c 00 00       	call   0x401ca0
  401037:	c3                   	ret    

While /O1 produces:

  401000:	e9 00 00 00 00       	jmp    0x401005
  401005:	a1 28 c1 40 00       	mov    eax,ds:0x40c128
  40100a:	a3 84 2a 41 00       	mov    ds:0x412a84,eax
  40100f:	c3                   	ret    
  401010:	83 7c 24 04 00       	cmp    DWORD PTR [esp+0x4],0x0
  401015:	74 12                	je     0x401029
  401017:	6a 00                	push   0x0
  401019:	6a ff                	push   0xffffffff
  40101b:	68 40 e0 40 00       	push   0x40e040
  401020:	ff 74 24 10          	push   DWORD PTR [esp+0x10]
  401024:	e8 8f 09 00 00       	call   0x4019b8
  401029:	c3                   	ret    

This is to be compared to the original version of Diablo.exe (1.09b):

  401000:	e9 00 00 00 00       	jmp    0x401005
  401005:	a1 00 94 47 00       	mov    eax,ds:0x479400
  40100a:	a3 30 79 4b 00       	mov    ds:0x4b7930,eax
  40100f:	c3                   	ret    
  401010:	83 7c 24 04 00       	cmp    DWORD PTR [esp+0x4],0x0
  401015:	74 12                	je     0x401029
  401017:	6a 00                	push   0x0
  401019:	6a ff                	push   0xffffffff
  40101b:	68 b0 30 48 00       	push   0x4830b0
  401020:	ff 74 24 10          	push   DWORD PTR [esp+0x10]
  401024:	e8 8d 87 06 00       	call   0x4697b6
  401029:	c3                   	ret    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions