mirror of
https://github.com/ksherlock/mpw.git
synced 2025-01-23 12:32:12 +00:00
Merge branch 'feature_toolbox_microseconds'
Add support for the Microseconds toolcall.
This commit is contained in:
commit
d826ef8c13
12
cpu/memory.c
12
cpu/memory.c
@ -97,8 +97,8 @@ UWO memoryReadWord(ULO address)
|
||||
if (address & 0x01) memoryOddRead(address);
|
||||
|
||||
if (address + 1 < MemorySize)
|
||||
return (Memory[address++] << 8)
|
||||
| (Memory[address++] << 0);
|
||||
return (Memory[address + 0] << 8)
|
||||
| (Memory[address + 1] << 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -112,10 +112,10 @@ ULO memoryReadLong(ULO address)
|
||||
if (address & 0x01) memoryOddRead(address);
|
||||
|
||||
if (address + 3 < MemorySize)
|
||||
return (Memory[address++] << 24)
|
||||
| (Memory[address++] << 16)
|
||||
| (Memory[address++] << 8)
|
||||
| (Memory[address++] << 0);
|
||||
return (Memory[address + 0] << 24)
|
||||
| (Memory[address + 1] << 16)
|
||||
| (Memory[address + 2] << 8)
|
||||
| (Memory[address + 3] << 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -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];
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user