Subversion Repositories pentevo

Rev

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