comparison z80_to_x86.c @ 315:684e71e9f0d0

Fix return address for RST
author Mike Pavone <pavone@retrodev.com>
date Thu, 09 May 2013 20:09:49 -0700
parents 54c0e5f22198
children 14a937097c2b
comparison
equal deleted inserted replaced
314:54c0e5f22198 315:684e71e9f0d0
13 #define ZLIMIT RDI 13 #define ZLIMIT RDI
14 #define SCRATCH1 R13 14 #define SCRATCH1 R13
15 #define SCRATCH2 R14 15 #define SCRATCH2 R14
16 #define CONTEXT RSI 16 #define CONTEXT RSI
17 17
18 #define DO_DEBUG_PRINT 18 //#define DO_DEBUG_PRINT
19 19
20 #ifdef DO_DEBUG_PRINT 20 #ifdef DO_DEBUG_PRINT
21 #define dprintf printf 21 #define dprintf printf
22 #else 22 #else
23 #define dprintf 23 #define dprintf
1574 break; 1574 break;
1575 case Z80_RST: { 1575 case Z80_RST: {
1576 //RST is basically CALL to an address in page 0 1576 //RST is basically CALL to an address in page 0
1577 dst = zcycles(dst, 5);//T States: 5 1577 dst = zcycles(dst, 5);//T States: 5
1578 dst = sub_ir(dst, 2, opts->regs[Z80_SP], SZ_W); 1578 dst = sub_ir(dst, 2, opts->regs[Z80_SP], SZ_W);
1579 dst = mov_ir(dst, address + 3, SCRATCH1, SZ_W); 1579 dst = mov_ir(dst, address + 1, SCRATCH1, SZ_W);
1580 dst = mov_rr(dst, opts->regs[Z80_SP], SCRATCH2, SZ_W); 1580 dst = mov_rr(dst, opts->regs[Z80_SP], SCRATCH2, SZ_W);
1581 dst = call(dst, (uint8_t *)z80_write_word_highfirst);//T States: 3, 3 1581 dst = call(dst, (uint8_t *)z80_write_word_highfirst);//T States: 3, 3
1582 uint8_t * call_dst = z80_get_native_address(context, inst->immed); 1582 uint8_t * call_dst = z80_get_native_address(context, inst->immed);
1583 if (!call_dst) { 1583 if (!call_dst) {
1584 opts->deferred = defer_address(opts->deferred, inst->immed, dst + 1); 1584 opts->deferred = defer_address(opts->deferred, inst->immed, dst + 1);