' DEHACK - Doom Exe HACK
' by Matt Fell (matt.burnett@acebbs.com)
' written 6/13/94
'
' DEHACK 5 - The SOUND TABLE
'
' These crude programs extract information from the DOOM.EXE or DOOM.WAD
' files and store it into a TXT file, suitable for perusing or printing.
' If you want to print the results, you might have to reformat it. Please
' don't waste reams of paper. Thanks.
' All of these only work on the 1.2 registered doom.exe, because I use
' simple byte offset numbers, not search strings.
'
' IMPORTANT: If you don't like typing pathnames, modify the next section,
' un-comment it, and remove or comment-out the input section.

' infile$ = "c:\doom\doom.exe"
' outfile$ = "c:\-\doom\12\dehack5.txt"

CLS
PRINT "Enter the full pathname to your DOOM.EXE file, then the full pathname"
PRINT "to where you want the textfile to be (in an already existing directory)"
PRINT "e.g. 'c:\doom\doom.exe' and 'c:\doom\txt\dehack5.txt'"
PRINT "Note: modify the program with built-in pathnames, and skip this!"
PRINT
INPUT infile$
INPUT outfile$

OPEN infile$ FOR BINARY AS 1
OPEN outfile$ FOR OUTPUT AS 2

DIM byte AS STRING * 1

PRINT #2, "The 'Sound Table' contained in DOOM.EXE version 1.2 2-17-94"
PRINT #2, "List-maker program written by Matt Fell (matt.burnett@acebbs.com)"
PRINT #2, "=========================================================================="
PRINT #2, "At 553292 ($8714c) is the sound table. It has 61 entries, each is 9 4-byte"
PRINT #2, "integers. The first is a pointer, which when added to $6f414 = 455700,"
PRINT #2, "points to the text string that is that sound's name. Prefix DS or DP to"
PRINT #2, "get the names of the entries in DOOM.WAD"
PRINT #2, "The columns below are:"
PRINT #2, "  1. sound #, used in THING TABLE"
PRINT #2, "  2. sound name (I grab the name, not the pointer)"
PRINT #2, "  3. ? 0 or 1"
PRINT #2, "  4. ranges from 32 to 128"
PRINT #2, "  5. to 10. ? unknown"
PRINT #2, "=========================================================================="

pointer& = 553293               ' this is for 1.2 doom

FOR i& = 1 TO 61

PRINT #2, USING "####"; i&;
PRINT #2, " ",
GET #1, pointer& + (i& - 1) * 36, offset&
sndname$ = ""
FOR j% = 0 TO 5
        GET #1, 455701 + offset& + j%, byte$
        IF ASC(byte$) = 0 THEN EXIT FOR
        sndname$ = sndname$ + byte$
NEXT j%
PRINT #2, sndname$;
PRINT #2, " ",
FOR j% = 4 TO 32 STEP 4
        GET #1, pointer& + (i& - 1) * 36 + j%, num&
        PRINT #2, USING "###"; num&;
        PRINT #2, " ";
        NEXT j%
PRINT #2, " "

NEXT i&

END

