| /trunk/decompiled/cs__1DD7.c |
| |
| 5 |
5 |
#include "decompiled.h" |
| 6 |
6 |
|
| 7 |
7 |
/** |
| 8 |
|
* Decompiled function f__1DD7_000E_001C_4593() |
| 9 |
|
* |
| 10 |
|
* @name f__1DD7_000E_001C_4593 |
| 11 |
|
* @implements 1DD7:000E:001C:4593 () |
| 12 |
|
* @implements 1DD7:002A:002F:A13F |
| 13 |
|
* @implements 1DD7:002B:002E:813E |
| 14 |
|
* @implements 1DD7:0059:0002:C53A |
| 15 |
|
* @implements 1DD7:0065:0005:BBA6 |
| 16 |
|
* @implements 1DD7:006A:0005:8BCF |
| 17 |
|
* |
| 18 |
|
* Called From: B4F2:003A:000A:8FD3 |
| 19 |
|
* Called From: B4F2:0439:000C:103B |
| 20 |
|
* Called From: B4F2:0439:0009:9993 |
| 21 |
|
*/ |
| 22 |
|
void f__1DD7_000E_001C_4593() |
| 23 |
|
{ |
| 24 |
|
l__000E: |
| 25 |
|
emu_push(emu_bp); |
| 26 |
|
emu_bp = emu_sp; |
| 27 |
|
emu_subw(&emu_sp, 0x6); |
| 28 |
|
emu_push(emu_si); |
| 29 |
|
emu_si = emu_get_memory16(emu_ss, emu_bp, 0x6); |
| 30 |
|
emu_ax = emu_get_memory16(emu_ds, 0x00, 0x700A); |
| 31 |
|
emu_get_memory16(emu_ss, emu_bp, -0x2) = emu_ax; |
| 32 |
|
emu_get_memory16(emu_ds, 0x00, 0x700A) = emu_si; |
| 33 |
|
emu_orw(&emu_si, emu_si); |
| 34 |
|
if (emu_si != 0) goto l__002B; |
| 35 |
|
emu_push(emu_cs); |
| 36 |
|
emu_push(0x002A); f__1DD7_09DA_000F_D404(); |
| 37 |
|
l__002A: |
| 38 |
|
l__002B: |
| 39 |
|
emu_cmpw(&emu_get_memory16(emu_ds, 0x00, 0x6302), 0xFFFF); |
| 40 |
|
if (emu_get_memory16(emu_ds, 0x00, 0x6302) != 0xFFFF) goto l__0065; |
| 41 |
|
emu_ax = emu_get_memory16(emu_ds, 0x00, 0x6310); |
| 42 |
|
emu_orw(&emu_ax, emu_get_memory16(emu_ds, 0x00, 0x6312)); |
| 43 |
|
if (emu_ax == 0) goto l__0065; |
| 44 |
|
emu_ax = emu_get_memory16(emu_ds, 0x00, 0x6312); |
| 45 |
|
emu_dx = emu_get_memory16(emu_ds, 0x00, 0x6310); |
| 46 |
|
emu_get_memory16(emu_ss, emu_bp, -0x4) = emu_ax; |
| 47 |
|
emu_get_memory16(emu_ss, emu_bp, -0x6) = emu_dx; |
| 48 |
|
emu_cmpw(&emu_get_memory16(emu_ds, 0x00, 0x700A), 0x0); |
| 49 |
|
if (emu_get_memory16(emu_ds, 0x00, 0x700A) != 0x0) { /* Unresolved jump */ emu_ip = 0x005B; emu_last_cs = 0x1DD7; emu_last_ip = 0x004D; emu_last_length = 0x002E; emu_last_crc = 0x813E; emu_call(); return; } |
| 50 |
|
emu_ax = 0x1; |
| 51 |
|
emu_bx = 0x10; |
| 52 |
|
emu_pushf(); |
| 53 |
|
|
| 54 |
|
/* Call based on memory/register values */ |
| 55 |
|
emu_ip = emu_get_memory16(emu_ss, emu_bp, -0x6); |
| 56 |
|
emu_push(emu_cs); |
| 57 |
|
emu_cs = emu_get_memory16(emu_ss, emu_bp, -0x4); |
| 58 |
|
emu_push(0x0059); |
| 59 |
|
switch ((emu_cs << 16) + emu_ip) { |
| 60 |
|
default: |
| 61 |
|
/* In case we don't know the call point yet, call the dynamic call */ |
| 62 |
|
emu_last_cs = 0x1DD7; emu_last_ip = 0x0056; emu_last_length = 0x002E; emu_last_crc = 0x813E; |
| 63 |
|
emu_call(); |
| 64 |
|
return; |
| 65 |
|
} |
| 66 |
|
l__0059: |
| 67 |
|
goto l__0065; |
| 68 |
|
l__0065: |
| 69 |
|
emu_ax = emu_get_memory16(emu_ss, emu_bp, -0x2); |
| 70 |
|
goto l__006A; |
| 71 |
|
l__006A: |
| 72 |
|
emu_pop(&emu_si); |
| 73 |
|
emu_sp = emu_bp; |
| 74 |
|
emu_pop(&emu_bp); |
| 75 |
|
|
| 76 |
|
/* Return from this function */ |
| 77 |
|
emu_pop(&emu_ip); |
| 78 |
|
emu_pop(&emu_cs); |
| 79 |
|
return; |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
/** |
| 83 |
|
* Decompiled function f__1DD7_006F_001C_4403() |
| 84 |
|
* |
| 85 |
|
* @name f__1DD7_006F_001C_4403 |
| 86 |
|
* @implements 1DD7:006F:001C:4403 () |
| 87 |
|
* @implements 1DD7:008B:002F:916D |
| 88 |
|
* @implements 1DD7:008C:002E:B16C |
| 89 |
|
* @implements 1DD7:00BA:0002:C53A |
| 90 |
|
* @implements 1DD7:00C6:0005:BBA6 |
| 91 |
|
* @implements 1DD7:00CB:0005:8BCF |
| 92 |
|
* |
| 93 |
|
* Called From: B4F2:0030:000C:02B1 |
| 94 |
|
* Called From: B4F2:0410:000F:AF85 |
| 95 |
|
* Called From: B4F2:0410:0009:8999 |
| 96 |
|
*/ |
| 97 |
|
void f__1DD7_006F_001C_4403() |
| 98 |
|
{ |
| 99 |
|
l__006F: |
| 100 |
|
emu_push(emu_bp); |
| 101 |
|
emu_bp = emu_sp; |
| 102 |
|
emu_subw(&emu_sp, 0x6); |
| 103 |
|
emu_push(emu_si); |
| 104 |
|
emu_si = emu_get_memory16(emu_ss, emu_bp, 0x6); |
| 105 |
|
emu_ax = emu_get_memory16(emu_ds, 0x00, 0x700A); |
| 106 |
|
emu_get_memory16(emu_ss, emu_bp, -0x2) = emu_ax; |
| 107 |
|
emu_get_memory16(emu_ds, 0x00, 0x700C) = emu_si; |
| 108 |
|
emu_orw(&emu_si, emu_si); |
| 109 |
|
if (emu_si != 0) goto l__008C; |
| 110 |
|
emu_push(emu_cs); |
| 111 |
|
emu_push(0x008B); f__1DD7_0A7B_001E_4A5A(); |
| 112 |
|
l__008B: |
| 113 |
|
l__008C: |
| 114 |
|
emu_cmpw(&emu_get_memory16(emu_ds, 0x00, 0x6344), 0xFFFF); |
| 115 |
|
if (emu_get_memory16(emu_ds, 0x00, 0x6344) != 0xFFFF) goto l__00C6; |
| 116 |
|
emu_ax = emu_get_memory16(emu_ds, 0x00, 0x6352); |
| 117 |
|
emu_orw(&emu_ax, emu_get_memory16(emu_ds, 0x00, 0x6354)); |
| 118 |
|
if (emu_ax == 0) goto l__00C6; |
| 119 |
|
emu_ax = emu_get_memory16(emu_ds, 0x00, 0x6354); |
| 120 |
|
emu_dx = emu_get_memory16(emu_ds, 0x00, 0x6352); |
| 121 |
|
emu_get_memory16(emu_ss, emu_bp, -0x4) = emu_ax; |
| 122 |
|
emu_get_memory16(emu_ss, emu_bp, -0x6) = emu_dx; |
| 123 |
|
emu_cmpw(&emu_get_memory16(emu_ds, 0x00, 0x700C), 0x0); |
| 124 |
|
if (emu_get_memory16(emu_ds, 0x00, 0x700C) != 0x0) { /* Unresolved jump */ emu_ip = 0x00BC; emu_last_cs = 0x1DD7; emu_last_ip = 0x00AE; emu_last_length = 0x002E; emu_last_crc = 0xB16C; emu_call(); return; } |
| 125 |
|
emu_ax = 0x2; |
| 126 |
|
emu_bx = 0x10; |
| 127 |
|
emu_pushf(); |
| 128 |
|
|
| 129 |
|
/* Call based on memory/register values */ |
| 130 |
|
emu_ip = emu_get_memory16(emu_ss, emu_bp, -0x6); |
| 131 |
|
emu_push(emu_cs); |
| 132 |
|
emu_cs = emu_get_memory16(emu_ss, emu_bp, -0x4); |
| 133 |
|
emu_push(0x00BA); |
| 134 |
|
switch ((emu_cs << 16) + emu_ip) { |
| 135 |
|
default: |
| 136 |
|
/* In case we don't know the call point yet, call the dynamic call */ |
| 137 |
|
emu_last_cs = 0x1DD7; emu_last_ip = 0x00B7; emu_last_length = 0x002E; emu_last_crc = 0xB16C; |
| 138 |
|
emu_call(); |
| 139 |
|
return; |
| 140 |
|
} |
| 141 |
|
l__00BA: |
| 142 |
|
goto l__00C6; |
| 143 |
|
l__00C6: |
| 144 |
|
emu_ax = emu_get_memory16(emu_ss, emu_bp, -0x2); |
| 145 |
|
goto l__00CB; |
| 146 |
|
l__00CB: |
| 147 |
|
emu_pop(&emu_si); |
| 148 |
|
emu_sp = emu_bp; |
| 149 |
|
emu_pop(&emu_bp); |
| 150 |
|
|
| 151 |
|
/* Return from this function */ |
| 152 |
|
emu_pop(&emu_ip); |
| 153 |
|
emu_pop(&emu_cs); |
| 154 |
|
return; |
| 155 |
|
} |
| 156 |
|
|
| 157 |
|
/** |
| 158 |
8 |
* Decompiled function f__1DD7_010B_000E_A324() |
| 159 |
9 |
* |
| 160 |
10 |
* @name f__1DD7_010B_000E_A324 |
| |
| /trunk/src/driver.c |
| |
| 15 |
15 |
extern void emu_CustomTimer_AddHandler(); |
| 16 |
16 |
extern void emu_Drivers_Load(); |
| 17 |
17 |
extern void f__01F7_27FD_0037_E2C0(); |
| |
18 |
extern void f__1DD7_09DA_000F_D404(); |
| |
19 |
extern void f__1DD7_0A7B_001E_4A5A(); |
| 18 |
20 |
extern void f__1DD7_1696_0011_A4E3(); |
| 19 |
21 |
extern void f__23E1_0004_0014_2BC0(); |
| 20 |
22 |
extern void f__23E1_01C2_0011_24E8(); |
| |
| |
| 42 |
42 |
extern void f__AB01_2336_002C_4FDC(); |
| 43 |
43 |
extern void f__AB01_26EB_0047_41F4(); |
| 44 |
44 |
|
| |
45 |
uint16 Drivers_EnableSounds(uint16 sounds) |
| |
46 |
{ |
| |
47 |
uint16 ret; |
| |
48 |
|
| |
49 |
ret = g_global->soundsEnabled; |
| |
50 |
g_global->soundsEnabled = sounds; |
| |
51 |
|
| |
52 |
if (sounds == 0) { |
| |
53 |
emu_push(emu_cs); emu_push(0x002A); f__1DD7_09DA_000F_D404(); |
| |
54 |
} |
| |
55 |
|
| |
56 |
if (g_global->soundDriver.index != 0xFFFF || g_global->soundDriver.dcontent.csip == 0x0) return ret; |
| |
57 |
|
| |
58 |
emu_ax = 0x1; |
| |
59 |
emu_bx = g_global->soundsEnabled == 0 ? 0x10 : 0x11; |
| |
60 |
emu_pushf(); |
| |
61 |
|
| |
62 |
/* Call based on memory/register values */ |
| |
63 |
emu_ip = g_global->soundDriver.dcontent.s.ip; |
| |
64 |
emu_push(emu_cs); |
| |
65 |
emu_cs = g_global->soundDriver.dcontent.s.cs; |
| |
66 |
emu_push(0x0059); |
| |
67 |
switch ((emu_cs << 16) + emu_ip) { |
| |
68 |
default: |
| |
69 |
/* In case we don't know the call point yet, call the dynamic call */ |
| |
70 |
emu_last_cs = 0x1DD7; emu_last_ip = 0x0056; emu_last_length = 0x002E; emu_last_crc = 0x813E; |
| |
71 |
emu_call(); |
| |
72 |
return ret; |
| |
73 |
} |
| |
74 |
|
| |
75 |
return ret; |
| |
76 |
} |
| |
77 |
|
| |
78 |
uint16 Drivers_EnableMusic(uint16 music) |
| |
79 |
{ |
| |
80 |
uint16 ret; |
| |
81 |
|
| |
82 |
ret = g_global->soundsEnabled; /* Looks like a bug in original code */ |
| |
83 |
g_global->musicEnabled = music; |
| |
84 |
|
| |
85 |
if (music == 0) { |
| |
86 |
emu_push(emu_cs); emu_push(0x008B); f__1DD7_0A7B_001E_4A5A(); |
| |
87 |
} |
| |
88 |
|
| |
89 |
if (g_global->musicDriver.index != 0xFFFF || g_global->musicDriver.dcontent.csip == 0x0) return ret; |
| |
90 |
|
| |
91 |
emu_ax = 0x2; |
| |
92 |
emu_bx = g_global->musicEnabled == 0 ? 0x10 : 0x11; |
| |
93 |
emu_pushf(); |
| |
94 |
|
| |
95 |
/* Call based on memory/register values */ |
| |
96 |
emu_ip = g_global->musicDriver.dcontent.s.ip; |
| |
97 |
emu_push(emu_cs); |
| |
98 |
emu_cs = g_global->musicDriver.dcontent.s.cs; |
| |
99 |
emu_push(0x00BA); |
| |
100 |
switch ((emu_cs << 16) + emu_ip) { |
| |
101 |
default: |
| |
102 |
/* In case we don't know the call point yet, call the dynamic call */ |
| |
103 |
emu_last_cs = 0x1DD7; emu_last_ip = 0x00B7; emu_last_length = 0x002E; emu_last_crc = 0xB16C; |
| |
104 |
emu_call(); |
| |
105 |
return ret; |
| |
106 |
} |
| |
107 |
|
| |
108 |
return ret; |
| |
109 |
} |
| |
110 |
|
| |
111 |
|
| 45 |
112 |
bool Drivers_Init(const char *filename, csip32 fcsip, Driver *driver, csip32 dcsip, const char *extension, uint16 variable_0008) |
| 46 |
113 |
{ |
| 47 |
114 |
if (filename == NULL || !File_Exists(filename)) return false; |
| |