Subversion Repositories pentevo

Rev

Rev 905 | Rev 1112 | Go to most recent revision | 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. // just DOS signal control
  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 zdos(
  27.  
  28.         input  wire        fclk,
  29.         input  wire        rst_n,
  30.  
  31.  
  32.         input  wire        dos_turn_on,
  33.         input  wire        dos_turn_off,
  34.  
  35.         input  wire        cpm_n,
  36.  
  37.  
  38.         output reg         dos,
  39.  
  40.  
  41.         // for clearing trdemu_wr_disable
  42.         input  wire        zpos,
  43.         input  wire        m1_n,
  44.  
  45.  
  46.         // control of page #FE for emulation
  47.         output reg         in_trdemu,
  48.  
  49.         input  wire        clr_nmi, // out (#BE),a
  50.         input  wire        vg_rdwr_fclk,
  51.         input  wire [ 3:0] fdd_mask,
  52.         input  wire [ 1:0] vg_a,
  53.         input  wire        romnram,
  54.  
  55.         output reg         trdemu_wr_disable
  56. );
  57.  
  58.         wire trdemu_on = vg_rdwr_fclk && fdd_mask[vg_a] && dos && romnram;
  59.  
  60.  
  61.         // control of 'DOS' signal
  62.         always @(posedge fclk, negedge rst_n)
  63.         if( !rst_n )
  64.         begin
  65.                 dos = 1'b1;
  66.         end
  67.         else // posedge fclk
  68.         begin
  69.                 if( !cpm_n )
  70.                         dos <= 1'b1;
  71.                 else if( dos_turn_off )
  72.                         dos <= 1'b0;
  73.                 else if( dos_turn_on )
  74.                         dos <= 1'b1;
  75.         end
  76.  
  77.  
  78.         // vg emulator RAM turn on/off
  79.         always @(posedge fclk, negedge rst_n)
  80.         if( !rst_n )
  81.                 in_trdemu <= 1'b0;
  82.         else if( clr_nmi )
  83.                 in_trdemu <= 1'b0;
  84.         else if( trdemu_on )
  85.                 in_trdemu <= 1'b1;
  86.  
  87.  
  88.         // wr disable for trdemu RAM page
  89.         always @(posedge fclk, negedge rst_n)
  90.         if( !rst_n )
  91.                 trdemu_wr_disable <= 1'b0;
  92.         else if( zpos && !m1_n )
  93.                 trdemu_wr_disable <= 1'b0;
  94.         else if( trdemu_on )
  95.                 trdemu_wr_disable <= 1'b1;
  96.  
  97.  
  98. endmodule
  99.  
  100.  
  101.