Subversion Repositories pentevo

Rev

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

  1. // ZX-Evo Base Configuration (c) NedoPC 2008,2009,2010,2011,2012,2013,2014
  2. //
  3. // decoding mode setup: which border, which modes in one-hot style coding
  4.  
  5. /*
  6.     This file is part of ZX-Evo Base Configuration firmware.
  7.  
  8.     ZX-Evo Base Configuration firmware is free software:
  9.     you can redistribute it and/or modify it under the terms of
  10.     the GNU General Public License as published by
  11.     the Free Software Foundation, either version 3 of the License, or
  12.     (at your option) any later version.
  13.  
  14.     ZX-Evo Base Configuration firmware is distributed in the hope that
  15.     it will be useful, but WITHOUT ANY WARRANTY; without even
  16.     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  17.     See the GNU General Public License for more details.
  18.  
  19.     You should have received a copy of the GNU General Public License
  20.     along with ZX-Evo Base Configuration firmware.
  21.     If not, see <http://www.gnu.org/licenses/>.
  22. */
  23.  
  24. `include "../include/tune.v"
  25.  
  26. module video_modedecode(
  27.  
  28.         input  wire        clk,
  29.  
  30.         input  wire [ 1:0] pent_vmode, // inputs as set by Z80 environment
  31.         input  wire [ 2:0] atm_vmode,  //
  32.  
  33.  
  34.         output reg         mode_atm_n_pent, // =1 - atm modes, =0 - pentagon modes (mainly for border and visible area changing)
  35.  
  36.  
  37.         output reg         mode_zx, // standard ZX mode
  38.  
  39.         output reg         mode_p_16c,   // pentagon 16 colors
  40.         output reg         mode_p_hmclr, // pentagon hardware multicolor
  41.  
  42.  
  43.         output reg         mode_a_hmclr, // 640x200 atm hardware multicolor
  44.         output reg         mode_a_16c,   // 320x200 atm 16 colors
  45.         output reg         mode_a_text,  // 640x200 (80x25 symbols) atm text mode
  46.         output reg         mode_a_txt_1page, // atm text mode in a single page (modifier for mode_a_text)
  47.  
  48.         output reg         mode_pixf_14, // =1: 14MHz pixelclock on (default is 7MHz).
  49.  
  50.  
  51.         output reg  [ 1:0] mode_bw // required bandwidth: 2'b00 - 1/8, 2'b01 - 1/4,
  52.                                    //                     2'b10 - 1/2, 2'b11 - 1
  53. );
  54.  
  55. // values for pent_vmode and atm_vmode:
  56.  
  57. // pent:
  58. // 2'b00 - standard ZX
  59. // 2'b01 - hardware multicolor
  60. // 2'b10 - pentagon 16 colors
  61. // 2'b11 - not defined yet
  62.  
  63. // atm:
  64. // 3'b011 - zx modes (pent_vmode is active)
  65. // 3'b010 - 640x200 hardware multicolor
  66. // 3'b000 - 320x200 16 colors
  67. // 3'b110 - 80x25 text mode
  68. // 3'b111 - 80x25 text mode (single page)
  69. // 3'b??? (others) - not defined yet
  70.  
  71.  
  72.  
  73.  
  74.         always @(posedge clk)
  75.         begin
  76.                 case( atm_vmode )
  77.                         3'b010:  mode_atm_n_pent <= 1'b1;
  78.                         3'b000:  mode_atm_n_pent <= 1'b1;
  79.                         3'b110:  mode_atm_n_pent <= 1'b1;
  80.                         3'b111:  mode_atm_n_pent <= 1'b1;
  81.  
  82.                         3'b011:  mode_atm_n_pent <= 1'b0;
  83.                         default: mode_atm_n_pent <= 1'b0;
  84.                 endcase
  85.  
  86.  
  87.                 case( atm_vmode )
  88.                         3'b010: mode_zx <= 1'b0;
  89.                         3'b000: mode_zx <= 1'b0;
  90.                         3'b110: mode_zx <= 1'b0;
  91.                         3'b111: mode_zx <= 1'b0;
  92.  
  93.                         default: begin
  94.                                 if( (pent_vmode==2'b00) || (pent_vmode==2'b11) )
  95.                                         mode_zx <= 1'b1;
  96.                                 else
  97.                                         mode_zx <= 1'b0;
  98.                         end
  99.                 endcase
  100.  
  101.  
  102.                
  103.                 if( (atm_vmode==3'b011) && (pent_vmode==2'b10) )
  104.                         mode_p_16c <= 1'b1;
  105.                 else
  106.                         mode_p_16c <= 1'b0;
  107.  
  108.  
  109.                 if( (atm_vmode==3'b011) && (pent_vmode==2'b01) )
  110.                         mode_p_hmclr <= 1'b1;
  111.                 else
  112.                         mode_p_hmclr <= 1'b0;
  113.  
  114.  
  115.                 if( atm_vmode==3'b010 )
  116.                         mode_a_hmclr <= 1'b1;
  117.                 else
  118.                         mode_a_hmclr <= 1'b0;
  119.                
  120.  
  121.                 if( atm_vmode==3'b000 )
  122.                         mode_a_16c <= 1'b1;
  123.                 else
  124.                         mode_a_16c <= 1'b0;
  125.                
  126.  
  127.                 if( (atm_vmode==3'b110) || (atm_vmode==3'b111) )
  128.                         mode_a_text <= 1'b1;
  129.                 else
  130.                         mode_a_text <= 1'b0;
  131.                
  132.                 if( atm_vmode==3'b111 )
  133.                         mode_a_txt_1page <= 1'b1;
  134.                 else
  135.                         mode_a_txt_1page <= 1'b0;
  136.  
  137.  
  138.  
  139.                 if( (atm_vmode==3'b010) || (atm_vmode==3'b110) || (atm_vmode==3'b111) )
  140.                         mode_pixf_14 <= 1'b1;
  141.                 else
  142.                         mode_pixf_14 <= 1'b0;
  143.  
  144.  
  145.  
  146.                 if( (atm_vmode==3'b011) && (pent_vmode!=2'b10) )
  147.                         mode_bw <= 2'b00; // 1/8
  148.                 else
  149.                         mode_bw <= 2'b01; // 1/4
  150.  
  151.  
  152.         end
  153.  
  154. endmodule
  155.  
  156.