Talk:PC speaker sound effects

From DoomWiki.org

[edit] Hardcoded values

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.

PosHex pairValue
000 000
1A2 1A6818
2E4 196628
331 196449
487 186279
5C7 176087
612 175906
768 165736
8C7 155575
92F 155423
109F 145279
1100 145120
126B 134971
13DE 124830
1459 124697
15CA 114554
1653 114435
17D3 104307
185A 104186
19DA 0F4058
206E 0F3950
21FC 0E3836
2290 0E3728
231F 0E3615
24BF 0D3519
255A 0D3418
26FB 0C3323
2798 0C3224
283B 0C3131
29E3 0B3043
3090 0B2960
313B 0B2875
PosHex pairValue
32EA 0A2794
3397 0A2711
3449 0A2633
3500 0A2560
36B5 092485
376F 092415
382C 092348
39E9 082281
40A5 082213
4169 082153
4229 082089
43F0 072032
44B7 071975
457E 071918
4648 071864
4712 071810
48DD 061757
49AD 061709
507B 061659
514C 061612
521D 061565
53F1 051521
54C6 051478
559B 051435
5673 051395
574B 051355
5824 051316
5900 051280
60DA 041242
61B7 041207
6295 041173
6374 041140
PosHex pairValue
6453 041107
6533 041075
6615 041045
67F7 031015
68DA 03986
69BF 03959
70A3 03931
7189 03905
726F 03879
7356 03854
743D 03829
7526 03806
760F 03783
77F8 02760
78E3 02739
79CE 02718
80B9 02697
81A5 02677
8292 02658
8380 02640
846D 02621
855C 02604
864A 02586
873A 02570
8829 02553
891A 02538
900A 02522
91FB 01507
92ED 01493
93DF 01479
94D1 01465
95C4 01452
PosHex pairValue
96B7 01439
97AB 01427
989F 01415
9993 01403
10087 01391
1017C 01380
10271 01369
10367 01359
1045C 01348
10553 01339
10649 01329
1073F 01319
10836 01310
1092E 01302
11025 01293
1111D 01285
11214 01276
1130D 01269
11405 01261
115FD 00253
116F6 00246
117EF 00239
118E8 00232
119E2 00226
120DB 00219
121D5 00213
122CF 00207
123C9 00201
124C3 00195
125BE 00190
126B8 00184
127B3 00179

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)