/* T O S _ V E R S */ /* Print Atari ST operating system component versions */ /* Copyright 1989 Rainer Klute. All rights reserved */ #include #include #define _sysbase (char **) 0x4f2 int contrl[12], intin[128], ptsin[128], intout[128], ptsout[128], work_in[11], work_out[57], vdi_handle; struct tos_version { int n1, n2, day, month, year; char nickname[20]; }; struct tos_version official_versions[] = { {1, 0, 20, 06, 1985, "RAM TOS"}, {1, 0, 06, 02, 1986, "ROM TOS"}, {1, 2, 22, 04, 1987, "BLiTTER TOS"}, {1, 4, 06, 04, 1989, "Rainbow TOS"} }; main (argc, argv) int argc; char *argv[]; { union { int i; char c[sizeof (int)]; } u; struct { int day, month, year; } tos_date; register char *sv_stackpointer; register char c; register int i; extern int global[]; printf ("Atari ST operating system component versions\n"); printf ("Copyright \275 Rainer Klute 1989\n\n"); sv_stackpointer = (char *) Super (0l); u.i = *((int *) (*_sysbase + 2)); c = *(*_sysbase + 0x18); tos_date.month = ((c & 0xf0) >> 4) * 10 + (c & 0x0f); c = *(*_sysbase + 0x19); tos_date.day = ((c & 0xf0) >> 4) * 10 + (c & 0x0f); c = *(*_sysbase + 0x1a); tos_date.year = ((c & 0xf0) >> 4) * 10 + (c & 0x0f); tos_date.year *= 100; c = *(*_sysbase + 0x1b); tos_date.year += ((c & 0xf0) >> 4) * 10 + (c & 0x0f); Super (sv_stackpointer); printf ("TOS version: %d.%d (%02.2d.%02.2d.%04.4d", u.c[0], u.c[1], tos_date.day, tos_date.month, tos_date.year); for (i = 0; i < sizeof (official_versions) / sizeof (struct tos_version); i++) if (u.c[0] == official_versions[i].n1 && u.c[1] == official_versions[i].n2 && tos_date.day == official_versions[i].day && tos_date.month == official_versions[i].month && tos_date.year == official_versions[i].year) printf (", \"%s\"", official_versions[i].nickname); printf (")\n"); u.i = Sversion (); printf ("GEMDOS version: %d.%d\n", u.c[1], u.c[0]); if (appl_init () != -1) { u.i = global[0]; printf ("AES version: %d.%d\n", u.c[0], u.c[1]); }; appl_exit (); if (argc > 1) Cnecin (); } /* In article <801@orbit.UUCP> steve@pnet51.cts.com (Steve Yelvington) writes: | The Sversion() Gemdos function allegedly provides this information, but on my | STFM it returns a value of 0.19. Does anybody know whether Sversion() really | works? Hmm, Sversion is returning a float value? Hmmm... ;-) Sversion() returns the GEMDOS version number, not the TOS version. The GEMDOS version number for your machine should be 0x1300 (our version numbers are all WORD values); I'm not sure how you get 0.19 from that, but... In any case, the TOS version number is in the OS header. To get the TOS version number, use the pointer to the OS header (sysbase) at 0x4f2. The TOS version number is the second word of the OS header. Offsets for the rest of the stuff in the OS header is documented in the Hitchhiker's Guide to the BIOS. The Pexec Cookbook also has a small section on GEMDOS/TOS version numbers. To add to the version number confusion, the AES has its own version number too (returned in global[0] on appl_init)! For those with a furniture fetish, here is a table: Versions ============== ROM TOS Mega TOS ------- -------- ------- $0100 $0102 $0104 TOS version (from the OS header) $1300 $1300 $1500 GEMDOS version (from the Sversion call) $0100 $0120 $0140 AES version (from global[0] after appl_init) Can you now see why we don't like to give OS releases specific version numbers? ;-) -- ||| Ken Badertscher (ames!atari!kbad) ||| Atari R&D System Software Engine / | \ #include / | \ */