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

Comparing BasiliskII/src/slot_rom.cpp (file contents):
Revision 1.6 by cebix, 2001-06-27T20:05:23Z vs.
Revision 1.9 by cebix, 2001-06-29T12:51:20Z

# Line 42 | Line 42 | static uint8 srom[4096];
42   // Index in srom
43   static uint32 p;
44  
45 + // Length of slot ROM
46 + static int slot_rom_size = 0;
47 +
48  
49   // Check whether a mode with the specified depth exists
50   static bool has_depth(video_depth depth)
51   {
52 <        vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end();
52 >        std::vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end();
53          while (i != end) {
54                  if (i->depth == depth)
55                          return true;
# Line 118 | Line 121 | static void PString(char *str)
121   static uint32 VModeParms(uint32 width, uint32 height, uint32 bytes_per_row, video_depth depth)
122   {
123          uint32 ret = p;
124 <        Long(50);                                                       // Length
125 <        Long(0);                                                        // Base offset
126 <        Word(bytes_per_row);                    // Row bytes
127 <        Word(0);                                                        // Bounds
124 >        Long(50);                                       // Length
125 >        Long(0);                                        // Base offset
126 >        Word(bytes_per_row);            // Row bytes
127 >        Word(0);                                        // Bounds
128          Word(0);
129          Word(height);
130          Word(width);
131 <        Word(0);                                                        // Version
132 <        Word(0);                                                        // Pack type
133 <        Long(0);                                                        // Pack size
134 <        Long(0x00480000);                                       // HRes
135 <        Long(0x00480000);                                       // VRes
131 >        Word(0);                                        // Version
132 >        Word(0);                                        // Pack type
133 >        Long(0);                                        // Pack size
134 >        Long(0x00480000);                       // HRes
135 >        Long(0x00480000);                       // VRes
136          switch (depth) {
137                  case VDEPTH_1BIT:
138 <                        Word(0);                                        // Pixel type (indirect)
139 <                        Word(1);                                        // Pixel size
140 <                        Word(1);                                        // CmpCount
141 <                        Word(1);                                        // CmpSize
138 >                        Word(0);                        // Pixel type (indirect)
139 >                        Word(1);                        // Pixel size
140 >                        Word(1);                        // CmpCount
141 >                        Word(1);                        // CmpSize
142                          break;
143                  case VDEPTH_2BIT:
144 <                        Word(0);                                        // Pixel type (indirect)
145 <                        Word(2);                                        // Pixel size
146 <                        Word(1);                                        // CmpCount
147 <                        Word(2);                                        // CmpSize
144 >                        Word(0);                        // Pixel type (indirect)
145 >                        Word(2);                        // Pixel size
146 >                        Word(1);                        // CmpCount
147 >                        Word(2);                        // CmpSize
148                          break;
149                  case VDEPTH_4BIT:
150 <                        Word(0);                                        // Pixel type (indirect)
151 <                        Word(4);                                        // Pixel size
152 <                        Word(1);                                        // CmpCount
153 <                        Word(4);                                        // CmpSize
150 >                        Word(0);                        // Pixel type (indirect)
151 >                        Word(4);                        // Pixel size
152 >                        Word(1);                        // CmpCount
153 >                        Word(4);                        // CmpSize
154                          break;
155                  case VDEPTH_8BIT:
156 <                        Word(0);                                        // Pixel type (indirect)
157 <                        Word(8);                                        // Pixel size
158 <                        Word(1);                                        // CmpCount
159 <                        Word(8);                                        // CmpSize
156 >                        Word(0);                        // Pixel type (indirect)
157 >                        Word(8);                        // Pixel size
158 >                        Word(1);                        // CmpCount
159 >                        Word(8);                        // CmpSize
160                          break;
161                  case VDEPTH_16BIT:
162 <                        Word(16);                                       // Pixel type (direct)
163 <                        Word(16);                                       // Pixel size
164 <                        Word(3);                                        // CmpCount
165 <                        Word(5);                                        // CmpSize
162 >                        Word(16);                       // Pixel type (direct)
163 >                        Word(16);                       // Pixel size
164 >                        Word(3);                        // CmpCount
165 >                        Word(5);                        // CmpSize
166                          break;
167                  case VDEPTH_32BIT:
168 <                        Word(16);                                       // Pixel type (direct)
169 <                        Word(32);                                       // Pixel size
170 <                        Word(3);                                        // CmpCount
171 <                        Word(8);                                        // CmpSize
168 >                        Word(16);                       // Pixel type (direct)
169 >                        Word(32);                       // Pixel size
170 >                        Word(3);                        // CmpCount
171 >                        Word(8);                        // CmpSize
172                          break;
173          }
174 <        Long(0);                                                        // Plane size
175 <        Long(0);                                                        // Reserved
174 >        Long(0);                                        // Plane size
175 >        Long(0);                                        // Reserved
176          return ret;
177   }
178  
# Line 233 | Line 236 | bool InstallSlotROM(void)
236  
237          // Video sResource for default mode
238          videoType = p;                                          // Literals
239 <        Word(3); Word(1); Word(1); Word(0x4232);                        // Display Video Apple 'B2'
239 >        Word(3); Word(1); Word(1); Word(0x4232);        // Display Video Apple 'B2'
240          videoName = p;
241          String("Display_Video_Apple_Basilisk");
242          minorBase = p;
243 <        Long(VideoMonitor.mac_frame_base);                                      // Frame buffer base
243 >        Long(VideoMonitor.mac_frame_base);      // Frame buffer base
244          minorLength = p;
245 <        Long(VideoMonitor.mode.bytes_per_row * VideoMonitor.mode.y);    // Frame buffer size
245 >        Long(0);                                                        // Frame buffer size (unspecified)
246  
247          videoDrvr = p;                                          // Video driver
248          Long(0x72);                                                     // Length
# Line 433 | Line 436 | bool InstallSlotROM(void)
436          // Format/header block
437          Offs(0, sRsrcDir);                                      // sResource directory
438          Long(p + 16);                                           // Length of declaration data
439 <        Long(0);                                                        // CRC (calculated below)
439 >        Long(0);                                                        // CRC (calculated later)
440          Word(0x0101);                                           // Rev. level, format
441          Long(0x5a932bc7);                                       // Test pattern
442          Word(0x000f);                                           // Byte lanes
443  
444 +        // Copy slot ROM to Mac ROM
445 +        slot_rom_size = p;
446 +        memcpy(ROMBaseHost + ROMSize - slot_rom_size, srom, slot_rom_size);
447 +
448 +        // Calculate checksum
449 +        ChecksumSlotROM();
450 +        return true;
451 + }
452 +
453 + /*
454 + *  Calculate slot ROM checksum (in-place)
455 + */
456 +
457 + void ChecksumSlotROM(void)
458 + {
459          // Calculate CRC
460 +        uint8 *p = ROMBaseHost + ROMSize - slot_rom_size;
461 +        p[slot_rom_size - 12] = 0;
462 +        p[slot_rom_size - 11] = 0;
463 +        p[slot_rom_size - 10] = 0;
464 +        p[slot_rom_size - 9] = 0;
465          uint32 crc = 0;
466 <        for (uint32 i=0; i<p; i++) {
466 >        for (uint32 i=0; i<slot_rom_size; i++) {
467                  crc = (crc << 1) | (crc >> 31);
468 <                crc += srom[i];
468 >                crc += p[i];
469          }
470 <        srom[p - 12] = crc >> 24;
471 <        srom[p - 11] = crc >> 16;
472 <        srom[p - 10] = crc >> 8;
473 <        srom[p - 9] = crc;
451 <
452 <        // Copy slot ROM to Mac ROM
453 <        memcpy(ROMBaseHost + ROMSize - p, srom, p);
454 <        return true;
470 >        p[slot_rom_size - 12] = crc >> 24;
471 >        p[slot_rom_size - 11] = crc >> 16;
472 >        p[slot_rom_size - 10] = crc >> 8;
473 >        p[slot_rom_size - 9] = crc;
474   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines