diff --git a/doc/sim65.sgml b/doc/sim65.sgml index 8a7329b0b..075d95849 100644 --- a/doc/sim65.sgml +++ b/doc/sim65.sgml @@ -115,22 +115,12 @@ The - int open (const char* name, int flags, ...); - int __fastcall__ close (int fd); - int __fastcall__ read (int fd, void* buf, unsigned count); - int __fastcall__ write (int fd, const void* buf, unsigned count); - - -These built-in functions can be used with -). Creating a Test in Assembly

@@ -169,6 +159,11 @@ pre-loaded with the given The +Several bytes immediately below the vector table are reserved for paravirtualization functions. +Except for = PARAVIRT_BASE) { + Error ("'%s': To large to fit into $%04X-$%04X", ProgramFile, Addr, PARAVIRT_BASE); } MemWriteByte (Addr++, (unsigned char) Val); } diff --git a/src/sim65/paravirt.c b/src/sim65/paravirt.c index c9f6e61b0..603a07e9a 100644 --- a/src/sim65/paravirt.c +++ b/src/sim65/paravirt.c @@ -318,13 +318,13 @@ void ParaVirtHooks (CPURegs* Regs) /* Potentially execute paravirtualization hooks */ { /* Check for paravirtualization address range */ - if (Regs->PC < 0xFFF4 || - Regs->PC >= 0xFFF4 + sizeof (Hooks) / sizeof (Hooks[0])) { + if (Regs->PC < PARAVIRT_BASE || + Regs->PC >= PARAVIRT_BASE + sizeof (Hooks) / sizeof (Hooks[0])) { return; } /* Call paravirtualization hook */ - Hooks[Regs->PC - 0xFFF4] (Regs); + Hooks[Regs->PC - PARAVIRT_BASE] (Regs); /* Simulate RTS */ Regs->PC = Pop(Regs) + (Pop(Regs) << 8) + 1; diff --git a/src/sim65/paravirt.h b/src/sim65/paravirt.h index cd4915398..99c28fa02 100644 --- a/src/sim65/paravirt.h +++ b/src/sim65/paravirt.h @@ -38,6 +38,17 @@ +/*****************************************************************************/ +/* Data */ +/*****************************************************************************/ + + + +#define PARAVIRT_BASE 0xFFF4 +/* Lowest address used by a paravirtualization hook */ + + + /*****************************************************************************/ /* Code */ /*****************************************************************************/