Subversion Repositories pentevo

Rev

Rev 796 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed | ?url?

  1. #include "std.h"
  2.  
  3. #include "emul.h"
  4. #include "vars.h"
  5. #include "draw.h"
  6. #include "dxrend.h"
  7. #include "dxr_atm.h"
  8. #include "dxr_atm0.h"
  9. #include "dxr_atm2.h"
  10. #include "dxr_atm4.h"
  11. #include "dxr_atm6.h"
  12. #include "dxr_atm7.h"
  13. #include "dxr_atmf.h"
  14.  
  15. typedef void (*TAtmRendFunc)(unsigned char *dst, unsigned pitch);
  16.  
  17. static void rend_atm_frame_small(unsigned char *dst, unsigned pitch)
  18. {
  19.      static const TAtmRendFunc AtmRendFunc[] =
  20.      { rend_atmframe8, rend_atmframe16, nullptr, rend_atmframe32 };
  21.  
  22.      AtmRendFunc[temp.obpp/8-1](dst, pitch);
  23. }
  24.  
  25. static void rend_atm_frame(unsigned char *dst, unsigned pitch)
  26. {
  27.     if (conf.fast_sl) {
  28.         switch(temp.obpp)
  29.         {
  30.         case 8:
  31.             rend_atmframe_8d1(dst, pitch);
  32.             break;
  33.         case 16:
  34.             rend_atmframe_16d1(dst, pitch);
  35.             break;
  36.         case 32:
  37.             rend_atmframe_32d1(dst, pitch);
  38.             break;
  39.         }
  40.     } else {
  41.         switch(temp.obpp)
  42.         {
  43.         case 8:
  44.             rend_atmframe_8d(dst, pitch);
  45.             break;
  46.         case 16:
  47.             rend_atmframe_16d(dst, pitch);
  48.             break;
  49.         case 32:
  50.             rend_atmframe_32d(dst, pitch);
  51.             break;
  52.         }
  53.     }
  54.  
  55. }
  56.  
  57. // atm2, atm3
  58. void rend_atm_2_small(unsigned char *dst, unsigned pitch)
  59. {
  60.     if (temp.comp_pal_changed) {
  61.         pixel_tables();
  62.         temp.comp_pal_changed = 0;
  63.     }
  64.  
  65.     if ( 3 == (comp.pFF77 & 7) ) // Sinclair VideoMode
  66.     {
  67.         rend_small(dst, pitch);
  68.         return;
  69.     }
  70.  
  71.     if ( 7 == (comp.pFF77 & 7) ) // Undocumented Sinclair Textmode VideoMode
  72.     {
  73. //        rend_atm7_small(dst, pitch);
  74.         return;
  75.     }
  76.  
  77.     if (temp.oy > temp.scy && conf.fast_sl)
  78.         pitch *= 2;
  79.     rend_atm_frame_small(dst, pitch);
  80.  
  81.     for (unsigned y = 0; y < 200; y++)
  82.     {
  83.         const AtmVideoController::ScanLine& Scanline = AtmVideoCtrl.Scanlines[y+56];
  84.         switch (Scanline.VideoMode)
  85.         {
  86.         case 0: // EGA 320x200
  87.             rend_atm0_small(dst, pitch, y, Scanline.Offset);
  88.             break;
  89. /* 640x200
  90.         case 2: // Hardware Multicolor
  91.             rend_atm2(dst, pitch, y, Scanline.Offset);
  92.             break;
  93.         case 6: //< Textmode
  94.             rend_atm6(dst, pitch, y, Scanline.Offset);
  95.             break;
  96. */
  97.         }
  98.     }
  99. }
  100.  
  101. // atm2, atm3 dbl
  102. void rend_atm_2(unsigned char *dst, unsigned pitch)
  103. {
  104.     if (temp.comp_pal_changed) {
  105.         pixel_tables();
  106.         temp.comp_pal_changed = 0;
  107.     }
  108.  
  109.     if ( 3 == (comp.pFF77 & 7) ) // Sinclair VideoMode
  110.     {
  111.         rend_dbl(dst, pitch);
  112.         return;
  113.     }
  114.  
  115.     if ( 7 == (comp.pFF77 & 7) ) // Undocumented Sinclair Textmode VideoMode
  116.     {
  117.         rend_atm7(dst, pitch);
  118.         return;
  119.     }
  120.    
  121.     if (temp.oy > temp.scy && conf.fast_sl)
  122.         pitch *= 2;
  123.     rend_atm_frame(dst, pitch);
  124.  
  125.     for (unsigned y=0; y < 200; y++)
  126.     {
  127.         const AtmVideoController::ScanLine& Scanline = AtmVideoCtrl.Scanlines[y+56];
  128.         switch (Scanline.VideoMode)
  129.         {
  130.         case 0: // EGA 320x200
  131.             rend_atm0(dst, pitch, y, Scanline.Offset);
  132.             break;
  133.         case 2: // Hardware Multicolor
  134.             rend_atm2(dst, pitch, y, Scanline.Offset);
  135.             break;
  136.         case 4: // Textmode (vga like)
  137.             if(conf.mem_model == MM_ATM3)
  138.                 rend_atm4(dst, pitch, y);
  139.             break;
  140.         case 6: // Textmode
  141.             rend_atm6(dst, pitch, y, Scanline.Offset);
  142.             break;
  143.         }
  144.     }
  145. }
  146.  
  147. // atm1 small
  148. void rend_atm_1_small(unsigned char *dst, unsigned pitch)
  149. {
  150.    if (temp.comp_pal_changed) {
  151.       pixel_tables();
  152.       temp.comp_pal_changed = 0;
  153.    }
  154.  
  155.    int VideoMode = (comp.aFE >> 5) & 3;
  156.    if ( 3 == VideoMode ) // Sinclair VideoMode
  157.    {
  158.        rend_small(dst, pitch);
  159.        return;
  160.    }
  161.  
  162.    if (temp.oy > temp.scy && conf.fast_sl)
  163.        pitch *= 2;
  164.    rend_atm_frame_small(dst, pitch);
  165.  
  166.    for (unsigned y = 0; y < 200; y++)
  167.    {
  168.        const AtmVideoController::ScanLine& Scanline = AtmVideoCtrl.Scanlines[y+56];
  169.        switch (Scanline.VideoMode)
  170.        {
  171.        case 0: // EGA 320x200
  172.            rend_atm0_small(dst, pitch, y, Scanline.Offset);
  173.            break;
  174. /*
  175.        case 1: // Hardware Multicolor
  176.            rend_atm2(dst, pitch, y, Scanline.Offset);
  177.            break;
  178. */
  179.        }
  180.    }
  181. }
  182.  
  183. // atm1 dbl
  184. void rend_atm_1(unsigned char *dst, unsigned pitch)
  185. {
  186.    if (temp.comp_pal_changed) {
  187.       pixel_tables();
  188.       temp.comp_pal_changed = 0;
  189.    }
  190.  
  191.    int VideoMode = (comp.aFE >> 5) & 3;
  192.    if ( 3 == VideoMode ) // Sinclair VideoMode
  193.    {
  194.        rend_dbl(dst, pitch);
  195.        return;
  196.    }
  197.  
  198.    if (temp.oy > temp.scy && conf.fast_sl)
  199.        pitch *= 2;
  200.    rend_atm_frame(dst, pitch);
  201.  
  202.    for (unsigned y = 0; y < 200; y++)
  203.    {
  204.        const AtmVideoController::ScanLine& Scanline = AtmVideoCtrl.Scanlines[y+56];
  205.        switch (Scanline.VideoMode)
  206.        {
  207.        case 0: // EGA 320x200
  208.            rend_atm0(dst, pitch, y, Scanline.Offset);
  209.            break;
  210.        case 1: // Hardware Multicolor
  211.            rend_atm2(dst, pitch, y, Scanline.Offset);
  212.            break;
  213.        }
  214.    }
  215. }
  216.