Rev 896 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
668 | lvd | 1 | // ZX-Evo Base Configuration (c) NedoPC 2008,2009,2010,2011,2012,2013,2014 |
275 | lvd | 2 | // |
3 | // decoding mode setup: which border, which modes in one-hot style coding |
||
4 | |||
668 | lvd | 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 | |||
275 | lvd | 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 | |||
319 | lvd | 42 | |
275 | lvd | 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 |
||
528 | lvd | 46 | output reg mode_a_txt_1page, // atm text mode in a single page (modifier for mode_a_text) |
275 | lvd | 47 | |
48 | output reg mode_pixf_14, // =1: 14MHz pixelclock on (default is 7MHz). |
||
319 | lvd | 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 |
||
275 | lvd | 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 |
||
528 | lvd | 68 | // 3'b111 - 80x25 text mode (single page) |
275 | lvd | 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; |
||
528 | lvd | 80 | 3'b111: mode_atm_n_pent <= 1'b1; |
275 | lvd | 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; |
||
528 | lvd | 91 | 3'b111: mode_zx <= 1'b0; |
275 | lvd | 92 | |
93 | default: begin |
||
94 | if( (pent_vmode==2'b00) || (pent_vmode==2'b11) ) |
||
332 | lvd | 95 | mode_zx <= 1'b1; |
96 | else |
||
275 | lvd | 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 | |||
528 | lvd | 127 | if( (atm_vmode==3'b110) || (atm_vmode==3'b111) ) |
275 | lvd | 128 | mode_a_text <= 1'b1; |
129 | else |
||
130 | mode_a_text <= 1'b0; |
||
131 | |||
528 | lvd | 132 | if( atm_vmode==3'b111 ) |
133 | mode_a_txt_1page <= 1'b1; |
||
134 | else |
||
135 | mode_a_txt_1page <= 1'b0; |
||
275 | lvd | 136 | |
137 | |||
528 | lvd | 138 | |
139 | if( (atm_vmode==3'b010) || (atm_vmode==3'b110) || (atm_vmode==3'b111) ) |
||
275 | lvd | 140 | mode_pixf_14 <= 1'b1; |
141 | else |
||
142 | mode_pixf_14 <= 1'b0; |
||
143 | |||
319 | lvd | 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 | |||
275 | lvd | 152 | end |
153 | |||
154 | endmodule |
||
155 |