File: common\targa.c

    1 /** targa.c **/
    2 
    3 #ifdef __TURBOC__
4 # pragma warn -par
5 #endif 6 7 #define TARGA_DATA 8 9 #include <string.h> 10 #ifndef XFRACT 11 #include <conio.h> 12 #endif 13 14 /* see Fractint.c for a description of the "include" hierarchy */ 15 #include "port.h" 16 #include "prototyp.h" 17 #include "targa.h" 18 19 /************* ****************/ 20 21 void WriteTGA( int x, int y, int index ); 22 int ReadTGA ( int x, int y ); 23 void EndTGA ( void ); 24 void StartTGA( void ); 25 void ReopenTGA( void ); 26 27 /************* ****************/ 28 29 static unsigned _fastcall near Row16Calculate(unsigned,unsigned); 30 static void _fastcall near PutPix16(int,int,int); 31 static unsigned _fastcall near GetPix16(int,int); 32 static unsigned _fastcall near Row32Calculate(unsigned,unsigned); 33 static void _fastcall near PutPix32(int,int,int); 34 static unsigned _fastcall near GetPix32(int,int); 35 static void _fastcall near DoFirstPixel(int,int,int); 36 static void _fastcall fatalerror(char far *); 37 static int GetLine(int); 38 static void _fastcall near SetDispReg(int,int); 39 static int VWait(void); 40 static void _fastcall SetVBorder(int,int); 41 static void _fastcall SetBorderColor(long); 42 static void _fastcall SetVertShift(int); 43 static void _fastcall SetInterlace(int); 44 static void _fastcall SetBlndReg(int); 45 static void _fastcall SetRGBorCV(int); 46 static void _fastcall SetVCRorCamera(int); 47 static void _fastcall SetMask(int); 48 static void _fastcall SetBlndReg(int); 49 static void _fastcall SetContrast(int); 50 static void _fastcall SetHue(int); 51 static void _fastcall SetSaturation(int); 52 static void _fastcall SetHBorder(int,int); 53 static void SetFixedRegisters(void); 54 static void _fastcall VCenterDisplay(int); 55 static void _fastcall SetOverscan(int); 56 static void _fastcall near TSetMode(int); 57 static int GraphInit(void); 58 static void GraphEnd(void); 59 60 /************* ****************/ 61 62 int xorTARGA; 63 unsigned far *tga16 = NULL; /* [256] */ 64 long far *tga32; /* [256] */ 65 static int last = 0; 66 67 /************* ****************/ 68 69 static int initialized; 70 71 /************* ****************/ 72 73 static void (near _fastcall *DoPixel) ( int x, int y, int index ); 74 static void (near _fastcall *PutPixel)( int x, int y, int index ); 75 static unsigned (near _fastcall *GetPixel)( int x, int y ); 76 77 /**************************************************************************/ 78 #ifdef __BORLANDC__
79 #if(__BORLANDC__ > 2) 80 #pragma warn -eff 81 #endif
82 #endif 83 84 static unsigned _fastcall near Row16Calculate( unsigned line, unsigned x1 ) 85 { 86 outp( DESTREG, (line >> 5) ); 87 return( ((line & 31) << 10) | (x1 << 1) ); /* calc the pixel offset */ 88 } 89 90 /**************************************************************************/ 91 92 static void _fastcall near PutPix16( int x, int y, int index ) 93 { 94 unsigned far * ip; 95 96 /**************/ 97 ip = MK_FP( MEMSEG, Row16Calculate( y, x ) ); 98 if( ! xorTARGA ) 99 *ip = tga16[index]; 100 else 101 *ip = *ip ^ 0x7fff; 102 } 103 104 /**************************************************************************/ 105 106 static unsigned _fastcall near GetPix16( int x, int y ) 107 { 108 register unsigned pixel, index; 109 unsigned far * ip; 110 /**************/ 111 ip = MK_FP( MEMSEG, Row16Calculate( y, x ) ); 112 pixel = *ip & 0x7FFF; 113 if( pixel == tga16[last] ) return( last ); 114 for( index = 0; index < 256; index++ ) 115 if( pixel == tga16[index] ) { 116 last = index; 117 return( index ); 118 } 119 return( 0 ); 120 } 121 122 /**************************************************************************/ 123 124 static unsigned _fastcall near Row32Calculate( unsigned line, unsigned x1 ) 125 { 126 outp( DESTREG, (line >> 4) ); 127 return ( ((line & 15) << 11) | (x1 << 2) ); /* calc the pixel offset */ 128 } 129 130 /**************************************************************************/ 131 132 static void _fastcall near PutPix32( int x, int y, int index ) 133 { 134 long far * lp; 135 lp = MK_FP( MEMSEG, Row32Calculate( y, x ) ); 136 if( ! xorTARGA ) 137 *lp = tga32[index]; 138 else 139 *lp = *lp ^ 0x00FFFFFFL; 140 } 141 142 /**************************************************************************/ 143 144 static unsigned _fastcall near GetPix32( int x, int y ) 145 { 146 register int index; 147 long pixel; 148 long far * lp; 149 150 lp = MK_FP( MEMSEG, Row32Calculate( y, x ) ); 151 pixel = *lp & 0x00FFFFFFL; 152 if( pixel == tga32[last] ) return( last ); 153 for( index = 0; index < 256; index++ ) 154 if( pixel == tga32[index] ) { 155 last = index; 156 return( index ); 157 } 158 return( 0 ); 159 } 160 161 /**************************************************************************/ 162 163 static void _fastcall near DoFirstPixel( int x, int y, int index ) 164 { 165 int cnt; 166 TSetMode( targa.mode | 1 ); 167 for( cnt = 0; cnt < targa.MaxBanks; cnt += 2 ) { /* erase */ 168 outp( DESTREG, cnt ); 169 outp( SRCREG, cnt + 1 ); 170 erasesegment(targa.memloc,0); /** general.asm **/ 171 } 172 TSetMode( targa.mode & 0xFFFE ); 173 PutPixel = DoPixel; 174 (*PutPixel)( x, y, index ); 175 } 176 177 #ifdef __BORLANDC__
178 #if(__BORLANDC__ > 2) 179 #pragma warn +eff 180 #endif
181 #endif 182 183 /***************************************************************************/ 184 185 void WriteTGA( int x, int y, int index ) 186 { 187 OUTPORTB(MODEREG, targa.mode |= 1 ); /* TSetMode inline for speed */ 188 (*PutPixel)( x, sydots-y, index&0xFF ); /* fix origin to match EGA/VGA */ 189 OUTPORTB(MODEREG, targa.mode &= 0xFFFE ); 190 } 191 192 /***************************************************************************/ 193 194 int ReadTGA( int x, int y ) 195 { 196 int val; 197 OUTPORTB(MODEREG, targa.mode |= 1 ); /* TSetMode inline for speed */ 198 val = (*GetPixel)( x, sydots-y ); 199 OUTPORTB(MODEREG, targa.mode &= 0xFFFE ); 200 return( val ); 201 } 202 203 /***************************************************************************/ 204 205 void EndTGA( void ) 206 { 207 if( initialized ) { 208 GraphEnd(); 209 initialized = 0; 210 } 211 } 212 213 /***************************************************************************/ 214 215 void StartTGA() 216 { 217 int i; 218 /* 219 This overlayed data safe because used in this file, any only used for 220 fatal error message! 221 */ 222 static FCODE couldntfind[]={"Could not find Targa card"}; 223 static FCODE noenvvar[]={"TARGA environment variable missing"}; 224 static FCODE insuffmem[]={"Insufficient memory for Targa"}; 225 226 /****************/ 227 if( initialized ) return; 228 initialized = 1; 229 230 /****************/ 231 /* note that video.asm has already set the regualar video adapter */ 232 /* to text mode (ax in Targa table entries is 3); */ 233 /* that's necessary because TARGA can live at 0xA000, we DO NOT */ 234 /* want to have an EGA/VGA in graphics mode!! */ 235 ReopenTGA(); /* clear text screen and display message */ 236 237 /****************/ 238 /*** look for and activate card ***/ 239 if ((i = GraphInit()) != 0) 240 fatalerror((i == -1) ? couldntfind : noenvvar); 241 242 VCenterDisplay( sydots + 1 ); 243 244 if (tga16 == NULL) 245 if ( (tga16 = (unsigned far *)farmemalloc(512L)) == NULL 246 || (tga32 = (long far *)farmemalloc(1024L)) == NULL) 247 fatalerror(insuffmem); 248 249 SetTgaColors(); 250 251 if( targa.boardType == 16 ) { 252 GetPixel = (unsigned (near _fastcall *)(int, int))GetPix16; 253 DoPixel = PutPix16; 254 } 255 else { 256 GetPixel = (unsigned (near _fastcall *)(int, int))GetPix32; 257 DoPixel = PutPix32; 258 } 259 PutPixel = DoFirstPixel; /* on first pixel --> erase */ 260 261 if( sydots == 482 ) SetOverscan( 1 ); 262 263 TSetMode( targa.mode & 0xFFFE ); 264 265 /****************/ 266 if (mapdacbox == NULL && SetColorPaletteName("default") != 0) 267 exit( 1 ); /* stopmsg has already been issued */ 268 269 } 270 271 void ReopenTGA() 272 { 273 static FCODE runningontarga[]={"Running On TrueVision TARGA Card"}; 274 helptitle(); 275 putstring(2,20,7,runningontarga); 276 movecursor(6,0); /* in case of brutal exit */ 277 } 278 279 static void _fastcall fatalerror(char far *msg) 280 { 281 static FCODE abortmsg[]={"...aborting!"}; 282 putstring(4,20,15,msg); 283 putstring(5,20,15,abortmsg); 284 movecursor(8,0); 285 exit(1); 286 } 287 288 289 290 /*** the rest of this module used to be separate, in tgasubs.c, ***/ 291 /*** has now been merged into a single source ***/ 292 293 /*******************************************************************/ 294 295 static void _fastcall VCenterDisplay( int nLines ) 296 { 297 int lines; 298 int top, bottom; 299 long color; 300 301 lines = nLines >> 1; /* half value of last line 0..x */ 302 top = 140 - (lines >> 1); 303 bottom = top + lines; 304 SetVBorder( top, bottom ); 305 SetVertShift( 255 - lines ); /* skip lines we're not using */ 306 307 if( targa.boardType == 16 ) 308 color = (12 << 10) | (12 << 5) | 12; 309 else 310 color = ((long)80 << 16) | (80 << 8) | 80; 311 SetBorderColor( color ); 312 } 313 314 315 /*****************************************************************/ 316 317 static void _fastcall near SetDispReg(int reg, int value) 318 { 319 targa.DisplayRegister[reg] = value; 320 321 TSetMode(targa.mode&MSK_REGWRITE); /* select Index Register write */ 322 OUTPORTB(DRREG, reg); /* select sync register */ 323 /* 324 * Set Mask register to write value to 325 * display register and to set Bit 9 in the DR 326 */ 327 TSetMode( ((targa.mode|(~MSK_REGWRITE)) /* turn on write bit */ 328 & MSK_BIT9 ) /* turn off Bit 9 */ 329 | ((value&0x0100)>>1)); /* set bit 9 for value */ 330 OUTPORTB(DRREG, value); /* select sync register */ 331 } 332 333 /*****************************************************************/ 334 335 #define WAITCOUNT 60000L 336 337 static int VWait() 338 { 339 int rasterreg; 340 unsigned GiveUp; 341 342 rasterreg = RASTERREG; 343 344 /* 345 * If beyond bottom of frame wait for next field 346 */ 347 GiveUp= WAITCOUNT; 348 while ( (--GiveUp) && (GetLine(rasterreg) == 0) ) { } 349 if (GiveUp) { 350 /* 351 * Wait for the bottom of the border 352 */ 353 GiveUp= WAITCOUNT; 354 while ( (--GiveUp) && (GetLine(rasterreg) > 0) ) { } 355 } 356 357 return ( ( GiveUp ) ? 0 : -1); 358 } 359 360 361 /*****************************************************************/ 362 363 static void _fastcall SetVBorder(int top, int bottom) 364 { 365 /* top border */ 366 if ( top < MIN_TOP ) top=MIN_TOP; 367 SetDispReg(TOPBORDER,top); 368 /* bottom border */ 369 if ( bottom > MAX_BOTTOM ) bottom=MAX_BOTTOM; 370 SetDispReg(BOTTOMBORDER,bottom); 371 372 SetDispReg(DR10,top); 373 SetDispReg(DR11,bottom); 374 } 375 376 377 /*****************************************************************/ 378 379 static void _fastcall SetRGBorCV(int type) 380 { 381 /* set the contrast level */ 382 targa.RGBorCV = type; 383 targa.VCRCon = ( targa.VCRCon & MSK_RGBORCV ) | 384 (targa.RGBorCV<<SHF_RGBORCV) ; 385 OUTPORTB(VCRCON, targa.VCRCon ); 386 } 387 388 /*****************************************************************/ 389 390 static void _fastcall SetVCRorCamera(int type) 391 { 392 targa.VCRorCamera = type&1; 393 targa.VCRCon = ( targa.VCRCon & MSK_VCRORCAMERA ) | 394 (targa.VCRorCamera<<SHF_VCRORCAMERA) ; 395 OUTPORTB(VCRCON, targa.VCRCon ); 396 } 397 398 399 /*****************************************************************/ 400 401 static void _fastcall SetBorderColor(long color) 402 { 403 targa.BorderColor = color; 404 OUTPORTB(BORDER, (int)(0x0000ffffL&(color))); 405 OUTPORTB((BORDER+2), (int)((color)>>16)); 406 } 407 408 /*****************************************************************/ 409 410 static void _fastcall SetMask(int mask) 411 { 412 /* mask to valid values and output to mode register */ 413 targa.Mask = mask; 414 OUTPORTB(MASKREG, mask); 415 } 416 417 418 /*****************************************************************/ 419 420 static void _fastcall SetVertShift(int preshift) 421 { 422 /* set the Vertical Preshift count level */ 423 targa.VertShift = preshift; 424 OUTPORTB(VERTPAN, preshift); 425 } 426 427 428 /*****************************************************************/ 429 430 static void _fastcall SetOverscan(int mode) 431 { 432 long tempColor; 433 434 targa.ovrscnOn = mode; 435 if ( mode == 0 ) { 436 INPORTB(UNDERREG); /* select underscan mode */ 437 SetHBorder( (DEF_LEFT+targa.xOffset), 438 (DEF_RIGHT+targa.xOffset)); 439 SetDispReg(4,352); 440 SetDispReg(5,1); 441 SetBorderColor(targa.BorderColor); 442 } 443 else { 444 INPORTB(OVERREG); /* select overrscan mode */ 445 SetDispReg(0,64); /* Set four of the display registers */ 446 SetDispReg(1,363); /* to values required for Overscan */ 447 SetDispReg(4,363); 448 SetDispReg(5,17); 449 tempColor = targa.BorderColor; 450 SetBorderColor(0L); 451 targa.BorderColor = tempColor; 452 } 453 } 454 455 456 /*****************************************************************/ 457 458 static void _fastcall SetInterlace(int type) 459 { 460 targa.InterlaceMode= type & MSK_INTERLACE; 461 SetDispReg(INTREG, targa.InterlaceMode); 462 /* 463 * SET THE INTERLACE BIT TO MATCH THE INTERLACE MODE AND 464 * SCREEN RESOLUTION - SCREEN PAGE 465 */ 466 if ( ( targa.InterlaceMode >= 2 ) && 467 ( targa.PageMode> 1 ) && 468 ( (targa.PageMode&1) != 0 ) ) 469 TSetMode(targa.mode|(~MSK_IBIT) ); 470 else 471 TSetMode(targa.mode& MSK_IBIT); 472 } 473 474 475 /*****************************************************************/ 476 477 static void _fastcall SetBlndReg(int value) 478 { 479 /* set the Vertical Preshift count level */ 480 if ( targa.boardType == 32 ) { 481 targa.VCRCon = (targa.VCRCon&0xfe) | value; 482 OUTPORTB(BLNDREG, value); 483 } 484 } 485 486 487 /*****************************************************************/ 488 489 static void _fastcall near TSetMode(int mode) 490 { 491 /* mask to valid values and output to mode register */ 492 OUTPORTB(MODEREG, mode ); 493 targa.mode = mode; 494 } 495 496 497 /*****************************************************************/ 498 499 static void _fastcall SetContrast(int level) 500 { 501 /* set the contrast level */ 502 targa.Contrast = level &((~MSK_CONTRAST)>>SHF_CONTRAST); 503 targa.VCRCon = ( targa.VCRCon & MSK_CONTRAST ) | 504 (targa.Contrast<<SHF_CONTRAST) ; 505 OUTPORTB(VCRCON, targa.VCRCon ); 506 } 507 508 509 /*****************************************************************/ 510 511 static void _fastcall SetHue(int level) 512 { 513 /* set the hue level - Mask to valid value */ 514 targa.Hue = level&((~MSK_HUE)>>SHF_HUE); 515 /* mask to valid range */ 516 targa.SatHue = (targa.SatHue&MSK_HUE) | (targa.Hue<<SHF_HUE); 517 OUTPORTB(SATHUE, targa.SatHue ); 518 } 519 520 521 /*****************************************************************/ 522 523 static void _fastcall SetSaturation(int level) 524 { 525 /* set the saturation level */ 526 targa.Saturation= level&( (~MSK_SATURATION)>>SHF_SATURATION); 527 targa.SatHue = (targa.SatHue&MSK_SATURATION) | 528 (targa.Saturation<<SHF_SATURATION); 529 OUTPORTB(SATHUE , targa.SatHue ); 530 } 531 532 533 /*************************************************************/ 534 535 /*** UNUSED 536 static void _fastcall SetPageMode(int pageMode) 537 { 538 pageMode &= 0x07; 539 targa.PageMode = pageMode; 540 VWait(); 541 TSetMode( (targa.mode)&(MSK_RES) |((pageMode<<SHF_RES)&(~MSK_RES)) ) ; 542 if ( ( targa.DisplayRegister[20] >= 2 ) && 543 ( pageMode> 1 ) && 544 ( (pageMode&1) != 0 ) ) TSetMode(targa.mode|(~MSK_IBIT) ); 545 else 546 TSetMode(targa.mode& MSK_IBIT); 547 } 548 ***/ 549 550 551 /*****************************************************************/ 552 553 static void _fastcall SetHBorder(int left, int right) 554 { 555 SetDispReg(LEFTBORDER, left); /* set horizontal left border */ 556 SetDispReg(RIGHTBORDER,right); /* set horizontal right border */ 557 /* 558 * Set DR 8 and 9 since they 559 * default to tracking DR0 and DR 1 560 */ 561 SetDispReg(DR8,left); 562 SetDispReg(DR9,left); 563 } 564 565 566 /*****************************************************************/ 567 568 /*** UNUSED 569 static void _fastcall SetGenlock(int OnOrOff) 570 { 571 TSetMode( (targa.mode)&(MSK_GENLOCK) 572 |((OnOrOff<<SHF_GENLOCK)&(~MSK_GENLOCK)) ); 573 } 574 ***/ 575 576 577 /*****************************************************************/ 578 /* was asm, TC fast enough on AT */ 579 580 static int GetLine( int port ) 581 { 582 int cnt; 583 int val1, val2; 584 585 val1 = INPORTB( port ); 586 for( cnt = 0; cnt < 20; cnt++ ) { 587 val2 = INPORTB( port ); 588 if( val1 == val2 ) 589 break; 590 val1 = val2; 591 } 592 return( val1 ); 593 } 594 595 596 /********************************************************************** 597 TINIT 598 **********************************************************************/ 599 600 static int GraphInit() 601 { 602 int i; 603 int bottom, top; 604 char *envptr; 605 unsigned switches, got_switches; 606 607 memset( &targa, 0, sizeof(targa) ); 608 609 targa.boardType = TYPE_16; /* default to T16 */ 610 targa.xOffset = 0; targa.yOffset = 0; /* default to no offset */ 611 targa.LinesPerField= DEF_ROWS/2; /* number of lines per field */ 612 targa.AlwaysGenLock = DEF_GENLOCK; /* default to genlock off */ 613 targa.PageMode = 0; 614 targa.InterlaceMode = DEF_INT; /* Defalut: Interlace Mode 0 */ 615 targa.Contrast= DEF_CONTRAST; 616 targa.Saturation = DEF_SATURATION; 617 targa.Hue = DEF_HUE; 618 targa.RGBorCV = CV; /* default to Composite video */ 619 targa.VCRorCamera = CAMERA; 620 targa.PanXOrig = 0; targa.PanYOrig = 0; 621 targa.PageUpper= 0xffff; /* set the bank flags to illega& values */ 622 targa.PageLower= 0xffff; /* so that they will be set the first time */ 623 targa.ovrscnAvail = 0; /* Assume no Overscan option */ 624 targa.ovrscnOn = 0; 625 626 if ((envptr = getenv("TARGA")) == NULL) 627 return(-2); 628 switches = got_switches = 0; 629 while (*envptr) { 630 if (*envptr != ' ') ++got_switches; 631 if (*envptr >= '2' && *envptr <= '8') 632 switches |= (1 << ('8' - *envptr)); 633 ++envptr; 634 } 635 if (got_switches == 0) { /* all blanks, use default */ 636 targa.memloc = (signed int)0xA000; 637 targa.iobase = 0x220; 638 } 639 else { 640 targa.memloc = 0x8000 + ((switches & 0x70) << 8); 641 targa.iobase = 0x200 + ((switches & 0x0f) << 4); 642 } 643 644 if ((envptr = getenv("TARGASET")) != NULL) { 645 for(;;) { /* parse next parameter */ 646 while (*envptr == ' ' || *envptr == ',') ++envptr; 647 if (*envptr == 0) break; 648 if (*envptr >= 'a' && *envptr <= 'z') *envptr -= ('a'-'A'); 649 i = atoi(envptr+1); 650 switch (*envptr) { 651 case 'T': 652 if (i == 16) targa.boardType = TYPE_16; 653 if (i == 24) targa.boardType = TYPE_24; 654 if (i == 32) targa.boardType = TYPE_32; 655 break; 656 /* case 'E' not done, meaning not clear */ 657 case 'X': 658 targa.xOffset = i; 659 break; 660 case 'Y': 661 targa.yOffset = i; 662 break; 663 case 'I': 664 targa.InterlaceMode = i; 665 break; 666 /* case 'N' not done, I don't know how to handle it */ 667 case 'R': 668 targa.RGBorCV = RGB; 669 break; 670 case 'B': 671 targa.VCRorCamera = CAMERA; 672 break; 673 case 'V': 674 targa.VCRorCamera = VCR; 675 break; 676 case 'G': 677 targa.AlwaysGenLock = 1; 678 break; 679 case 'C': 680 targa.Contrast = i * 31 / 100; 681 break; 682 case 'S': 683 targa.Saturation = i * 7 / 100; 684 break; 685 case 'H': 686 targa.Hue = i * 31 / 100; 687 break; 688 /* note: 'A' and 'O' defined but apply only to type M8 */ 689 /* case 'P' not handled cause I don't know how */ 690 } 691 while (*(++envptr) >= '0' && *envptr <= '9') { } 692 } 693 } 694 695 if ( targa.boardType == TYPE_16 ) { 696 targa.MaxBanks = 16; 697 targa.BytesPerPixel = 2; 698 } 699 if ( targa.boardType == TYPE_24 ) { 700 targa.MaxBanks = 32; 701 targa.BytesPerPixel = 3; 702 } 703 if ( targa.boardType == TYPE_32 ) { 704 targa.MaxBanks = 32; 705 targa.BytesPerPixel = 4; 706 } 707 708 /****** Compute # of rows per 32K bank ********/ 709 targa.RowsPerBank = 512/(targa.MaxBanks); 710 targa.AddressShift = targa.MaxBanks>>4; 711 712 /* if initializing CVA: set these before we quit */ 713 SetSaturation(targa.Saturation); 714 SetHue(targa.Hue); 715 SetContrast( targa.Contrast); 716 717 /* Set Genlock bit if always genlocked */ 718 /* Set before flipping and jerking screen */ 719 TSetMode( (targa.AlwaysGenLock<<SHF_GENLOCK) | DEF_MODE); 720 721 SetBlndReg(0); /* disable blend mode on TARGA 32 */ 722 723 SetInterlace(targa.InterlaceMode); 724 SetFixedRegisters(); 725 SetOverscan( 0 ); 726 727 top = 140 - (targa.LinesPerField / 2); 728 bottom = top + targa.LinesPerField; 729 SetVBorder(top,bottom); 730 SetVertShift(256-targa.LinesPerField); 731 732 SetMask(DEF_MASK); 733 SetRGBorCV (targa.RGBorCV ); 734 SetVCRorCamera(targa.VCRorCamera); 735 736 /* See if the raster register is working correctly and 737 return error flag if its not */ 738 return (( VWait() == -1) ? -1 : 0); 739 740 } 741 742 743 /**************************************************************/ 744 745 static void GraphEnd() 746 { 747 TSetMode( (targa.mode)&MSK_MSEL ); /* disable memory */ 748 } 749 750 751 /**************************************************************/ 752 /* Set the registers which have required values */ 753 754 #define FIXED_REGS 10 755 756 static int FixedRegs[] = { 757 DR6,DR7,DR12,DR13,DR14,DR15,DR16,DR17,DR18,DR19 758 }; 759 760 static int FixedValue[] = { 761 DEF_DR6,DEF_DR7,DEF_DR12,DEF_DR13,DEF_DR14, 762 DEF_DR15,DEF_DR16,DEF_DR17,DEF_DR18,DEF_DR19 763 }; 764 765 static void SetFixedRegisters() 766 { 767 int reg; 768 769 for ( reg=0; reg<FIXED_REGS; reg++) 770 SetDispReg(FixedRegs[reg],FixedValue[reg]); 771 } 772 773