more work on C65/Mega65 extended memory support

This commit is contained in:
FeralChild64 committed 2020-01-12 10:47:02 +01:00
1 parent 49693f1543
commit 33b8e2537e
4 files changed
+40 -44

No files matched your search

+28 -40
View File
@@ -3,16 +3,20 @@
// Provide pseudocommands (and other goodies) to make CPU optimizations easier
//
#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_WDC_65816
#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_CSG_4510 || CONFIG_CPU_M65_45GS02 || CONFIG_CPU_WDC_65816
.cpu _65c02
#define HAS_OPCODES_65C02
#define HAS_BCD_SAFE_INTERRUPTS
#endif
#if CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_M65_45GS02
#if CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_CSG_4510 || CONFIG_CPU_M65_45GS02
#define HAS_OPCODES_65CE02
#endif
#if CONFIG_CPU_CSG_4510 || CONFIG_CPU_M65_45GS02
#define HAS_OPCODES_4510
#endif
#if CONFIG_CPU_M65_45GS02
#define HAS_OPCODES_45GS02
#endif
@@ -22,10 +26,6 @@
#endif
#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_M65_45GS02 || CONFIG_CPU_WDC_65816
#define HAS_BCD_SAFE_INTERRUPTS
#endif
//
// These are not exactly for optimization - but to encourage proper usage of panic screen
@@ -46,46 +46,18 @@
// Trick to skip a 2-byte instruction
//
.pseudocommand skip_2_bytes_trash_nvz
{
.byte $2C
}
.pseudocommand skip_2_bytes_trash_nvz { .byte $2C }
//
// Some additional 45GS02 instructions
// Memory mapping for C65 and Mega65
//
#if HAS_OPCODES_45GS02
#if HAS_OPCODES_4510
.function byteLO(value)
{
.return mod(value.getValue(), $100)
}
.function byteHI(value)
{
.return (value.getValue() - byteLO(value)) / $100
}
.pseudocommand rts_32 // XXX not tested yet
{
.byte $F8, $F8, $60
}
.pseudocommand jmp_32 bank:address // XXX not tested yet
{
.byte $F8, $F8, $4C, byteLO(address), byteHI(address), byteLO(bank), byteHI(bank)
}
.pseudocommand jsr_32 bank:address // XXX not tested yet
{
.var al = address.getValue();
.var ah = bank.getValue();
.byte $F8, $F8, $20, byteLO(address), byteHI(address), byteLO(bank), byteHI(bank)
}
.pseudocommand map { .byte $5C }
.pseudocommand eom { .byte $EA }
#endif
@@ -97,6 +69,22 @@
#if HAS_OPCODES_65CE02
// .B register support
.pseudocommand tab { .byte $5B }
.pseudocommand tba { .byte $7B }
// .Z register support
.pseudocommand inz { .byte $1B }
.pseudocommand dez { .byte $3B }
.pseudocommand phz { .byte $DB }
.pseudocommand plz { .byte $FB }
.pseudocommand taz { .byte $4B }
.pseudocommand tza { .byte $6B }
// 16-bit data processing
.pseudocommand dew addr
{
.var arg = addr.getValue()
+1 -1
View File
@@ -7,7 +7,7 @@
// XXX this is for testing only
rts_32
rts
#endif // ROM layout