Subversion Repositories pentevo

Rev

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