News Team Current issue History Online Support Download Forum @Pouet

01 - 02 - SE - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 - 11 - 12 - 13 - 14

Alive 9
Cookies for the Beast

With  TOS 1.06  Atari implemented  the cookie  jar into  the OS  and the   first
official  document mentioning   cookies is  dated  to 1989. However  cookies are
really nice for  gaining informations about the current  system, and unless some
jester is  faking them,  they offer  a reliable  and easy  way to   obtain these
informations. Over the past years the  cookie jar has always been  modified  and
extended whenever  new  hardware  appeared. So  it  wouldn't  be far fetched  to
expect some additions caused  by the release of  the CT60. And in  fact Didier's
patched TOS 4.04 contains some new cookies to identify the beast.

In CT60 mode the current TOS adds  a cookie called CT60 to the jar.  Other third
party Atari compatibles  used their own  cookies too. The  Hades used hade  (all
lower case letters), on  Milan it was _MIL.  On CT60 the cookie  is called CT60.
According to  Didier Mequignon  TOS sets  this cookie  is used  as a pointer  to
an undocumented  structure, that is used by the ct60 cpx.

CT60 $0000 0000

On my machine it  points to $01000000, but  you can check for  yourself with the
included cookie-viewer. The undocumented structure contains the following:

trigger_temp:  ds.b 1
daystop:       ds.b 1
timestop:      ds.b 1
speed_fan:     ds.b 1

Or if you like it better in C-style:

typedef struct
unsigned short trigger_temp;
unsigned short daystop;
unsigned short timestop;
unsigned short speed_fan;

The _CPU  cookie contains  informations about  the build-in  CPU of the machine.
This information  is rather  simple, because  it contains  the value  of the CPU

_CPU $0000 0000 MC68000
$0000 000A MC68010
$0000 0014 MC68020
$0000 001E MC68030
$0000 0028 MC68040
$0000 003C MC68060

The Value $0000003C  (decimal 60) can  be found on  all Machines that  contain a
68060 CPU like CT60, Hades060 and even other Falcon accelerators. So this cookie
is no real indicator for the presence of a CT60.

The _VDO  cookie is  telling the  revision of  the video  shifter of the current
machine. The higher Word represents the major version of the shifter, the  lower
word the minor version. The CT60 is  identified by the same value as a  standard
Falcon 030 unless you plug additional video hardware to the machine.

_VDO $ffff ffff ST incompatible Video Hardware (eg. Medusa)
$0000 0000 ST Shifter
$0001 0000 STE Shifter
$0002 0000 TT030 Shifter
$0003 0000 Falcon030 (CT60) Videl or Medusa T40 (ET4000 1MB DRAM)
$0004 0000 Milan Video

If you want  to know which  machine is present,  you might want  to look for the
_MCH cookie. The  higher word contains  the major hardware  revision number, the
lower word contains the minor revision  number. The CT60 identifies just like  a
normal Falcon via _MCH cookie. So  you will need further checks to  determine if
it is a plain Falcon or a CT60.

_MCH $ffff ffff ST incompatible Machine
$0000 0000 ST (all models) or Medusa T40 with old TOS (before 07/1994)
$0000 4D34 Medusa T40 without SCSI ($0000"M4") 
$0001 0000 STE
$0001 0008 ST Book
$0001 0010 Mega STE
$0001 0100 Sparrow (Falcon Prototype) couldn't be verified so far
$0002 0000 TT030 or Hades
$0002 4D34 Medusa T40 with SCSI    ($0002"M4") 
$0003 0000 Falcon030 / CT60 / ARAnyM < v0.8.5beta
$0004 0000 Milan (also ?_MIL? with value $0000 0001)
$0005 0000 ARAnyM >= v0.8.5beta

If you happen to own a Sparrow it  would be nice if could run my little  program
and send me the generated textfile. The program is contained on the disk in  the
cookie folder.

The _FPU cookie  contains several bits  to indicate the  presence or absence  of
several  FPU  types.  Beside  the  well  known  68881  and  68882  models, Atari
distributed  a small  add-on board  for the  Mega Bus.  It's  called  SFP004 and
contains a 16 MHz capable 68881 FPU.

Bitmap of the higher word of the _FPU cookie:

          |||||'- SFP004 (Atari Mega Bus FPU card with 68881)
 not used ||||'-- 68881 or 68882
          |||'--- 68881
          ||'---- 68882
          |'----- 68040 internal FPU
          '------ 68060 internal FPU

Example Values:

_FPU $0000 0000 No FPU installed
$0001 0000 SFP004
$0002 0000 68881 or 68882
$0004 0000 68881
$0006 0000 68882
$0008 0000 68040 internal FPU
$0010 0000 68060 internal FPU

Appendix A

Example Cookie Jars


_CPU $00000000
_VDO $00010000
_MCH $00010000
_SND $00000003
_SWI $000000ff

STE (TOS 2.06)

_CPU $00000000
_VDO $00010000
_MCH $00010000
_SWI $000000ff
_SND $00000003
_FPU $00000000


_TOS $00000704
_CT2 $f6d00061
_CPU $0000001e
PMMU $0100b8d0
_VDO $00030000
_MCH $00030000
_SWI $000000bf
_SND $0000001f
_FDC $01415443
_FPU $00060000
_FRB $0000f99c
_AKP $00000301
_IDT $0000112f
_SYM $0100ca48
SCSI $010153e8
USHD $010103fe
XHDI $01010c36


_CPU $0000001e
_FPU $00060000
_TOS $00000704
_CT2 $f6800062
PMMU $0100b8d0
_VDO $00030000
_MCH $00030000
_SWI $000000bf
_SND $0000001f
_FDC $01415443
_FRB $0000f99c
_AKP $00000606
_IDT $0000122d
_SYM $0100ca48
SCSI $014890cc
USHD $01010400
XHDI $01484310
NVDI $013989c8
FSMC $0137fea0
_VID $0140c496
CNTS $0140c666
FSEL $0142f72a
HBFS $01420420
MiNT $00000110
_FLK $00000000
ICIP $014da070
STiK $014f6dfc
nAES $0004e000
EdDI $01380b92
APEX $0172ca70
DHST $00000004

Medusa T40 (Information extracted from the User Manual)

     old T40   since 07/1994
_CPU $00000028 $00000028 
_FPU $00080000 $00080000
_MCH $00000000 $00004D34 ($0000"M4") without SCSI
_MCH $00000000 $00024D34 ($0002"M4") with SCSI
_VDO $00000000 $00030000 (ET4000 1MB DRAM)
_FDC $01415443 $02000000 (DD 720KB, HD 1,44MB, ED 2,88MB)
_SND $00000001 $00000001 (ST Sound)

The _MCH cookie of Medusa T40  with older TOS versions (before 07/1994)  will be
changed by the Accessory to the new value.

Milan 040 (Tos 4.08) minimal boot

_CPU $00000028 
_FPU $00080000 
_VDO $00040000 
_MCH $00040000 
_MIL $00000001 
_PCI $00e06fa8 
MNAM $00e507ec ; Machine Name
_SND $00000000 
_FDC $014d494c 
_FRB $00100000 
_AKP $00000101 
_IDT $0000112e 
SCSI $00115d06 ; HDDriver
USHD $001112f4 ; HDDriver
XHDI $00111d72 ; HDDriver

Milan 040 (Tos 4.xx)

_CPU $00000028
_FPU $00080000
_VDO $00040000
_MCH $00040000
_MIL $00000001
_PCI $00E05ECC
MNAM $00E4D368
_SND $00000004
_FDC $014D494C
_FRB $000168B0
_AKP $00000001
_IDT $0000112E
SCSI $0002C1D0
USHD $00027C78
XHDI $000284DA
_VDI $01009604
EdDI $01003B98
McSn $000B54C6
XSSI $010140D4
FSEL $0103199E
HBFS $01022694
NVDI $0108B460
FSMC $01072938
MiNT $0000010F
_FLK $00000000
STiK $000C0838
RSVF $000C7E90
ICIP $0146DEE0
nAES $000B7990
BGEM $000F4000
NOTE $00000200
DHST $00000011

Hades 060 (Patched TOS 3.06)

_CPU $0000003c         minimal boot
_VDO $00020000
_FPU $00100000
_MCH $00020000
hade $0000400e
_SND $00000001
_FDC $68616465
_AKP $00000303
_IDT $00001000

_CPU $0000003c         full boot
_FPU $00100000
_VDO $00020000
_MCH $00020000
hade $0000400e
_SND $00000025
_FDC $68616465
_AKP $00000300
_IDT $00001000
SCSI $011d6826         ; HDDriver
USHD $0000e95c         ; HDDriver
XHDI $011d2d9a         ; HDDriver
MOGR $00477404
CJar $01404e0e
NOVA $01002cea
NVDI $0107979c
FSMC $01060bc2
_PCI $01172b34
FSEL $01190c9e
HBFS $01181994
GSXB $01193c76
MiNT $00000110
_FLK $00000100
RSVF $004b4000
STiK $01222458
nAES $004ea000
IMNE $0102701e
VSCR $01023b68
EdDI $0101900a
DHST $00000009

Appendix B - Sources

; Title:       Cookie Reader
; Description: This program reads the cookie jar and saves the contents to disk
;              to a file called "COOKIE.TXT" in the current folder.
; Author:      Cyclone / X-Troll
; Mail:        cxt(at)
; Web:
os_entry:       RS.W 1
os_version:     RS.W 1
os_start:       RS.L 1
os_base:        RS.L 1
os_membot:      RS.L 1
os_shell:       RS.L 1
os_magic:       RS.L 1
os_gendat:      RS.L 1
os_palmode:     RS.W 1
os_gendatg:     RS.W 1
os_mifl_root:   RS.L 1                  ; these exist from TOS 1.02 upwards
os_kbshift:     RS.L 1
os_act_PD:      RS.L 1
Reset_SSP       EQU 0
Reset_PC        EQU 4
_sysbase        EQU $04F2
_p_cookies      EQU $05A0


                linea   #0 [ Init ]
                linea   #10 [ Hidem ]

                pea     cookieview(PC)
                move.w  #$26,-(SP)
                trap    #14
                addq.w  #6,SP

                move.w  #2,-(SP)          ; check for pressed key
                move.w  #1,-(SP)
                trap    #13
                addq.w  #4,SP
                tst.w   D0
                beq.s   wait_key

                move.w  #2,-(SP)
                move.w  #2,-(SP)
                trap    #13
                addq.w  #4,SP

                linea   #9 [ Showm ]

                move.l  cookie_ptr(PC),D0  ; are there any cookies to save?
                cmp.l   #cookie_file,D0
                beq.s   error

                move.w  #0,-(SP)           ; Fcreate
                pea     fname(PC)
                move.w  #$3C,-(SP)
                trap    #1
                addq.w  #8,SP

                tst.w   D0
                bmi.s   error

                move.w  D0,fhandle

                pea     cookie_file(PC)    ; FWrite
                move.l  cookie_ptr(PC),D1
                sub.l   #cookie_file,D1
                move.l  D1,-(SP)
                move.w  D0,-(SP)
                move.w  #$40,-(SP)
                trap    #1
                lea     $0C(SP),SP

                tst.w   D0
                bmi.s   error

                move.w  fhandle(PC),-(SP)
                move.w  #$3E,-(SP)
                trap    #1
                addq.w  #4,SP
                clr.w   -(SP)
                trap    #1

                movea.l _sysbase.w,A3
                move.l  #"TOS ",D0
                moveq   #0,D1
                move.w  os_version(A3),D1  ; Mirrored TOS Version
                bsr.s   print
                move.l  #"Base",D0
                move.l  os_base(A3),D1     ; TOS Base Address
                bsr.s   print
                move.l  #"Date",D0
                move.l  os_gendat(A3),D1   ; TOS Base Address
                bsr.s   print
                move.l  #"Sync",D0
                moveq   #0,D1
                move.w  os_palmode(A3),D1
                bra.s   print
                move.l  #cookie_file,cookie_ptr
                bsr.s   cls

                bsr.s   tos_ver            ; get TOS Info

                move.l  _p_cookies.w,D0    ; fetch pointer to cookie jar
                beq.s   no_cookies
                movea.l D0,A0
                move.l  (A0)+,D0           ; get cookie
                beq.s   end_of_jar
                move.l  (A0)+,D1
                bsr.s   print
                bra.s   loop
                bra.s   exit
                pea     no_cookies_str(PC)
                move.w  #9,-(SP)
                trap    #1
                addq.w  #6,SP

                pea     cls_str(PC)
                move.w  #9,-(SP)
                trap    #1
                addq.w  #6,SP

                lea     cookie_str(PC),A1
                move.l  D0,(A1)+
                move.w  #" $",(A1)+
                lea     cipher_tab(PC),A2
                moveq   #7,D2
                rol.l   #4,D1
                move.w  D1,D0
                and.w   #$0F,D0
                move.b  0(A2,D0.w),(A1)+
                dbra    D2,print1

                move.b  #13,(A1)+
                move.b  #10,(A1)+
                clr.b   (A1)+

                move.l  A0,-(SP)
                pea     cookie_str(PC)
                move.w  #9,-(SP)
                trap    #1
                addq.w  #6,SP
                movea.l (SP)+,A0

                lea     cookie_str(PC),A1
                movea.l cookie_ptr(PC),A2
                move.b  (A1)+,(A2)+
                bne.s   copy_loop
                subq.w  #1,A2
                move.l  A2,cookie_ptr



cipher_tab:     DC.B "0123456789abcdef"

cls_str:        DC.B 27,"E",0
no_cookies_str: DC.B "No cookies found!",0
fname:          DC.B "COOKIES.TXT",0

fhandle:        DS.W 1
cookie_ptr:     DS.L 1
cookie_file:    DS.B 32000

cookie_str:     DS.B 4+1+9+2+1

Appendix C - Docs

Handbuch zum Medusa T40, Medusa Computer Systems, 1999

Hans Dieter Jankowski, Julian Reschke, Dietmar Rabich
Atari ST Profibuch, Sybex 1989

Julian F. Reschke
MiNT 1.12 ist da!, ST Computer 1/95

Various Authors
Atari Linux Kernel Sources

Thanks to Altf4, LP2, evl , swe and ozk for supplying cookie dumps.

2004-06-27 Cyclone / X-Troll

Alive 9