Subversion Repositories pentevo

Rev

Rev 332 | Rev 543 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. `include "../include/tune.v"
  2.  
  3. // Pentevo project (c) NedoPC 2010
  4. //
  5. // decoding mode setup: which border, which modes in one-hot style coding
  6.  
  7. module video_modedecode(
  8.  
  9.         input  wire        clk,
  10.  
  11.         input  wire [ 1:0] pent_vmode, // inputs as set by Z80 environment
  12.         input  wire [ 2:0] atm_vmode,  //
  13.  
  14.  
  15.         output reg         mode_atm_n_pent, // =1 - atm modes, =0 - pentagon modes (mainly for border and visible area changing)
  16.  
  17.  
  18.         output reg         mode_zx, // standard ZX mode
  19.  
  20.         output reg         mode_p_16c,   // pentagon 16 colors
  21.         output reg         mode_p_hmclr, // pentagon hardware multicolor
  22.  
  23.  
  24.         output reg         mode_a_hmclr, // 640x200 atm hardware multicolor
  25.         output reg         mode_a_16c,   // 320x200 atm 16 colors
  26.         output reg         mode_a_text,  // 640x200 (80x25 symbols) atm text mode
  27.  
  28.  
  29.         output reg         mode_pixf_14, // =1: 14MHz pixelclock on (default is 7MHz).
  30.  
  31.  
  32.         output reg  [ 1:0] mode_bw // required bandwidth: 2'b00 - 1/8, 2'b01 - 1/4,
  33.                                    //                     2'b10 - 1/2, 2'b11 - 1
  34. );
  35.  
  36. // values for pent_vmode and atm_vmode:
  37.  
  38. // pent:
  39. // 2'b00 - standard ZX
  40. // 2'b01 - hardware multicolor
  41. // 2'b10 - pentagon 16 colors
  42. // 2'b11 - not defined yet
  43.  
  44. // atm:
  45. // 3'b011 - zx modes (pent_vmode is active)
  46. // 3'b010 - 640x200 hardware multicolor
  47. // 3'b000 - 320x200 16 colors
  48. // 3'b110 - 80x25 text mode
  49. // 3'b??? (others) - not defined yet
  50.  
  51.  
  52.  
  53.  
  54.         always @(posedge clk)
  55.         begin
  56.                 case( atm_vmode )
  57.                         3'b010:  mode_atm_n_pent <= 1'b1;
  58.                         3'b000:  mode_atm_n_pent <= 1'b1;
  59.                         3'b110:  mode_atm_n_pent <= 1'b1;
  60.  
  61.                         3'b011:  mode_atm_n_pent <= 1'b0;
  62.                         default: mode_atm_n_pent <= 1'b0;
  63.                 endcase
  64.  
  65.  
  66.                 case( atm_vmode )
  67.                         3'b010: mode_zx <= 1'b0;
  68.                         3'b000: mode_zx <= 1'b0;
  69.                         3'b110: mode_zx <= 1'b0;
  70.  
  71.                         default: begin
  72.                                 if( (pent_vmode==2'b00) || (pent_vmode==2'b11) )
  73.                                         mode_zx <= 1'b1;
  74.                                 else
  75.                                         mode_zx <= 1'b0;
  76.                         end
  77.                 endcase
  78.  
  79.  
  80.                
  81.                 if( (atm_vmode==3'b011) && (pent_vmode==2'b10) )
  82.                         mode_p_16c <= 1'b1;
  83.                 else
  84.                         mode_p_16c <= 1'b0;
  85.  
  86.  
  87.                 if( (atm_vmode==3'b011) && (pent_vmode==2'b01) )
  88.                         mode_p_hmclr <= 1'b1;
  89.                 else
  90.                         mode_p_hmclr <= 1'b0;
  91.  
  92.  
  93.                 if( atm_vmode==3'b010 )
  94.                         mode_a_hmclr <= 1'b1;
  95.                 else
  96.                         mode_a_hmclr <= 1'b0;
  97.                
  98.  
  99.                 if( atm_vmode==3'b000 )
  100.                         mode_a_16c <= 1'b1;
  101.                 else
  102.                         mode_a_16c <= 1'b0;
  103.                
  104.  
  105.                 if( atm_vmode==3'b110 )
  106.                         mode_a_text <= 1'b1;
  107.                 else
  108.                         mode_a_text <= 1'b0;
  109.                
  110.  
  111.  
  112.                 if( (atm_vmode==3'b010) || (atm_vmode==3'b110) )
  113.                         mode_pixf_14 <= 1'b1;
  114.                 else
  115.                         mode_pixf_14 <= 1'b0;
  116.  
  117.  
  118.  
  119.  
  120.                 if( (atm_vmode==3'b011) && (pent_vmode!=2'b10) )
  121.                         mode_bw <= 2'b00; // 1/8
  122.                 else
  123.                         mode_bw <= 2'b01; // 1/4
  124.  
  125.  
  126.         end
  127.  
  128. endmodule
  129.  
  130.