mirror of
https://github.com/ksherlock/mpw.git
synced 2025-01-22 21:32:23 +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.
This commit is contained in:
parent
1675a479c9
commit
84ff99c177
@ -687,7 +687,6 @@ std::string find_exe(const std::string &name)
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
// otherwise, check the Commands variable for locations.
|
||||
std::string commands = MPW::GetEnv("Commands");
|
||||
if (commands.empty()) return old_find_exe(name);
|
||||
@ -938,6 +937,7 @@ int main(int argc, char **argv)
|
||||
|
||||
MM::Init(Memory, MemorySize, kGlobalSize, Flags.stackSize);
|
||||
OS::Init();
|
||||
ToolBox::Init();
|
||||
MPW::Init(argc, argv);
|
||||
|
||||
|
||||
|
@ -27,6 +27,7 @@ set(TOOLBOX_SRC
|
||||
utility.cpp
|
||||
fs_spec.cpp
|
||||
realpath.c
|
||||
dispatch.cpp
|
||||
)
|
||||
|
||||
|
||||
|
1035
toolbox/dispatch.cpp
Normal file
1035
toolbox/dispatch.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -958,6 +958,7 @@ namespace OS
|
||||
|
||||
#pragma mark - Trap Manager
|
||||
|
||||
#ifdef OLD_TRAP_DISPATCH
|
||||
uint16_t GetToolTrapAddress(uint16_t trap)
|
||||
{
|
||||
/*
|
||||
@ -1050,6 +1051,7 @@ namespace OS
|
||||
|
||||
return MacOS::dsCoreErr;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#pragma mark XP - RAM
|
||||
|
@ -6,6 +6,45 @@
|
||||
|
||||
//
|
||||
|
||||
|
||||
template<int Bytes>
|
||||
void Push__(uint32_t sp)
|
||||
{
|
||||
static_assert(Bytes == 0, "Invalid Stack Size");
|
||||
}
|
||||
|
||||
template<int Bytes, typename... Args>
|
||||
void Push__(uint32_t sp, uint16_t value, Args&&... args);
|
||||
|
||||
template<int Bytes, typename... Args>
|
||||
void Push__(uint32_t sp, uint32_t value, Args&&... args);
|
||||
|
||||
|
||||
template<int Bytes, typename... Args>
|
||||
void Push__(uint32_t sp, uint16_t value, Args&&... args)
|
||||
{
|
||||
memoryWriteWord(value, sp);
|
||||
Push__<Bytes-2>(sp + 2, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template<int Bytes, typename... Args>
|
||||
void Push__(uint32_t sp, uint32_t value, Args&&... args)
|
||||
{
|
||||
memoryWriteLong(value, sp);
|
||||
Push__<Bytes-4>(sp + 4, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template<int Bytes, typename... Args>
|
||||
void Push(Args&&... args)
|
||||
{
|
||||
uint32_t sp = cpuGetAReg(7) - Bytes;
|
||||
cpuSetAReg(7, sp);
|
||||
|
||||
Push__<Bytes>(sp, std::forward<Args>(args)...);
|
||||
|
||||
}
|
||||
|
||||
|
||||
template<unsigned N>
|
||||
void ToolReturn(uint32_t sp, uint32_t value)
|
||||
{
|
||||
|
@ -26,8 +26,11 @@
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdint>
|
||||
#include <cassert>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <cpu/defs.h>
|
||||
#include <cpu/CpuModule.h>
|
||||
@ -54,10 +57,13 @@
|
||||
// yuck. TST.W d0
|
||||
extern "C" void cpuSetFlagsNZ00NewW(UWO res);
|
||||
|
||||
|
||||
|
||||
namespace ToolBox {
|
||||
|
||||
bool Trace = false;
|
||||
|
||||
#ifdef OLD_TRAP_DISPATCH
|
||||
|
||||
uint16_t OSDispatch(uint16_t trap)
|
||||
{
|
||||
@ -103,7 +109,6 @@ namespace ToolBox {
|
||||
|
||||
void dispatch(uint16_t trap)
|
||||
{
|
||||
// todo -- check/remove extra bits for save a0, toolglue, etc.
|
||||
|
||||
uint32_t d0 = 0;
|
||||
switch (trap)
|
||||
@ -672,7 +677,9 @@ namespace ToolBox {
|
||||
|
||||
cpuSetDReg(0, d0);
|
||||
cpuSetFlagsNZ00NewW(d0);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
std::string ReadCString(uint32_t address, bool fname)
|
||||
{
|
||||
@ -749,86 +756,5 @@ namespace ToolBox {
|
||||
return std::string(tmp);
|
||||
}
|
||||
|
||||
/*
|
||||
* MacOS basically does the absolute/relative paths backwards vs unix.
|
||||
*
|
||||
* file -> file
|
||||
* :dir -> dir
|
||||
* :dir:file -> dir/file
|
||||
* volume:file -> /volume/file
|
||||
*/
|
||||
#if 0
|
||||
std::string UnixToMac(const std::string &path)
|
||||
{
|
||||
// ./..., //... etc.
|
||||
|
||||
std::string tmp;
|
||||
int sep;
|
||||
|
||||
if (path.empty()) return path;
|
||||
|
||||
sep = path.find_first_of('/');
|
||||
|
||||
if (sep == path.npos)
|
||||
{
|
||||
// no sep -- relative file. treat as-is
|
||||
return path;
|
||||
}
|
||||
if (sep == 0)
|
||||
{
|
||||
// absolute path -- drop the leading /
|
||||
// '/' doesn't make sense.
|
||||
tmp = path.substr(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// relative path.
|
||||
tmp = '/';
|
||||
tmp.append(path);
|
||||
}
|
||||
|
||||
std::replace(tmp.begin(), tmp.end(), '/', ':');
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
std::string MacToUnix(const std::string &path)
|
||||
{
|
||||
std::string tmp;
|
||||
int sep;
|
||||
int slash;
|
||||
|
||||
if (path.empty()) return path;
|
||||
|
||||
sep = path.find_first_of(':');
|
||||
slash = path.find_first_of('/');
|
||||
|
||||
// if there's a / prior to the :, assume it's a unix prefix.
|
||||
if (sep == path.npos) return path;
|
||||
|
||||
if (slash == path.npos || slash > sep)
|
||||
{
|
||||
if (sep == 0)
|
||||
{
|
||||
// :directory... -> directory
|
||||
tmp = path.substr(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// volume:path...
|
||||
tmp = '/';
|
||||
tmp.append(path);
|
||||
}
|
||||
}
|
||||
else // assume a unix prefix.
|
||||
{
|
||||
tmp = path;
|
||||
}
|
||||
|
||||
std::replace(tmp.begin(), tmp.end(), ':', '/');
|
||||
|
||||
return tmp;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ namespace ToolBox
|
||||
}
|
||||
|
||||
|
||||
bool Init();
|
||||
void dispatch(uint16_t trap);
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user