From 3ed4d26624e0ba1ac5cbf5c561fcf339a5cd8068 Mon Sep 17 00:00:00 2001 From: Jim Date: Mon, 17 Oct 2011 22:45:33 -0400 Subject: [PATCH] bs: change tch and tcr to functions, change callers to use get/put --- em.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/em.c b/em.c index f237930..aa7c805 100644 --- a/em.c +++ b/em.c @@ -4197,12 +4197,11 @@ static inline unsigned int arr(unsigned short val, unsigned short inst) { /* math functions */ -static inline tcr(unsigned int *un) { +static inline tcr(unsigned int un) { unsigned int utempl; - utempl = - (*(int *)un); - *un = utempl; + utempl = -(int)un; if (utempl != 0) { /* clear C, L, EQ, set LT from bit 1 */ putcrs16(KEYS, (getcrs16(KEYS) & ~0120300) | ((utempl & 0x80000000) >> 24)); if (utempl == 0x80000000) { @@ -4211,14 +4210,14 @@ static inline tcr(unsigned int *un) { } } else putcrs16(KEYS, (getcrs16(KEYS) & ~0120300) | 020100); /* set L, EQ */ + return utempl; } -static inline tch (unsigned short *un) { +static inline tch (unsigned short un) { unsigned short utemp; - utemp = - (*(short *)un); - *un = utemp; + utemp = -(short)un; if (utemp != 0) { /* clear C, L, EQ, set LT from bit 1 */ putcrs16(KEYS, (getcrs16(KEYS) & ~0120300) | ((utemp & 0x8000) >> 8)); if (utemp == 0x8000) { @@ -4227,6 +4226,7 @@ static inline tch (unsigned short *un) { } } else putcrs16(KEYS, (getcrs16(KEYS) & ~0120300) | 020100); /* set L, EQ */ + return utemp; } /* NOTE: ea is only used to set faddr should an arithmetic exception occur */ @@ -6943,12 +6943,12 @@ d_xcb: /* 0140204 */ d_tca: /* 0140407 */ TRACE(T_FLOW, " TCA\n"); - tch(crs+A); + putcrs16(A, tch(getcrs16(A))); goto fetch; d_tcl: /* 0141210 */ TRACE(T_FLOW, " TCL\n"); - tcr(crsl+GR2); + putcrs32(L, tcr(getcrs32(L))); goto fetch; d_scb: /* 0140600 */ @@ -8477,12 +8477,12 @@ imode: case 0046: TRACE(T_FLOW, " TC\n"); - tcr(crsl+dr); + putgr32(dr, tcr(getgr32(dr))); break; case 0047: TRACE(T_FLOW, " TCH\n"); - tch(crs+dr*2); + putgr16(dr, tch(getgr16(dr))); break; case 0170: