use global names

This commit is contained in:
Kelvin Sherlock 2013-05-12 22:36:22 -04:00
parent 7536e05a6c
commit 0d6874ae08
4 changed files with 15 additions and 8 deletions

View File

@ -22,6 +22,8 @@
#include <toolbox/mm.h> #include <toolbox/mm.h>
#include <toolbox/os_internal.h> #include <toolbox/os_internal.h>
#include <macos/sysequ.h>
extern char **environ; extern char **environ;
@ -134,7 +136,7 @@ namespace MPW
std::memcpy(str32 + 1, name, l); std::memcpy(str32 + 1, name, l);
while (l < 32) str32[l++] = 0; while (l < 32) str32[l++] = 0;
std::memcpy(memoryPointer(0x0910), str32, 32); std::memcpy(memoryPointer(MacOS::CurApName), str32, 32);
} }

View File

@ -11,6 +11,7 @@
#include <map> #include <map>
#include <mplite/mplite.h> #include <mplite/mplite.h>
#include <macos/sysequ.h>
using ToolBox::Log; using ToolBox::Log;
using namespace ToolBox::Errors; using namespace ToolBox::Errors;
@ -45,7 +46,7 @@ namespace
inline uint16_t SetMemError(uint16_t error) inline uint16_t SetMemError(uint16_t error)
{ {
memoryWriteWord(error, 0x0220); memoryWriteWord(error, MacOS::MemErr);
return error; return error;
} }

View File

@ -19,6 +19,8 @@
#include <cpu/CpuModule.h> #include <cpu/CpuModule.h>
#include <cpu/fmem.h> #include <cpu/fmem.h>
#include <macos/sysequ.h>
#include "os.h" #include "os.h"
#include "os_internal.h" #include "os_internal.h"
#include "toolbox.h" #include "toolbox.h"
@ -79,7 +81,7 @@ namespace OS
bool Init() bool Init()
{ {
BootTime = std::chrono::steady_clock::now(); BootTime = std::chrono::steady_clock::now();
memoryWriteLong(0, 0x16A); // 0 ticks since boot. memoryWriteLong(0, MacOS::Ticks); // 0 ticks since boot.
return true; return true;
} }
@ -905,7 +907,7 @@ namespace OS
if (secsPtr) memoryWriteLong(now, secsPtr); if (secsPtr) memoryWriteLong(now, secsPtr);
// also set global variable Time. // also set global variable Time.
memoryWriteLong(now, 0x020c); memoryWriteLong(now, MacOS::TimeLM);
return 0; return 0;
} }
@ -959,7 +961,7 @@ namespace OS
// global Ticks // global Ticks
memoryWriteLong(t, 0x16A); memoryWriteLong(t, MacOS::Ticks);
ToolReturn<4>(-1, t); ToolReturn<4>(-1, t);
return 0; return 0;

View File

@ -15,6 +15,8 @@
#include <cpu/CpuModule.h> #include <cpu/CpuModule.h>
#include <cpu/fmem.h> #include <cpu/fmem.h>
#include <macos/sysequ.h>
#include "stackframe.h" #include "stackframe.h"
@ -42,7 +44,7 @@ namespace
inline uint16_t SetResError(uint16_t error) inline uint16_t SetResError(uint16_t error)
{ {
memoryWriteWord(error, 0x0a60); memoryWriteWord(error, MacOS::ResErr);
return error; return error;
} }
@ -261,7 +263,7 @@ namespace RM
{ {
Log("%04x ResError()\n", trap); Log("%04x ResError()\n", trap);
return memoryReadWord(0x0a60); return memoryReadWord(MacOS::ResErr);
} }
// SetResLoad (load: BOOLEAN); // SetResLoad (load: BOOLEAN);
@ -273,7 +275,7 @@ namespace RM
Log("%04x SetResLoad(%04x)\n", trap, load); 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; return 0;
} }