diff --git a/lib/cpu.c b/lib/cpu.c index a777c54..f84268a 100644 --- a/lib/cpu.c +++ b/lib/cpu.c @@ -19,7 +19,7 @@ FILE *log; void cpu_init() { ctx.regs.a = 0x01; ctx.regs.f = 0xB0; - ctx.regs.b = 0x19; + ctx.regs.b = 0x0; ctx.regs.c = 0x13; ctx.regs.d = 0x00; ctx.regs.e = 0xD8; diff --git a/lib/cpu_proc.c b/lib/cpu_proc.c index de77d83..ef6a3d2 100644 --- a/lib/cpu_proc.c +++ b/lib/cpu_proc.c @@ -497,8 +497,10 @@ static void goto_addr(cpu_context *ctx, u16 addr, bool pushpc){ if(ctx->cur_inst->reg_1 != RT_HL) emu_cycles(1); if(pushpc) { - stack_push16(ctx->regs.pc); - emu_cycles(2); + stack_push((ctx->regs.pc >> 8) & 0xFF); + emu_cycles(1); + stack_push(ctx->regs.pc & 0xFF); + emu_cycles(1); } ctx->regs.pc = addr; }