Previous 199869 Revisions Next

r35196 Sunday 22nd February, 2015 at 03:43:48 UTC by R. Belmont
(MESS) apple3: Implement 'smooth scrolling' feature for all video modes. [R. Belmont]
[src/mess/includes]apple3.h
[src/mess/machine]apple3.c
[src/mess/video]apple3.c

trunk/src/mess/includes/apple3.h
r243707r243708
164164   int m_analog_sel;
165165   bool m_ramp_active;
166166   int m_pdl_charge;
167   int m_va, m_vb, m_vc;
168   int m_smoothscr;
167169};
168170
169171#endif /* APPLE3_H_ */
trunk/src/mess/machine/apple3.c
r243707r243708
240240         result = 0x00;
241241         break;
242242
243      case 0xd9:
244         popmessage("Smooth scroll enabled, contact MESSdev");
243      case 0xd8: case 0xd9:
244         m_smoothscr = offset & 1;
245245         break;
246246
247247      case 0xDB:
248248         apple3_write_charmem();
249249         break;
250250
251      case 0xE0: case 0xE1: case 0xE2: case 0xE3:
252      case 0xE4: case 0xE5: case 0xE6: case 0xE7:
253      case 0xE8: case 0xE9: case 0xEA: case 0xEB:
254      case 0xEC: case 0xED: case 0xEE: case 0xEF:
251      case 0xE0: case 0xE1:
255252         result = m_fdc->read(space, offset&0xf);
253         m_va = offset & 1;
256254         break;
257255
256      case 0xE2: case 0xE3:
257         result = m_fdc->read(space, offset&0xf);
258         m_vb = offset & 1;
259         break;
260
261      case 0xE4: case 0xE5:
262         result = m_fdc->read(space, offset&0xf);
263         m_vc = offset & 1;
264         break;
265
266      case 0xE6: case 0xE7: case 0xE8: case 0xE9:
267      case 0xEA: case 0xEB: case 0xEC: case 0xED:
268      case 0xEE: case 0xEF:
269         result = m_fdc->read(space, offset&0xf);
270         break;
271
258272      case 0xF0:
259273      case 0xF1:
260274      case 0xF2:
r243707r243708
659673   m_via_1_a = ~0;
660674   m_via_0_irq = 0;
661675   m_via_1_irq = 0;
676   m_va = 0;
677   m_vb = 0;
678   m_vc = 0;
679   m_smoothscr = 0;
662680
663681   // kludge round +12v pull up resistors, which after conversion will bring this low when nothing is plugged in. issue also affects dcd/dsr but those don't affect booting.
664682   m_acia->write_cts(0);
r243707r243708
707725   save_item(NAME(m_analog_sel));
708726   save_item(NAME(m_ramp_active));
709727   save_item(NAME(m_pdl_charge));
728   save_item(NAME(m_va));
729   save_item(NAME(m_vb));
730   save_item(NAME(m_vc));
731   save_item(NAME(m_smoothscr));
710732
711733   machine().save().register_postload(save_prepost_delegate(FUNC(apple3_state::apple3_postload), this));
712734}
r243707r243708
12751297      m_maincpu->set_input_line(INPUT_LINE_NMI, state);
12761298   }
12771299}
1300
trunk/src/mess/video/apple3.c
r243707r243708
138138
139139void apple3_state::apple3_video_text40(bitmap_ind16 &bitmap)
140140{
141   int x, y, col, row;
141   int x, y, col, row, lc;
142142   offs_t offset;
143143   UINT8 ch;
144144   const UINT8 *char_data;
r243707r243708
146146   UINT16 *dest;
147147   UINT8 *ram = m_ram->pointer();
148148   UINT32 ram_size = m_ram->size();
149   int smooth = m_va | (m_vb << 1) | (m_vc << 2);
149150
150151   for (y = 0; y < 24; y++)
151152   {
r243707r243708
164165         }
165166         else
166167         {
167            /* monochrome */
168            /* monochrome - on a real /// with an RGB monitor, text is white */
168169            bg = BLACK;
169            fg = GREEN;
170            fg = WHITE;
170171         }
171172
172173         /* inverse? */
r243707r243708
183184         {
184185            for (col = 0; col < 7; col++)
185186            {
186               dest = &bitmap.pix16(y * 8 + row, x * 14 + col * 2);
187               if (m_smoothscr)
188               {
189                  // get the offset into the group of 8 lines
190                  lc = (col + smooth) & 7;
191               }
192               else
193               {
194                  lc = col;
195               }
196
197               dest = &bitmap.pix16(y * 8 + row, x * 14 + lc * 2);
187198               dest[0] = (char_data[row] & (1 << col)) ? fg : bg;
188199               dest[1] = (char_data[row] & (1 << col)) ? fg : bg;
189200            }
r243707r243708
196207
197208void apple3_state::apple3_video_text80(bitmap_ind16 &bitmap)
198209{
199   int x, y, col, row;
210   int x, y, col, row, lc;
200211   offs_t offset;
201212   UINT8 ch;
202213   const UINT8 *char_data;
r243707r243708
204215   UINT16 *dest;
205216   UINT8 *ram = m_ram->pointer();
206217   UINT32 ram_size = m_ram->size();
218   int smooth = m_va | (m_vb << 1) | (m_vc << 2);
207219
208220   for (y = 0; y < 24; y++)
209221   {
r243707r243708
221233         {
222234            for (col = 0; col < 7; col++)
223235            {
224               dest = &bitmap.pix16(y * 8 + row, x * 14 + col + 0);
236               if (m_smoothscr)
237               {
238                  // get the offset into the group of 8 lines
239                  lc = (col + smooth) & 7;
240               }
241               else
242               {
243                  lc = col;
244               }
245
246               dest = &bitmap.pix16(y * 8 + row, x * 14 + lc + 0);
225247               *dest = (char_data[row] & (1 << col)) ? fg : bg;
226248            }
227249         }
r243707r243708
249271void apple3_state::apple3_video_graphics_hgr(bitmap_ind16 &bitmap)
250272{
251273   /* hi-res mode: 280x192x2 */
252   int y, i, x;
274   int y, i, x, ly, lyb;
253275   const UINT8 *pix_info;
254276   UINT16 *ptr;
255277   UINT8 b;
256278   UINT8 *ram = m_ram->pointer();
279   int smooth = m_va | (m_vb << 1) | (m_vc << 2);
257280
258281   for (y = 0; y < 192; y++)
259282   {
283      ly = y;
284      if (m_smoothscr)
285      {
286         // get our base Y position
287         ly = y & ~7;
288         // get the offset into the group of 8 lines
289         lyb = ((y % 8) + smooth) & 7;
290         // add to the base
291         ly += lyb;
292      }
293
260294      if (m_flags & VAR_VM2)
261         pix_info = &ram[m_hgr_map[y]];
295         pix_info = &ram[m_hgr_map[ly]];
262296      else
263         pix_info = &ram[m_hgr_map[y] - 0x2000];
297         pix_info = &ram[m_hgr_map[ly] - 0x2000];
264298      ptr = &bitmap.pix16(y);
265299
266300      for (i = 0; i < 40; i++)
r243707r243708
280314void apple3_state::apple3_video_graphics_chgr(bitmap_ind16 &bitmap)
281315{
282316   /* color hi-res mode: 280x192x16 */
283   int y, i, x;
317   int y, i, x, ly, lyb;
284318   const UINT8 *pix_info;
285319   const UINT8 *col_info;
286320   UINT16 *ptr;
287321   UINT8 b;
288322   UINT16 fgcolor, bgcolor;
289323   UINT8 *ram = m_ram->pointer();
324   int smooth = m_va | (m_vb << 1) | (m_vc << 2);
290325
291326   for (y = 0; y < 192; y++)
292327   {
328      ly = y;
329      if (m_smoothscr)
330      {
331         // get our base Y position
332         ly = y & ~7;
333         // get the offset into the group of 8 lines
334         lyb = ((y % 8) + smooth) & 7;
335         // add to the base
336         ly += lyb;
337      }
338
293339      if (m_flags & VAR_VM2)
294340      {
295         pix_info = &ram[m_hgr_map[y] + 0x2000];
296         col_info = &ram[m_hgr_map[y] + 0x4000];
341         pix_info = &ram[m_hgr_map[ly] + 0x2000];
342         col_info = &ram[m_hgr_map[ly] + 0x4000];
297343      }
298344      else
299345      {
300         pix_info = &ram[m_hgr_map[y] - 0x2000];
301         col_info = &ram[m_hgr_map[y]];
346         pix_info = &ram[m_hgr_map[ly] - 0x2000];
347         col_info = &ram[m_hgr_map[ly]];
302348      }
303349      ptr = &bitmap.pix16(y);
304350
r243707r243708
326372void apple3_state::apple3_video_graphics_shgr(bitmap_ind16 &bitmap)
327373{
328374   /* super hi-res mode: 560x192x2 */
329   int y, i, x;
375   int y, i, x, ly, lyb;
330376   const UINT8 *pix_info1;
331377   const UINT8 *pix_info2;
332378   UINT16 *ptr;
333379   UINT8 b1, b2;
334380   UINT8 *ram = m_ram->pointer();
381   int smooth = m_va | (m_vb << 1) | (m_vc << 2);
335382
336383   for (y = 0; y < 192; y++)
337384   {
385      ly = y;
386      if (m_smoothscr)
387      {
388         // get our base Y position
389         ly = y & ~7;
390         // get the offset into the group of 8 lines
391         lyb = ((y % 8) + smooth) & 7;
392         // add to the base
393         ly += lyb;
394      }
395
338396      if (m_flags & VAR_VM2)
339397      {
340         pix_info1 = &ram[m_hgr_map[y] + 0x2000];
341         pix_info2 = &ram[m_hgr_map[y] + 0x4000];
398         pix_info1 = &ram[m_hgr_map[ly] + 0x2000];
399         pix_info2 = &ram[m_hgr_map[ly] + 0x4000];
342400      }
343401      else
344402      {
345         pix_info1 = &ram[m_hgr_map[y] - 0x2000];
346         pix_info2 = &ram[m_hgr_map[y]];
403         pix_info1 = &ram[m_hgr_map[ly] - 0x2000];
404         pix_info2 = &ram[m_hgr_map[ly]];
347405      }
348406      ptr = &bitmap.pix16(y);
349407
r243707r243708
373431{
374432   UINT16 *pen;
375433   UINT8 p1, p2, p3, p4;
376   int y, i;
434   int y, i, ly, lyb;
377435   UINT8 *ram = m_ram->pointer();
436   int smooth = m_va | (m_vb << 1) | (m_vc << 2);
378437
379438   for (y = 0; y < 192; y++)
380439   {
440      ly = y;
441      if (m_smoothscr)
442      {
443         // get our base Y position
444         ly = y & ~7;
445         // get the offset into the group of 8 lines
446         lyb = ((y % 8) + smooth) & 7;
447         // add to the base
448         ly += lyb;
449      }
450
381451      pen = &bitmap.pix16(y);
382452      for (i = 0; i < 20; i++)
383453      {
384454         if (m_flags & VAR_VM2)
385455         {
386            p1 = ram[m_hgr_map[y] + 0x2000 + (i * 2) + 0];
387            p2 = ram[m_hgr_map[y] + 0x4000 + (i * 2) + 0];
388            p3 = ram[m_hgr_map[y] + 0x2000 + (i * 2) + 1];
389            p4 = ram[m_hgr_map[y] + 0x4000 + (i * 2) + 1];
456            p1 = ram[m_hgr_map[ly] + 0x2000 + (i * 2) + 0];
457            p2 = ram[m_hgr_map[ly] + 0x4000 + (i * 2) + 0];
458            p3 = ram[m_hgr_map[ly] + 0x2000 + (i * 2) + 1];
459            p4 = ram[m_hgr_map[ly] + 0x4000 + (i * 2) + 1];
390460         }
391461         else
392462         {
393            p1 = ram[m_hgr_map[y] - 0x2000 + (i * 2) + 0];
394            p2 = ram[m_hgr_map[y] - 0x0000 + (i * 2) + 0];
395            p3 = ram[m_hgr_map[y] - 0x2000 + (i * 2) + 1];
396            p4 = ram[m_hgr_map[y] - 0x0000 + (i * 2) + 1];
463            p1 = ram[m_hgr_map[ly] - 0x2000 + (i * 2) + 0];
464            p2 = ram[m_hgr_map[ly] - 0x0000 + (i * 2) + 0];
465            p3 = ram[m_hgr_map[ly] - 0x2000 + (i * 2) + 1];
466            p4 = ram[m_hgr_map[ly] - 0x0000 + (i * 2) + 1];
397467         }
398468
399469         pen[ 0] = pen[ 1] = pen[ 2] = pen[ 3] = (p1 & 0x0f);
r243707r243708
412482
413483UINT32 apple3_state::screen_update_apple3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
414484{
415//  printf("gfx mode %x\n", m_flags & (VAR_VM3|VAR_VM1|VAR_VM0));
485//   printf("gfx mode %x\n", m_flags & (VAR_VM3|VAR_VM1|VAR_VM0));
416486
417487   switch(m_flags & (VAR_VM3|VAR_VM1|VAR_VM0))
418488   {


Previous 199869 Revisions Next


© 1997-2024 The MAME Team