mpw/toolbox/toolbox.cpp

765 lines
13 KiB
C++
Raw Normal View History

2013-07-30 05:06:19 +00:00
/*
* Copyright (c) 2013, Kelvin W Sherlock
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
2013-07-30 05:06:19 +00:00
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
2013-07-30 05:06:19 +00:00
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
2013-07-30 05:06:19 +00:00
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
2013-02-08 00:21:47 +00:00
#include <cstdio>
#include <cstdint>
Squashed commit of the following: commit f4807cd071ba5c4ce9ba4aa8c906ba335da07a2d Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Feb 13 16:09:55 2015 -0500 merge in missing tool calls commit 6830ab51ce7c48e3d0d1352f04df8df914146b3e Merge: 1675a47 24c17a9 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Feb 13 16:06:05 2015 -0500 Merge branch 'feature_trap_address_2015' into merge_dispatcher Conflicts: bin/loader.cpp toolbox/rm.cpp toolbox/toolbox.cpp commit 24c17a9a888b2a95e99761ee7ee8b15874a9ce42 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Feb 13 13:22:07 2015 -0500 SetOSTrapAddress stub commit b255937e6c9a6765a9763b011bd99c3f675d997c Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jan 24 14:40:45 2015 -0500 Use the $Commands environment variable as a list of directories where commands may be located. Conflicts: bin/loader.cpp commit a3925747cef0203d178091cdd827c50ded134484 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jan 23 10:26:52 2015 -0500 HWPriv OS Trap commit 16d0038fd1b9b6db3e154ab5e810624ab7d3ca08 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jan 23 10:26:40 2015 -0500 HWPriv OS Trap commit bf92f806326925b68b497127da421f833e2cdba2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed Jan 21 17:34:30 2015 -0500 RM::GetNamedResource commit 540490d0c5ba7c8310271b1c7fd68259a77a2f28 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed Jan 21 14:31:03 2015 -0500 GetNamedResource trap commit 09aa8d0f2600668b37a51e7872db9a9f9c9ea4ef Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue Jan 20 19:32:04 2015 -0500 Set ApplZone global (ARMCFront) commit 45fa54abca52a80c980c870f43f1f82225d7c43d Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue Jan 20 13:58:24 2015 -0500 update test makefile commit b1e6635630d2fc112b613312000e091ff7f297bc Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue Jan 20 13:35:07 2015 -0500 SysEnvirons ($a090) OS Trap commit a5126544b8bdda155a5f8e9395d547a7bf3eae94 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Jan 19 15:02:29 2015 -0500 undo HGetVolume cwd, for now commit 912c8748254a83d3a5eacf776a6b6b3a4439aa75 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Jan 19 10:55:58 2015 -0500 Fix SetPtrSize commit c0fe74c1b81d1782a61240a18ecc4e51a3ecb88c Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 17:31:09 2015 -0500 support the auto-pop bit for tool calls (MPW Pascal IIgs 1.0b1) commit 2e9ab5200c285bb97bc15a11dcc7e7127e779245 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 15:20:38 2015 -0500 update dispatch code... commit c7c548e5ac2096e29aebf532e0eb69e2227bdecd Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 14:48:22 2015 -0500 add back new tool calls. commit cbb554174ef186b8b74383596212d9b8f04ebfea Merge: 44d19f7 5e616d3 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 14:43:58 2015 -0500 Merge branch 'feature_trap_address' into feature_trap_address_2015 Conflicts: toolbox/CMakeLists.txt toolbox/os.cpp toolbox/toolbox.cpp commit 5e616d353b1421b96cc4e3a4f82d4422911d1243 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Dec 14 18:01:38 2014 -0500 new dispatcher. commit ea5f2139217df8aebe975b8e4680080d58a772bd Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Dec 8 11:42:23 2014 -0500 get ready for trap overrides. commit 17c5b40ac866a7adaa559bc9164ffe32e926cc96 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Dec 5 14:39:17 2014 -0500 remove dead code commit fc7df738cc9dd72d65ba656df71dd6aa124ce8af Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Dec 5 14:32:18 2014 -0500 display trap name for GetToolTrap, etc.
2015-02-13 21:11:55 +00:00
#include <cassert>
2013-02-08 00:21:47 +00:00
#include <stdlib.h>
2013-02-14 03:16:40 +00:00
#include <string>
Squashed commit of the following: commit f4807cd071ba5c4ce9ba4aa8c906ba335da07a2d Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Feb 13 16:09:55 2015 -0500 merge in missing tool calls commit 6830ab51ce7c48e3d0d1352f04df8df914146b3e Merge: 1675a47 24c17a9 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Feb 13 16:06:05 2015 -0500 Merge branch 'feature_trap_address_2015' into merge_dispatcher Conflicts: bin/loader.cpp toolbox/rm.cpp toolbox/toolbox.cpp commit 24c17a9a888b2a95e99761ee7ee8b15874a9ce42 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Feb 13 13:22:07 2015 -0500 SetOSTrapAddress stub commit b255937e6c9a6765a9763b011bd99c3f675d997c Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jan 24 14:40:45 2015 -0500 Use the $Commands environment variable as a list of directories where commands may be located. Conflicts: bin/loader.cpp commit a3925747cef0203d178091cdd827c50ded134484 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jan 23 10:26:52 2015 -0500 HWPriv OS Trap commit 16d0038fd1b9b6db3e154ab5e810624ab7d3ca08 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jan 23 10:26:40 2015 -0500 HWPriv OS Trap commit bf92f806326925b68b497127da421f833e2cdba2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed Jan 21 17:34:30 2015 -0500 RM::GetNamedResource commit 540490d0c5ba7c8310271b1c7fd68259a77a2f28 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed Jan 21 14:31:03 2015 -0500 GetNamedResource trap commit 09aa8d0f2600668b37a51e7872db9a9f9c9ea4ef Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue Jan 20 19:32:04 2015 -0500 Set ApplZone global (ARMCFront) commit 45fa54abca52a80c980c870f43f1f82225d7c43d Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue Jan 20 13:58:24 2015 -0500 update test makefile commit b1e6635630d2fc112b613312000e091ff7f297bc Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue Jan 20 13:35:07 2015 -0500 SysEnvirons ($a090) OS Trap commit a5126544b8bdda155a5f8e9395d547a7bf3eae94 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Jan 19 15:02:29 2015 -0500 undo HGetVolume cwd, for now commit 912c8748254a83d3a5eacf776a6b6b3a4439aa75 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Jan 19 10:55:58 2015 -0500 Fix SetPtrSize commit c0fe74c1b81d1782a61240a18ecc4e51a3ecb88c Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 17:31:09 2015 -0500 support the auto-pop bit for tool calls (MPW Pascal IIgs 1.0b1) commit 2e9ab5200c285bb97bc15a11dcc7e7127e779245 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 15:20:38 2015 -0500 update dispatch code... commit c7c548e5ac2096e29aebf532e0eb69e2227bdecd Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 14:48:22 2015 -0500 add back new tool calls. commit cbb554174ef186b8b74383596212d9b8f04ebfea Merge: 44d19f7 5e616d3 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 14:43:58 2015 -0500 Merge branch 'feature_trap_address' into feature_trap_address_2015 Conflicts: toolbox/CMakeLists.txt toolbox/os.cpp toolbox/toolbox.cpp commit 5e616d353b1421b96cc4e3a4f82d4422911d1243 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Dec 14 18:01:38 2014 -0500 new dispatcher. commit ea5f2139217df8aebe975b8e4680080d58a772bd Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Dec 8 11:42:23 2014 -0500 get ready for trap overrides. commit 17c5b40ac866a7adaa559bc9164ffe32e926cc96 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Dec 5 14:39:17 2014 -0500 remove dead code commit fc7df738cc9dd72d65ba656df71dd6aa124ce8af Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Dec 5 14:32:18 2014 -0500 display trap name for GetToolTrap, etc.
2015-02-13 21:11:55 +00:00
#include <utility>
2013-02-08 00:21:47 +00:00
#include <cpu/defs.h>
#include <cpu/CpuModule.h>
#include <cpu/fmem.h>
2015-02-03 01:16:30 +00:00
#include <macos/traps.h>
#include <macos/errors.h>
2013-02-08 00:21:47 +00:00
#include "toolbox.h"
2015-02-03 01:16:30 +00:00
#include "loader.h"
2013-02-08 03:49:04 +00:00
#include "mm.h"
2013-02-12 22:32:31 +00:00
#include "os.h"
2015-02-03 01:16:30 +00:00
#include "packages.h"
#include "process.h"
2013-02-15 04:08:38 +00:00
#include "qd.h"
2015-02-03 01:16:30 +00:00
#include "rm.h"
2013-02-21 04:28:13 +00:00
#include "sane.h"
2014-12-15 00:52:08 +00:00
#include "stackframe.h"
2015-02-03 01:16:30 +00:00
#include "utility.h"
2013-02-08 00:21:47 +00:00
// yuck. TST.W d0
extern "C" void cpuSetFlagsNZ00NewW(UWO res);
Squashed commit of the following: commit f4807cd071ba5c4ce9ba4aa8c906ba335da07a2d Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Feb 13 16:09:55 2015 -0500 merge in missing tool calls commit 6830ab51ce7c48e3d0d1352f04df8df914146b3e Merge: 1675a47 24c17a9 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Feb 13 16:06:05 2015 -0500 Merge branch 'feature_trap_address_2015' into merge_dispatcher Conflicts: bin/loader.cpp toolbox/rm.cpp toolbox/toolbox.cpp commit 24c17a9a888b2a95e99761ee7ee8b15874a9ce42 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Feb 13 13:22:07 2015 -0500 SetOSTrapAddress stub commit b255937e6c9a6765a9763b011bd99c3f675d997c Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jan 24 14:40:45 2015 -0500 Use the $Commands environment variable as a list of directories where commands may be located. Conflicts: bin/loader.cpp commit a3925747cef0203d178091cdd827c50ded134484 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jan 23 10:26:52 2015 -0500 HWPriv OS Trap commit 16d0038fd1b9b6db3e154ab5e810624ab7d3ca08 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jan 23 10:26:40 2015 -0500 HWPriv OS Trap commit bf92f806326925b68b497127da421f833e2cdba2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed Jan 21 17:34:30 2015 -0500 RM::GetNamedResource commit 540490d0c5ba7c8310271b1c7fd68259a77a2f28 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed Jan 21 14:31:03 2015 -0500 GetNamedResource trap commit 09aa8d0f2600668b37a51e7872db9a9f9c9ea4ef Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue Jan 20 19:32:04 2015 -0500 Set ApplZone global (ARMCFront) commit 45fa54abca52a80c980c870f43f1f82225d7c43d Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue Jan 20 13:58:24 2015 -0500 update test makefile commit b1e6635630d2fc112b613312000e091ff7f297bc Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue Jan 20 13:35:07 2015 -0500 SysEnvirons ($a090) OS Trap commit a5126544b8bdda155a5f8e9395d547a7bf3eae94 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Jan 19 15:02:29 2015 -0500 undo HGetVolume cwd, for now commit 912c8748254a83d3a5eacf776a6b6b3a4439aa75 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Jan 19 10:55:58 2015 -0500 Fix SetPtrSize commit c0fe74c1b81d1782a61240a18ecc4e51a3ecb88c Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 17:31:09 2015 -0500 support the auto-pop bit for tool calls (MPW Pascal IIgs 1.0b1) commit 2e9ab5200c285bb97bc15a11dcc7e7127e779245 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 15:20:38 2015 -0500 update dispatch code... commit c7c548e5ac2096e29aebf532e0eb69e2227bdecd Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 14:48:22 2015 -0500 add back new tool calls. commit cbb554174ef186b8b74383596212d9b8f04ebfea Merge: 44d19f7 5e616d3 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 14:43:58 2015 -0500 Merge branch 'feature_trap_address' into feature_trap_address_2015 Conflicts: toolbox/CMakeLists.txt toolbox/os.cpp toolbox/toolbox.cpp commit 5e616d353b1421b96cc4e3a4f82d4422911d1243 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Dec 14 18:01:38 2014 -0500 new dispatcher. commit ea5f2139217df8aebe975b8e4680080d58a772bd Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Dec 8 11:42:23 2014 -0500 get ready for trap overrides. commit 17c5b40ac866a7adaa559bc9164ffe32e926cc96 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Dec 5 14:39:17 2014 -0500 remove dead code commit fc7df738cc9dd72d65ba656df71dd6aa124ce8af Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Dec 5 14:32:18 2014 -0500 display trap name for GetToolTrap, etc.
2015-02-13 21:11:55 +00:00
2013-02-08 00:21:47 +00:00
namespace ToolBox {
2013-02-16 23:51:28 +00:00
bool Trace = false;
2013-02-13 03:35:15 +00:00
Squashed commit of the following: commit f4807cd071ba5c4ce9ba4aa8c906ba335da07a2d Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Feb 13 16:09:55 2015 -0500 merge in missing tool calls commit 6830ab51ce7c48e3d0d1352f04df8df914146b3e Merge: 1675a47 24c17a9 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Feb 13 16:06:05 2015 -0500 Merge branch 'feature_trap_address_2015' into merge_dispatcher Conflicts: bin/loader.cpp toolbox/rm.cpp toolbox/toolbox.cpp commit 24c17a9a888b2a95e99761ee7ee8b15874a9ce42 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Feb 13 13:22:07 2015 -0500 SetOSTrapAddress stub commit b255937e6c9a6765a9763b011bd99c3f675d997c Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jan 24 14:40:45 2015 -0500 Use the $Commands environment variable as a list of directories where commands may be located. Conflicts: bin/loader.cpp commit a3925747cef0203d178091cdd827c50ded134484 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jan 23 10:26:52 2015 -0500 HWPriv OS Trap commit 16d0038fd1b9b6db3e154ab5e810624ab7d3ca08 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jan 23 10:26:40 2015 -0500 HWPriv OS Trap commit bf92f806326925b68b497127da421f833e2cdba2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed Jan 21 17:34:30 2015 -0500 RM::GetNamedResource commit 540490d0c5ba7c8310271b1c7fd68259a77a2f28 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed Jan 21 14:31:03 2015 -0500 GetNamedResource trap commit 09aa8d0f2600668b37a51e7872db9a9f9c9ea4ef Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue Jan 20 19:32:04 2015 -0500 Set ApplZone global (ARMCFront) commit 45fa54abca52a80c980c870f43f1f82225d7c43d Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue Jan 20 13:58:24 2015 -0500 update test makefile commit b1e6635630d2fc112b613312000e091ff7f297bc Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue Jan 20 13:35:07 2015 -0500 SysEnvirons ($a090) OS Trap commit a5126544b8bdda155a5f8e9395d547a7bf3eae94 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Jan 19 15:02:29 2015 -0500 undo HGetVolume cwd, for now commit 912c8748254a83d3a5eacf776a6b6b3a4439aa75 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Jan 19 10:55:58 2015 -0500 Fix SetPtrSize commit c0fe74c1b81d1782a61240a18ecc4e51a3ecb88c Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 17:31:09 2015 -0500 support the auto-pop bit for tool calls (MPW Pascal IIgs 1.0b1) commit 2e9ab5200c285bb97bc15a11dcc7e7127e779245 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 15:20:38 2015 -0500 update dispatch code... commit c7c548e5ac2096e29aebf532e0eb69e2227bdecd Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 14:48:22 2015 -0500 add back new tool calls. commit cbb554174ef186b8b74383596212d9b8f04ebfea Merge: 44d19f7 5e616d3 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 14:43:58 2015 -0500 Merge branch 'feature_trap_address' into feature_trap_address_2015 Conflicts: toolbox/CMakeLists.txt toolbox/os.cpp toolbox/toolbox.cpp commit 5e616d353b1421b96cc4e3a4f82d4422911d1243 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Dec 14 18:01:38 2014 -0500 new dispatcher. commit ea5f2139217df8aebe975b8e4680080d58a772bd Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Dec 8 11:42:23 2014 -0500 get ready for trap overrides. commit 17c5b40ac866a7adaa559bc9164ffe32e926cc96 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Dec 5 14:39:17 2014 -0500 remove dead code commit fc7df738cc9dd72d65ba656df71dd6aa124ce8af Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Dec 5 14:32:18 2014 -0500 display trap name for GetToolTrap, etc.
2015-02-13 21:11:55 +00:00
#ifdef OLD_TRAP_DISPATCH
2013-02-13 03:35:15 +00:00
2014-12-15 00:52:08 +00:00
uint16_t OSDispatch(uint16_t trap)
{
uint16_t selector;
StackFrame<2>(selector);
Log("%04x OSDispatch(%04x)\n", trap, selector);
switch(selector)
{
case 0x0015:
return MM::TempMaxMem();
2014-12-18 19:40:03 +00:00
case 0x0018:
return MM::TempFreeMem();
2014-12-28 23:15:27 +00:00
case 0x001d:
return MM::TempNewHandle();
case 0x001e:
return MM::TempHLock();
case 0x001f:
return MM::TempHUnlock();
case 0x0020:
return MM::TempDisposeHandle();
2015-02-03 01:16:30 +00:00
case 0x0037:
return Process::GetCurrentProcess();
case 0x003a:
return Process::GetProcessInformation();
2014-12-28 23:15:27 +00:00
2014-12-15 00:52:08 +00:00
default:
fprintf(stderr, "OSDispatch: selector %04x not implemented\n",
2014-12-15 00:52:08 +00:00
selector);
exit(1);
2014-12-15 00:52:08 +00:00
}
}
2013-02-08 00:21:47 +00:00
void dispatch(uint16_t trap)
{
uint32_t d0 = 0;
switch (trap)
{
2013-05-24 01:44:14 +00:00
case 0xa000: // Open
case 0xa200: // HOpen
2013-02-25 04:22:31 +00:00
d0 = OS::Open(trap);
break;
2013-05-24 01:44:14 +00:00
case 0xa00a: // OpenRF
case 0xa20a: // HOpenRF
2013-05-19 02:11:42 +00:00
d0 = OS::OpenRF(trap);
break;
2013-05-19 01:24:49 +00:00
2013-02-25 22:34:25 +00:00
case 0xa001:
d0 = OS::Close(trap);
break;
2013-02-25 04:22:31 +00:00
case 0xa002:
d0 = OS::Read(trap);
break;
2013-03-04 03:07:25 +00:00
case 0xa003:
d0 = OS::Write(trap);
break;
2015-01-06 01:11:10 +00:00
case 0xa207:
d0 = OS::HGetVInfo(trap);
break;
2013-05-24 01:44:14 +00:00
case 0xa008: // Create
case 0xa208: // HCreate
2013-02-14 03:16:40 +00:00
d0 = OS::Create(trap);
break;
2013-05-24 01:44:14 +00:00
2015-01-07 22:01:20 +00:00
case 0xa009: // Delete
case 0xa209: // HDelete
2013-02-14 03:38:34 +00:00
d0 = OS::Delete(trap);
break;
2013-02-14 04:07:33 +00:00
2013-05-24 01:44:14 +00:00
case 0xa00c: // GetFInfo
case 0xa20c: // HGetFInfo
2013-02-12 22:32:31 +00:00
d0 = OS::GetFileInfo(trap);
break;
2013-02-16 21:11:10 +00:00
2013-05-24 01:44:14 +00:00
case 0xa00d: // SetFileInfo
case 0xa20d: // HSetFileInfo
2013-02-13 03:35:15 +00:00
d0 = OS::SetFileInfo(trap);
break;
2013-02-08 00:21:47 +00:00
2013-02-16 21:11:10 +00:00
case 0xa011:
d0 = OS::GetEOF(trap);
break;
2013-03-04 03:07:25 +00:00
case 0xa012:
d0 = OS::SetEOF(trap);
break;
2013-03-27 04:00:47 +00:00
case 0xa013:
d0 = OS::FlushVol(trap);
break;
2013-02-16 21:11:10 +00:00
2013-02-14 03:16:40 +00:00
case 0xa014:
d0 = OS::GetVol(trap);
break;
case 0xa214:
d0 = OS::HGetVol(trap);
break;
2013-05-24 01:42:06 +00:00
case 0xa015: // SetVol
d0 = OS::SetVol(trap);
break;
case 0xa215: // HSetVol
d0 = OS::HSetVol(trap);
2013-05-18 00:14:30 +00:00
break;
2013-05-18 00:14:30 +00:00
2013-05-18 04:00:47 +00:00
case 0xa018:
d0 = OS::GetFPos(trap);
break;
2013-03-04 03:07:25 +00:00
case 0xa044:
d0 = OS::SetFPos(trap);
2013-03-02 22:39:54 +00:00
break;
2013-03-04 03:07:25 +00:00
2014-12-16 18:47:33 +00:00
case 0xa051:
d0 = OS::ReadXPRam(trap);
break;
case 0xa060:
2013-05-18 03:49:59 +00:00
d0 = OS::FSDispatch(trap);
break;
2013-05-18 03:49:59 +00:00
case 0xa260:
d0 = OS::HFSDispatch(trap);
break;
2013-02-28 23:05:39 +00:00
case 0xaa52:
d0 = OS::HighLevelHFSDispatch(trap);
break;
case 0xA746:
d0 = OS::GetToolTrapAddress(trap);
break;
2013-08-04 18:34:34 +00:00
case 0xa647:
d0 = OS::SetToolTrapAddress(trap);
break;
case 0xA346:
d0 = OS::GetOSTrapAddress(trap);
break;
case 0xa247:
d0 = OS::SetOSTrapAddress(trap);
break;
2013-05-18 00:14:30 +00:00
case 0xA823:
d0 = OS::AliasDispatch(trap);
break;
2014-07-24 17:40:57 +00:00
case 0xA1AD:
d0 = OS::Gestalt(trap);
break;
2015-01-20 19:07:38 +00:00
case 0xa090:
d0 = OS::SysEnvirons(trap);
break;
2013-02-16 01:33:00 +00:00
// SetPtrSize (p: Ptr; newSize: Size);
case 0xa020:
d0 = MM::SetPtrSize(trap);
break;
2013-02-16 20:37:55 +00:00
// GetPtrSize (p: Ptr) : Size
case 0xa021:
d0 = MM::GetPtrSize(trap);
break;
2013-02-15 04:08:56 +00:00
case 0xA023:
d0 = MM::DisposeHandle(trap);
break;
2013-02-26 23:31:43 +00:00
case 0xa024:
d0 = MM::SetHandleSize(trap);
break;
2013-02-25 04:20:38 +00:00
case 0xa025:
d0 = MM::GetHandleSize(trap);
break;
2013-02-16 20:37:55 +00:00
case 0xa029:
d0 = MM::HLock(trap);
break;
case 0xa02a:
d0 = MM::HUnlock(trap);
break;
2015-02-27 13:55:10 +00:00
case 0xa02d:
d0 = MM::SetApplLimit(trap);
break;
2013-02-08 04:44:58 +00:00
// BlockMove (sourcePtr,destPtr: Ptr; byteCount: Size);
2014-12-18 19:39:48 +00:00
case 0xa02e: // BlockMove
case 0xa22e: // BlockMoveData
2013-02-08 04:44:58 +00:00
d0 = MM::BlockMove(trap);
break;
2013-02-25 04:20:38 +00:00
case 0xa049:
d0 = MM::HPurge(trap);
break;
2015-01-14 19:26:49 +00:00
case 0xa04a:
d0 = MM::HNoPurge(trap);
break;
2013-03-30 22:45:20 +00:00
case 0xA11D:
d0 = MM::MaxMem(trap);
break;
case 0xA01C:
d0 = MM::FreeMem(trap);
break;
2013-02-15 05:08:22 +00:00
// CompactMem (cbNeeded: Size) : Size;
case 0xa04c:
d0 = MM::CompactMem(trap);
break;
2013-04-01 03:49:59 +00:00
case 0xa040:
d0 = MM::ReserveMem(trap);
break;
2013-02-25 22:33:26 +00:00
case 0xa055:
d0 = MM::StripAddress(trap);
break;
2013-05-17 23:05:03 +00:00
case 0xa061:
d0 = MM::MaxBlock(trap);
break;
2013-08-03 23:17:50 +00:00
case 0xa069:
d0 = MM::HGetState(trap);
break;
2015-01-05 16:56:33 +00:00
case 0xa06a:
d0 = MM::HSetState(trap);
break;
2013-02-19 23:28:29 +00:00
// MoveHHi (h: Handle);
case 0xa064:
d0 = MM::MoveHHi(trap);
break;
2013-02-14 03:16:40 +00:00
2013-07-13 23:19:49 +00:00
case 0xa9e1:
d0 = MM::HandToHand(trap);
break;
2013-02-26 23:32:39 +00:00
case 0xa9e3:
d0 = MM::PtrToHand(trap);
2013-06-30 17:07:35 +00:00
break;
case 0xa9ef:
d0 = MM::PtrAndHand(trap);
break;
2013-06-27 03:50:08 +00:00
case 0xa11a:
d0 = MM::GetZone(trap);
break;
2013-06-27 03:50:08 +00:00
case 0xa01b:
d0 = MM::SetZone(trap);
break;
2013-06-27 03:24:03 +00:00
case 0xa126:
d0 = MM::HandleZone(trap);
break;
2014-12-20 18:03:02 +00:00
case 0xa128:
d0 = MM::RecoverHandle(trap);
break;
2014-07-24 15:37:21 +00:00
// MaxApplZone
case 0xa063:
d0 = MM::MaxApplZone(trap);
break;
2014-12-15 00:51:49 +00:00
case 0xa162:
d0 = MM::PurgeSpace(trap);
break;
2013-02-14 03:16:40 +00:00
// ReadDateTime (VAR sees: LONGINT) : OSErr;
case 0xa039:
d0 = OS::ReadDateTime(trap);
2013-02-14 03:16:40 +00:00
break;
// SecondsToDate (s: LongInt; VAR d: DateTimeRec);
case 0xa9c6:
d0 = OS::SecondsToDate(trap);
2013-02-14 03:16:40 +00:00
break;
2013-02-16 01:41:57 +00:00
// TickCount : LONGINT;
case 0xa975:
d0 = OS::TickCount(trap);
2013-02-16 01:41:57 +00:00
break;
case 0xa193:
d0 = OS::Microseconds(trap);
break;
2013-02-25 04:21:48 +00:00
case 0xa9ed:
d0 = Packages::Pack6(trap);
2013-02-25 04:21:48 +00:00
break;
//_CmpString [MARKS,CASE]
case 0xa03c:
case 0xa23c:
case 0xa43c:
case 0xa63c:
d0 = OS::CmpString(trap);
break;
2013-02-08 03:12:30 +00:00
// NewPtr [Sys, Clear] (logicalSize: Size): Ptr;
case 0xa11e:
case 0xa31e:
case 0xa51e:
case 0xa71e:
// clear = bit 9, sys = bit 10
2013-02-08 03:49:04 +00:00
d0 = MM::NewPtr(trap);
2013-02-08 03:12:30 +00:00
break;
2013-02-11 01:19:35 +00:00
// DisposPtr (p: Ptr);
case 0xa01f:
d0 = MM::DisposePtr(trap);
break;
2013-02-08 03:12:30 +00:00
2013-06-27 03:24:03 +00:00
case 0xa065:
d0 = MM::StackSpace(trap);
break;
2013-02-15 04:08:56 +00:00
// NewHandle (logicalSize: Size) : Handle;
case 0xA122:
case 0xa322:
d0 = MM::NewHandle(trap);
break;
2013-03-04 02:54:53 +00:00
case 0xA027:
d0 = MM::ReallocHandle(trap);
break;
2013-03-04 02:54:53 +00:00
case 0xA02B:
d0 = MM::EmptyHandle(trap);
break;
2014-12-18 19:29:20 +00:00
case 0xa058:
d0 = OS::InsTime(trap);
break;
case 0xa059:
d0 = OS::RmvTime(trap);
break;
case 0xa05a:
d0 = OS::PrimeTime(trap);
break;
2015-01-23 15:26:40 +00:00
case 0xA0BD:
d0 = OS::FlushCodeCache(trap);
break;
case 0xA098:
case 0xA198: // don't save a0
d0 = OS::HWPriv(trap);
break;
2013-02-14 04:07:33 +00:00
// resource manager stuff.
2013-06-25 02:53:17 +00:00
// Count1Resources (theType: ResType): Integer;
case 0xa80d:
d0 = RM::Count1Resources(trap);
break;
2013-06-28 00:27:55 +00:00
case 0xa80e:
d0 = RM::Get1IndResource(trap);
break;
2013-08-18 05:10:14 +00:00
case 0xa80f:
d0 = RM::Get1IndType(trap);
break;
2014-12-16 18:07:51 +00:00
case 0xa81a:
d0 = RM::HOpenResFile(trap);
break;
2015-01-17 23:33:34 +00:00
case 0xa81b:
d0 = RM::HCreateResFile(trap);
break;
2013-08-18 05:10:14 +00:00
case 0xa81c:
d0 = RM::Count1Types(trap);
break;
2013-02-19 23:28:58 +00:00
// Get1Resource (theType: ResType; thelD: INTEGER) : Handle;
case 0xa81f:
d0 = RM::Get1Resource(trap);
break;
2013-02-08 00:21:47 +00:00
// Get1NamedResource (theType: ResType; name: Str255) : Handle;
case 0xa820:
2013-02-08 03:12:30 +00:00
d0 = RM::Get1NamedResource(trap);
2013-02-08 00:21:47 +00:00
break;
2013-06-27 03:24:20 +00:00
case 0xa992:
d0 = RM::DetachResource(trap);
break;
2013-03-03 01:53:54 +00:00
case 0xa994:
d0 = RM::CurResFile(trap);
break;
2013-02-26 23:33:21 +00:00
case 0xA997:
d0 = RM::OpenResFile(trap);
break;
2013-03-04 02:55:33 +00:00
case 0xA998:
d0 = RM::UseResFile(trap);
break;
2013-06-25 02:53:17 +00:00
case 0xa999:
d0 = RM::UpdateResFile(trap);
break;
2013-02-26 23:33:21 +00:00
case 0xa99a:
d0 = RM::CloseResFile(trap);
break;
case 0xa99b:
d0 = RM::SetResLoad(trap);
break;
2013-02-14 04:07:33 +00:00
// GetResource (theType: ResType; thelD: INTEGER) : Handle;
case 0xa9a0:
d0 = RM::GetResource(trap);
break;
2015-01-21 19:31:03 +00:00
case 0xa9a1:
d0 = RM::GetNamedResource(trap);
break;
2013-08-03 23:19:44 +00:00
case 0xa9a2:
d0 = RM::LoadResource(trap);
break;
2013-02-19 23:28:58 +00:00
// ReleaseResource (theResource: Handle);
case 0xa9a3:
d0 = RM::ReleaseResource(trap);
break;
2013-08-18 04:51:31 +00:00
case 0xa9a4:
d0 = RM::HomeResFile(trap);
break;
2013-06-30 17:08:26 +00:00
case 0xa9a5:
d0 = RM::GetResourceSizeOnDisk(trap);
break;
2013-06-28 00:27:55 +00:00
case 0xa9a6:
d0 = RM::GetResAttrs(trap);
break;
2013-06-27 03:24:20 +00:00
case 0xa9a7:
d0 = RM::SetResAttrs(trap);
break;
2013-08-03 23:19:44 +00:00
case 0xa9a8:
d0 = RM::GetResInfo(trap);
break;
2013-06-27 03:24:20 +00:00
case 0xa9ab:
d0 = RM::AddResource(trap);
break;
2013-06-28 00:27:55 +00:00
2015-02-07 17:30:30 +00:00
case 0xa9aa:
d0 = RM::ChangedResource(trap);
break;
2013-06-28 00:27:55 +00:00
case 0xa9ad:
d0 = RM::RemoveResource(trap);
break;
2013-02-26 23:33:21 +00:00
// ResError : INTEGER;
case 0xa9af:
d0 = RM::ResError(trap);
break;
2013-06-27 03:24:20 +00:00
case 0xa9b0:
d0 = RM::WriteResource(trap);
break;
2013-06-24 00:42:16 +00:00
// CreateResFile(fileName: Str255);
case 0xa9b1:
d0 = RM::CreateResFile(trap);
break;
2013-06-24 02:05:57 +00:00
// OpenRFPerm (fileName: Str255; vRefNum: Integer;
// permission: SignedByte): Integer;
case 0xa9c4:
d0 = RM::OpenRFPerm(trap);
break;
2013-06-25 02:53:17 +00:00
case 0xa9f6:
d0 = RM::GetResFileAttrs(trap);
break;
case 0xa9f7:
d0 = RM::SetResFileAttrs(trap);
break;
2013-08-16 03:35:39 +00:00
// UnloadSeg (routineAddr: Ptr);
case 0xa9f1:
d0 = Loader::UnloadSeg(trap);
break;
2013-02-15 04:08:38 +00:00
// quickdraw (AsmIIgs ... )
2013-02-14 04:07:33 +00:00
// _ShowCursor();
case 0xA853:
2013-02-15 04:08:38 +00:00
d0 = QD::ShowCursor(trap);
break;
// GetCursor (cursorlD: INTEGER) : CursHandle;
case 0xA9B9:
d0 = QD::GetCursor(trap);
break;
2013-04-11 01:21:01 +00:00
case 0xa834:
d0 = QD::SetFScaleDisable(trap);
break;
2013-02-15 04:08:38 +00:00
//SetCursor (crsr: Cursor)
case 0xA851:
d0 = QD::SetCursor(trap);
break;
2013-04-11 01:21:01 +00:00
case 0xa86e:
d0 = QD::InitGraf(trap);
break;
2013-02-15 04:08:38 +00:00
// GetFNum (fontName: Str255; VAR theNum: INTEGER);
case 0xa900:
d0 = QD::GetFNum(trap);
2013-02-14 04:07:33 +00:00
break;
2013-02-21 04:28:13 +00:00
// sane
case 0xa9Eb:
d0 = SANE::fp68k(trap);
cpuSetDReg(0, d0);
return; // SANE sets the flags.
2013-02-21 04:28:13 +00:00
break;
2013-02-25 22:35:01 +00:00
case 0x0a9ee:
d0 = SANE::decstr68k(trap);
break;
2013-03-27 03:29:08 +00:00
// utility
case 0xa906:
d0 = Utility::NewString(trap);
break;
2013-03-27 03:54:28 +00:00
case 0xa9ba:
d0 = Utility::GetString(trap);
break;
2013-03-27 04:00:47 +00:00
2013-05-23 00:37:03 +00:00
case 0xa85d:
d0 = Utility::BitTst(trap);
break;
2014-12-15 00:52:08 +00:00
case 0xa88f:
d0 = OSDispatch(trap);
break;
2013-02-08 00:21:47 +00:00
default:
2014-07-24 15:59:38 +00:00
fprintf(stderr, "Unsupported tool trap: %04x (%s)\n",
trap, TrapName(trap));
2013-02-08 00:21:47 +00:00
fprintf(stderr, "pc: %08x\n", cpuGetPC());
exit(255);
}
2013-03-02 22:39:54 +00:00
if (d0)
{
int16_t v = (int16_t)d0;
Log(" -> %d\n", v);
}
2013-02-08 00:21:47 +00:00
cpuSetDReg(0, d0);
cpuSetFlagsNZ00NewW(d0);
Squashed commit of the following: commit f4807cd071ba5c4ce9ba4aa8c906ba335da07a2d Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Feb 13 16:09:55 2015 -0500 merge in missing tool calls commit 6830ab51ce7c48e3d0d1352f04df8df914146b3e Merge: 1675a47 24c17a9 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Feb 13 16:06:05 2015 -0500 Merge branch 'feature_trap_address_2015' into merge_dispatcher Conflicts: bin/loader.cpp toolbox/rm.cpp toolbox/toolbox.cpp commit 24c17a9a888b2a95e99761ee7ee8b15874a9ce42 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Feb 13 13:22:07 2015 -0500 SetOSTrapAddress stub commit b255937e6c9a6765a9763b011bd99c3f675d997c Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jan 24 14:40:45 2015 -0500 Use the $Commands environment variable as a list of directories where commands may be located. Conflicts: bin/loader.cpp commit a3925747cef0203d178091cdd827c50ded134484 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jan 23 10:26:52 2015 -0500 HWPriv OS Trap commit 16d0038fd1b9b6db3e154ab5e810624ab7d3ca08 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jan 23 10:26:40 2015 -0500 HWPriv OS Trap commit bf92f806326925b68b497127da421f833e2cdba2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed Jan 21 17:34:30 2015 -0500 RM::GetNamedResource commit 540490d0c5ba7c8310271b1c7fd68259a77a2f28 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed Jan 21 14:31:03 2015 -0500 GetNamedResource trap commit 09aa8d0f2600668b37a51e7872db9a9f9c9ea4ef Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue Jan 20 19:32:04 2015 -0500 Set ApplZone global (ARMCFront) commit 45fa54abca52a80c980c870f43f1f82225d7c43d Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue Jan 20 13:58:24 2015 -0500 update test makefile commit b1e6635630d2fc112b613312000e091ff7f297bc Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue Jan 20 13:35:07 2015 -0500 SysEnvirons ($a090) OS Trap commit a5126544b8bdda155a5f8e9395d547a7bf3eae94 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Jan 19 15:02:29 2015 -0500 undo HGetVolume cwd, for now commit 912c8748254a83d3a5eacf776a6b6b3a4439aa75 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Jan 19 10:55:58 2015 -0500 Fix SetPtrSize commit c0fe74c1b81d1782a61240a18ecc4e51a3ecb88c Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 17:31:09 2015 -0500 support the auto-pop bit for tool calls (MPW Pascal IIgs 1.0b1) commit 2e9ab5200c285bb97bc15a11dcc7e7127e779245 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 15:20:38 2015 -0500 update dispatch code... commit c7c548e5ac2096e29aebf532e0eb69e2227bdecd Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 14:48:22 2015 -0500 add back new tool calls. commit cbb554174ef186b8b74383596212d9b8f04ebfea Merge: 44d19f7 5e616d3 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 14:43:58 2015 -0500 Merge branch 'feature_trap_address' into feature_trap_address_2015 Conflicts: toolbox/CMakeLists.txt toolbox/os.cpp toolbox/toolbox.cpp commit 5e616d353b1421b96cc4e3a4f82d4422911d1243 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Dec 14 18:01:38 2014 -0500 new dispatcher. commit ea5f2139217df8aebe975b8e4680080d58a772bd Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Dec 8 11:42:23 2014 -0500 get ready for trap overrides. commit 17c5b40ac866a7adaa559bc9164ffe32e926cc96 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Dec 5 14:39:17 2014 -0500 remove dead code commit fc7df738cc9dd72d65ba656df71dd6aa124ce8af Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Dec 5 14:32:18 2014 -0500 display trap name for GetToolTrap, etc.
2015-02-13 21:11:55 +00:00
2013-02-08 00:21:47 +00:00
}
Squashed commit of the following: commit f4807cd071ba5c4ce9ba4aa8c906ba335da07a2d Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Feb 13 16:09:55 2015 -0500 merge in missing tool calls commit 6830ab51ce7c48e3d0d1352f04df8df914146b3e Merge: 1675a47 24c17a9 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Feb 13 16:06:05 2015 -0500 Merge branch 'feature_trap_address_2015' into merge_dispatcher Conflicts: bin/loader.cpp toolbox/rm.cpp toolbox/toolbox.cpp commit 24c17a9a888b2a95e99761ee7ee8b15874a9ce42 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Feb 13 13:22:07 2015 -0500 SetOSTrapAddress stub commit b255937e6c9a6765a9763b011bd99c3f675d997c Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sat Jan 24 14:40:45 2015 -0500 Use the $Commands environment variable as a list of directories where commands may be located. Conflicts: bin/loader.cpp commit a3925747cef0203d178091cdd827c50ded134484 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jan 23 10:26:52 2015 -0500 HWPriv OS Trap commit 16d0038fd1b9b6db3e154ab5e810624ab7d3ca08 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Jan 23 10:26:40 2015 -0500 HWPriv OS Trap commit bf92f806326925b68b497127da421f833e2cdba2 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed Jan 21 17:34:30 2015 -0500 RM::GetNamedResource commit 540490d0c5ba7c8310271b1c7fd68259a77a2f28 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Wed Jan 21 14:31:03 2015 -0500 GetNamedResource trap commit 09aa8d0f2600668b37a51e7872db9a9f9c9ea4ef Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue Jan 20 19:32:04 2015 -0500 Set ApplZone global (ARMCFront) commit 45fa54abca52a80c980c870f43f1f82225d7c43d Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue Jan 20 13:58:24 2015 -0500 update test makefile commit b1e6635630d2fc112b613312000e091ff7f297bc Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Tue Jan 20 13:35:07 2015 -0500 SysEnvirons ($a090) OS Trap commit a5126544b8bdda155a5f8e9395d547a7bf3eae94 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Jan 19 15:02:29 2015 -0500 undo HGetVolume cwd, for now commit 912c8748254a83d3a5eacf776a6b6b3a4439aa75 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Jan 19 10:55:58 2015 -0500 Fix SetPtrSize commit c0fe74c1b81d1782a61240a18ecc4e51a3ecb88c Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 17:31:09 2015 -0500 support the auto-pop bit for tool calls (MPW Pascal IIgs 1.0b1) commit 2e9ab5200c285bb97bc15a11dcc7e7127e779245 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 15:20:38 2015 -0500 update dispatch code... commit c7c548e5ac2096e29aebf532e0eb69e2227bdecd Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 14:48:22 2015 -0500 add back new tool calls. commit cbb554174ef186b8b74383596212d9b8f04ebfea Merge: 44d19f7 5e616d3 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Jan 18 14:43:58 2015 -0500 Merge branch 'feature_trap_address' into feature_trap_address_2015 Conflicts: toolbox/CMakeLists.txt toolbox/os.cpp toolbox/toolbox.cpp commit 5e616d353b1421b96cc4e3a4f82d4422911d1243 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Dec 14 18:01:38 2014 -0500 new dispatcher. commit ea5f2139217df8aebe975b8e4680080d58a772bd Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Mon Dec 8 11:42:23 2014 -0500 get ready for trap overrides. commit 17c5b40ac866a7adaa559bc9164ffe32e926cc96 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Dec 5 14:39:17 2014 -0500 remove dead code commit fc7df738cc9dd72d65ba656df71dd6aa124ce8af Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Fri Dec 5 14:32:18 2014 -0500 display trap name for GetToolTrap, etc.
2015-02-13 21:11:55 +00:00
#endif
2013-02-08 00:21:47 +00:00
std::string ReadCString(uint32_t address, bool fname)
2013-02-13 03:35:15 +00:00
{
std::string tmp;
if (address)
{
tmp.assign((char *)memoryPointer(address));
}
2013-03-07 00:17:55 +00:00
if (fname) tmp = MacToUnix(tmp);
2013-02-13 03:35:15 +00:00
return tmp;
}
std::string ReadPString(uint32_t address, bool fname)
2013-02-13 03:35:15 +00:00
{
std::string tmp;
if (address)
{
unsigned length = memoryReadByte(address);
2013-02-13 03:35:15 +00:00
tmp.assign((char *)memoryPointer(address + 1), length);
2013-03-07 00:17:55 +00:00
if (fname) tmp = MacToUnix(tmp);
2013-02-13 03:35:15 +00:00
}
return tmp;
}
std::string ReadString(uint32_t address, uint32_t length)
{
std::string tmp;
if (address)
{
tmp.assign((char *)memoryPointer(address), length);
}
return tmp;
}
2013-02-14 03:16:05 +00:00
bool WritePString(uint32_t address, const std::string &s)
{
int length = s.length();
if (length > 255) return false;
if (address == 0) return false;
uint8_t *ptr = memoryPointer(address);
*ptr++ = (uint8_t)length;
for (char c : s)
{
*ptr++ = (uint8_t)c;
}
return true;
}
2014-07-24 17:40:57 +00:00
std::string TypeToString(uint32_t type)
{
char tmp[5] = { 0, 0, 0, 0, 0};
for (unsigned i = 0; i < 4; ++i)
{
char c = type & 0xff;
type >>= 8;
c = isprint(c) ? c : '.';
tmp[3 - i] = c;
}
return std::string(tmp);
}
2013-03-07 00:17:55 +00:00
2015-01-20 19:07:38 +00:00
}