Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!mips!apple!fox!portal!atari!apratt From: apratt@atari.UUCP (Allan Pratt) Newsgroups: comp.sys.atari.st Subject: Re: How to know we are in TOS 1.0? Message-ID: <1903@atari.UUCP> Date: 19 Dec 89 19:14:31 GMT References: <452@mirsa.inria.fr> Organization: Atari Corp., Sunnyvale CA Lines: 37 colas@modja.inria.fr (Colas Nahaboo) writes: >My question is: what is the LEGAL way to know I am running on an ST with >TOS 1.0 roms from a C program? [...] > >All I have seen is de-referencing the pointer > unsigned char *ROMS_YEAR = 0x00fc0018L + 3L; >which gives you the year of the TOS (on US and French tos it is 0x86), but >this is undocumented, and will surely break on the STe, since the Roms are >not in the same place! Good for you! You're right, the ROMs are free to move from rev to rev. So you can't use a constant for an address in the ROM. However, you can use a variable, and there is one: the system variable _sysbase at $4f2 holds the base of "the OS header" which is where things like the date are kept. This code extracts the date as a LONG from the OS header, no matter where it lives: char *sysbase = *(char **)0x4f2; long romdate = *(long *)(sysbase + 0x18); romdate will have a number like 0x04061989 for April 6, 1989. >PPPS: and do not tell me to pay to become a registred developper, all my atari >programming is public domain! :-) That doesn't matter. If you paid to become a registered developer, you would be able to look this stuff up instead of bothering all of us! :-) You don't have to be a commercial developer to join the Atari developer program. (I know I'm answering your question anyway -- think of it as advertising. (If you're a Net God, *don't* think of it as advertising!)) ============================================ Opinions expressed above do not necessarily -- Allan Pratt, Atari Corp. reflect those of Atari Corp. or anyone else. ...ames!atari!apratt