TickCount

This commit is contained in:
Kelvin Sherlock 2013-02-15 20:41:57 -05:00
parent a14cd5eb5d
commit 97a89c1904
3 changed files with 30 additions and 0 deletions

View File

@ -6,11 +6,18 @@
#include <cpu/CpuModule.h>
#include <cpu/fmem.h>
#include <chrono>
#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;
}
}

View File

@ -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

View File

@ -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: