mirror of
https://github.com/aaru-dps/fstester.git
synced 2025-12-16 19:24:39 +00:00
Implement OS information for Atari ST.
This commit is contained in:
@@ -26,4 +26,4 @@ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "MiNT")
|
|||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_sources(attr.c attr.h deleted.c dirdepth.c filename.c files.c frag.c links.c os.c perms.c rsrcfork.c sparse.c time.c tostime.h volume.c xattr.c)
|
add_sources(attr.c attr.h deleted.c dirdepth.c filename.c files.c frag.c links.c os.c os.h perms.c rsrcfork.c sparse.c time.c tostime.h volume.c xattr.c)
|
||||||
|
|||||||
142
setter/src/atarist/os.c
Normal file
142
setter/src/atarist/os.c
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
Aaru Data Preservation Suite
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Author(s) : Natalia Portillo
|
||||||
|
|
||||||
|
--[ License ] ---------------------------------------------------------------
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2011-2021 Natalia Portillo
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include <eti.h>
|
||||||
|
#include <mint/cookie.h>
|
||||||
|
#include <mint/mintbind.h>
|
||||||
|
#include <mint/osbind.h>
|
||||||
|
#include <mint/ssystem.h>
|
||||||
|
#include <mint/sysvars.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "os.h"
|
||||||
|
|
||||||
|
#include "../include/defs.h"
|
||||||
|
#include "../log.h"
|
||||||
|
|
||||||
|
void GetOsInfo()
|
||||||
|
{
|
||||||
|
OSHEADER* osHeader = (OSHEADER*)_sysbase;
|
||||||
|
unsigned short version;
|
||||||
|
long** cookieJar = _p_cookies;
|
||||||
|
long cookie = 0;
|
||||||
|
char type[5];
|
||||||
|
int rc;
|
||||||
|
struct _stemu_vars* stemu_vars;
|
||||||
|
struct _tos2win_vars* tos2win_vars;
|
||||||
|
MAGX_COOKIE* magic_vars;
|
||||||
|
|
||||||
|
version = Sversion();
|
||||||
|
|
||||||
|
log_write("OS information:\n");
|
||||||
|
log_write("\tRunning under TOS %d.%02d\n", (osHeader->os_version & 0xFF00) >> 8, osHeader->os_version & 0xFF);
|
||||||
|
log_write("\tCountry code: %d\n", osHeader->os_conf >> 1);
|
||||||
|
log_write("\tVideo mode: %d\n", (osHeader->os_conf & 0x01) ? "PAL" : "NTSC");
|
||||||
|
log_write("\tSystem build date: %04X/%02X/%02X\n",
|
||||||
|
osHeader->os_date >> 16,
|
||||||
|
(osHeader->os_date & 0xFF00) >> 8,
|
||||||
|
osHeader->os_date & 0xFF);
|
||||||
|
log_write("\tGEMDOS v%d.%02d\n", version >> 8, version & 0xFF);
|
||||||
|
|
||||||
|
rc = Ssystem(-1, 0, 0);
|
||||||
|
|
||||||
|
if(rc == E_OK)
|
||||||
|
{
|
||||||
|
rc = Ssystem(S_OSNAME, 0, 0);
|
||||||
|
|
||||||
|
if(rc > 0)
|
||||||
|
{
|
||||||
|
memset(type, 0, 5);
|
||||||
|
snprintf(type, 4, "%s", (char*)&rc);
|
||||||
|
log_write("\tOS name: %s\n", type);
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = Ssystem(S_OSXNAME, 0, 0);
|
||||||
|
|
||||||
|
if(rc > 0)
|
||||||
|
{
|
||||||
|
memset(type, 0, 5);
|
||||||
|
snprintf(type, 4, "%s", (char*)&rc);
|
||||||
|
log_write("\tOS sub-name: %s\n", type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for a cookie jar
|
||||||
|
if(*cookieJar == 0) return;
|
||||||
|
|
||||||
|
// KAOS TOS
|
||||||
|
rc = Getcookie(C__T30, &cookie);
|
||||||
|
if(rc == E_OK)
|
||||||
|
log_write(
|
||||||
|
"\tRunning under KAOS TOS from %04X/%02X/%02X\n", cookie & 0xFFFF, (cookie & 0xFF0000 >> 16), cookie >> 24);
|
||||||
|
|
||||||
|
// MiNT / MultiTOS
|
||||||
|
rc = Getcookie(C_MiNT, &cookie);
|
||||||
|
if(rc == E_OK) log_write("\tRunning under MiNT/MultiTOS version %d.%02d\n", cookie >> 8, cookie & 0xFF);
|
||||||
|
|
||||||
|
// oTOSis (format of cookie not known
|
||||||
|
rc = Getcookie(0x4F544F53L, &cookie);
|
||||||
|
if(rc == E_OK) log_write("\tRunning under oTOSis\n");
|
||||||
|
|
||||||
|
// STEmulator
|
||||||
|
rc = Getcookie(0x5354454DL, (long*)&stemu_vars);
|
||||||
|
if(rc == E_OK)
|
||||||
|
log_write("\tRunning under STEmulator version %d.%02d\n", stemu_vars->version >> 8, stemu_vars->version & 0xFF);
|
||||||
|
|
||||||
|
// STEmulator
|
||||||
|
rc = Getcookie(C__T2W, (long*)&tos2win_vars);
|
||||||
|
if(rc == E_OK)
|
||||||
|
log_write(
|
||||||
|
"\tRunning under TOS2WIN version %X.%02X\n", tos2win_vars->version >> 8, tos2win_vars->version & 0xFF);
|
||||||
|
|
||||||
|
// MagiC
|
||||||
|
rc = Getcookie(C_MagX, (long*)&magic_vars);
|
||||||
|
if(rc == E_OK)
|
||||||
|
log_write("\tRunning under MagiC version %d.%d\n",
|
||||||
|
magic_vars->aesvars->version >> 8,
|
||||||
|
magic_vars->aesvars->version & 0xFF);
|
||||||
|
|
||||||
|
// MagiC
|
||||||
|
rc = Getcookie(C_MgMc, (long*)&magic_vars);
|
||||||
|
if(rc == E_OK)
|
||||||
|
log_write("\tRunning under MagiCMac version %d.%d\n",
|
||||||
|
magic_vars->aesvars->version >> 8,
|
||||||
|
magic_vars->aesvars->version & 0xFF);
|
||||||
|
|
||||||
|
// MagiC
|
||||||
|
rc = Getcookie(C_MgMx, (long*)&magic_vars);
|
||||||
|
if(rc == E_OK)
|
||||||
|
log_write("\tRunning under MagiCMac X version %d.%d\n",
|
||||||
|
magic_vars->aesvars->version >> 8,
|
||||||
|
magic_vars->aesvars->version & 0xFF);
|
||||||
|
|
||||||
|
// MagiC
|
||||||
|
rc = Getcookie(C_MgPC, (long*)&magic_vars);
|
||||||
|
if(rc == E_OK)
|
||||||
|
log_write("\tRunning under MagiC PC version %d.%d\n",
|
||||||
|
magic_vars->aesvars->version >> 8,
|
||||||
|
magic_vars->aesvars->version & 0xFF);
|
||||||
|
}
|
||||||
91
setter/src/atarist/os.h
Normal file
91
setter/src/atarist/os.h
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
Aaru Data Preservation Suite
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Author(s) : Natalia Portillo
|
||||||
|
|
||||||
|
--[ License ] ---------------------------------------------------------------
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2011-2021 Natalia Portillo
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef FSSETTER_TEST_SRC_ATARIST_OS_H_
|
||||||
|
#define FSSETTER_TEST_SRC_ATARIST_OS_H_
|
||||||
|
|
||||||
|
struct _stemu_vars
|
||||||
|
{
|
||||||
|
int16_t version; /* e.g. 0x0121 Version 1.21 */
|
||||||
|
int32_t unused; /* 0, currently not used */
|
||||||
|
}
|
||||||
|
|
||||||
|
struct _tos2win_vars
|
||||||
|
{
|
||||||
|
int16_t len; /* Length of the structure */
|
||||||
|
int16_t version; /* Version in BCD i.e. $0119 = Version 1.19 */
|
||||||
|
int32_t pc_ptr; /* Offset of the Atari memory in PC memory for recalculation of pointers */
|
||||||
|
int32_t features[4]; /* Bit-fields for individual T2W features */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int32_t magic; /* Has to be 0x87654321 */
|
||||||
|
void* membot; /* End of the AES variables */
|
||||||
|
void* aes_start; /* Start address */
|
||||||
|
int32_t magic2; /* Is 'MAGX' */
|
||||||
|
int32_t date; /* Creation date */
|
||||||
|
void (*chgres)(int16_t res, int16_t txt); /* Change resolution */
|
||||||
|
int32_t (**shel_vector)(void); /* Resident desktop */
|
||||||
|
int8_t* aes_bootdrv; /* Booting will be from here */
|
||||||
|
int16_t* vdi_device; /* Driver used by AES */
|
||||||
|
void* reservd1; /* Reserved */
|
||||||
|
void* reservd2; /* Reserved */
|
||||||
|
void* reservd3; /* Reserved */
|
||||||
|
int16_t version; /* Version (0x0201 is V2.1) */
|
||||||
|
int16_t release; /* 0=alpha..3=release */
|
||||||
|
} AESVARS;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int8_t* in_dos; /* Adress of the DOS semaphore */
|
||||||
|
int16_t* dos_time; /* Adress of the DOS time */
|
||||||
|
int16_t* dos_date; /* Adress of the DOS date */
|
||||||
|
int32_t res1; /* */
|
||||||
|
int32_t res2; /* */
|
||||||
|
int32_t res3; /* is 0L */
|
||||||
|
void* act_pd; /* Running program */
|
||||||
|
int32_t res4; /* */
|
||||||
|
int16_t res5; /* */
|
||||||
|
void* res6; /* */
|
||||||
|
void* res7; /* Internal DOS memory list */
|
||||||
|
void (*resv_intmem)(); /* Extend DOS memory */
|
||||||
|
int32_t (*etv_critica)(); /* etv_critic of the GEMDOS */
|
||||||
|
int8_t*((*err_to_str)(int8_t e)); /* Conversion code->plain text */
|
||||||
|
int32_t res8; /* */
|
||||||
|
int32_t res9; /* */
|
||||||
|
int32_t res10; /* */
|
||||||
|
} DOSVARS;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int32_t config_status;
|
||||||
|
DOSVARS* dosvars;
|
||||||
|
AESVARS* aesvars;
|
||||||
|
void* res1;
|
||||||
|
void* hddrv_functions;
|
||||||
|
int32_t status_bits;
|
||||||
|
} MAGX_COOKIE;
|
||||||
|
|
||||||
|
#endif // FSSETTER_TEST_SRC_ATARIST_OS_H_
|
||||||
Reference in New Issue
Block a user