// ----------------------------------------------------------------------- // This function loops until cycles <= 0. // Ignores bad opcodes, doesn't return anything. asm void N6502_Exec() { mflr r14 // save our calling address entry static __execloop subc. r28,r28,r4 // decrease cycles by r4 ble exec_end fetchbyte(r5) // get next instruction from PC slwi r5,r5,2 // use opcode as index into jumptable (r16) lwzx r7,r5,r16 mtlr r7 blr // jump to opcode handler entry static __execbad #ifdef TrapBadOps subic r24,r24,1 // set pc to offending instruction b exec_end #else li r4,4 b __execloop // ignore, charge nop (?) cycles. #endif exec_end: mtlr r14 // restore caller address (the LR) blr }
uint8 memz80_fetch_mem_byte(uint16 addr) { return (fetchbyte(cpuz80_bank | (addr - 0x8000))); }