add callLQ preprocessor macro

This commit is contained in:
Aaron Culliney 2014-06-21 14:05:00 -07:00
parent 44f06dfb48
commit c13caa0798
3 changed files with 24 additions and 18 deletions

View File

@ -9,6 +9,9 @@
*
*/
#ifndef _CPU_REGS_H_
#define _CPU_REGS_H_
#include "cpu.h"
#define X_Reg %bl /* 6502 X register in %bl */
@ -40,6 +43,7 @@
// full-length assembly instructions
# define addLQ addq
# define andLQ andq
# define callLQ callq
# define decLQ decq
# define orLQ orq
# define movLQ movq
@ -73,6 +77,7 @@
// full-length assembly instructions
# define addLQ addl
# define andLQ andl
# define callLQ calll
# define decLQ decl
# define orLQ orl
# define movLQ movl
@ -91,3 +96,4 @@
# define xorLQ xorl
#endif
#endif // whole file

View File

@ -31,16 +31,16 @@
#define GetFromPC_B \
movLQ PC_Reg_X, EffectiveAddr_X; \
incw PC_Reg; \
call *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR);
callLQ *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR);
#define GetFromPC_W \
movLQ PC_Reg_X, EffectiveAddr_X; \
incw EffectiveAddr; \
addw $2, PC_Reg; \
call *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR); \
callLQ *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR); \
decw EffectiveAddr; \
movb %al, %ah; \
call *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR);
callLQ *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR);
#define JumpNextInstruction \
GetFromPC_B \
@ -51,31 +51,31 @@
#define GetFromEA_B \
orb $1, DebugCurrRW; \
call *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR);
callLQ *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR);
#define GetFromEA_W \
incw EffectiveAddr; \
call *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR); \
callLQ *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR); \
decw EffectiveAddr; \
movb %al, %ah; \
call *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR);
callLQ *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR);
#define PutToEA_B \
orb $2, DebugCurrRW; \
movb %al, DebugCurrByte; \
call *SN(cpu65_vmem_w)(,EffectiveAddr_X,SZ_PTR);
callLQ *SN(cpu65_vmem_w)(,EffectiveAddr_X,SZ_PTR);
#define GetFromMem_B(x) \
movLQ x, EffectiveAddr_X; \
call *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR);
callLQ *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR);
#define GetFromMem_W(x) \
movLQ x, EffectiveAddr_X; \
incw EffectiveAddr; \
call *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR); \
callLQ *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR); \
decw EffectiveAddr; \
movb %al, %ah; \
call *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR);
callLQ *SN(cpu65_vmem_r)(,EffectiveAddr_X,SZ_PTR);
#define Continue \
jmp continue;
@ -289,22 +289,22 @@
jz 6f; \
testb $0x60, A_Reg; \
jz 6f; \
call SN(c_debug_illegal_bcd); \
callLQ SN(c_debug_illegal_bcd); \
6: testb $0x08, A_Reg; \
jz 7f; \
testb $0x06, A_Reg; \
jz 7f; \
call SN(c_debug_illegal_bcd); \
callLQ SN(c_debug_illegal_bcd); \
7: testb $0x80, %al; \
jz 8f; \
testb $0x60, %al; \
jz 8f; \
call SN(c_debug_illegal_bcd); \
callLQ SN(c_debug_illegal_bcd); \
8: testb $0x08, %al; \
jz 9f; \
testb $0x06, %al; \
jz 9f; \
call SN(c_debug_illegal_bcd); \
callLQ SN(c_debug_illegal_bcd); \
9:
#else
#define DebugBCDCheck
@ -2167,7 +2167,7 @@ E(cpu65_direct_write)
pushLQ EffectiveAddr_X
movLQ 8(_XSP),EffectiveAddr_X
movLQ 12(_XSP),_XAX
call *SN(cpu65_vmem_w)(,EffectiveAddr_X,SZ_PTR)
callLQ *SN(cpu65_vmem_w)(,EffectiveAddr_X,SZ_PTR)
popLQ EffectiveAddr_X
ret

View File

@ -30,7 +30,7 @@ E(func) movb %al,SN(address)(EffectiveAddr_X); \
#define GLUE_BANK_MAYBEREAD(func,pointer) \
E(func) testLQ $SS_CXROM, SN(softswitches); \
jnz 1f; \
call *SN(pointer); \
callLQ *SN(pointer); \
ret; \
1: addLQ SN(pointer),EffectiveAddr_X; \
movb (EffectiveAddr_X),%al; \
@ -76,7 +76,7 @@ E(func) pushLQ _XAX; \
pushLQ PC_Reg_X; \
andLQ $0xff,_XAX; \
_PUSH_ARGS \
call SN(c_##func); \
callLQ SN(c_##func); \
_POP_ARGS \
popLQ PC_Reg_X; \
popLQ SP_Reg_X; \
@ -93,7 +93,7 @@ E(func) pushLQ XY_Reg_X; \
pushLQ PC_Reg_X; \
pushLQ _XAX; /* HACK: works around mysterious issue with generated mov(_XAX), _XAX ... */ \
pushLQ EffectiveAddr_X; /* ea is arg0 (and preserved) */ \
call SN(c_##func); \
callLQ SN(c_##func); \
popLQ EffectiveAddr_X; /* restore ea */ \
movb %al, %dl; \
popLQ _XAX; /* ... ugh */ \