1 /***************************************************************************
4 begin : Sun Oct 28 2001
5 copyright : (C) 2001 by Pete Bernert
6 email : BlackDove@addcom.de
7 ***************************************************************************/
8 /***************************************************************************
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. See also the license.txt file for *
14 * additional informations. *
16 ***************************************************************************/
20 #include "externals.h"
26 ////////////////////////////////////////////////////////////////////////
28 ////////////////////////////////////////////////////////////////////////
30 BOOL bUsingTWin=FALSE;
32 //unsigned long clutid; // global clut
33 unsigned short usMirror=0; // sprite mirror
40 uint32_t dwActFixes=0;
41 uint32_t dwEmuFixes=0;
44 BOOL bDoVSyncUpdate=FALSE;
46 ////////////////////////////////////////////////////////////////////////
47 // Some ASM color convertion by LEWPY
48 ////////////////////////////////////////////////////////////////////////
52 #define BGR24to16 i386_BGR24to16
53 __inline unsigned short BGR24to16 (uint32_t BGR);
57 __inline unsigned short BGR24to16 (uint32_t BGR)
59 return (unsigned short)(((BGR>>3)&0x1f)|((BGR&0xf80000)>>9)|((BGR&0xf800)>>6));
64 ////////////////////////////////////////////////////////////////////////
65 // Update global TP infos
66 ////////////////////////////////////////////////////////////////////////
68 __inline void UpdateGlobalTP(unsigned short gdata)
70 GlobalTextAddrX = (gdata << 6) & 0x3c0; // texture addr
76 GlobalTextAddrY =((gdata & 0x60 ) << 3);
77 GlobalTextIL =(gdata & 0x2000) >> 13;
78 GlobalTextABR = (unsigned short)((gdata >> 7) & 0x3);
79 GlobalTextTP = (gdata >> 9) & 0x3;
80 if(GlobalTextTP==3) GlobalTextTP=2;
82 lGPUstatusRet = (lGPUstatusRet & 0xffffe000 ) | (gdata & 0x1fff );
84 // tekken dithering? right now only if dithering is forced by user
85 if(iUseDither==2) iDither=2; else iDither=0;
91 GlobalTextAddrY = (unsigned short)(((gdata << 4) & 0x100) | ((gdata >> 2) & 0x200));
94 else GlobalTextAddrY = (gdata << 4) & 0x100;
96 GlobalTextTP = (gdata >> 7) & 0x3; // tex mode (4,8,15)
98 if(GlobalTextTP==3) GlobalTextTP=2; // seen in Wild9 :(
100 GlobalTextABR = (gdata >> 5) & 0x3; // blend mode
102 lGPUstatusRet&=~0x000001ff; // Clear the necessary bits
103 lGPUstatusRet|=(gdata & 0x01ff); // set the necessary bits
111 if(lGPUstatusRet&0x0200) iDither=2;
120 ////////////////////////////////////////////////////////////////////////
122 __inline void SetRenderMode(uint32_t DrawAttributes)
124 DrawSemiTrans = (SEMITRANSBIT(DrawAttributes)) ? TRUE : FALSE;
126 if(SHADETEXBIT(DrawAttributes))
127 {g_m1=g_m2=g_m3=128;}
130 if((dwActFixes&4) && ((DrawAttributes&0x00ffffff)==0))
131 DrawAttributes|=0x007f7f7f;
133 g_m1=(short)(DrawAttributes&0xff);
134 g_m2=(short)((DrawAttributes>>8)&0xff);
135 g_m3=(short)((DrawAttributes>>16)&0xff);
139 ////////////////////////////////////////////////////////////////////////
141 // oki, here are the psx gpu coord rules: poly coords are
142 // 11 bit signed values (-1024...1023). If the x or y distance
143 // exceeds 1024, the polygon will not be drawn.
144 // Since quads are treated as two triangles by the real gpu,
145 // this 'discard rule' applies to each of the quad's triangle
146 // (so one triangle can be drawn, the other one discarded).
147 // Also, y drawing is wrapped at 512 one time,
148 // then it will get negative (and therefore not drawn). The
149 // 'CheckCoord' funcs are a simple (not comlete!) approach to
150 // do things right, I will add a better detection soon... the
151 // current approach will be easier to do in hw/accel plugins, imho
155 #define CHKMAX_X 1024
160 lx0=(short)(((int)lx0<<SIGNSHIFT)>>SIGNSHIFT);
161 lx1=(short)(((int)lx1<<SIGNSHIFT)>>SIGNSHIFT);
162 lx2=(short)(((int)lx2<<SIGNSHIFT)>>SIGNSHIFT);
163 lx3=(short)(((int)lx3<<SIGNSHIFT)>>SIGNSHIFT);
164 ly0=(short)(((int)ly0<<SIGNSHIFT)>>SIGNSHIFT);
165 ly1=(short)(((int)ly1<<SIGNSHIFT)>>SIGNSHIFT);
166 ly2=(short)(((int)ly2<<SIGNSHIFT)>>SIGNSHIFT);
167 ly3=(short)(((int)ly3<<SIGNSHIFT)>>SIGNSHIFT);
172 lx0=(short)(((int)lx0<<SIGNSHIFT)>>SIGNSHIFT);
173 lx1=(short)(((int)lx1<<SIGNSHIFT)>>SIGNSHIFT);
174 lx2=(short)(((int)lx2<<SIGNSHIFT)>>SIGNSHIFT);
175 ly0=(short)(((int)ly0<<SIGNSHIFT)>>SIGNSHIFT);
176 ly1=(short)(((int)ly1<<SIGNSHIFT)>>SIGNSHIFT);
177 ly2=(short)(((int)ly2<<SIGNSHIFT)>>SIGNSHIFT);
182 lx0=(short)(((int)lx0<<SIGNSHIFT)>>SIGNSHIFT);
183 lx1=(short)(((int)lx1<<SIGNSHIFT)>>SIGNSHIFT);
184 ly0=(short)(((int)ly0<<SIGNSHIFT)>>SIGNSHIFT);
185 ly1=(short)(((int)ly1<<SIGNSHIFT)>>SIGNSHIFT);
190 lx0=(short)(((int)lx0<<SIGNSHIFT)>>SIGNSHIFT);
191 ly0=(short)(((int)ly0<<SIGNSHIFT)>>SIGNSHIFT);
193 if(lx0<-512 && PSXDisplay.DrawOffset.x<=-512)
196 if(ly0<-512 && PSXDisplay.DrawOffset.y<=-512)
200 ////////////////////////////////////////////////////////////////////////
201 // special checks... nascar, syphon filter 2, mgs
202 ////////////////////////////////////////////////////////////////////////
204 // xenogears FT4: not removed correctly right now... the tri 0,1,2
205 // should get removed, the tri 1,2,3 should stay... pfff
207 // x -466 1023 180 1023
208 // y 20 -228 222 -100
214 __inline BOOL CheckCoord4()
218 if(((lx1-lx0)>CHKMAX_X) ||
219 ((lx2-lx0)>CHKMAX_X))
223 if((lx1-lx3)>CHKMAX_X) return TRUE;
224 if((lx2-lx3)>CHKMAX_X) return TRUE;
230 if((lx0-lx1)>CHKMAX_X) return TRUE;
231 if((lx2-lx1)>CHKMAX_X) return TRUE;
232 if((lx3-lx1)>CHKMAX_X) return TRUE;
236 if((lx0-lx2)>CHKMAX_X) return TRUE;
237 if((lx1-lx2)>CHKMAX_X) return TRUE;
238 if((lx3-lx2)>CHKMAX_X) return TRUE;
242 if(((lx1-lx3)>CHKMAX_X) ||
243 ((lx2-lx3)>CHKMAX_X))
247 if((lx1-lx0)>CHKMAX_X) return TRUE;
248 if((lx2-lx0)>CHKMAX_X) return TRUE;
256 if((ly1-ly0)>CHKMAX_Y) return TRUE;
257 if((ly2-ly0)>CHKMAX_Y) return TRUE;
261 if((ly0-ly1)>CHKMAX_Y) return TRUE;
262 if((ly2-ly1)>CHKMAX_Y) return TRUE;
263 if((ly3-ly1)>CHKMAX_Y) return TRUE;
267 if((ly0-ly2)>CHKMAX_Y) return TRUE;
268 if((ly1-ly2)>CHKMAX_Y) return TRUE;
269 if((ly3-ly2)>CHKMAX_Y) return TRUE;
273 if((ly1-ly3)>CHKMAX_Y) return TRUE;
274 if((ly2-ly3)>CHKMAX_Y) return TRUE;
280 __inline BOOL CheckCoord3()
284 if((lx1-lx0)>CHKMAX_X) return TRUE;
285 if((lx2-lx0)>CHKMAX_X) return TRUE;
289 if((lx0-lx1)>CHKMAX_X) return TRUE;
290 if((lx2-lx1)>CHKMAX_X) return TRUE;
294 if((lx0-lx2)>CHKMAX_X) return TRUE;
295 if((lx1-lx2)>CHKMAX_X) return TRUE;
299 if((ly1-ly0)>CHKMAX_Y) return TRUE;
300 if((ly2-ly0)>CHKMAX_Y) return TRUE;
304 if((ly0-ly1)>CHKMAX_Y) return TRUE;
305 if((ly2-ly1)>CHKMAX_Y) return TRUE;
309 if((ly0-ly2)>CHKMAX_Y) return TRUE;
310 if((ly1-ly2)>CHKMAX_Y) return TRUE;
317 __inline BOOL CheckCoord2()
321 if((lx1-lx0)>CHKMAX_X) return TRUE;
325 if((lx0-lx1)>CHKMAX_X) return TRUE;
329 if((ly1-ly0)>CHKMAX_Y) return TRUE;
333 if((ly0-ly1)>CHKMAX_Y) return TRUE;
339 __inline BOOL CheckCoordL(short slx0,short sly0,short slx1,short sly1)
343 if((slx1-slx0)>CHKMAX_X) return TRUE;
347 if((slx0-slx1)>CHKMAX_X) return TRUE;
351 if((sly1-sly0)>CHKMAX_Y) return TRUE;
355 if((sly0-sly1)>CHKMAX_Y) return TRUE;
362 ////////////////////////////////////////////////////////////////////////
363 // mask stuff... used in silent hill
364 ////////////////////////////////////////////////////////////////////////
366 void cmdSTP(unsigned char * baseAddr)
368 uint32_t gdata = GETLE32(&((uint32_t*)baseAddr)[0]);
370 lGPUstatusRet&=~0x1800; // Clear the necessary bits
371 lGPUstatusRet|=((gdata & 0x03) << 11); // Set the necessary bits
373 if(gdata&1) {sSetMask=0x8000;lSetMask=0x80008000;}
374 else {sSetMask=0; lSetMask=0; }
376 if(gdata&2) bCheckMask=TRUE;
377 else bCheckMask=FALSE;
380 ////////////////////////////////////////////////////////////////////////
381 // cmd: Set texture page infos
382 ////////////////////////////////////////////////////////////////////////
384 void cmdTexturePage(unsigned char * baseAddr)
386 uint32_t gdata = GETLE32(&((uint32_t*)baseAddr)[0]);
388 lGPUstatusRet&=~0x000007ff;
389 lGPUstatusRet|=(gdata & 0x07ff);
391 usMirror=gdata&0x3000;
393 UpdateGlobalTP((unsigned short)gdata);
394 GlobalTextREST = (gdata&0x00ffffff)>>9;
397 ////////////////////////////////////////////////////////////////////////
398 // cmd: turn on/off texture window
399 ////////////////////////////////////////////////////////////////////////
401 void cmdTextureWindow(unsigned char *baseAddr)
403 uint32_t gdata = GETLE32(&((uint32_t*)baseAddr)[0]);
405 uint32_t YAlign,XAlign;
407 lGPUInfoVals[INFO_TW]=gdata&0xFFFFF;
410 TWin.Position.y1 = 8; // xxxx1
411 else if (gdata & 0x040)
412 TWin.Position.y1 = 16; // xxx10
413 else if (gdata & 0x080)
414 TWin.Position.y1 = 32; // xx100
415 else if (gdata & 0x100)
416 TWin.Position.y1 = 64; // x1000
417 else if (gdata & 0x200)
418 TWin.Position.y1 = 128; // 10000
420 TWin.Position.y1 = 256; // 00000
422 // Texture window size is determined by the least bit set of the relevant 5 bits
425 TWin.Position.x1 = 8; // xxxx1
426 else if (gdata & 0x002)
427 TWin.Position.x1 = 16; // xxx10
428 else if (gdata & 0x004)
429 TWin.Position.x1 = 32; // xx100
430 else if (gdata & 0x008)
431 TWin.Position.x1 = 64; // x1000
432 else if (gdata & 0x010)
433 TWin.Position.x1 = 128; // 10000
435 TWin.Position.x1 = 256; // 00000
437 // Re-calculate the bit field, because we can't trust what is passed in the data
440 YAlign = (uint32_t)(32 - (TWin.Position.y1 >> 3));
441 XAlign = (uint32_t)(32 - (TWin.Position.x1 >> 3));
443 // Absolute position of the start of the texture window
445 TWin.Position.y0 = (short)(((gdata >> 15) & YAlign) << 3);
446 TWin.Position.x0 = (short)(((gdata >> 10) & XAlign) << 3);
448 if((TWin.Position.x0 == 0 && // tw turned off
449 TWin.Position.y0 == 0 &&
450 TWin.Position.x1 == 0 &&
451 TWin.Position.y1 == 0) ||
452 (TWin.Position.x1 == 256 &&
453 TWin.Position.y1 == 256))
455 bUsingTWin = FALSE; // -> just do it
459 bUsingTWin = TRUE; // -> tw turned on
463 ////////////////////////////////////////////////////////////////////////
464 // cmd: start of drawing area... primitives will be clipped inside
465 ////////////////////////////////////////////////////////////////////////
469 void cmdDrawAreaStart(unsigned char * baseAddr)
471 uint32_t gdata = GETLE32(&((uint32_t*)baseAddr)[0]);
473 drawX = gdata & 0x3ff; // for soft drawing
477 lGPUInfoVals[INFO_DRAWSTART]=gdata&0x3FFFFF;
478 drawY = (gdata>>12)&0x3ff;
479 if(drawY>=1024) drawY=1023; // some security
483 lGPUInfoVals[INFO_DRAWSTART]=gdata&0xFFFFF;
484 drawY = (gdata>>10)&0x3ff;
485 if(drawY>=512) drawY=511; // some security
489 ////////////////////////////////////////////////////////////////////////
490 // cmd: end of drawing area... primitives will be clipped inside
491 ////////////////////////////////////////////////////////////////////////
493 void cmdDrawAreaEnd(unsigned char * baseAddr)
495 uint32_t gdata = GETLE32(&((uint32_t*)baseAddr)[0]);
497 drawW = gdata & 0x3ff; // for soft drawing
501 lGPUInfoVals[INFO_DRAWEND]=gdata&0x3FFFFF;
502 drawH = (gdata>>12)&0x3ff;
503 if(drawH>=1024) drawH=1023; // some security
507 lGPUInfoVals[INFO_DRAWEND]=gdata&0xFFFFF;
508 drawH = (gdata>>10)&0x3ff;
509 if(drawH>=512) drawH=511; // some security
513 ////////////////////////////////////////////////////////////////////////
514 // cmd: draw offset... will be added to prim coords
515 ////////////////////////////////////////////////////////////////////////
517 void cmdDrawOffset(unsigned char * baseAddr)
519 uint32_t gdata = GETLE32(&((uint32_t*)baseAddr)[0]);
521 PSXDisplay.DrawOffset.x = (short)(gdata & 0x7ff);
525 lGPUInfoVals[INFO_DRAWOFF]=gdata&0x7FFFFF;
526 PSXDisplay.DrawOffset.y = (short)((gdata>>12) & 0x7ff);
530 lGPUInfoVals[INFO_DRAWOFF]=gdata&0x3FFFFF;
531 PSXDisplay.DrawOffset.y = (short)((gdata>>11) & 0x7ff);
534 PSXDisplay.DrawOffset.y=(short)(((int)PSXDisplay.DrawOffset.y<<21)>>21);
535 PSXDisplay.DrawOffset.x=(short)(((int)PSXDisplay.DrawOffset.x<<21)>>21);
538 ////////////////////////////////////////////////////////////////////////
539 // cmd: load image to vram
540 ////////////////////////////////////////////////////////////////////////
542 void primLoadImage(unsigned char * baseAddr)
544 unsigned short *sgpuData = ((unsigned short *) baseAddr);
546 VRAMWrite.x = GETLEs16(&sgpuData[2])&0x3ff;
547 VRAMWrite.y = GETLEs16(&sgpuData[3])&iGPUHeightMask;
548 VRAMWrite.Width = GETLEs16(&sgpuData[4]);
549 VRAMWrite.Height = GETLEs16(&sgpuData[5]);
551 DataWriteMode = DR_VRAMTRANSFER;
553 VRAMWrite.ImagePtr = psxVuw + (VRAMWrite.y<<10) + VRAMWrite.x;
554 VRAMWrite.RowsRemaining = VRAMWrite.Width;
555 VRAMWrite.ColsRemaining = VRAMWrite.Height;
558 ////////////////////////////////////////////////////////////////////////
559 // cmd: vram -> psx mem
560 ////////////////////////////////////////////////////////////////////////
562 void primStoreImage(unsigned char * baseAddr)
564 unsigned short *sgpuData = ((unsigned short *) baseAddr);
566 VRAMRead.x = GETLEs16(&sgpuData[2])&0x03ff;
567 VRAMRead.y = GETLEs16(&sgpuData[3])&iGPUHeightMask;
568 VRAMRead.Width = GETLEs16(&sgpuData[4]);
569 VRAMRead.Height = GETLEs16(&sgpuData[5]);
571 VRAMRead.ImagePtr = psxVuw + (VRAMRead.y<<10) + VRAMRead.x;
572 VRAMRead.RowsRemaining = VRAMRead.Width;
573 VRAMRead.ColsRemaining = VRAMRead.Height;
575 DataReadMode = DR_VRAMTRANSFER;
577 lGPUstatusRet |= GPUSTATUS_READYFORVRAM;
580 ////////////////////////////////////////////////////////////////////////
581 // cmd: blkfill - NO primitive! Doesn't care about draw areas...
582 ////////////////////////////////////////////////////////////////////////
584 void primBlkFill(unsigned char * baseAddr)
586 uint32_t *gpuData = ((uint32_t *) baseAddr);
587 short *sgpuData = ((short *) baseAddr);
589 short sX = GETLEs16(&sgpuData[2]);
590 short sY = GETLEs16(&sgpuData[3]);
591 short sW = GETLEs16(&sgpuData[4]) & 0x3ff;
592 short sH = GETLEs16(&sgpuData[5]) & 0x3ff;
596 // Increase H & W if they are one short of full values, because they never can be full values
597 if (sH >= 1023) sH=1024;
598 if (sW >= 1023) sW=1024;
600 // x and y of end pos
604 FillSoftwareArea(sX, sY, sW, sH, BGR24to16(GETLE32(&gpuData[0])));
609 ////////////////////////////////////////////////////////////////////////
610 // cmd: move image vram -> vram
611 ////////////////////////////////////////////////////////////////////////
613 void primMoveImage(unsigned char * baseAddr)
615 short *sgpuData = ((short *) baseAddr);
617 short imageY0,imageX0,imageY1,imageX1,imageSX,imageSY,i,j;
619 imageX0 = GETLEs16(&sgpuData[2])&0x03ff;
620 imageY0 = GETLEs16(&sgpuData[3])&iGPUHeightMask;
621 imageX1 = GETLEs16(&sgpuData[4])&0x03ff;
622 imageY1 = GETLEs16(&sgpuData[5])&iGPUHeightMask;
623 imageSX = GETLEs16(&sgpuData[6]);
624 imageSY = GETLEs16(&sgpuData[7]);
626 if((imageX0 == imageX1) && (imageY0 == imageY1)) return;
627 if(imageSX<=0) return;
628 if(imageSY<=0) return;
630 // ZN SF2: screwed moves
632 // move sgpuData[2],sgpuData[3],sgpuData[4],sgpuData[5],sgpuData[6],sgpuData[7]
634 // move 365 182 32723 -21846 17219 15427
635 // move 127 160 147 -1 20817 13409
636 // move 141 165 16275 -21862 -32126 13442
637 // move 161 136 24620 -1 16962 13388
638 // move 168 138 32556 -13090 -29556 15500
640 // and here's the hack for it:
642 if(iGPUHeight==1024 && GETLEs16(&sgpuData[7])>1024) return;
644 if((imageY0+imageSY)>iGPUHeight ||
645 (imageX0+imageSX)>1024 ||
646 (imageY1+imageSY)>iGPUHeight ||
647 (imageX1+imageSX)>1024)
650 for(j=0;j<imageSY;j++)
651 for(i=0;i<imageSX;i++)
652 psxVuw [(1024*((imageY1+j)&iGPUHeightMask))+((imageX1+i)&0x3ff)]=
653 psxVuw[(1024*((imageY0+j)&iGPUHeightMask))+((imageX0+i)&0x3ff)];
660 if(imageSX&1) // not dword aligned? slower func
662 unsigned short *SRCPtr, *DSTPtr;
663 unsigned short LineOffset;
665 SRCPtr = psxVuw + (1024*imageY0) + imageX0;
666 DSTPtr = psxVuw + (1024*imageY1) + imageX1;
668 LineOffset = 1024 - imageSX;
670 for(j=0;j<imageSY;j++)
672 for(i=0;i<imageSX;i++) *DSTPtr++ = *SRCPtr++;
673 SRCPtr += LineOffset;
674 DSTPtr += LineOffset;
677 else // dword aligned
679 uint32_t *SRCPtr, *DSTPtr;
680 unsigned short LineOffset;
683 SRCPtr = (uint32_t *)(psxVuw + (1024*imageY0) + imageX0);
684 DSTPtr = (uint32_t *)(psxVuw + (1024*imageY1) + imageX1);
686 LineOffset = 512 - dx;
688 for(j=0;j<imageSY;j++)
690 for(i=0;i<dx;i++) *DSTPtr++ = *SRCPtr++;
691 SRCPtr += LineOffset;
692 DSTPtr += LineOffset;
700 if(!PSXDisplay.Interlaced) // stupid frame skip stuff
703 imageX1<PSXDisplay.DisplayEnd.x &&
704 imageSX>=PSXDisplay.DisplayPosition.x &&
705 imageY1<PSXDisplay.DisplayEnd.y &&
706 imageSY>=PSXDisplay.DisplayPosition.y)
714 ////////////////////////////////////////////////////////////////////////
715 // cmd: draw free-size Tile
716 ////////////////////////////////////////////////////////////////////////
719 //#include <dbgout.h>
721 void primTileS(unsigned char * baseAddr)
723 uint32_t *gpuData = ((uint32_t*)baseAddr);
724 short *sgpuData = ((short *) baseAddr);
725 short sW = GETLEs16(&sgpuData[4]) & 0x3ff;
726 short sH = GETLEs16(&sgpuData[5]) & iGPUHeightMask; // mmm... limit tiles to 0x1ff or height?
728 lx0 = GETLEs16(&sgpuData[2]);
729 ly0 = GETLEs16(&sgpuData[3]);
731 if(!(dwActFixes&8)) AdjustCoord1();
734 ly2 = ly3 = ly0+sH +PSXDisplay.DrawOffset.y;
735 ly0 = ly1 = ly0 +PSXDisplay.DrawOffset.y;
736 lx1 = lx2 = lx0+sW +PSXDisplay.DrawOffset.x;
737 lx0 = lx3 = lx0 +PSXDisplay.DrawOffset.x;
739 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
741 if(!(iTileCheat && sH==32 && GETLE32(&gpuData[0])==0x60ffffff)) // special cheat for certain ZiNc games
742 FillSoftwareAreaTrans(lx0,ly0,lx2,ly2,
743 BGR24to16(GETLE32(&gpuData[0])));
748 ////////////////////////////////////////////////////////////////////////
749 // cmd: draw 1 dot Tile (point)
750 ////////////////////////////////////////////////////////////////////////
752 void primTile1(unsigned char * baseAddr)
754 uint32_t *gpuData = ((uint32_t*)baseAddr);
755 short *sgpuData = ((short *) baseAddr);
759 lx0 = GETLEs16(&sgpuData[2]);
760 ly0 = GETLEs16(&sgpuData[3]);
762 if(!(dwActFixes&8)) AdjustCoord1();
765 ly2 = ly3 = ly0+sH +PSXDisplay.DrawOffset.y;
766 ly0 = ly1 = ly0 +PSXDisplay.DrawOffset.y;
767 lx1 = lx2 = lx0+sW +PSXDisplay.DrawOffset.x;
768 lx0 = lx3 = lx0 +PSXDisplay.DrawOffset.x;
770 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
772 FillSoftwareAreaTrans(lx0,ly0,lx2,ly2,
773 BGR24to16(GETLE32(&gpuData[0]))); // Takes Start and Offset
778 ////////////////////////////////////////////////////////////////////////
779 // cmd: draw 8 dot Tile (small rect)
780 ////////////////////////////////////////////////////////////////////////
782 void primTile8(unsigned char * baseAddr)
784 uint32_t *gpuData = ((uint32_t*)baseAddr);
785 short *sgpuData = ((short *) baseAddr);
789 lx0 = GETLEs16(&sgpuData[2]);
790 ly0 = GETLEs16(&sgpuData[3]);
792 if(!(dwActFixes&8)) AdjustCoord1();
795 ly2 = ly3 = ly0+sH +PSXDisplay.DrawOffset.y;
796 ly0 = ly1 = ly0 +PSXDisplay.DrawOffset.y;
797 lx1 = lx2 = lx0+sW +PSXDisplay.DrawOffset.x;
798 lx0 = lx3 = lx0 +PSXDisplay.DrawOffset.x;
800 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
802 FillSoftwareAreaTrans(lx0,ly0,lx2,ly2,
803 BGR24to16(GETLE32(&gpuData[0]))); // Takes Start and Offset
808 ////////////////////////////////////////////////////////////////////////
809 // cmd: draw 16 dot Tile (medium rect)
810 ////////////////////////////////////////////////////////////////////////
812 void primTile16(unsigned char * baseAddr)
814 uint32_t *gpuData = ((uint32_t*)baseAddr);
815 short *sgpuData = ((short *) baseAddr);
819 lx0 = GETLEs16(&sgpuData[2]);
820 ly0 = GETLEs16(&sgpuData[3]);
822 if(!(dwActFixes&8)) AdjustCoord1();
825 ly2 = ly3 = ly0+sH +PSXDisplay.DrawOffset.y;
826 ly0 = ly1 = ly0 +PSXDisplay.DrawOffset.y;
827 lx1 = lx2 = lx0+sW +PSXDisplay.DrawOffset.x;
828 lx0 = lx3 = lx0 +PSXDisplay.DrawOffset.x;
830 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
832 FillSoftwareAreaTrans(lx0,ly0,lx2,ly2,
833 BGR24to16(GETLE32(&gpuData[0]))); // Takes Start and Offset
838 ////////////////////////////////////////////////////////////////////////
839 // cmd: small sprite (textured rect)
840 ////////////////////////////////////////////////////////////////////////
842 void primSprt8(unsigned char * baseAddr)
844 uint32_t *gpuData = ((uint32_t *) baseAddr);
845 short *sgpuData = ((short *) baseAddr);
847 lx0 = GETLEs16(&sgpuData[2]);
848 ly0 = GETLEs16(&sgpuData[3]);
850 if(!(dwActFixes&8)) AdjustCoord1();
852 SetRenderMode(GETLE32(&gpuData[0]));
854 if(bUsingTWin) DrawSoftwareSpriteTWin(baseAddr,8,8);
856 if(usMirror) DrawSoftwareSpriteMirror(baseAddr,8,8);
857 else DrawSoftwareSprite(baseAddr,8,8,
864 ////////////////////////////////////////////////////////////////////////
865 // cmd: medium sprite (textured rect)
866 ////////////////////////////////////////////////////////////////////////
868 void primSprt16(unsigned char * baseAddr)
870 uint32_t *gpuData = ((uint32_t *) baseAddr);
871 short *sgpuData = ((short *) baseAddr);
873 lx0 = GETLEs16(&sgpuData[2]);
874 ly0 = GETLEs16(&sgpuData[3]);
876 if(!(dwActFixes&8)) AdjustCoord1();
878 SetRenderMode(GETLE32(&gpuData[0]));
880 if(bUsingTWin) DrawSoftwareSpriteTWin(baseAddr,16,16);
882 if(usMirror) DrawSoftwareSpriteMirror(baseAddr,16,16);
883 else DrawSoftwareSprite(baseAddr,16,16,
890 ////////////////////////////////////////////////////////////////////////
891 // cmd: free-size sprite (textured rect)
892 ////////////////////////////////////////////////////////////////////////
894 // func used on texture coord wrap
895 void primSprtSRest(unsigned char * baseAddr,unsigned short type)
897 uint32_t *gpuData = ((uint32_t *) baseAddr);
898 short *sgpuData = ((short *) baseAddr);
899 unsigned short sTypeRest=0;
902 short sX = GETLEs16(&sgpuData[2]);
903 short sY = GETLEs16(&sgpuData[3]);
904 short sW = GETLEs16(&sgpuData[6]) & 0x3ff;
905 short sH = GETLEs16(&sgpuData[7]) & 0x1ff;
906 short tX = baseAddr[8];
907 short tY = baseAddr[9];
957 SetRenderMode(GETLE32(&gpuData[0]));
959 if(tX+sW>256) {sW=256-tX;sTypeRest+=1;}
960 if(tY+sH>256) {sH=256-tY;sTypeRest+=2;}
965 if(!(dwActFixes&8)) AdjustCoord1();
967 DrawSoftwareSprite(baseAddr,sW,sH,tX,tY);
969 if(sTypeRest && type<4)
971 if(sTypeRest&1 && type==1) primSprtSRest(baseAddr,4);
972 if(sTypeRest&2 && type==2) primSprtSRest(baseAddr,5);
973 if(sTypeRest==3 && type==3) primSprtSRest(baseAddr,6);
978 ////////////////////////////////////////////////////////////////////////
980 void primSprtS(unsigned char * baseAddr)
982 uint32_t *gpuData = ((uint32_t *) baseAddr);
983 short *sgpuData = ((short *) baseAddr);
986 lx0 = GETLEs16(&sgpuData[2]);
987 ly0 = GETLEs16(&sgpuData[3]);
989 if(!(dwActFixes&8)) AdjustCoord1();
991 sW = GETLEs16(&sgpuData[6]) & 0x3ff;
992 sH = GETLEs16(&sgpuData[7]) & 0x1ff;
994 SetRenderMode(GETLE32(&gpuData[0]));
996 if(bUsingTWin) DrawSoftwareSpriteTWin(baseAddr,sW,sH);
998 if(usMirror) DrawSoftwareSpriteMirror(baseAddr,sW,sH);
1001 unsigned short sTypeRest=0;
1002 short tX=baseAddr[8];
1003 short tY=baseAddr[9];
1005 if(tX+sW>256) {sW=256-tX;sTypeRest+=1;}
1006 if(tY+sH>256) {sH=256-tY;sTypeRest+=2;}
1008 DrawSoftwareSprite(baseAddr,sW,sH,tX,tY);
1012 if(sTypeRest&1) primSprtSRest(baseAddr,1);
1013 if(sTypeRest&2) primSprtSRest(baseAddr,2);
1014 if(sTypeRest==3) primSprtSRest(baseAddr,3);
1019 bDoVSyncUpdate=TRUE;
1022 ////////////////////////////////////////////////////////////////////////
1023 // cmd: flat shaded Poly4
1024 ////////////////////////////////////////////////////////////////////////
1026 void primPolyF4(unsigned char *baseAddr)
1028 uint32_t *gpuData = ((uint32_t *) baseAddr);
1029 short *sgpuData = ((short *) baseAddr);
1031 lx0 = GETLEs16(&sgpuData[2]);
1032 ly0 = GETLEs16(&sgpuData[3]);
1033 lx1 = GETLEs16(&sgpuData[4]);
1034 ly1 = GETLEs16(&sgpuData[5]);
1035 lx2 = GETLEs16(&sgpuData[6]);
1036 ly2 = GETLEs16(&sgpuData[7]);
1037 lx3 = GETLEs16(&sgpuData[8]);
1038 ly3 = GETLEs16(&sgpuData[9]);
1043 if(CheckCoord4()) return;
1047 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
1049 drawPoly4F(GETLE32(&gpuData[0]));
1051 bDoVSyncUpdate=TRUE;
1054 ////////////////////////////////////////////////////////////////////////
1055 // cmd: smooth shaded Poly4
1056 ////////////////////////////////////////////////////////////////////////
1058 void primPolyG4(unsigned char * baseAddr)
1060 uint32_t *gpuData = (uint32_t *)baseAddr;
1061 short *sgpuData = ((short *) baseAddr);
1063 lx0 = GETLEs16(&sgpuData[2]);
1064 ly0 = GETLEs16(&sgpuData[3]);
1065 lx1 = GETLEs16(&sgpuData[6]);
1066 ly1 = GETLEs16(&sgpuData[7]);
1067 lx2 = GETLEs16(&sgpuData[10]);
1068 ly2 = GETLEs16(&sgpuData[11]);
1069 lx3 = GETLEs16(&sgpuData[14]);
1070 ly3 = GETLEs16(&sgpuData[15]);
1075 if(CheckCoord4()) return;
1079 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
1081 drawPoly4G(GETLE32(&gpuData[0]), GETLE32(&gpuData[2]),
1082 GETLE32(&gpuData[4]), GETLE32(&gpuData[6]));
1084 bDoVSyncUpdate=TRUE;
1087 ////////////////////////////////////////////////////////////////////////
1088 // cmd: flat shaded Texture3
1089 ////////////////////////////////////////////////////////////////////////
1091 void primPolyFT3(unsigned char * baseAddr)
1093 uint32_t *gpuData = ((uint32_t *) baseAddr);
1094 short *sgpuData = ((short *) baseAddr);
1096 lx0 = GETLEs16(&sgpuData[2]);
1097 ly0 = GETLEs16(&sgpuData[3]);
1098 lx1 = GETLEs16(&sgpuData[6]);
1099 ly1 = GETLEs16(&sgpuData[7]);
1100 lx2 = GETLEs16(&sgpuData[10]);
1101 ly2 = GETLEs16(&sgpuData[11]);
1103 lLowerpart=GETLE32(&gpuData[4])>>16;
1104 UpdateGlobalTP((unsigned short)lLowerpart);
1109 if(CheckCoord3()) return;
1113 SetRenderMode(GETLE32(&gpuData[0]));
1115 drawPoly3FT(baseAddr);
1117 bDoVSyncUpdate=TRUE;
1120 ////////////////////////////////////////////////////////////////////////
1121 // cmd: flat shaded Texture4
1122 ////////////////////////////////////////////////////////////////////////
1124 void primPolyFT4(unsigned char * baseAddr)
1126 uint32_t *gpuData = ((uint32_t *) baseAddr);
1127 short *sgpuData = ((short *) baseAddr);
1129 lx0 = GETLEs16(&sgpuData[2]);
1130 ly0 = GETLEs16(&sgpuData[3]);
1131 lx1 = GETLEs16(&sgpuData[6]);
1132 ly1 = GETLEs16(&sgpuData[7]);
1133 lx2 = GETLEs16(&sgpuData[10]);
1134 ly2 = GETLEs16(&sgpuData[11]);
1135 lx3 = GETLEs16(&sgpuData[14]);
1136 ly3 = GETLEs16(&sgpuData[15]);
1138 lLowerpart=GETLE32(&gpuData[4])>>16;
1139 UpdateGlobalTP((unsigned short)lLowerpart);
1144 if(CheckCoord4()) return;
1149 SetRenderMode(GETLE32(&gpuData[0]));
1151 drawPoly4FT(baseAddr);
1153 bDoVSyncUpdate=TRUE;
1156 ////////////////////////////////////////////////////////////////////////
1157 // cmd: smooth shaded Texture3
1158 ////////////////////////////////////////////////////////////////////////
1160 void primPolyGT3(unsigned char *baseAddr)
1162 uint32_t *gpuData = ((uint32_t *) baseAddr);
1163 short *sgpuData = ((short *) baseAddr);
1165 lx0 = GETLEs16(&sgpuData[2]);
1166 ly0 = GETLEs16(&sgpuData[3]);
1167 lx1 = GETLEs16(&sgpuData[8]);
1168 ly1 = GETLEs16(&sgpuData[9]);
1169 lx2 = GETLEs16(&sgpuData[14]);
1170 ly2 = GETLEs16(&sgpuData[15]);
1172 lLowerpart=GETLE32(&gpuData[5])>>16;
1173 UpdateGlobalTP((unsigned short)lLowerpart);
1178 if(CheckCoord3()) return;
1182 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
1184 if(SHADETEXBIT(GETLE32(&gpuData[0])))
1186 gpuData[0] = (gpuData[0]&HOST2LE32(0xff000000))|HOST2LE32(0x00808080);
1187 gpuData[3] = (gpuData[3]&HOST2LE32(0xff000000))|HOST2LE32(0x00808080);
1188 gpuData[6] = (gpuData[6]&HOST2LE32(0xff000000))|HOST2LE32(0x00808080);
1191 drawPoly3GT(baseAddr);
1193 bDoVSyncUpdate=TRUE;
1196 ////////////////////////////////////////////////////////////////////////
1197 // cmd: smooth shaded Poly3
1198 ////////////////////////////////////////////////////////////////////////
1200 void primPolyG3(unsigned char *baseAddr)
1202 uint32_t *gpuData = ((uint32_t *) baseAddr);
1203 short *sgpuData = ((short *) baseAddr);
1205 lx0 = GETLEs16(&sgpuData[2]);
1206 ly0 = GETLEs16(&sgpuData[3]);
1207 lx1 = GETLEs16(&sgpuData[6]);
1208 ly1 = GETLEs16(&sgpuData[7]);
1209 lx2 = GETLEs16(&sgpuData[10]);
1210 ly2 = GETLEs16(&sgpuData[11]);
1215 if(CheckCoord3()) return;
1219 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
1221 drawPoly3G(GETLE32(&gpuData[0]), GETLE32(&gpuData[2]), GETLE32(&gpuData[4]));
1223 bDoVSyncUpdate=TRUE;
1226 ////////////////////////////////////////////////////////////////////////
1227 // cmd: smooth shaded Texture4
1228 ////////////////////////////////////////////////////////////////////////
1230 void primPolyGT4(unsigned char *baseAddr)
1232 uint32_t *gpuData = ((uint32_t *) baseAddr);
1233 short *sgpuData = ((short *) baseAddr);
1235 lx0 = GETLEs16(&sgpuData[2]);
1236 ly0 = GETLEs16(&sgpuData[3]);
1237 lx1 = GETLEs16(&sgpuData[8]);
1238 ly1 = GETLEs16(&sgpuData[9]);
1239 lx2 = GETLEs16(&sgpuData[14]);
1240 ly2 = GETLEs16(&sgpuData[15]);
1241 lx3 = GETLEs16(&sgpuData[20]);
1242 ly3 = GETLEs16(&sgpuData[21]);
1244 lLowerpart=GETLE32(&gpuData[5])>>16;
1245 UpdateGlobalTP((unsigned short)lLowerpart);
1250 if(CheckCoord4()) return;
1254 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
1256 if(SHADETEXBIT(GETLE32(&gpuData[0])))
1258 gpuData[0] = (gpuData[0]&HOST2LE32(0xff000000))|HOST2LE32(0x00808080);
1259 gpuData[3] = (gpuData[3]&HOST2LE32(0xff000000))|HOST2LE32(0x00808080);
1260 gpuData[6] = (gpuData[6]&HOST2LE32(0xff000000))|HOST2LE32(0x00808080);
1261 gpuData[9] = (gpuData[9]&HOST2LE32(0xff000000))|HOST2LE32(0x00808080);
1264 drawPoly4GT(baseAddr);
1266 bDoVSyncUpdate=TRUE;
1269 ////////////////////////////////////////////////////////////////////////
1270 // cmd: smooth shaded Poly3
1271 ////////////////////////////////////////////////////////////////////////
1273 void primPolyF3(unsigned char *baseAddr)
1275 uint32_t *gpuData = ((uint32_t *) baseAddr);
1276 short *sgpuData = ((short *) baseAddr);
1278 lx0 = GETLEs16(&sgpuData[2]);
1279 ly0 = GETLEs16(&sgpuData[3]);
1280 lx1 = GETLEs16(&sgpuData[4]);
1281 ly1 = GETLEs16(&sgpuData[5]);
1282 lx2 = GETLEs16(&sgpuData[6]);
1283 ly2 = GETLEs16(&sgpuData[7]);
1288 if(CheckCoord3()) return;
1292 SetRenderMode(GETLE32(&gpuData[0]));
1294 drawPoly3F(GETLE32(&gpuData[0]));
1296 bDoVSyncUpdate=TRUE;
1299 ////////////////////////////////////////////////////////////////////////
1300 // cmd: skipping shaded polylines
1301 ////////////////////////////////////////////////////////////////////////
1303 void primLineGSkip(unsigned char *baseAddr)
1305 uint32_t *gpuData = ((uint32_t *) baseAddr);
1309 ly1 = (short)((GETLE32(&gpuData[1])>>16) & 0xffff);
1310 lx1 = (short)(GETLE32(&gpuData[1]) & 0xffff);
1312 while(!(((GETLE32(&gpuData[i]) & 0xF000F000) == 0x50005000) && i>=4))
1315 ly1 = (short)((GETLE32(&gpuData[i])>>16) & 0xffff);
1316 lx1 = (short)(GETLE32(&gpuData[i]) & 0xffff);
1317 i++;if(i>iMax) break;
1321 ////////////////////////////////////////////////////////////////////////
1322 // cmd: shaded polylines
1323 ////////////////////////////////////////////////////////////////////////
1325 void primLineGEx(unsigned char *baseAddr)
1327 uint32_t *gpuData = ((uint32_t *) baseAddr);
1330 short slx0,slx1,sly0,sly1;int i=2;BOOL bDraw=TRUE;
1332 sly1 = (short)((GETLE32(&gpuData[1])>>16) & 0xffff);
1333 slx1 = (short)(GETLE32(&gpuData[1]) & 0xffff);
1337 slx1=(short)(((int)slx1<<SIGNSHIFT)>>SIGNSHIFT);
1338 sly1=(short)(((int)sly1<<SIGNSHIFT)>>SIGNSHIFT);
1341 lc1 = gpuData[0] & 0xffffff;
1343 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
1345 while(!(((GETLE32(&gpuData[i]) & 0xF000F000) == 0x50005000) && i>=4))
1347 sly0=sly1; slx0=slx1; lc0=lc1;
1348 lc1=GETLE32(&gpuData[i]) & 0xffffff;
1352 // no check needed on gshaded polyline positions
1353 // if((gpuData[i] & 0xF000F000) == 0x50005000) break;
1355 sly1 = (short)((GETLE32(&gpuData[i])>>16) & 0xffff);
1356 slx1 = (short)(GETLE32(&gpuData[i]) & 0xffff);
1360 slx1=(short)(((int)slx1<<SIGNSHIFT)>>SIGNSHIFT);
1361 sly1=(short)(((int)sly1<<SIGNSHIFT)>>SIGNSHIFT);
1362 if(CheckCoordL(slx0,sly0,slx1,sly1)) bDraw=FALSE; else bDraw=TRUE;
1365 if ((lx0 != lx1) || (ly0 != ly1))
1373 if(bDraw) DrawSoftwareLineShade(lc0, lc1);
1379 bDoVSyncUpdate=TRUE;
1382 ////////////////////////////////////////////////////////////////////////
1383 // cmd: shaded polyline2
1384 ////////////////////////////////////////////////////////////////////////
1386 void primLineG2(unsigned char *baseAddr)
1388 uint32_t *gpuData = ((uint32_t *) baseAddr);
1389 short *sgpuData = ((short *) baseAddr);
1391 lx0 = GETLEs16(&sgpuData[2]);
1392 ly0 = GETLEs16(&sgpuData[3]);
1393 lx1 = GETLEs16(&sgpuData[6]);
1394 ly1 = GETLEs16(&sgpuData[7]);
1399 if(CheckCoord2()) return;
1402 if((lx0 == lx1) && (ly0 == ly1)) {lx1++;ly1++;}
1404 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
1406 DrawSoftwareLineShade(GETLE32(&gpuData[0]),GETLE32(&gpuData[2]));
1408 bDoVSyncUpdate=TRUE;
1411 ////////////////////////////////////////////////////////////////////////
1412 // cmd: skipping flat polylines
1413 ////////////////////////////////////////////////////////////////////////
1415 void primLineFSkip(unsigned char *baseAddr)
1417 uint32_t *gpuData = ((uint32_t *) baseAddr);
1420 ly1 = (short)((GETLE32(&gpuData[1])>>16) & 0xffff);
1421 lx1 = (short)(GETLE32(&gpuData[1]) & 0xffff);
1423 while(!(((GETLE32(&gpuData[i]) & 0xF000F000) == 0x50005000) && i>=3))
1425 ly1 = (short)((GETLE32(&gpuData[i])>>16) & 0xffff);
1426 lx1 = (short)(GETLE32(&gpuData[i]) & 0xffff);
1427 i++;if(i>iMax) break;
1431 ////////////////////////////////////////////////////////////////////////
1432 // cmd: drawing flat polylines
1433 ////////////////////////////////////////////////////////////////////////
1435 void primLineFEx(unsigned char *baseAddr)
1437 uint32_t *gpuData = ((uint32_t *) baseAddr);
1439 short slx0,slx1,sly0,sly1;int i=2;BOOL bDraw=TRUE;
1443 sly1 = (short)((GETLE32(&gpuData[1])>>16) & 0xffff);
1444 slx1 = (short)(GETLE32(&gpuData[1]) & 0xffff);
1447 slx1=(short)(((int)slx1<<SIGNSHIFT)>>SIGNSHIFT);
1448 sly1=(short)(((int)sly1<<SIGNSHIFT)>>SIGNSHIFT);
1451 SetRenderMode(GETLE32(&gpuData[0]));
1453 while(!(((GETLE32(&gpuData[i]) & 0xF000F000) == 0x50005000) && i>=3))
1455 sly0 = sly1;slx0=slx1;
1456 sly1 = (short)((GETLE32(&gpuData[i])>>16) & 0xffff);
1457 slx1 = (short)(GETLE32(&gpuData[i]) & 0xffff);
1460 slx1=(short)(((int)slx1<<SIGNSHIFT)>>SIGNSHIFT);
1461 sly1=(short)(((int)sly1<<SIGNSHIFT)>>SIGNSHIFT);
1463 if(CheckCoordL(slx0,sly0,slx1,sly1)) bDraw=FALSE; else bDraw=TRUE;
1472 if(bDraw) DrawSoftwareLineFlat(GETLE32(&gpuData[0]));
1474 i++;if(i>iMax) break;
1477 bDoVSyncUpdate=TRUE;
1480 ////////////////////////////////////////////////////////////////////////
1481 // cmd: drawing flat polyline2
1482 ////////////////////////////////////////////////////////////////////////
1484 void primLineF2(unsigned char *baseAddr)
1486 uint32_t *gpuData = ((uint32_t *) baseAddr);
1487 short *sgpuData = ((short *) baseAddr);
1489 lx0 = GETLEs16(&sgpuData[2]);
1490 ly0 = GETLEs16(&sgpuData[3]);
1491 lx1 = GETLEs16(&sgpuData[4]);
1492 ly1 = GETLEs16(&sgpuData[5]);
1497 if(CheckCoord2()) return;
1500 if((lx0 == lx1) && (ly0 == ly1)) {lx1++;ly1++;}
1503 SetRenderMode(GETLE32(&gpuData[0]));
1505 DrawSoftwareLineFlat(GETLE32(&gpuData[0]));
1507 bDoVSyncUpdate=TRUE;
1510 ////////////////////////////////////////////////////////////////////////
1511 // cmd: well, easiest command... not implemented
1512 ////////////////////////////////////////////////////////////////////////
1514 void primNI(unsigned char *bA)
1518 ////////////////////////////////////////////////////////////////////////
1519 // cmd func ptr table
1520 ////////////////////////////////////////////////////////////////////////
1523 void (*primTableJ[256])(unsigned char *) =
1526 primNI,primNI,primBlkFill,primNI,primNI,primNI,primNI,primNI,
1528 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1530 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1532 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1534 primPolyF3,primPolyF3,primPolyF3,primPolyF3,primPolyFT3,primPolyFT3,primPolyFT3,primPolyFT3,
1536 primPolyF4,primPolyF4,primPolyF4,primPolyF4,primPolyFT4,primPolyFT4,primPolyFT4,primPolyFT4,
1538 primPolyG3,primPolyG3,primPolyG3,primPolyG3,primPolyGT3,primPolyGT3,primPolyGT3,primPolyGT3,
1540 primPolyG4,primPolyG4,primPolyG4,primPolyG4,primPolyGT4,primPolyGT4,primPolyGT4,primPolyGT4,
1542 primLineF2,primLineF2,primLineF2,primLineF2,primNI,primNI,primNI,primNI,
1544 primLineFEx,primLineFEx,primLineFEx,primLineFEx,primLineFEx,primLineFEx,primLineFEx,primLineFEx,
1546 primLineG2,primLineG2,primLineG2,primLineG2,primNI,primNI,primNI,primNI,
1548 primLineGEx,primLineGEx,primLineGEx,primLineGEx,primLineGEx,primLineGEx,primLineGEx,primLineGEx,
1550 primTileS,primTileS,primTileS,primTileS,primSprtS,primSprtS,primSprtS,primSprtS,
1552 primTile1,primTile1,primTile1,primTile1,primNI,primNI,primNI,primNI,
1554 primTile8,primTile8,primTile8,primTile8,primSprt8,primSprt8,primSprt8,primSprt8,
1556 primTile16,primTile16,primTile16,primTile16,primSprt16,primSprt16,primSprt16,primSprt16,
1558 primMoveImage,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1560 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1562 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1564 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1566 primLoadImage,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1568 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1570 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1572 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1574 primStoreImage,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1576 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1578 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1580 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1582 primNI,cmdTexturePage,cmdTextureWindow,cmdDrawAreaStart,cmdDrawAreaEnd,cmdDrawOffset,cmdSTP,primNI,
1584 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1586 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1588 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI
1591 ////////////////////////////////////////////////////////////////////////
1592 // cmd func ptr table for skipping
1593 ////////////////////////////////////////////////////////////////////////
1595 void (*primTableSkip[256])(unsigned char *) =
1598 primNI,primNI,primBlkFill,primNI,primNI,primNI,primNI,primNI,
1600 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1602 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1604 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1606 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1608 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1610 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1612 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1614 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1616 primLineFSkip,primLineFSkip,primLineFSkip,primLineFSkip,primLineFSkip,primLineFSkip,primLineFSkip,primLineFSkip,
1618 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1620 primLineGSkip,primLineGSkip,primLineGSkip,primLineGSkip,primLineGSkip,primLineGSkip,primLineGSkip,primLineGSkip,
1622 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1624 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1626 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1628 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1630 primMoveImage,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1632 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1634 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1636 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1638 primLoadImage,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1640 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1642 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1644 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1646 primStoreImage,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1648 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1650 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1652 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1654 primNI,cmdTexturePage,cmdTextureWindow,cmdDrawAreaStart,cmdDrawAreaEnd,cmdDrawOffset,cmdSTP,primNI,
1656 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1658 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1660 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI