From 0d6874ae08567d0de7f3112dd2cfe97e560d5b36 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Sun, 12 May 2013 22:36:22 -0400 Subject: [PATCH] use global names --- mpw/mpw.cpp | 4 +++- toolbox/mm.cpp | 3 ++- toolbox/os.cpp | 8 +++++--- toolbox/rm.cpp | 8 +++++--- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/mpw/mpw.cpp b/mpw/mpw.cpp index d9d4a72..d396243 100644 --- a/mpw/mpw.cpp +++ b/mpw/mpw.cpp @@ -22,6 +22,8 @@ #include #include +#include + extern char **environ; @@ -134,7 +136,7 @@ namespace MPW std::memcpy(str32 + 1, name, l); while (l < 32) str32[l++] = 0; - std::memcpy(memoryPointer(0x0910), str32, 32); + std::memcpy(memoryPointer(MacOS::CurApName), str32, 32); } diff --git a/toolbox/mm.cpp b/toolbox/mm.cpp index 3dbaec9..f72d089 100644 --- a/toolbox/mm.cpp +++ b/toolbox/mm.cpp @@ -11,6 +11,7 @@ #include #include +#include using ToolBox::Log; using namespace ToolBox::Errors; @@ -45,7 +46,7 @@ namespace inline uint16_t SetMemError(uint16_t error) { - memoryWriteWord(error, 0x0220); + memoryWriteWord(error, MacOS::MemErr); return error; } diff --git a/toolbox/os.cpp b/toolbox/os.cpp index b0f0aeb..04b0649 100644 --- a/toolbox/os.cpp +++ b/toolbox/os.cpp @@ -19,6 +19,8 @@ #include #include +#include + #include "os.h" #include "os_internal.h" #include "toolbox.h" @@ -79,7 +81,7 @@ namespace OS bool Init() { BootTime = std::chrono::steady_clock::now(); - memoryWriteLong(0, 0x16A); // 0 ticks since boot. + memoryWriteLong(0, MacOS::Ticks); // 0 ticks since boot. return true; } @@ -905,7 +907,7 @@ namespace OS if (secsPtr) memoryWriteLong(now, secsPtr); // also set global variable Time. - memoryWriteLong(now, 0x020c); + memoryWriteLong(now, MacOS::TimeLM); return 0; } @@ -959,7 +961,7 @@ namespace OS // global Ticks - memoryWriteLong(t, 0x16A); + memoryWriteLong(t, MacOS::Ticks); ToolReturn<4>(-1, t); return 0; diff --git a/toolbox/rm.cpp b/toolbox/rm.cpp index d41160a..6d79c40 100644 --- a/toolbox/rm.cpp +++ b/toolbox/rm.cpp @@ -15,6 +15,8 @@ #include #include +#include + #include "stackframe.h" @@ -42,7 +44,7 @@ namespace inline uint16_t SetResError(uint16_t error) { - memoryWriteWord(error, 0x0a60); + memoryWriteWord(error, MacOS::ResErr); return error; } @@ -261,7 +263,7 @@ namespace RM { Log("%04x ResError()\n", trap); - return memoryReadWord(0x0a60); + return memoryReadWord(MacOS::ResErr); } // SetResLoad (load: BOOLEAN); @@ -273,7 +275,7 @@ namespace RM Log("%04x SetResLoad(%04x)\n", trap, load); - memoryWriteByte(load ? 0xff : 0x00, 0x0a5e); // word or byte? + memoryWriteByte(load ? 0xff : 0x00, MacOS::ResLoad); // word or byte? return 0; }