--- np2/io/gdc_sub.c 2004/02/21 00:25:33 1.17 +++ np2/io/gdc_sub.c 2011/01/15 18:04:43 1.22 @@ -1,5 +1,7 @@ #include "compiler.h" +#if !defined(DISABLE_MATH_H) #include +#endif #include "cpucore.h" #include "pccore.h" #include "iocore.h" @@ -14,6 +16,8 @@ enum { RT_TABLEMAX = (1 << RT_TABLEBIT) }; +static UINT16 gdc_rt[RT_TABLEMAX+1]; + typedef struct { SINT16 x; SINT16 y; @@ -23,8 +27,6 @@ typedef struct { const UINT32 gdcplaneseg[4] = {VRAM_E, VRAM_B, VRAM_R, VRAM_G}; -static UINT16 gdc_rt[RT_TABLEMAX+1]; - static const VECTDIR vectdir[16] = { { 0, 1, 1, 0}, { 1, 1, 1,-1}, { 1, 0, 0,-1}, { 1,-1,-1,-1}, @@ -90,12 +92,14 @@ REG8 gdcbitreverse(REG8 data) { void gdcsub_initialize(void) { +#if !defined(DISABLE_MATH_H) int i; for (i=0; i<=RT_TABLEMAX; i++) { gdc_rt[i] = (UINT16)((double)(1 << RT_MULBIT) * (1 - sqrt(1 - pow((0.70710678118654 * i) / RT_TABLEMAX, 2)))); } +#endif } void gdcslavewait(NEVENTITEM item) { @@ -134,7 +138,7 @@ static void calc_gdcslavewait(UINT dots) gdcsub_setslavewait(clk); } -void gdcsub_setvectl(GDCVECT *vect, int x1, int y1, int x2, int y2) { +void gdcsub_setvectl(GDCVECT *vect, int xx1, int yy1, int xx2, int yy2) { UINT ope; int dy; @@ -142,13 +146,13 @@ void gdcsub_setvectl(GDCVECT *vect, int int tmp; ope = 0; - dy = y2 - y1; + dy = yy2 - yy1; if (dy < 0) { dy = 0 - dy; } - dx = x2 - x1; + dx = xx2 - xx1; if (dx == 0) { - if (y1 <= y2) { + if (yy1 <= yy2) { ope = 7; } else { @@ -157,14 +161,14 @@ void gdcsub_setvectl(GDCVECT *vect, int } else { if (dx > 0) { - if (y1 >= y2) { + if (yy1 >= yy2) { ope += 2; } } else { dx = 0 - dx; ope += 4; - if (y1 <= y2) { + if (yy1 <= yy2) { ope += 2; } } @@ -179,7 +183,7 @@ void gdcsub_setvectl(GDCVECT *vect, int } } } - if (ope & 1) { + if (!((ope + 1) & 2)) { tmp = dx; dx = dy; dy = tmp; @@ -288,14 +292,14 @@ void gdcsub_vectl(UINT32 csrw, const GDC void gdcsub_vectt(UINT32 csrw, const GDCVECT *vect, REG16 pat, REG8 ope) { _GDCPSET pset; - BYTE multiple; + UINT8 multiple; UINT sx; const VECTDIR *dir; - BYTE muly; + UINT8 muly; REG16 cx; REG16 cy; UINT xrem; - BYTE mulx; + UINT8 mulx; if (vect->ope & 0x80) { // SL pat = (REG16)((GDCPATREVERSE(pat) << 8) + GDCPATREVERSE(pat >> 8)); @@ -473,21 +477,21 @@ const VECTDIR *dir; calc_gdcslavewait(pset.dots); } -void gdcsub_text(UINT32 csrw, const GDCVECT *vect, const BYTE *pat, +void gdcsub_text(UINT32 csrw, const GDCVECT *vect, const UINT8 *pat, REG8 ope) { _GDCPSET pset; - BYTE multiple; + UINT8 multiple; UINT sx; UINT sy; const VECTDIR *dir; UINT patnum; - BYTE muly; + UINT8 muly; REG16 cx; REG16 cy; UINT xrem; - BYTE bit; - BYTE mulx; + UINT8 bit; + UINT8 mulx; gdcpset_prepare(&pset, csrw, 0xffff, ope); multiple = (gdc.s.para[GDC_ZOOM] & 15) + 1; @@ -554,7 +558,7 @@ void gdcsub_write(void) { UINT16 data; UINT32 adrs; UINT leng; - BYTE *ptr; + UINT8 *ptr; UINT16 updatebit; #if 0 @@ -621,7 +625,7 @@ void gdcsub_write(void) { ptr += VRAM_STEP; updatebit = 0x0202; } - gdcs.grphdisp |= (BYTE)updatebit; + gdcs.grphdisp |= (UINT8)updatebit; ptr += gdcplaneseg[(adrs >> 14) & 3]; adrs = (adrs & 0x3fff) << 1;