REFACTOR : simplified/streamlined some assembly

This commit is contained in:
Aaron Culliney 2015-02-14 22:22:35 -08:00
parent 12ba31f1af
commit 30c09da259

View File

@ -2137,23 +2137,23 @@ continue:
subl %eax, SYM(gc_cycles_timer_1) subl %eax, SYM(gc_cycles_timer_1)
subl %eax, SYM(cpu65_cycles_to_execute) subl %eax, SYM(cpu65_cycles_to_execute)
jle exit_cpu65_run jle exit_cpu65_run
continue1: xorLQ _XAX, _XAX continue1: xorLQ _XAX, _XAX
orb SYM(cpu65__signal), %al orb SYM(cpu65__signal), %al
jnz exception jnz exception
1: JumpNextInstruction JumpNextInstruction
/* ------------------------------------------------------------------------- /* -------------------------------------------------------------------------
Exception handlers Exception handlers
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
exception: testb $ResetSig, %al exception: testb $ResetSig, %al
jnz ex_reset0 jz ex_irq
jmp ex_irq testb $0xff, SYM(joy_button0) // OpenApple
jnz exit_reinit
ex_reset0: testb $0xff, SYM(joy_button0) // OpenApple
jnz emul_reinit
testb $0xff, SYM(joy_button1) // ClosedApple testb $0xff, SYM(joy_button1) // ClosedApple
jnz emul_reinit jnz exit_reinit
ex_reset: movb $0, SYM(cpu65__signal) ex_reset: movb $0, SYM(cpu65__signal)
movw $0xFFFC, EffectiveAddr // ROM reset vector movw $0xFFFC, EffectiveAddr // ROM reset vector
GetFromEA_W GetFromEA_W
@ -2188,7 +2188,7 @@ ex_irq: testb $I_Flag, F_Reg // Already interrupt
JumpNextInstruction JumpNextInstruction
/* ------------------------------------------------------------------------- /* -------------------------------------------------------------------------
CPU thread main entry and exit points 65c02 CPU processing loop entry point
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
ENTRY(cpu65_run) ENTRY(cpu65_run)
@ -2199,7 +2199,7 @@ ENTRY(cpu65_run)
pushLQ _XBP pushLQ _XBP
movLQ _XSP, _XBP movLQ _XSP, _XBP
cmpb $0, SYM(emul_reinitialize) cmpb $0, SYM(emul_reinitialize)
jnz 1f jnz enter_reinit
// Restore CPU state when being called from C. // Restore CPU state when being called from C.
movzwLQ DebugCurrEA, EffectiveAddr_X movzwLQ DebugCurrEA, EffectiveAddr_X
@ -2221,7 +2221,7 @@ ENTRY(cpu65_run)
#endif #endif
jmp continue1 jmp continue1
1: movb $0, SYM(emul_reinitialize) enter_reinit: movb $0, SYM(emul_reinitialize)
// Zero all used registers // Zero all used registers
xorLQ _XAX, _XAX xorLQ _XAX, _XAX
xorLQ XY_Reg_X, XY_Reg_X xorLQ XY_Reg_X, XY_Reg_X
@ -2235,16 +2235,23 @@ ENTRY(cpu65_run)
movLQ $0x1FC, SP_Reg_X movLQ $0x1FC, SP_Reg_X
jmp ex_reset jmp ex_reset
/* -------------------------------------------------------------------------
65c02 CPU processing loop exit point
------------------------------------------------------------------------- */
exit_cpu65_run: exit_cpu65_run:
// Save CPU state when returning from being called from C // Save CPU state when returning from being called from C
movw PC_Reg, SYM(cpu65_pc) movw PC_Reg, SYM(cpu65_pc)
CommonSaveCPUState() CommonSaveCPUState()
jmp exit_frame popLQ _XBP
#ifdef __LP64__
popq %rbx
#endif
ret
emul_reinit: movb $0, SYM(cpu65__signal) exit_reinit: movb $0, SYM(cpu65__signal)
movb $1, SYM(emul_reinitialize) movb $1, SYM(emul_reinitialize)
popLQ _XBP
exit_frame: popLQ _XBP
#ifdef __LP64__ #ifdef __LP64__
popq %rbx popq %rbx
#endif #endif