use macros for CPU-specific jumptable generation

This commit is contained in:
FeralChild64 committed 2020-06-06 10:09:25 +02:00
1 parent f560e26c65
commit f5b4e554ac
3 files changed
+236 -496

No files matched your search

+37
View File
@@ -42,6 +42,43 @@
//
// Macros for generating jumptables
//
#if !HAS_OPCODES_65C02
.macro put_jumptable_lo(list)
{
.for (var i = 0; i < list.size(); i++)
{
.byte mod((list.get(i) - 1), $100)
}
}
.macro put_jumptable_hi(list)
{
.for (var i = 0; i < list.size(); i++)
{
.byte floor((list.get(i) - 1) / $100)
}
}
#else // HAS_OPCODES_65C02
.macro put_jumptable(list)
{
.for (var i = 0; i < list.size(); i++)
{
.word list.get(i)
}
}
#endif
//
// Trick to skip a 2-byte instruction
//