mirror of
https://github.com/ksherlock/mpw.git
synced 2025-01-09 13:30:34 +00:00
SysEnvirons ($a090) OS Trap
This commit is contained in:
parent
7beb3a7b43
commit
e4ad003bc7
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -218,6 +218,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);
|
||||
@ -793,4 +797,4 @@ namespace ToolBox {
|
||||
return tmp;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user