mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-12-25 09:29:48 +00:00
REFACTOR : macro renaming for clarity/readability
This commit is contained in:
parent
cf79056b28
commit
b246baa90d
@ -39,8 +39,8 @@
|
|||||||
|
|
||||||
#define RestoreAltZP \
|
#define RestoreAltZP \
|
||||||
/* Apple //e set stack point to ALTZP (or not) */ \
|
/* Apple //e set stack point to ALTZP (or not) */ \
|
||||||
movLQ SN(base_stackzp), _XAX; \
|
movLQ SYM(base_stackzp), _XAX; \
|
||||||
subLQ SN(base_vmem), _XAX; \
|
subLQ SYM(base_vmem), _XAX; \
|
||||||
orLQ _XAX, SP_Reg_X;
|
orLQ _XAX, SP_Reg_X;
|
||||||
|
|
||||||
#ifdef __LP64__
|
#ifdef __LP64__
|
||||||
@ -118,28 +118,28 @@
|
|||||||
|
|
||||||
/* Symbol naming issues */
|
/* Symbol naming issues */
|
||||||
#ifdef NO_UNDERSCORES
|
#ifdef NO_UNDERSCORES
|
||||||
#define SN(foo) foo
|
#define SYM(foo) foo
|
||||||
#define SNX(foo, INDEX, SCALE) foo(,INDEX,SCALE)
|
#define SYMX(foo, INDEX, SCALE) foo(,INDEX,SCALE)
|
||||||
#define SNX_PROLOGUE(foo)
|
#define SYMX_PROLOGUE(foo)
|
||||||
#define E(foo) .globl foo; .balign 16; foo##:
|
#define ENTRY(foo) .globl foo; .balign 16; foo##:
|
||||||
#define CALL(foo) foo
|
#define CALL(foo) foo
|
||||||
#else /* !NO_UNDERSCORES */
|
#else /* !NO_UNDERSCORES */
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
# warning "2014/06/22 -- Apple's clang appears to not like certain manipulations of %_h register values (for example %ah, %ch) that are valid on *nix ... and it creates bizarre bytecode
|
# warning "2014/06/22 -- Apple's clang appears to not like certain manipulations of %_h register values (for example %ah, %ch) that are valid on *nix ... and it creates bizarre bytecode
|
||||||
# define APPLE_ASSEMBLER_IS_BROKEN 1
|
# define APPLE_ASSEMBLER_IS_BROKEN 1
|
||||||
# define SN(foo) _##foo(%rip)
|
# define SYM(foo) _##foo(%rip)
|
||||||
# define SNX(foo, INDEX, SCALE) (_X8,INDEX,SCALE)
|
# define SYMX(foo, INDEX, SCALE) (_X8,INDEX,SCALE)
|
||||||
# ifdef __LP64__
|
# ifdef __LP64__
|
||||||
# define SNX_PROLOGUE(foo) leaLQ _##foo(%rip), _X8;
|
# define SYMX_PROLOGUE(foo) leaLQ _##foo(%rip), _X8;
|
||||||
# else
|
# else
|
||||||
# error "Building 32bit Darwin/x86 is not supported (unless you're a go-getter and make it supported)"
|
# error "Building 32bit Darwin/x86 is not supported (unless you're a go-getter and make it supported)"
|
||||||
# endif
|
# endif
|
||||||
# define E(foo) .globl _##foo; .balign 4; _##foo##:
|
# define ENTRY(foo) .globl _##foo; .balign 4; _##foo##:
|
||||||
#else
|
#else
|
||||||
# define SN(foo) _##foo
|
# define SYM(foo) _##foo
|
||||||
# define SNX(foo, INDEX, SCALE) _##foo(,INDEX,SCALE)
|
# define SYMX(foo, INDEX, SCALE) _##foo(,INDEX,SCALE)
|
||||||
# define SNX_PROLOGUE(foo)
|
# define SYMX_PROLOGUE(foo)
|
||||||
# define E(foo) .globl _##foo; .balign 16; _##foo##:
|
# define ENTRY(foo) .globl _##foo; .balign 16; _##foo##:
|
||||||
#endif
|
#endif
|
||||||
#define CALL(foo) _##foo
|
#define CALL(foo) _##foo
|
||||||
#endif /* !NO_UNDERSCORES */
|
#endif /* !NO_UNDERSCORES */
|
||||||
|
614
src/x86/cpu.S
614
src/x86/cpu.S
File diff suppressed because it is too large
Load Diff
@ -19,33 +19,33 @@
|
|||||||
#include "cpu-regs.h"
|
#include "cpu-regs.h"
|
||||||
|
|
||||||
#define GLUE_BANK_MAYBEREAD(func,pointer) \
|
#define GLUE_BANK_MAYBEREAD(func,pointer) \
|
||||||
E(func) testLQ $SS_CXROM, SN(softswitches); \
|
ENTRY(func) testLQ $SS_CXROM, SYM(softswitches); \
|
||||||
jnz 1f; \
|
jnz 1f; \
|
||||||
callLQ *SN(pointer); \
|
callLQ *SYM(pointer); \
|
||||||
ret; \
|
ret; \
|
||||||
1: addLQ SN(pointer),EffectiveAddr_X; \
|
1: addLQ SYM(pointer),EffectiveAddr_X; \
|
||||||
movb (EffectiveAddr_X),%al; \
|
movb (EffectiveAddr_X),%al; \
|
||||||
subLQ SN(pointer),EffectiveAddr_X; \
|
subLQ SYM(pointer),EffectiveAddr_X; \
|
||||||
ret;
|
ret;
|
||||||
|
|
||||||
#define GLUE_BANK_READ(func,pointer) \
|
#define GLUE_BANK_READ(func,pointer) \
|
||||||
E(func) addLQ SN(pointer),EffectiveAddr_X; \
|
ENTRY(func) addLQ SYM(pointer),EffectiveAddr_X; \
|
||||||
movb (EffectiveAddr_X),%al; \
|
movb (EffectiveAddr_X),%al; \
|
||||||
subLQ SN(pointer),EffectiveAddr_X; \
|
subLQ SYM(pointer),EffectiveAddr_X; \
|
||||||
ret;
|
ret;
|
||||||
|
|
||||||
#define GLUE_BANK_WRITE(func,pointer) \
|
#define GLUE_BANK_WRITE(func,pointer) \
|
||||||
E(func) addLQ SN(pointer),EffectiveAddr_X; \
|
ENTRY(func) addLQ SYM(pointer),EffectiveAddr_X; \
|
||||||
movb %al,(EffectiveAddr_X); \
|
movb %al,(EffectiveAddr_X); \
|
||||||
subLQ SN(pointer),EffectiveAddr_X; \
|
subLQ SYM(pointer),EffectiveAddr_X; \
|
||||||
ret;
|
ret;
|
||||||
|
|
||||||
#define GLUE_BANK_MAYBEWRITE(func,pointer) \
|
#define GLUE_BANK_MAYBEWRITE(func,pointer) \
|
||||||
E(func) addLQ SN(pointer),EffectiveAddr_X; \
|
ENTRY(func) addLQ SYM(pointer),EffectiveAddr_X; \
|
||||||
cmpl $0,SN(pointer); \
|
cmpl $0,SYM(pointer); \
|
||||||
jz 1f; \
|
jz 1f; \
|
||||||
movb %al,(EffectiveAddr_X); \
|
movb %al,(EffectiveAddr_X); \
|
||||||
1: subLQ SN(pointer),EffectiveAddr_X; \
|
1: subLQ SYM(pointer),EffectiveAddr_X; \
|
||||||
ret;
|
ret;
|
||||||
|
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ E(func) addLQ SN(pointer),EffectiveAddr_X; \
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GLUE_C_WRITE(func) \
|
#define GLUE_C_WRITE(func) \
|
||||||
E(func) pushLQ _XAX; \
|
ENTRY(func) pushLQ _XAX; \
|
||||||
pushLQ XY_Reg_X; \
|
pushLQ XY_Reg_X; \
|
||||||
pushLQ AF_Reg_X; \
|
pushLQ AF_Reg_X; \
|
||||||
pushLQ SP_Reg_X; \
|
pushLQ SP_Reg_X; \
|
||||||
@ -79,7 +79,7 @@ E(func) pushLQ _XAX; \
|
|||||||
|
|
||||||
// TODO FIXME : implement CDECL prologue/epilogues...
|
// TODO FIXME : implement CDECL prologue/epilogues...
|
||||||
#define _GLUE_C_READ(func, ...) \
|
#define _GLUE_C_READ(func, ...) \
|
||||||
E(func) pushLQ XY_Reg_X; \
|
ENTRY(func) pushLQ XY_Reg_X; \
|
||||||
pushLQ AF_Reg_X; \
|
pushLQ AF_Reg_X; \
|
||||||
pushLQ SP_Reg_X; \
|
pushLQ SP_Reg_X; \
|
||||||
pushLQ PC_Reg_X; \
|
pushLQ PC_Reg_X; \
|
||||||
|
Loading…
Reference in New Issue
Block a user