ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/video.cpp
(Generate patch)

Comparing BasiliskII/src/video.cpp (file contents):
Revision 1.20 by cebix, 2001-07-03T19:20:38Z vs.
Revision 1.24 by cebix, 2002-01-15T14:58:32Z

# Line 1 | Line 1
1   /*
2   *  video.cpp - Video/graphics emulation
3   *
4 < *  Basilisk II (C) 1997-2001 Christian Bauer
5 < *  Portions (C) 1997-1999 Marc Hellwig
4 > *  Basilisk II (C) 1997-2002 Christian Bauer
5 > *  Portions written by Marc Hellwig
6   *
7   *  This program is free software; you can redistribute it and/or modify
8   *  it under the terms of the GNU General Public License as published by
# Line 23 | Line 23
23   *  SEE ALSO
24   *    Inside Macintosh: Devices, chapter 1 "Device Manager"
25   *    Designing Cards and Drivers for the Macintosh Family, Second Edition
26 + *    Designing PCI Cards and Drivers for Power Macintosh Computers
27 + *    Display Device Driver Guide
28   */
29  
30   #include <stdio.h>
# Line 218 | Line 220 | static void set_gray_palette(void)
220   static void load_ramp_palette(void)
221   {
222          // Find tables for gamma correction
223 <        uint8 *red_gamma, *green_gamma, *blue_gamma;
223 >        uint8 *red_gamma = NULL, *green_gamma = NULL, *blue_gamma = NULL;
224          bool have_gamma = false;
225          int data_width = 0;
226          if (VidLocal.gamma_table) {
# Line 409 | Line 411 | static void switch_mode(const video_mode
411          // Patch frame buffer base address for MacOS versions <7.6
412          if (!VidLocal.dm_present) { // Only do this when no Display Manager seems to be present; otherwise, the screen will not get redrawn
413                  WriteMacInt32(0x824, frame_base);                       // ScrnBase
414 +                WriteMacInt32(0x898, frame_base);                       // CrsrBase
415                  uint32 gdev = ReadMacInt32(0x8a4);                      // MainDevice
416                  gdev = ReadMacInt32(gdev);
417                  uint32 pmap = ReadMacInt32(gdev + 0x16);        // gdPMap
# Line 508 | Line 511 | int16 VideoDriverControl(uint32 pb, uint
511                                  return paramErr;
512  
513                          // Find tables for gamma correction
514 <                        uint8 *red_gamma, *green_gamma, *blue_gamma;
514 >                        uint8 *red_gamma = NULL, *green_gamma = NULL, *blue_gamma = NULL;
515                          bool have_gamma = false;
516                          int data_width = 0;
517                          if (VidLocal.gamma_table) {
# Line 619 | Line 622 | int16 VideoDriverControl(uint32 pb, uint
622                          return noErr;
623  
624                  case cscSetDefaultMode: { // Set default color depth
625 <                        uint16 mode = ReadMacInt16(param + csMode);
626 <                        D(bug(" SetDefaultMode %04x\n", mode));
625 >                        uint16 mode = ReadMacInt8(param + csMode);
626 >                        D(bug(" SetDefaultMode %02x\n", mode));
627                          VidLocal.preferred_mode = mode;
628                          return noErr;
629                  }
# Line 733 | Line 736 | int16 VideoDriverStatus(uint32 pb, uint3
736  
737                  case cscGetGray:                        // Get luminance mapping flag
738                          D(bug(" GetGray -> %d\n", VidLocal.luminance_mapping));
739 <                        WriteMacInt16(param, VidLocal.luminance_mapping ? 0x0100 : 0);
739 >                        WriteMacInt8(param, VidLocal.luminance_mapping ? 1 : 0);
740                          return noErr;
741  
742                  case cscGetInterrupt:           // Get interrupt disable flag
743                          D(bug(" GetInterrupt -> %d\n", VidLocal.interrupts_enabled));
744 <                        WriteMacInt16(param, VidLocal.interrupts_enabled ? 0 : 0x0100);
744 >                        WriteMacInt8(param, VidLocal.interrupts_enabled ? 0 : 1);
745                          return noErr;
746  
747                  case cscGetGamma:
# Line 747 | Line 750 | int16 VideoDriverStatus(uint32 pb, uint3
750                          return noErr;
751  
752                  case cscGetDefaultMode:         // Get default color depth
753 <                        D(bug(" GetDefaultMode -> %04x\n", VidLocal.preferred_mode));
754 <                        WriteMacInt16(param + csMode, VidLocal.preferred_mode);
753 >                        D(bug(" GetDefaultMode -> %02x\n", VidLocal.preferred_mode));
754 >                        WriteMacInt8(param + csMode, VidLocal.preferred_mode);
755                          return noErr;
756  
757                  case cscGetCurrentMode:         // Get current video mode (depth and resolution)
# Line 832 | Line 835 | int16 VideoDriverStatus(uint32 pb, uint3
835                          WriteMacInt32(param + csVerticalLines, y);
836                          WriteMacInt32(param + csRefreshRate, 75 << 16);
837                          WriteMacInt16(param + csMaxDepthMode, DepthToAppleMode(max_depth_of_resolution(id)));
838 +                        WriteMacInt32(param + csResolutionFlags, 0);
839                          return noErr;
840                  }
841  
# Line 858 | Line 862 | int16 VideoDriverStatus(uint32 pb, uint3
862                                          WriteMacInt32(vp + vpVRes, 0x00480000);
863                                          uint32 pix_type, pix_size, cmp_count, cmp_size, dev_type;
864                                          switch (i->depth) {
861                                                case VDEPTH_1BIT:
862                                                        pix_type = 0; pix_size = 1;
863                                                        cmp_count = 1; cmp_size = 1;
864                                                        dev_type = 0; // CLUT
865                                                        break;
866                                                case VDEPTH_2BIT:
867                                                        pix_type = 0; pix_size = 2;
868                                                        cmp_count = 1; cmp_size = 2;
869                                                        dev_type = 0; // CLUT
870                                                        break;
871                                                case VDEPTH_4BIT:
872                                                        pix_type = 0; pix_size = 4;
873                                                        cmp_count = 1; cmp_size = 4;
874                                                        dev_type = 0; // CLUT
875                                                        break;
876                                                case VDEPTH_8BIT:
877                                                        pix_type = 0; pix_size = 8;
878                                                        cmp_count = 1; cmp_size = 8;
879                                                        dev_type = 0; // CLUT
880                                                        break;
865                                                  case VDEPTH_16BIT:
866                                                          pix_type = 0x10; pix_size = 16;
867                                                          cmp_count = 3; cmp_size = 5;
# Line 888 | Line 872 | int16 VideoDriverStatus(uint32 pb, uint3
872                                                          cmp_count = 3; cmp_size = 8;
873                                                          dev_type = 2; // direct
874                                                          break;
875 +                                                default:
876 +                                                        pix_type = 0; pix_size = 1 << i->depth;
877 +                                                        cmp_count = 1; cmp_size = 1 << i->depth;
878 +                                                        dev_type = 0; // CLUT
879 +                                                        break;
880                                          }
881                                          WriteMacInt16(vp + vpPixelType, pix_type);
882                                          WriteMacInt16(vp + vpPixelSize, pix_size);
# Line 901 | Line 890 | int16 VideoDriverStatus(uint32 pb, uint3
890                          return paramErr; // specified resolution/depth not supported
891                  }
892  
893 +                case cscGetMultiConnect: {
894 +                        uint32 conn = ReadMacInt32(param + csDisplayCountOrNumber);
895 +                        D(bug(" GetMultiConnect %08x\n", conn));
896 +                        if (conn == 0xffffffff) {       // Get number of connections
897 +                                WriteMacInt32(param + csDisplayCountOrNumber, 1); // Single-headed
898 +                                return noErr;
899 +                        } else if (conn == 1) {         // Get information about first connection
900 +                                WriteMacInt16(param + csConnectInfo + csDisplayType, 8);                // Modeless connection
901 +                                WriteMacInt8(param + csConnectInfo + csConnectTaggedType, 0);
902 +                                WriteMacInt8(param + csConnectInfo + csConnectTaggedData, 0);
903 +                                WriteMacInt32(param + csConnectInfo + csConnectFlags, 0x43);    // All modes valid and safe, non-standard tagging
904 +                                WriteMacInt32(param + csConnectInfo + csDisplayComponent, 0);
905 +                                return noErr;
906 +                        } else
907 +                                return paramErr;
908 +                }
909 +
910                  default:
911                          printf("WARNING: Unknown VideoDriverStatus(%d)\n", code);
912                          return statusErr;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines