diff --git a/toolbox/os.cpp b/toolbox/os.cpp index 85c56de..4ba6043 100644 --- a/toolbox/os.cpp +++ b/toolbox/os.cpp @@ -1039,6 +1039,31 @@ namespace OS return 0; } + + uint16_t Microseconds(uint16_t trap) + { + + // UnsignedWide is a uint64_t + // Microseconds(UnsignedWide * microTickCount) + // FOURWORDINLINE(0xA193, 0x225F, 0x22C8, 0x2280); + + + uint32_t microTickCount; + StackFrame<4>(microTickCount); + + Log("%04x %s(%08x)\n", trap, __func__, microTickCount); + + auto now = std::chrono::steady_clock::now(); + + uint64_t t = std::chrono::duration_cast< std::chrono::microseconds >(now - BootTime).count(); + + if (microTickCount) + memoryWriteLongLong(t, microTickCount); + + + return 0; + } + uint16_t Pack6(uint16_t trap) { char buffer[256]; diff --git a/toolbox/os.h b/toolbox/os.h index a371bc9..08c1d39 100644 --- a/toolbox/os.h +++ b/toolbox/os.h @@ -73,6 +73,7 @@ namespace OS uint16_t Pack6(uint16_t trap); uint16_t TickCount(uint16_t trap); + uint16_t Microseconds(uint16_t trap); uint16_t FSDispatch(uint16_t trap); uint16_t HFSDispatch(uint16_t trap); diff --git a/toolbox/toolbox.cpp b/toolbox/toolbox.cpp index f4f477a..e5b4ee1 100644 --- a/toolbox/toolbox.cpp +++ b/toolbox/toolbox.cpp @@ -278,6 +278,11 @@ namespace ToolBox { d0 = OS::TickCount(trap); break; + case 0xa193: + d0 = OS::Microseconds(trap); + break; + + case 0xa9ed: d0 = OS::Pack6(trap); break;