home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
No Fragments Archive 10: Diskmags
/
nf_archive_10.iso
/
MAGS
/
INFO
/
IINFO51.MSA
/
PROGRAMS_COOKIE.MOD
< prev
next >
Wrap
Text File
|
1991-03-14
|
7KB
|
230 lines
MODULE ReadCookie;
(*$T-*)
(*$S-*)
(*This program reads the ST's Cookie Jar. It is an extremely quick and
nasty program, but it was written as an investigation only*)
(*This program is in the Public Domain. You are free to modify it
in any way you wish. It is written in TDI Modula-2/ST*)
IMPORT LongInOut;
FROM Strings IMPORT Compare, CompareResults,String,Assign,Length;
FROM InOut IMPORT WriteString, WriteCard, ReadString, WriteLn, Write,
OpenOutputFile, CloseOutput;
FROM XBIOS IMPORT SuperExec;
FROM SYSTEM IMPORT CODE,ADDRESS;
(*Define two types of records to point at cookies. The first refers to the
cookie as containing an address. The second splits the cookie value into
two word. *)
TYPE CookieAddType = RECORD
Identifier : ARRAY[0..3] OF CHAR;
Pointer : LONGCARD
END;
TYPE CookieType = RECORD
Identifier : ARRAY[0..3] OF CHAR;
HiWord, LoWord : CARDINAL;
END;
TYPE CookiePointer = POINTER TO CookieType;
TYPE CookieAddPointer = POINTER TO CookieAddType;
CONST RTS = 04e75H; (*68000 return from subroutine opcode*)
VAR CookieAddress[05a0H] : ADDRESS;
ind : CARDINAL;
Addval : LONGCARD;
OutputFile : String;
Cookie : CookiePointer;
CookieAdd : CookieAddPointer;
(*$P- Turn off normal entry/exit code for this procedure*)
PROCEDURE GetAddress;
BEGIN
(*This routine called by the SuperExec mode of the extended BIOS. Address
$5a0 contains a pointer to the start of the Cookie Jar. Apparently this
address is one of Atari's cast in concrete, guaranteed not to change
variables *)
Cookie := CookieAddress;
CookieAdd := CookieAddress;
CODE(RTS)
END GetAddress;
(*$P+*)
PROCEDURE DoComments;
(*Writes out some comments about our current cookie*)
VAR KnownCookie : BOOLEAN; (*If we knew this Cookie will become true*)
BEGIN
KnownCookie := FALSE;
WriteString(" ");
(*Go through our list of known cookies*)
(*For the identifier _CPU, the low word contains 00,10,20,30 or 40
indicating that we have a 680xx processor. For example 00 indicates
the 68000, 30 the 68030. *)
IF Compare(Cookie^.Identifier,"_CPU") = Equal THEN
WriteString("Processor is 680");
IF Cookie^.LoWord < 10 THEN
Write("0");
WriteCard(Cookie^.LoWord,1);
ELSE
WriteCard(Cookie^.LoWord,2);
END;
KnownCookie := TRUE
END;
(*_SND. The low value contains, at the bit level what internal sound
generators are present. Bit 0 - The Yamaha chip of the original ST
Bit 1 - The STE/TT Stereo chip *)
IF Compare(Cookie^.Identifier,"_SND") = Equal THEN
WriteString("Sound chips present:-");
IF ODD(Cookie^.LoWord) THEN
WriteLn;
WriteString(" ");
WriteString("Normal ST sound chip (Yamaha/GI)")
END;
IF ODD(Cookie^.LoWord DIV 2) THEN
WriteLn;
WriteString(" ");
WriteString("STE/TT Hardware DMA stereo chip");
END;
KnownCookie := TRUE
END;
(*_VDO tells as about the graphics chip, in the high value in this case*)
IF Compare(Cookie^.Identifier,"_VDO") = Equal THEN
CASE Cookie^.HiWord OF
0 : WriteString("Plain normal ST shifter"); |
1 : WriteString("Improved STE shifter"); |
2 : WriteString("TT Graphics chip")
ELSE
WriteString("Unknown graphics chip")
END;
KnownCookie := TRUE
END;
(*_MCH tells us a bit about the actual computer we've got*)
IF Compare(Cookie^.Identifier,"_MCH") = Equal THEN
CASE Cookie^.HiWord OF
0 : WriteString("This is a plain ST"); |
1 : WriteString("This is a mega ST"); |
2 : WriteString("This is an STE"); |
3 : WriteString("This is a TT")
ELSE
WriteString("I don't know this computer type")
END;
KnownCookie := TRUE
END;
(*_FRB, A longword containing the where the Fast Ram Buffer on the TT is*)
(*If it is zero, then there is no Fast Ram Buffer*)
IF Compare(Cookie^.Identifier,"_FRB")= Equal THEN
WriteString("Fast Ram Buffer Address");
KnownCookie := TRUE
END;
(*_SWI tells us about configuration switches, whatever they do*)
IF Compare(Cookie^.Identifier,"_SWI") = Equal THEN
WriteString("For configuration switches");
KnownCookie := TRUE
END;
(*_INF. This turns up after running STE_FIX, and seems to indicate where
the patch goes??*)
IF Compare(Cookie^.Identifier,"_INF") = Equal THEN
WriteString("Desktop.INF patch installed");
KnownCookie := TRUE
END;
IF ~KnownCookie THEN
WriteString("I don't know this cookie");
END
END DoComments;
BEGIN
SuperExec(GetAddress); (*Get the Pointer to the Cookie Jar*)
WriteString("Cookie jar check--Where would you like the");
WriteLn;
WriteString("output to be sent ? (Press <return> for screen-->");
Assign(OutputFile,"CON:");
ReadString(OutputFile);
WriteLn;
OpenOutputFile(OutputFile);
WriteString("Quick and Nasty Cookie Jar Investigation");
WriteLn;
WriteLn;
IF LONGCARD(Cookie) = 0 THEN
WriteString("No Cookie Jar available");
ELSE
WriteString("Cookie Jar starts at (decimal) :-");
LongInOut.WriteLongCard(LONGCARD(Cookie),10);
WriteLn;
WriteString(" (hexadecimal) :-");
LongInOut.WriteLongHex(LONGCARD(Cookie),10);
WriteLn;
WriteString("Contents :-");
WriteLn;
WriteLn;
WriteString("Identifier High Low Address Comments");
WriteLn;
WHILE (Length(Cookie^.Identifier)>0) DO
(*Replace nulls with spaces*)
FOR ind := 1 TO 4-Length(Cookie^.Identifier) DO
Write(" ")
END;
(*Output cookie and info*)
WriteString(Cookie^.Identifier);
WriteString(" ");
WriteCard(Cookie^.HiWord,6);
WriteCard(Cookie^.LoWord,6);
LongInOut.WriteLongHex(CookieAdd^.Pointer,10);
DoComments;
INC(Cookie,8); (*Point to next cookie*)
INC(CookieAdd,8);
WriteLn;
END;
(*at The end of the list the null first null cookie contains the
number of reserved cookies*)
WriteLn;
LongInOut.WriteLongCard(CookieAdd^.Pointer,7);
WriteString(" Slots reserved for cookies");
WriteLn;
WriteLn;
CloseOutput;
END;
WriteString("Press return to exit");
ReadString(OutputFile)
END ReadCookie.