fix stack frames with byte values

This commit is contained in:
Kelvin Sherlock 2015-01-05 13:11:50 -05:00
parent 24e47c7f9b
commit 7eb33de435

View File

@ -26,6 +26,9 @@ template<int Bytes, int Offset, typename... Args>
uint32_t StackFrame__(uint32_t sp, uint32_t &x, Args&&... args);
template<int Bytes, int Offset, typename... Args>
uint32_t StackFrame__(uint32_t sp, uint16_t &x, Args&&... args);
template<int Bytes, int Offset, typename... Args>
uint32_t StackFrame__(uint32_t sp, uint8_t &x, Args&&... args);
template<int Bytes, int Offset>
uint32_t StackFrame__(uint32_t sp);
@ -55,6 +58,16 @@ uint32_t StackFrame__(uint32_t sp, uint16_t &x, Args&&... args)
return StackFrame__<Bytes, Offset - 2>(sp, std::forward<Args>(args)...);
}
template<int Bytes, int Offset, typename... Args>
uint32_t StackFrame__(uint32_t sp, uint8_t &x, Args&&... args)
{
// byte pushes as 2 bytes with 1 garbage byte
x = memoryReadByte(sp + Offset - 2);
return StackFrame__<Bytes, Offset - 2>(sp, std::forward<Args>(args)...);
}
template<int Bytes, typename... Args>
uint32_t StackFrame(Args&&... args)
{