Core changes and CSAVE support.

1.	Added support for cassette save.  To use: A) You have to have a file [anyname.cas]
	which is larger than needed.  B) Select the file through the UI Menu 'Save
	Cassette'.  C)Set 'Cass Rwd=0 / Rec=1' to 1. D) Issue your 'CSAVE "NAME"'
	E) When done, set 'Cass Rwd=0 / Rec=1' to 0 to complete the write.  The file can
	now be loaded or copied.  Note a dummy file of a specific size can be created in
	the MiSTer SSH shell in the /media/fat/games/coco3 with the command:
	'truncate -s 65536 tapefileame.cas'. [Note do NOT use over 65536 file length]
2.	Fixed serial interrupt [6551] to not be functional on slot 3 [carts].
3.	Modification of sys_top.v to override use of USER_IO for HDMI - so it can be used
	for logic analyzer debug.  This will only occur when `define	Config_Debug is
	enabled in config.v.
4.	Fixed MUGS of powerup issue occurring on some MiSTer units.
5.	Fixed incorrect application of GIME_IRQ on legacy interrupts.  Fixed race condition
	on reading IRQ status vs clearing the interrupt.
6.	Improved Castle of Tharoggad.  App now loads but locks as the graphics animate.  This
	change improved mmu usage through to CARTS.
7.	Builds now keep track of multiple builds in the same date.  It shows as V240512-001 in
	the menus.  Its also exposed to BASIC and a boot.vhd which can be enabled to autorun is
	supplied in the archive to show how it works.
8.	Additionally, on the boot.vhd disk, is a program which demonstrated how to load a font -
	IBMFONT.BAS. Run it and it maps a font much like the IBM font to the 80 column format.
	Also, a file called TESTRTC.BAS pulls the MiSTer RTC values exposed in BASIC to display
	a clock.
9.	Large improvement in the Timer function.  Code closer emulates COCO3 Timer. Fixes
	Sliphead cart.
10.	In the 20231023 release the wd1773 instances were reduced to 1 for the FDC and one for
	the FDC.  This saved space but introduced a bug when using multiple drives at the same
	time - like a copy command.  This change was removed and the copy command works again.

To Do...
1.	Add Speech / Music cart
2.	Fix Castle of Tharoggad
This commit is contained in:
shodge12 committed 2024-05-14 23:00:16 -04:00
1 parent a3373d34b9
commit 1da70a7929
27 files changed
+1113 -850

No files matched your search

+51 -56
View File
@@ -82,8 +82,6 @@ module Cassette_Write(
);
assign sd_blk_cnt = 6'd0;
// Create 16x sample clock for the 2400 Baud rate...
// ~26us based on 1.78Mhz [562 ns]- divide by 46....
@@ -115,35 +113,38 @@ begin
end
end
// Mounted SD Image [for the cass]
// Mounted SD Image [for the cass]
// This is not used and only here for completeness
reg drive_wp;
reg [31:0] drive_size;
//reg drive_wp;
//reg [31:0] drive_size;
always @(negedge img_mounted)
begin
drive_wp <= img_readonly;
drive_size <= img_size[31:0]; //Size / 256 on [31:8]
end
//always @(negedge img_mounted)
//begin
// drive_wp <= img_readonly;
// drive_size <= img_size[31:0]; //Size / 256 on [31:8]
//end
// Set to 1 512 byte block per r/w
assign sd_blk_cnt = 6'd0;
// Byte Receiver
reg [15:0] incomming_reg;
reg [15:0] incomming_reg;
reg [5:0] bit_time;
reg [2:0] bit_count;
reg wave_negative;
reg [5:0] bit_time;
reg [2:0] bit_count;
reg wave_negative;
localparam time_out = 6'h3f;
localparam wave_zero_level = 6'd32;
localparam bit_time_1 = 6'd22;
//localparam sync = 15'b010_1010_1001_1110; // Pre shift $553C
localparam sync = 15'b0111_1000_1010_101; // Pre shift $553C [L -> R]
localparam sync_proper = 8'h3C;
localparam leader = 8'h55;
localparam pre_rollover = 9'h1FF;
localparam rollover = 9'h000;
localparam time_out = 6'h3f;
localparam wave_zero_level = 6'd32;
localparam bit_time_1 = 6'd22;
localparam sync = 15'b0111_1000_1010_101; // Pre shift $553C [L -> R]
localparam sync_proper = 8'h3C;
localparam leader = 8'h55;
localparam pre_rollover = 9'h1FF;
localparam rollover = 9'h000;
reg byte_clk;
reg look_for_sync;
@@ -151,36 +152,37 @@ reg flush_end, flush_end_que;
reg sd_hold;
reg pre_roll;
reg [7:0] blk_type;
reg [7:0] protocol_data_count;
reg gap;
// Buffer interface
wire [8:0] buf_address;
wire [7:0] buf_data_in;
wire [7:0] buf_data_out;
wire buf_write;
reg [7:0] protocol_data_count;
localparam st_beg0 = 4'd0;
localparam st_start = 4'd1;
localparam st_st1 = 4'd2;
localparam st_st2 = 4'd3;
localparam st_st3 = 4'd4;
localparam st_wr = 4'd5;
localparam st_wr1 = 4'd6;
// State Mach states
localparam st_beg0 = 4'd0;
localparam st_start = 4'd1;
localparam st_st1 = 4'd2;
localparam st_st2 = 4'd3;
localparam st_wr = 4'd4;
localparam st_wr1 = 4'd5;
reg [3:0] st_state;
reg [3:0] state_stack;
localparam p_sync = 3'd0;
localparam p_blk_type = 3'd1;
localparam p_len = 3'd2;
localparam p_dta = 3'd3;
localparam p_cksum = 3'd4;
localparam p_sync = 3'd0;
localparam p_blk_type = 3'd1;
localparam p_len = 3'd2;
localparam p_dta = 3'd3;
localparam p_cksum = 3'd4;
reg [2:0] p_state;
localparam sd_wr_st = 2'd0;
localparam sd_wr_st1 = 2'd1;
localparam sd_wr_st2 = 2'd2;
localparam sd_wr_st = 2'd0;
localparam sd_wr_st1 = 2'd1;
localparam sd_wr_st2 = 2'd2;
reg [1:0] sd_wr_state;
@@ -210,6 +212,7 @@ begin
sd_wr_state <= sd_wr_st;
sd_hold <= 1'b0;
pre_roll <= 1'b0;
gap <= 1'b0;
end
else
begin
@@ -248,6 +251,7 @@ begin
sd_wr_state <= sd_wr_st;
sd_hold <= 1'b0;
pre_roll <= 1'b0;
gap <= 1'b0;
end
byte_clk <= 1'b0;
@@ -265,7 +269,7 @@ begin
if ((DTOA_CODE >= wave_zero_level) && wave_negative)
begin
// Initially we are not collecting the leader bytes just collecting them and
// waiting for the sync $$553C. The write to file stage will automatically
// waiting for the sync $3C55. The write to file stage will automatically
// write the 128 leader bytes befor we start transfering data.
if (!look_for_sync)
begin
@@ -301,7 +305,7 @@ begin
begin
buf_address <= 9'b000000000;
buf_data_in <= leader;
protocol_data_count <= 8'h7f; // We will use this to count the 128 bytes
protocol_data_count <= 8'h80; // We will use this to count the 128 bytes
st_state <= st_start;
end
@@ -363,6 +367,8 @@ begin
state_stack <= st_st1; // We come back here
st_state <= st_wr; // Write a byte
p_state <= p_dta;
if ((blk_type == 8'h00) & (protocol_data_count == 8'h05) & (incomming_reg[15:8] == 8'hff))
gap <= 1'b1;
if (protocol_data_count == 8'h01)
p_state <= p_cksum;
end
@@ -390,24 +396,13 @@ begin
st_st2:
begin
buf_data_in <= leader;
if (blk_type == 8'h00)
protocol_data_count <= 8'h7f; // We will use this to count the 128 bytes
if ((blk_type == 8'h00) || gap)
protocol_data_count <= 8'h80; // We will use this to count the 128 bytes
else
protocol_data_count <= 8'h01; // We will use this to count the 128 bytes
protocol_data_count <= 8'h02; // We will use this to count the 2 bytes
st_state <= st_start; // No, don't write any more - were done
end
st_st3:
begin
state_stack <= st_st3; // We come back here
st_state <= st_wr; // Write a byte
protocol_data_count <= protocol_data_count - 1'b1;
if (protocol_data_count == 8'h00) // 128 bytes
begin
st_state <= st_st1; // No, don't write any more - were done
end
end
// Perform the byte writes to the buffer
// This acts like a sub routine....
st_wr:
+1
View File
@@ -5,6 +5,7 @@ create_clock -period 1000.000 -name img_mounted[2] [get_nodes emu:emu|hps_io:hps
create_clock -period 1000.000 -name img_mounted[1] [get_nodes emu:emu|hps_io:hps_io|img_mounted[1]]
create_clock -period 1000.000 -name img_mounted[0] [get_nodes emu:emu|hps_io:hps_io|img_mounted[0]]
create_clock -period 1000.000 -name RESET_N [get_nodes emu:emu|coco3fpga:coco3|RESET_N]
create_clock -period 1000.000 -name NMISample2 [get_nodes emu:emu|coco3fpga:coco3|mc6809x:GLBCPU09|NMISample2]
#set_false_path -from [get_nodes sysmem_lite:sysmem|sysmem_HPS_fpga_interfaces:fpga_interfaces|clocks_resets~FF_4365]
#create_clock -period 17.46 -name PH_2 [get_nodes emu:emu|coco3fpga:coco3|PH_2_RAW]
#create_clock -period 1000.000 -name CLK_6551[4] [get_nodes emu:emu|coco3fpga:coco3|CLK_6551[4]]
+93 -80
View File
@@ -55,6 +55,7 @@
module EE_Cold_Bt(
input CLK,
input RESET,
input Display_EE, // from MISTer subsystem
input Cold_Boot, // from MISTer subsystem
@@ -106,105 +107,117 @@ assign Start_Display_EE = ((Display_EE == 1'b1) & (Display_EE_D == 1'b0));
assign Start_Cold_Boot = ((Cold_Boot == 1'b1) & (Cold_Boot_D == 1'b0));
always @(posedge CLK)
always @ (posedge CLK or posedge RESET)
begin
Display_EE_D <= Display_EE;
Cold_Boot_D <= Cold_Boot;
next_instruction <= 1'b0;
if (Start_Display_EE)
if(RESET)
begin
prog <= EE_PROG;
Display_EE_D <= 1'b0;
Cold_Boot_D <= 1'b0;
EE <= 1'b1;
N_RESET <= 1'b1;
prog <= 48'h000000000000;
next_instruction <= 1'b0;
timer <= 24'h000000;
end
if (Start_Cold_Boot)
else
begin
prog <= Cold_Boot_PROG;
end
Display_EE_D <= Display_EE;
Cold_Boot_D <= Cold_Boot;
if (next_instruction)
prog[43:0] <= prog[47:4];
next_instruction <= 1'b0;
case(inst)
inst_NULL:;
inst_START:
begin
if (!next_instruction)
if (Start_Display_EE)
begin
timer <= 24'h000000; // clear timer
next_instruction <= 1'b1;
prog <= EE_PROG;
end
end
inst_EE_ACTIVE:
begin
if (!next_instruction)
if (Start_Cold_Boot)
begin
EE <= 1'b0;
next_instruction <= 1'b1;
prog <= Cold_Boot_PROG;
end
end
inst_EE_INACTIVE:
begin
if (!next_instruction)
begin
EE <= 1'b1;
next_instruction <= 1'b1;
end
end
inst_RESET_ACTIVE:
begin
if (!next_instruction)
begin
N_RESET <= 1'b0;
next_instruction <= 1'b1;
end
end
if (next_instruction)
prog[43:0] <= prog[47:4];
case(inst)
inst_RESET_INACTIVE:
begin
if (!next_instruction)
begin
N_RESET <= 1'b1;
next_instruction <= 1'b1;
end
end
inst_SHORT_TIMER:
begin
if (!next_instruction)
begin
timer <= timer + 1'b1;
if (timer==SHORT_TIME)
inst_NULL:;
inst_START:
begin
next_instruction <= 1'b1;
timer <= 24'h000000; // clear timer
if (!next_instruction)
begin
timer <= 24'h000000; // clear timer
next_instruction <= 1'b1;
end
end
end
end
inst_LONG_TIMER:
begin
if (!next_instruction)
begin
timer <= timer + 1'b1;
if (timer==LONG_TIME)
inst_EE_ACTIVE:
begin
next_instruction <= 1'b1;
timer <= 24'h000000; // clear timer
if (!next_instruction)
begin
EE <= 1'b0;
next_instruction <= 1'b1;
end
end
end
inst_EE_INACTIVE:
begin
if (!next_instruction)
begin
EE <= 1'b1;
next_instruction <= 1'b1;
end
end
inst_RESET_ACTIVE:
begin
if (!next_instruction)
begin
N_RESET <= 1'b0;
next_instruction <= 1'b1;
end
end
inst_RESET_INACTIVE:
begin
if (!next_instruction)
begin
N_RESET <= 1'b1;
next_instruction <= 1'b1;
end
end
inst_SHORT_TIMER:
begin
if (!next_instruction)
begin
timer <= timer + 1'b1;
if (timer==SHORT_TIME)
begin
next_instruction <= 1'b1;
timer <= 24'h000000; // clear timer
end
end
end
inst_LONG_TIMER:
begin
if (!next_instruction)
begin
timer <= timer + 1'b1;
if (timer==LONG_TIME)
begin
next_instruction <= 1'b1;
timer <= 24'h000000; // clear timer
end
end
end
default:;
endcase
end
default:;
endcase
end
endmodule
+14 -4
View File
@@ -1827,15 +1827,25 @@ always @ (negedge MASTER_CLK)
// Adjust HSYNC here
**************************************************************************************/
// Width from 87 GIME 5.08 uS = 73 clocks
11'd751: // 824 - 751 = 73 (approx 5.09 uS)
// 11'd751: // 824 - 751 = 73 (approx 5.09 uS)
// begin
// HSYNC_N <= 1'b0; // Turn on Sync
// PIXEL_COUNT <= 11'd752;
// end
// 11'd810: // End of SYNC start of front porch 804 + 80 - 1, End of Sync to Video = 167 816 + 167 =
// begin
// HSYNC_N <= 1'b1; // SYNC OFF
// PIXEL_COUNT <= 11'd811;
// end
11'd752: // 824 - 751 = 73 (approx 5.09 uS)
begin
HSYNC_N <= 1'b0; // Turn on Sync
PIXEL_COUNT <= 11'd752;
PIXEL_COUNT <= 11'd753;
end
11'd810: // End of SYNC start of front porch 804 + 80 - 1, End of Sync to Video = 167 816 + 167 =
11'd811: // End of SYNC start of front porch 804 + 80 - 1, End of Sync to Video = 167 816 + 167 =
begin
HSYNC_N <= 1'b1; // SYNC OFF
PIXEL_COUNT <= 11'd811;
PIXEL_COUNT <= 11'd812;
end
/**************************************************************************************
* End of HSYNC adjustment
+11 -11
View File
@@ -6,16 +6,16 @@ module cassette(
input rewind,
input en,
output reg [24:0] sdram_addr,
output reg [15:0] sdram_addr,
input [7:0] sdram_data,
output reg sdram_rd,
// output reg sdram_rd,
output data,
output [2:0] status
output data
// output [2:0] status
);
assign status = state;
//assign status = state;
reg old_en;
reg ffrewind;
@@ -60,25 +60,25 @@ always @(posedge clk) begin
end
NEXT: begin
state <= READ1;
sdram_rd <= 1'b0;
// sdram_rd <= 1'b0;
if (seq == 24'h553c00) name <= 1'd1;
if (seq == 24'h555555 && name) begin
name <= 1'd0;
state <= WAIT;
hold <= 19'd445000; // 0.5s
sdram_addr <= sdram_addr - 25'd3;
sdram_addr <= sdram_addr - 16'd3;
end
if (seq == 24'h553cff) eof <= 2'd1;
if (seq == 24'h00ff55 && eof == 2'd1) eof <= 2'd2;
if (~en) state <= IDLE;
end
READ1: begin
sdram_rd <= 1'b1;
// sdram_rd <= 1'b1;
state <= READ2;
end
READ2: begin
ibyte <= sdram_data;
sdram_rd <= 1'b0;
// sdram_rd <= 1'b0;
state <= READ3;
sq_start <= 1'b1;
end
@@ -88,14 +88,14 @@ always @(posedge clk) begin
end
READ4: begin
seq <= { seq[15:0], sdram_data };
sdram_addr <= sdram_addr + 25'd1;
sdram_addr <= sdram_addr + 16'd1;
state <= eof == 2'd2 ? IDLE : NEXT;
end
endcase
if (ffrewind ^ rewind) begin
seq <= 24'd0;
sdram_addr <= 25'd0;
sdram_addr <= 16'd0;
state <= IDLE;
eof <= 2'd0;
end
+451 -250
View File
File diff suppressed because it is too large. Load diff
+34 -10
View File
@@ -61,23 +61,47 @@
// This file is a configuration definition file. The CoCo3FPGA for MiSTer source files
// can be built into multiple objects which have mutually exclusive features.
`include "../RTL/config_inc.v"
`define Config_Debug_FLAG 4'hA
localparam [7:0] FEATURE_1 = 8'h01;
localparam [7:0] FEATURE_2 = 8'h02;
localparam [7:0] FEATURE_3 = 8'h04;
localparam [7:0] FEATURE_4 = 8'h08;
localparam [7:0] FEATURE_5 = 8'h10;
localparam [7:0] FEATURE_6 = 8'h20;
localparam [7:0] FEATURE_7 = 8'h40;
localparam [7:0] FEATURE_8 = 8'h80;
// If defined the Config_Debug sets the FEATURE MASKS all OR'd together which appears on COCO space at FFF1 & (FFF0 = 0x55 as a debug flag)
//`define Config_Debug
// This is used for hardware debugging - it overrides the USER_IO to be user_out direct.
// It should be commented out for release
//`define Config_Debug
// Feature list - note only FEATURE_1 - FEATURE_8 are supported
///////////////////////////////////////////////////////////////////////////////////////////////////////////
`set_feature(CoCo3_Horz_INT_FIX, FEATURE_1) // Connection of the horz int to the Mister CoCo3 V5 rasterizer
// `set_feature(CoCo3_Horz_INT_FIX,Feat_1) // Connection of the horz int to the Mister CoCo3 V5 rasterizer
`define CoCo3_Horz_INT_FIX
`define Feat_1
//`set_feature(CoCo3_Vert_INT_FIX, FEATURE_2) // Connection of the vert int to the Mister CoCo3 V5 rasterizer
// `set_feature(CoCo3_Vert_INT_FIX,Feat_2) // Connection of the vert int to the Mister CoCo3 V5 rasterizer
// `define CoCo3_Vert_INT_FIX
// `define Feat_2
`set_feature(CoCo3_CYC_ACC_6809, FEATURE_3) // Use cycle accurate 6809
// `set_feature(CoCo3_CYC_ACC_6809,Feat_3) // Use cycle accurate 6809
`define CoCo3_CYC_ACC_6809
`define Feat_3
`set_feature(CoCo3_sdc_override_size, FEATURE_4) // Define static size value
// `set_feature(CoCo3_sdc_override_size,Feat_4) // Define static size value
`define CoCo3_sdc_override_size
`define Feat_4
`set_feature(CoCo3_sdc_fix_os9_driver, FEATURE_5) // fix sdc query disk size issue in llcocosdc driver in multipak enviroment
// `set_feature(CoCo3_sdc_fix_os9_driver,Feat_5) // fix sdc query disk size issue in llcocosdc driver in multipak enviroment
`define CoCo3_sdc_fix_os9_driver
`define Feat_5
`set_feature(CoCo3_disable_GART_in_GIMEX, FEATURE_6)// Disable GIMEX ram transfers [GIMEX detection in OS( EOU]
// `set_feature(CoCo3_disable_GART_in_GIMEX,Feat_6) // Disable GIMEX ram transfers [GIMEX detection in OS9 EOU]
`define CoCo3_disable_GART_in_GIMEX
`define Feat_6
// `set_feature(CoCo3_Select_GIMEX_RAST,Feat_7) // Use GIMEX Rasterizer Engine
// `define CoCo3_Select_GIMEX_RAST
// `define Feat_7
//`set_feature(CoCo3_Select_GIMEX_RAST, FEATURE_7) // Use GIMEX Rasterizer Engine
-123
View File
@@ -1,123 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
// Project Name: CoCo3FPGA Version 5.x.x
// File Name: config_inc.v
//
// CoCo3 in an FPGA
//
////////////////////////////////////////////////////////////////////////////////
//
// CPU section copyrighted by John Kent
//
////////////////////////////////////////////////////////////////////////////////
//
// Color Computer 3 compatible system on a chip
//
// Version : 5.x
//
// Copyright (c) 2008 Gary Becker ([email protected])
//
// All rights reserved
//
// Redistribution and use in source and synthezised forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// Redistributions in synthesized form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Please report bugs to the author, but before you do so, please
// make sure that this is not a derivative work and that
// you have the latest version of this file.
//
////////////////////////////////////////////////////////////////////////////////
// Gary Becker
// [email protected]
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// MISTer Conversion by Stan Hodge and Alan Steremberg (& Gary Becker)
// [email protected]
//
////////////////////////////////////////////////////////////////////////////////
// This file is a configuration definition include file. The CoCo3FPGA for MiSTer source files
// can be built into multiple objects which have mutually exclusive features.
`define Config_Debug_Value (`config_num_1 | `config_num_2 | `config_num_3 | `config_num_4 | `config_num_5 | `config_num_6 | `config_num_7 | `config_num_8)
`define Config_Debug_FLAG 8'h55
`define FEATURE_1 8'h01
`define FEATURE_2 8'h02
`define FEATURE_3 8'h04
`define FEATURE_4 8'h08
`define FEATURE_5 8'h10
`define FEATURE_6 8'h20
`define FEATURE_7 8'h40
`define FEATURE_8 8'h80
`define config_num_1 8'h00
`define config_num_2 8'h00
`define config_num_3 8'h00
`define config_num_4 8'h00
`define config_num_5 8'h00
`define config_num_6 8'h00
`define config_num_7 8'h00
`define config_num_8 8'h00
`define set_feature(Feat_Name, Feat_Mask) \
`define Feat_Name \
`ifndef config_value_1 \
`define config_value_1 Feat_Mask \
`define config_num_1 Feat_Mask \
`else \
`ifndef config_value_2 \
`define config_value_2 Feat_Mask \
`define config_num_2 Feat_Mask \
`else \
`ifndef config_value_3 \
`define config_value_3 Feat_Mask \
`define config_num_3 Feat_Mask \
`else \
`ifndef config_value_4 \
`define config_value_4 Feat_Mask \
`define config_num_4 Feat_Mask \
`else \
`ifndef config_value_5 \
`define config_value_5 Feat_Mask \
`define config_num_5 Feat_Mask \
`else \
`ifndef config_value_6 \
`define config_value_6 Feat_Mask \
`define config_num_6 Feat_Mask \
`else \
`ifndef config_value_7 \
`define config_value_7 Feat_Mask \
`define config_num_7 Feat_Mask \
`else \
`ifndef config_value_8 \
`define config_value_8 Feat_Mask \
`define config_num_8 Feat_Mask \
`endif \
`endif \
`endif \
`endif \
`endif \
`endif \
`endif \
`endif
+213 -89
View File
@@ -135,6 +135,10 @@ wire [3:0] DRIVE_SEL_EXT_PRE = {DATA_IN[6], DATA_IN[2:0]};
reg [2:0] drive_index;
// SD blk system is a array of 4 systems - one for each drive.
// To keep disk track memory, we created 4 wd1793's to match the sd block interfaces
// For the interface back to the coco - we need to isolate the wd1793 the computer is talking
// to and route those feedback signals back to the coco. This is accomplished via the drive
// select. 'drive_index' identifies which controller is addressd.
always @(negedge FF40_CLK or negedge RESET_N)
@@ -178,7 +182,7 @@ begin
4'b1001:
drive_index <= 3'd1;
default:
drive_index <= 3'd0; // Illegal
drive_index <= 3'd1; // Illegal
endcase
end
end
@@ -208,12 +212,13 @@ wire DRQ[4];
wire selected_DRQ;
wire selected_INTRQ;
wire WR;
wire RD;
wire RD_E;
wire WR[4];
wire RD[4];
wire RD_E[4];
//wire CE;
wire HALT_EN_RST;
wire [7:0] DATA_1793;
wire [7:0] dout[4];
reg read;
reg write;
reg read_d;
@@ -225,7 +230,11 @@ reg read1;
reg write1;
reg [1:0] ADDRESS_L;
assign RD = read || RD_E;
assign RD[0] = (read || RD_E[0]) && (drive_index == 2'd1);
assign RD[1] = (read || RD_E[1]) && (drive_index == 3'd2);
assign RD[2] = (read || RD_E[2]) && (drive_index == 3'd3);
assign RD[3] = (read || RD_E[3]) && (drive_index == 3'd4);
// The idea here is to "stretch" the CPU read and write signals to ensure we catch a 8 mhz enable.
// For writes we will buffer the data out to ensure it does not go away.
@@ -244,8 +253,14 @@ begin
write_d <= 1'b0;
r_w_active <= 1'b0;
clk_8Mhz_enable_found <= 1'b0;
WR <= 1'b0;
RD_E <= 1'b0;
WR[0] <= 1'b0;
WR[1] <= 1'b0;
WR[2] <= 1'b0;
WR[3] <= 1'b0;
RD_E[0] <= 1'b0;
RD_E[1] <= 1'b0;
RD_E[2] <= 1'b0;
RD_E[3] <= 1'b0;
read1 <= 1'b0;
write1 <= 1'b0;
read <= 1'b0;
@@ -278,14 +293,32 @@ begin
begin
// Set Writes
r_w_active <= 1'b1;
WR <= 1'b1;
case (drive_index)
3'd1:
WR[0] <= 1'b1;
3'd2:
WR[1] <= 1'b1;
3'd3:
WR[2] <= 1'b1;
3'd4:
WR[3] <= 1'b1;
endcase
end
// Synchronus rising edge of read
if ((read == 1'b1) && (read_d == 1'b0))
begin
r_w_active <= 1'b1;
RD_E <= 1'b1;
case (drive_index)
3'd1:
RD_E[0] <= 1'b1;
3'd2:
RD_E[1] <= 1'b1;
3'd3:
RD_E[2] <= 1'b1;
3'd4:
RD_E[3] <= 1'b1;
endcase
end
// Clears
@@ -298,54 +331,48 @@ begin
clk_8Mhz_enable_found <= 1'b0;
r_w_active <= 1'b0;
WR <= 1'b0;
WR[0] <= 1'b0;
WR[1] <= 1'b0;
WR[2] <= 1'b0;
WR[3] <= 1'b0;
RD_E <= 1'b0;
RD_E[0] <= 1'b0;
RD_E[1] <= 1'b0;
RD_E[2] <= 1'b0;
RD_E[3] <= 1'b0;
end
end
end
// NMI from disk controller
// Selected INTRQ
assign selected_INTRQ = (drive_index == 3'd1) ? INTRQ[0]:
(drive_index == 3'd2) ? INTRQ[1]:
(drive_index == 3'd3) ? INTRQ[2]:
(drive_index == 3'd4) ? INTRQ[3]:
1'b0;
assign NMI_09 = DENSITY & selected_INTRQ; // Send NMI if Double Density (Halt Mode)
// HALT from disk controller
// Selected DRQ
assign selected_DRQ = (drive_index == 3'd1) ? DRQ[0]:
(drive_index == 3'd2) ? DRQ[1]:
(drive_index == 3'd3) ? DRQ[2]:
(drive_index == 3'd4) ? DRQ[3]:
1'b1;
assign HALT = (HALT_EN & ~selected_DRQ);
assign HALT_EN_RST = RESET_N & ~selected_INTRQ; // From controller schematic
assign sd_lba[0] = wd1793_sd_lba;
assign sd_lba[1] = wd1793_sd_lba;
assign sd_lba[2] = wd1793_sd_lba;
assign sd_lba[3] = wd1793_sd_lba;
assign sd_rd[0] = (drive_index == 3'd1) ? wd1793_sd_rd:
1'b0;
assign sd_rd[1] = (drive_index == 3'd2) ? wd1793_sd_rd:
1'b0;
assign sd_rd[2] = (drive_index == 3'd3) ? wd1793_sd_rd:
1'b0;
assign sd_rd[3] = (drive_index == 3'd4) ? wd1793_sd_rd:
1'b0;
assign sd_wr[0] = (drive_index == 3'd1) ? wd1793_sd_wr:
1'b0;
assign sd_wr[1] = (drive_index == 3'd2) ? wd1793_sd_wr:
1'b0;
assign sd_wr[2] = (drive_index == 3'd3) ? wd1793_sd_wr:
1'b0;
assign sd_wr[3] = (drive_index == 3'd4) ? wd1793_sd_wr:
1'b0;
assign wd1793_sd_ack = (drive_index == 3'd1) ? sd_ack[0]:
(drive_index == 3'd2) ? sd_ack[1]:
(drive_index == 3'd3) ? sd_ack[2]:
(drive_index == 3'd4) ? sd_ack[3]:
sd_ack[0]; // default is drive 1
assign sd_buff_din[0] = wd1793_sd_buff_din;
assign sd_buff_din[1] = wd1793_sd_buff_din;
assign sd_buff_din[2] = wd1793_sd_buff_din;
assign sd_buff_din[3] = wd1793_sd_buff_din;
// Data bus selection
assign DATA_1793 = (drive_index == 3'd1) ? dout[0]:
(drive_index == 3'd2) ? dout[1]:
(drive_index == 3'd3) ? dout[2]:
(drive_index == 3'd4) ? dout[3]:
8'd0;
// The SD_BLK interface and thus the wd1793 will allways transfer 1 blk. This is blk qty - 1 per spec.
@@ -358,13 +385,6 @@ reg drive_wp[4];
reg [3:0] drive_ready = 4'B0000;
reg [3:0] double_sided = 4'B0000;
reg [23:0] drive_size[4];
wire [23:0] selected_drive_size;
wire [31:0] wd1793_sd_lba;
wire wd1793_sd_rd;
wire wd1793_sd_wr;
wire wd1793_sd_ack;
wire [7:0] wd1793_sd_buff_din;
wire selected_drive_ready, selected_drive_wp, selected_double_sided;
// As drives are mounted in MISTer this logic saves the write protect and generates ready for
@@ -413,28 +433,6 @@ begin
//double_sided[3]<= img_size > 20'd368600;//20'd368640;
end
assign selected_drive_size = (drive_index == 3'd1) ? drive_size[0]:
(drive_index == 3'd2) ? drive_size[1]:
(drive_index == 3'd3) ? drive_size[2]:
(drive_index == 3'd4) ? drive_size[3]:
drive_size[0]; // default is drive 1
assign selected_drive_wp = (drive_index == 3'd1) ? drive_wp[0]:
(drive_index == 3'd2) ? drive_wp[1]:
(drive_index == 3'd3) ? drive_wp[2]:
(drive_index == 3'd4) ? drive_wp[3]:
drive_wp[0]; // default is drive 1
assign selected_double_sided= (drive_index == 3'd1) ? double_sided[0]:
(drive_index == 3'd2) ? double_sided[1]:
(drive_index == 3'd3) ? double_sided[2]:
double_sided[0]; // default is drive 1
assign selected_drive_ready = (drive_index == 3'd1) ? drive_ready[0]:
(drive_index == 3'd2) ? drive_ready[1]:
(drive_index == 3'd3) ? drive_ready[2]:
(drive_index == 3'd4) ? drive_ready[3]:
1'b0; // default is not ready
wd1793 #(1,0) coco_wd1793_0
(
@@ -442,34 +440,160 @@ wd1793 #(1,0) coco_wd1793_0
.ce(ena_8Mhz),
.reset(~RESET_N),
.io_en(1'b1),
.rd(RD),
.wr(WR),
.rd(RD[0]),
.wr(WR[0]),
.addr(ADDRESS_L[1:0]),
.din(DATA_IN_L),
.dout(DATA_1793),
.drq(selected_DRQ),
.intrq(selected_INTRQ),
.dout(dout[0]),
.drq(DRQ[0]),
.intrq(INTRQ[0]),
.img_mounted(1'b0),
.img_mounted_overide(1'b1),
.img_size(selected_drive_size[19:0]),
.img_size(drive_size[0]),
.sd_lba(wd1793_sd_lba),
.sd_rd(wd1793_sd_rd),
.sd_wr(wd1793_sd_wr),
.sd_ack(wd1793_sd_ack),
.sd_lba(sd_lba[0]),
.sd_rd(sd_rd[0]),
.sd_wr(sd_wr[0]),
.sd_ack(sd_ack[0]),
.sd_buff_addr(sd_buff_addr),
.sd_buff_dout(sd_buff_dout),
.sd_buff_din(wd1793_sd_buff_din),
.sd_buff_din(sd_buff_din[0]),
.sd_buff_wr(sd_buff_wr),
.wp(selected_drive_wp),
.wp(drive_wp[0]),
.size_code(3'd5), // 5 is 18 sector x 256 bits COCO standard
.layout(~selected_double_sided), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
.side(selected_double_sided & DRIVE_SEL_EXT[3]),
.ready(selected_drive_ready),
.layout(~double_sided[0]), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
.side(double_sided[0] & DRIVE_SEL_EXT[3]),
.ready(drive_ready[0]),
.input_active(0), // Section not used
.input_addr(0),
.input_data(0),
.input_wr(0),
.buff_din(0)
);
wd1793 #(1,0) coco_wd1793_1
(
.clk_sys(~CLK),
.ce(ena_8Mhz),
.reset(~RESET_N),
.io_en(1'b1),
.rd(RD[1]),
.wr(WR[1]),
.addr(ADDRESS_L[1:0]),
.din(DATA_IN_L),
.dout(dout[1]),
.drq(DRQ[1]),
.intrq(INTRQ[1]),
.img_mounted(1'b0),
.img_mounted_overide(1'b1),
.img_size(drive_size[1]),
.sd_lba(sd_lba[1]),
.sd_rd(sd_rd[1]),
.sd_wr(sd_wr[1]),
.sd_ack(sd_ack[1]),
.sd_buff_addr(sd_buff_addr),
.sd_buff_dout(sd_buff_dout),
.sd_buff_din(sd_buff_din[1]),
.sd_buff_wr(sd_buff_wr),
.wp(drive_wp[1]),
.size_code(3'd5), // 5 is 18 sector x 256 bits COCO standard
.layout(~double_sided[1]), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
.side(double_sided[1] & DRIVE_SEL_EXT[3]),
.ready(drive_ready[1]),
.input_active(0), // Section not used
.input_addr(0),
.input_data(0),
.input_wr(0),
.buff_din(0)
);
wd1793 #(1,0) coco_wd1793_2
(
.clk_sys(~CLK),
.ce(ena_8Mhz),
.reset(~RESET_N),
.io_en(1'b1),
.rd(RD[2]),
.wr(WR[2]),
.addr(ADDRESS_L[1:0]),
.din(DATA_IN_L),
.dout(dout[2]),
.drq(DRQ[2]),
.intrq(INTRQ[2]),
.img_mounted(1'b0),
.img_mounted_overide(1'b1),
.img_size(drive_size[2]),
.sd_lba(sd_lba[2]),
.sd_rd(sd_rd[2]),
.sd_wr(sd_wr[2]),
.sd_ack(sd_ack[2]),
.sd_buff_addr(sd_buff_addr),
.sd_buff_dout(sd_buff_dout),
.sd_buff_din(sd_buff_din[2]),
.sd_buff_wr(sd_buff_wr),
.wp(drive_wp[2]),
.size_code(3'd5), // 5 is 18 sector x 256 bits COCO standard
.layout(~double_sided[2]), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
.side(double_sided[2] & DRIVE_SEL_EXT[3]),
.ready(drive_ready[2]),
.input_active(0), // Section not used
.input_addr(0),
.input_data(0),
.input_wr(0),
.buff_din(0)
);
wd1793 #(1,0) coco_wd1793_3
(
.clk_sys(~CLK),
.ce(ena_8Mhz),
.reset(~RESET_N),
.io_en(1'b1),
.rd(RD[3]),
.wr(WR[3]),
.addr(ADDRESS_L[1:0]),
.din(DATA_IN_L),
.dout(dout[3]),
.drq(DRQ[3]),
.intrq(INTRQ[3]),
.img_mounted(1'b0),
.img_mounted_overide(1'b1),
.img_size(drive_size[3]),
.sd_lba(sd_lba[3]),
.sd_rd(sd_rd[3]),
.sd_wr(sd_wr[3]),
.sd_ack(sd_ack[3]),
.sd_buff_addr(sd_buff_addr),
.sd_buff_dout(sd_buff_dout),
.sd_buff_din(sd_buff_din[3]),
.sd_buff_wr(sd_buff_wr),
.wp(drive_wp[3]),
.size_code(3'd5), // 5 is 18 sector x 256 bits COCO standard
.layout(1'b1), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
.side(1'b0),
.ready(drive_ready[3]),
.input_active(0), // Section not used
.input_addr(0),
+3 -2
View File
@@ -47,8 +47,6 @@
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Define Config features
`include "../RTL/config.v"
module sdc(
input CLK, // clock
@@ -89,6 +87,9 @@ module sdc(
);
// Define Config features
`include "../rtl/config.sv"
reg [23:0] LSN;
reg [7:0] command;
reg [7:0] transfer_address;
+107 -74
View File
@@ -146,54 +146,27 @@ assign DATA_HDD =
wire [31:0] sdc_sd_lba[2];
wire [31:0] fdc_sd_lba[2];
wire [31:0] wd1793_sd_lba;
wire [1:0] sdc_sd_rd;
wire wd1793_sd_rd;
wire [1:0] fdc_sd_rd;
wire [1:0] sdc_sd_wr;
wire [1:0] fdc_sd_wr;
wire wd1793_sd_wr;
wire [7:0] sdc_sd_buff_din[2];
wire [7:0] fdc_sd_buff_din[2];
wire [7:0] wd1793_sd_buff_din;
wire wd1793_sd_ack;
wire sdc_HALT;
assign sd_lba[0:1] = SDC_EN ? sdc_sd_lba[0:1]:
fdc_sd_lba[0:1];
assign fdc_sd_lba[0] = wd1793_sd_lba;
assign fdc_sd_lba[1] = wd1793_sd_lba;
assign sd_rd[1:0] = SDC_EN ? sdc_sd_rd[1:0]:
fdc_sd_rd[1:0];
assign fdc_sd_rd[0] = (drive_index == 3'd1) ? wd1793_sd_rd:
1'b0;
assign fdc_sd_rd[1] = (drive_index == 3'd2) ? wd1793_sd_rd:
1'b0;
assign sd_wr[1:0] = SDC_EN ? sdc_sd_wr[1:0]:
fdc_sd_wr[1:0];
assign fdc_sd_wr[0] = (drive_index == 3'd1) ? wd1793_sd_wr:
1'b0;
assign fdc_sd_wr[1] = (drive_index == 3'd2) ? wd1793_sd_wr:
1'b0;
assign sd_buff_din[0:1] = SDC_EN ? sdc_sd_buff_din[0:1]:
fdc_sd_buff_din[0:1];
assign fdc_sd_buff_din[0] = wd1793_sd_buff_din;
assign fdc_sd_buff_din[1] = wd1793_sd_buff_din;
assign wd1793_sd_ack = (drive_index == 3'd1) ? sd_ack[0]:
(drive_index == 3'd2) ? sd_ack[1]:
sd_ack[0]; // default is drive 1
sdc coco_sdc(
.CLK(CLK), // clock
@@ -277,13 +250,13 @@ begin
drive_index <= 3'd1;
4'b1011: // This is what the Magic Number $43 does so we select a non-active drive
drive_index <= 3'd0;
drive_index <= 3'd1;
4'b1000: // This is no drive with DS = illegal drive
drive_index <= 3'd0;
drive_index <= 3'd1;
4'b0000: // This is no drive (maybe 0 in ff40) = illegal drive
drive_index <= 3'd0;
drive_index <= 3'd1;
default:
drive_index <= 3'd0;
drive_index <= 3'd1;
endcase
end
end
@@ -310,14 +283,17 @@ end
// Control signals for the wd1793
wire INTRQ[2];
wire DRQ[2];
wire selected_DRQ;
wire selected_INTRQ;
wire WR;
wire RD;
wire RD_E;
wire WR[2];
wire RD[2];
wire RD_E[2];
wire HALT_EN_RST;
wire [7:0] DATA_1793;
wire [7:0] dout[2];
reg read;
reg write;
reg read_d;
@@ -329,7 +305,8 @@ reg read1;
reg write1;
reg [1:0] ADDRESS_L;
assign RD = (read || RD_E); // Even with no drive selected allow read to the controller
assign RD[0] = (read || RD_E[0]) && (drive_index == 2'd1);
assign RD[1] = (read || RD_E[1]) && (drive_index == 3'd2);
// The idea here is to "stretch" the CPU read and write signals to ensure we catch a 8 mhz enable.
// For writes we will buffer the data out to ensure it does not go away.
@@ -350,8 +327,10 @@ begin
write_d <= 1'b0;
r_w_active <= 1'b0;
clk_8Mhz_enable_found <= 1'b0;
WR <= 1'b0;
RD_E <= 1'b0;
WR[0] <= 1'b0;
WR[1] <= 1'b0;
RD_E[0] <= 1'b0;
RD_E[1] <= 1'b0;
read1 <= 1'b0;
write1 <= 1'b0;
read <= 1'b0;
@@ -383,14 +362,24 @@ begin
begin
// Set Write
r_w_active <= 1'b1;
WR <= 1'b1;
case (drive_index)
3'd1:
WR[0] <= 1'b1;
3'd2:
WR[1] <= 1'b1;
endcase
end
// Synchronus rising edge of read
if ((read == 1'b1) && (read_d == 1'b0))
begin
r_w_active <= 1'b1;
RD_E <= 1'b1;
case (drive_index)
3'd1:
RD_E[0] <= 1'b1;
3'd2:
RD_E[1] <= 1'b1;
endcase
end
// Clears
@@ -402,23 +391,42 @@ begin
begin
clk_8Mhz_enable_found <= 1'b0;
r_w_active <= 1'b0;
WR <= 1'b0;
RD_E <= 1'b0;
WR[0] <= 1'b0;
WR[1] <= 1'b0;
RD_E[0] <= 1'b0;
RD_E[1] <= 1'b0;
end
end
end
// NMI from disk controller
// Selected INTRQ
assign selected_INTRQ = (drive_index == 3'd1) ? INTRQ[0]:
(drive_index == 3'd2) ? INTRQ[1]:
1'b0;
assign NMI_09 = ~SDC_EN & DENSITY & selected_INTRQ; // Send NMI if Double Density (Halt Mode)
// HALT from disk controller
// Selected DRQ
assign selected_DRQ = (drive_index == 3'd1) ? DRQ[0]:
(drive_index == 3'd2) ? DRQ[1]:
1'b1;
assign HALT = (~SDC_EN & HALT_EN & ~selected_DRQ) | sdc_HALT;
assign HALT_EN_RST = RESET_N & ~selected_INTRQ; // From controller schematic
// Data bus selection
assign DATA_1793 = (drive_index == 3'd1) ? dout[0]:
(drive_index == 3'd2) ? dout[1]:
8'd0;
// The SD_BLK interface and thus the wd1793 will allways transfer 1 blk. This is blk qty - 1 per spec.
assign sd_blk_cnt[1] = 6'd0;
@@ -428,8 +436,6 @@ reg drive_wp[2];
reg [1:0] drive_ready = 2'b00;
reg [1:0] double_sided = 2'b00;
reg [31:0] drive_size[2];
wire [31:0] selected_drive_size;
wire selected_drive_ready, selected_drive_wp, selected_double_sided;
// As drives are mounted in MISTer this logic saves the write protect and generates ready for
// changing drives to the wd1793.
@@ -457,56 +463,83 @@ begin
double_sided[1]<= (img_size > 64'd368600) & (img_size < 64'd740000);//20'd368640;
end
assign selected_drive_size = (drive_index == 3'd1) ? drive_size[0]:
(drive_index == 3'd2) ? drive_size[1]:
drive_size[0]; // default is drive 1
assign selected_drive_wp = (drive_index == 3'd1) ? drive_wp[0]:
(drive_index == 3'd2) ? drive_wp[1]:
drive_wp[0]; // default is drive 1
assign selected_double_sided= (drive_index == 3'd1) ? double_sided[0]:
(drive_index == 3'd2) ? double_sided[1]:
double_sided[0]; // default is drive 1
assign selected_drive_ready = (drive_index == 3'd1) ? drive_ready[0]:
(drive_index == 3'd2) ? drive_ready[1]:
drive_ready[0]; // default is drive 1
wd1793 #(1,0) coco_wd1793_sdc
wd1793 #(1,0) coco_wd1793_sdc_0
(
.clk_sys(~CLK),
.ce(ena_8Mhz),
.reset(~RESET_N),
.io_en(1'b1),
.rd(RD),
.wr(WR),
.rd(RD[0]),
.wr(WR[0]),
.addr(ADDRESS_L[1:0]),
.din(DATA_IN_L),
.dout(DATA_1793),
.drq(selected_DRQ),
.intrq(selected_INTRQ),
.dout(dout[0]),
.drq(DRQ[0]),
.intrq(INTRQ[0]),
.img_mounted(1'b0), // Not used when using _override
.img_mounted_overide(1'b1), // Load img_size and layout on each clock
.img_size(selected_drive_size[19:0]),
.img_size(drive_size[0]),
.sd_lba(wd1793_sd_lba),
.sd_rd(wd1793_sd_rd),
.sd_wr(wd1793_sd_wr),
.sd_ack(wd1793_sd_ack),
.sd_lba(fdc_sd_lba[0]),
.sd_rd(fdc_sd_rd[0]),
.sd_wr(fdc_sd_wr[0]),
.sd_ack(sd_ack[0]),
.sd_buff_addr(sd_buff_addr),
.sd_buff_dout(sd_buff_dout),
.sd_buff_din(wd1793_sd_buff_din),
.sd_buff_din(fdc_sd_buff_din[0]),
.sd_buff_wr(sd_buff_wr),
.wp(selected_drive_wp),
.wp(drive_wp[0]),
.size_code(3'd5), // 5 is 18 sector x 256 bits COCO standard
.layout(~selected_double_sided), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
.side(selected_double_sided & DRIVE_SEL_EXT[3]),
.ready(selected_drive_ready),
.layout(~double_sided[0]), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
.side(double_sided[0] & DRIVE_SEL_EXT[3]),
.ready(drive_ready[0]),
.input_active(0), // Section not used
.input_addr(0),
.input_data(0),
.input_wr(0),
.buff_din(0)
);
wd1793 #(1,0) coco_wd1793_sdc_1
(
.clk_sys(~CLK),
.ce(ena_8Mhz),
.reset(~RESET_N),
.io_en(1'b1),
.rd(RD[1]),
.wr(WR[1]),
.addr(ADDRESS_L[1:0]),
.din(DATA_IN_L),
.dout(dout[1]),
.drq(DRQ[1]),
.intrq(INTRQ[1]),
.img_mounted(1'b0), // Not used when using _override
.img_mounted_overide(1'b1), // Load img_size and layout on each clock
.img_size(drive_size[1]),
.sd_lba(fdc_sd_lba[1]),
.sd_rd(fdc_sd_rd[1]),
.sd_wr(fdc_sd_wr[1]),
.sd_ack(sd_ack[1]),
.sd_buff_addr(sd_buff_addr),
.sd_buff_dout(sd_buff_dout),
.sd_buff_din(fdc_sd_buff_din[1]),
.sd_buff_wr(sd_buff_wr),
.wp(drive_wp[1]),
.size_code(3'd5), // 5 is 18 sector x 256 bits COCO standard
.layout(~double_sided[1]), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
.side(double_sided[1] & DRIVE_SEL_EXT[3]),
.ready(drive_ready[1]),
.input_active(0), // Section not used
.input_addr(0),