Hardcoded values[edit]
If you look at DOOM2.EXE v1.9 with a hex editor, you'll see at offset 0x89064 the beginning of a table of unsigned 16-bit LE values which correspond to the counter values.
Pos |
Hex pair |
Value
|
0 |
00 00 |
0
|
1 |
A2 1A |
6818
|
2 |
E4 19 |
6628
|
3 |
31 19 |
6449
|
4 |
87 18 |
6279
|
5 |
C7 17 |
6087
|
6 |
12 17 |
5906
|
7 |
68 16 |
5736
|
8 |
C7 15 |
5575
|
9 |
2F 15 |
5423
|
10 |
9F 14 |
5279
|
11 |
00 14 |
5120
|
12 |
6B 13 |
4971
|
13 |
DE 12 |
4830
|
14 |
59 12 |
4697
|
15 |
CA 11 |
4554
|
16 |
53 11 |
4435
|
17 |
D3 10 |
4307
|
18 |
5A 10 |
4186
|
19 |
DA 0F |
4058
|
20 |
6E 0F |
3950
|
21 |
FC 0E |
3836
|
22 |
90 0E |
3728
|
23 |
1F 0E |
3615
|
24 |
BF 0D |
3519
|
25 |
5A 0D |
3418
|
26 |
FB 0C |
3323
|
27 |
98 0C |
3224
|
28 |
3B 0C |
3131
|
29 |
E3 0B |
3043
|
30 |
90 0B |
2960
|
31 |
3B 0B |
2875
|
|
Pos |
Hex pair |
Value
|
32 |
EA 0A |
2794
|
33 |
97 0A |
2711
|
34 |
49 0A |
2633
|
35 |
00 0A |
2560
|
36 |
B5 09 |
2485
|
37 |
6F 09 |
2415
|
38 |
2C 09 |
2348
|
39 |
E9 08 |
2281
|
40 |
A5 08 |
2213
|
41 |
69 08 |
2153
|
42 |
29 08 |
2089
|
43 |
F0 07 |
2032
|
44 |
B7 07 |
1975
|
45 |
7E 07 |
1918
|
46 |
48 07 |
1864
|
47 |
12 07 |
1810
|
48 |
DD 06 |
1757
|
49 |
AD 06 |
1709
|
50 |
7B 06 |
1659
|
51 |
4C 06 |
1612
|
52 |
1D 06 |
1565
|
53 |
F1 05 |
1521
|
54 |
C6 05 |
1478
|
55 |
9B 05 |
1435
|
56 |
73 05 |
1395
|
57 |
4B 05 |
1355
|
58 |
24 05 |
1316
|
59 |
00 05 |
1280
|
60 |
DA 04 |
1242
|
61 |
B7 04 |
1207
|
62 |
95 04 |
1173
|
63 |
74 04 |
1140
|
|
Pos |
Hex pair |
Value
|
64 |
53 04 |
1107
|
65 |
33 04 |
1075
|
66 |
15 04 |
1045
|
67 |
F7 03 |
1015
|
68 |
DA 03 |
986
|
69 |
BF 03 |
959
|
70 |
A3 03 |
931
|
71 |
89 03 |
905
|
72 |
6F 03 |
879
|
73 |
56 03 |
854
|
74 |
3D 03 |
829
|
75 |
26 03 |
806
|
76 |
0F 03 |
783
|
77 |
F8 02 |
760
|
78 |
E3 02 |
739
|
79 |
CE 02 |
718
|
80 |
B9 02 |
697
|
81 |
A5 02 |
677
|
82 |
92 02 |
658
|
83 |
80 02 |
640
|
84 |
6D 02 |
621
|
85 |
5C 02 |
604
|
86 |
4A 02 |
586
|
87 |
3A 02 |
570
|
88 |
29 02 |
553
|
89 |
1A 02 |
538
|
90 |
0A 02 |
522
|
91 |
FB 01 |
507
|
92 |
ED 01 |
493
|
93 |
DF 01 |
479
|
94 |
D1 01 |
465
|
95 |
C4 01 |
452
|
|
Pos |
Hex pair |
Value
|
96 |
B7 01 |
439
|
97 |
AB 01 |
427
|
98 |
9F 01 |
415
|
99 |
93 01 |
403
|
100 |
87 01 |
391
|
101 |
7C 01 |
380
|
102 |
71 01 |
369
|
103 |
67 01 |
359
|
104 |
5C 01 |
348
|
105 |
53 01 |
339
|
106 |
49 01 |
329
|
107 |
3F 01 |
319
|
108 |
36 01 |
310
|
109 |
2E 01 |
302
|
110 |
25 01 |
293
|
111 |
1D 01 |
285
|
112 |
14 01 |
276
|
113 |
0D 01 |
269
|
114 |
05 01 |
261
|
115 |
FD 00 |
253
|
116 |
F6 00 |
246
|
117 |
EF 00 |
239
|
118 |
E8 00 |
232
|
119 |
E2 00 |
226
|
120 |
DB 00 |
219
|
121 |
D5 00 |
213
|
122 |
CF 00 |
207
|
123 |
C9 00 |
201
|
124 |
C3 00 |
195
|
125 |
BE 00 |
190
|
126 |
B8 00 |
184
|
127 |
B3 00 |
179
|
|
After the 128th value, there are several null bytes. This really looks like the table containing all the counter values that get programmed into the 8253 chip. This also shows that there are valid values above 95 -- the doc included with Andrew Apted & Simon Howard's specifications said that it "is not known if higher values are supported" -- I think this shows that they most certainly are. --Gez 18:40, 24 January 2014 (UTC)
- The same table exists in strife1.exe v1.2 @ dseg03:0009A09C and is xref'd from a DMX subroutine at cseg01:0004BC79.Here is the code in the immediate vicinity of the access. --Quasar 07:04, 25 January 2014 (UTC)
- On further research, that function is the function which does the actual output. It is invoked after setup code is run to initialize the global variables it accesses, which is in sub_4BD70. sub_4BD70 is invoked from SFX_PlayPatch when the DMX sample format byte is " < 1u" (DMX sample formats 1 and 2, which are unknown, are dispatched to sub_4C260; format 0x03, which we know to be the sound format, is dispatched to sub_48430, which I already did substantial reversing work on earlier). --Quasar 07:21, 25 January 2014 (UTC)
DMX formats 1 & 2[edit]
This is an interesting discovery by Alexey Khokholov: DMX sample formats 1 and 2 correspond to MIDI data! --Gez (talk) 13:28, 10 November 2015 (CST)
- I knew at least one was considered as being for "AdLib" due to code that is present in the pre-beta, but I was never able to crack the DMX code doing the format reading for them because it devolved into a bunch of function pointer calls and a ton of data movement that I couldn't effectively trace. Interesting to have my suspicions confirmed. --Quasar (talk) 16:35, 10 November 2015 (CST)