SysEnvirons ($a090) OS Trap

This commit is contained in:
Kelvin Sherlock 2015-01-20 13:35:07 -05:00
parent a5126544b8
commit b1e6635630
4 changed files with 66 additions and 0 deletions

View File

@ -550,6 +550,10 @@ namespace ToolBox {
d0 = OS::Gestalt(trap);
break;
case 0xa090:
d0 = OS::SysEnvirons(trap);
break;
// SetPtrSize (p: Ptr; newSize: Size);
case 0xa020:
d0 = MM::SetPtrSize(trap);

View File

@ -99,6 +99,7 @@ namespace OS
#pragma mark - Gestalt Manager
uint16_t Gestalt(uint16_t trap);
uint16_t SysEnvirons(uint16_t trap);
#pragma mark - XP Ram
uint16_t ReadXPRam(uint16_t trap);

View File

@ -46,6 +46,8 @@
#include <cpu/CpuModule.h>
#include <cpu/fmem.h>
#include <macos/errors.h>
#include "os.h"
#include "os_internal.h"
#include "toolbox.h"
@ -96,5 +98,60 @@ namespace OS {
return 0;
}
uint16_t SysEnvirons(uint16_t trap)
{
// FUNCTION SysEnvirons (versionRequested: Integer;
// VAR theWorld: SysEnvRec): OSErr;
/*
* on entry:
* D0 Version requested
* A0 SysEnvRec pointer
*
* on exit:
* D0 Result code
*
*/
enum {
/* SysEnvRec */
_environsVersion = 0,
_machineType = 2,
_systemVersion = 4,
_processor = 6,
_hasFPU = 8,
_hasColorQD = 9,
_keyBoardType = 10,
_atDrvrVersNum = 12,
_sysVRefNum = 14,
};
uint16_t versionRequested = cpuGetDReg(0);
uint32_t theWorld = cpuGetAReg(0);
Log("%04x SysEnvirons(%04x, %08x)\n", trap, versionRequested, theWorld);
memoryWriteWord(2, theWorld + _environsVersion);
// negative version.
if (versionRequested >= 0x8000)
return MacOS::envBadVers;
if (versionRequested > 2)
return MacOS::envVersTooBig;
memoryWriteWord(0, theWorld + _machineType); // 0 = unknown model newer than the IIci (v1) or IIfx (v2)
memoryWriteWord(1 + cpuGetModelMajor(), theWorld + _processor);
memoryWriteWord(0x0700, theWorld + _systemVersion); // system 7
memoryWriteWord(0, theWorld + _hasFPU);
memoryWriteWord(0, theWorld + _hasColorQD);
memoryWriteWord(5, theWorld + _keyBoardType); // standard adb I guess
memoryWriteWord(0, theWorld + _atDrvrVersNum); // no appletalk
memoryWriteWord(-1, theWorld + _sysVRefNum); // System folder #
return 0;
}
}

View File

@ -224,6 +224,10 @@ namespace ToolBox {
d0 = OS::Gestalt(trap);
break;
case 0xa090:
d0 = OS::SysEnvirons(trap);
break;
// SetPtrSize (p: Ptr; newSize: Size);
case 0xa020:
d0 = MM::SetPtrSize(trap);