From 97a89c1904761539548b450a3b8c8c86a66d5cfd Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Fri, 15 Feb 2013 20:41:57 -0500 Subject: [PATCH] TickCount --- toolbox/mpw_time.cpp | 24 ++++++++++++++++++++++++ toolbox/mpw_time.h | 1 + toolbox/toolbox.cpp | 5 +++++ 3 files changed, 30 insertions(+) diff --git a/toolbox/mpw_time.cpp b/toolbox/mpw_time.cpp index 781975c..3af81f0 100644 --- a/toolbox/mpw_time.cpp +++ b/toolbox/mpw_time.cpp @@ -6,11 +6,18 @@ #include #include +#include + +#include "stackframe.h" + + // todo -- have background thread to update Ticks and Time global variables? namespace { const long EpochAdjust = 86400 * (365 * (1970 - 1904) + 17); // 17 leap years. + + } namespace Time { @@ -92,4 +99,21 @@ namespace Time return 0; } + uint16_t TickCount(uint16_t trap) + { + uint32_t ticks; + + fprintf(stderr, "%04x TickCount()\n", trap); + + //auto t = std::chrono::steady_clock::now(); + ticks = 0; + + // global Ticks + memoryWriteLong(ticks, 0x16A); + ToolReturn<4>(-1, ticks); + + return 0; + } + + } \ No newline at end of file diff --git a/toolbox/mpw_time.h b/toolbox/mpw_time.h index 3028db2..b518a32 100644 --- a/toolbox/mpw_time.h +++ b/toolbox/mpw_time.h @@ -13,6 +13,7 @@ namespace Time uint16_t ReadDateTime(uint16_t trap); uint16_t SecondsToDate(uint16_t trap); + uint16_t TickCount(uint16_t trap); } #endif \ No newline at end of file diff --git a/toolbox/toolbox.cpp b/toolbox/toolbox.cpp index 6e01741..ff3ccf8 100644 --- a/toolbox/toolbox.cpp +++ b/toolbox/toolbox.cpp @@ -79,6 +79,11 @@ namespace ToolBox { d0 = Time::SecondsToDate(trap); break; + // TickCount : LONGINT; + case 0xa975: + d0 = Time::TickCount(trap); + break; + // NewPtr [Sys, Clear] (logicalSize: Size): Ptr; case 0xa11e: case 0xa31e: