' DEHACK - Doom Exe HACK
' by Matt Fell (matt.burnett@acebbs.com)
' written 3/17/94, last revised 6/13/94
'
' DEHACK 1 - The text strings which form the first part of the data segment.
'
' 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\dehack1.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\dehack1.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, "List of text strings in DOOM.EXE version 1.2 2-17-94"
PRINT #2, "List-making program was written by Matt Fell (matt.burnett@acebbs.com)"
PRINT #2, "=========================================================================="
PRINT #2, "The columns are: 1. decimal offset in doom.exe to start of text string"
PRINT #2, "                 2. decimal offset from 455700 (start of data segment)"
PRINT #2, "                 3. length of string in bytes. '00' marks string end"
PRINT #2, "                 4. hexadecimal offset"
PRINT #2, "                 5. hex offset from $6f414"
PRINT #2, "                 6. hex length of entry"
PRINT #2, "On the second line starts the text of the string. Extra/blank lines"
PRINT #2, " indicate the presence of $0a and/or $0d in the string."
PRINT #2, "=========================================================================="

offset& = 455701

anotherstring:

inc% = 0
l% = 0
entryname$ = ""
byte$ = ""
DO
        GET #1, offset& + inc%, byte$
        IF ASC(byte$) = 0 THEN EXIT DO
        entryname$ = entryname$ + byte$
        l% = l% + 1
        inc% = inc% + 1
LOOP
      
PRINT #2, USING "######"; offset& - 1;
PRINT #2, " ",
PRINT #2, USING "######"; offset& - 455701;
PRINT #2, " ",
PRINT #2, USING "####"; l%;
PRINT #2, " ",
PRINT #2, HEX$(offset& - 1),
PRINT #2, HEX$(offset& - 455701),
PRINT #2, HEX$(l%)
PRINT #2, entryname$

offset& = offset& + 4 * (INT(l% / 4) + 1)
IF offset& > 471370 THEN END
GOTO anotherstring

