Branch_20240019

All features except reduction in 1793 instances in the code.  Added debug code which routes {GPIO, GPIO, GPIO} for the disk size. Also removed reset from GPIO [survives reset].

Started with pattern $80 - did not work.  $40 does function.  Going back to Master to try $404040 for the sdc mounted size.
This commit is contained in:
shodge12 committed 2024-01-22 14:56:20 -05:00
1 parent 4b22017c93
commit 05c2d86144
5 files changed
+93 -51

No files matched your search

BIN
View File
Binary file not shown.
+41 -28
View File
@@ -834,28 +834,36 @@ COCO_ROM_CART CC3_ROM_CART(
wire SDC_EN_CS; wire SDC_EN_CS;
assign ENA_ORCC = ({CART_SEL, MPI_CTS} == 3'b100) ? 1'b1: // Orchestra-90CC C000-DFFF Slot 1 assign ENA_ORCC = ({CART_SEL, MPI_CTS} == 3'b100) ? 1'b1: // Orchestra-90CC C000-DFFF Slot 1
1'b0; 1'b0;
assign ENA_DISK2 = ({CART_SEL, MPI_CTS} == 3'b101) ? 1'b1: // Alternative Disk controller ROM up to 32K assign ENA_DISK2 = ({CART_SEL, MPI_CTS} == 3'b101) ? 1'b1: // Alternative Disk controller ROM up to 32K
1'b0; 1'b0;
assign ENA_PAK = ({CART_SEL, MPI_CTS} == 3'b110) ? 1'b1: // ROM SLOT 3 assign ENA_PAK = ({CART_SEL, MPI_CTS} == 3'b110) ? 1'b1: // ROM SLOT 3
1'b0; 1'b0;
assign ENA_DSK = ({CART_SEL, MPI_CTS} == 3'b111) ? 1'b1: // Disk C000-DFFF Slot 4 assign ENA_DSK = ({CART_SEL, MPI_CTS} == 3'b111) ? 1'b1: // Disk C000-DFFF Slot 4
1'b0; 1'b0;
assign HDD_EN = ({MPI_SCS, ADDRESS[15:5]} == 13'b1111111111010) ? 1'b1: // FF40-FF5F with MPI switch = 4 `ifdef CoCo3_sdc_fix_os9_driver
1'b0; assign HDD_EN = ({ext_response, MPI_SCS, ADDRESS[15:5]} == 15'b01111111111010) ? 1'b1: // FF40-FF5F with MPI switch = 4
1'b0;
assign SDC_EN_CS = ({MPI_SCS, ADDRESS[15:5]} == 13'b0111111111010) ? 1'b1: // FF40-FF5F with MPI switch = 2 assign SDC_EN_CS = (({MPI_SCS, ADDRESS[15:5]} == 13'b0111111111010) |
1'b0; ((ADDRESS[15:5] == 11'b11111111010) & ext_response)) ? 1'b1: // FF40-FF5F with MPI switch = 2
1'b0;
`else
assign HDD_EN = ({MPI_SCS, ADDRESS[15:5]} == 13'b1111111111010) ? 1'b1: // FF40-FF5F with MPI switch = 4
1'b0;
assign SDC_EN_CS = ({MPI_SCS, ADDRESS[15:5]} == 13'b0111111111010) ? 1'b1: // FF40-FF5F with MPI switch = 2
1'b0;
`endif
assign RS232_EN = ({MPI_SCS, ADDRESS[15:2]} == 16'b0011111111011010) ? 1'b1: //FF68-FF6B - Now in slot 1 assign RS232_EN = ({MPI_SCS, ADDRESS[15:2]} == 16'b0011111111011010) ? 1'b1: //FF68-FF6B - Now in slot 1
1'b0; 1'b0;
assign SLOT3_HW = ({SWITCH[2:1], ADDRESS[15:5]} == 13'b1011111111010) ? 1'b1: // FF40-FF5F Ensure this only appears in slot 3 PHYSICALLY assign SLOT3_HW = ({SWITCH[2:1], ADDRESS[15:5]} == 13'b1011111111010) ? 1'b1: // FF40-FF5F Ensure this only appears in slot 3 PHYSICALLY
1'b0; 1'b0;
assign VDAC_EN = ({RW_N,ADDRESS[15:0]} == 17'H0FF7E) ? 1'b1: // FF7E assign VDAC_EN = ({RW_N,ADDRESS[15:0]} == 17'H0FF7E) ? 1'b1: // FF7E
1'b0; 1'b0;
/* /*
$FF40 - This is the bank latch. The same latch that is used by the Super Program Paks to bank 16K of the Pak ROM $FF40 - This is the bank latch. The same latch that is used by the Super Program Paks to bank 16K of the Pak ROM
at a time. This latch is set to $00 on reset or power up (same as the super program paks). at a time. This latch is set to $00 on reset or power up (same as the super program paks).
@@ -889,8 +897,8 @@ assign DATA_IN =
(sdram_BE_0) ? hold_data_L[7:0]: (sdram_BE_0) ? hold_data_L[7:0]:
(sdram_BE_1) ? hold_data_L[15:8]: (sdram_BE_1) ? hold_data_L[15:8]:
FLASH_CE_S ? FLASH_DATA: FLASH_CE_S ? FLASH_DATA:
SDC_EN_CS ? DATA_SDC: // needs priority due to nitros9 llcocosdc ddriver bug
HDD_EN ? DATA_HDD: HDD_EN ? DATA_HDD:
SDC_EN_CS ? DATA_SDC:
RS232_EN ? DATA_RS232: RS232_EN ? DATA_RS232:
SLOT3_HW ? {5'b00000, ROM_BANK}: SLOT3_HW ? {5'b00000, ROM_BANK}:
// FF00, FF04, FF08, FF0C // FF00, FF04, FF08, FF0C
@@ -1512,6 +1520,7 @@ wire HALT_sdc, HALT_fdc;
wire NMI_09_sdc, NMI_09_fdc; wire NMI_09_sdc, NMI_09_fdc;
wire SDC_REG_W_ENA, SDC_REG_READ; wire SDC_REG_W_ENA, SDC_REG_READ;
wire ext_response;
assign FF40_ENA = ({PH_2, RW_N, HDD_EN, ADDRESS[3:0]} == 7'B1010000) ? 1'b1: assign FF40_ENA = ({PH_2, RW_N, HDD_EN, ADDRESS[3:0]} == 7'B1010000) ? 1'b1:
1'b0; 1'b0;
@@ -1603,6 +1612,10 @@ sdc_top coco_sdc_top(
.SDC_REG_W_ENA(SDC_REG_W_ENA), .SDC_REG_W_ENA(SDC_REG_W_ENA),
.SDC_REG_READ(SDC_REG_READ), .SDC_REG_READ(SDC_REG_READ),
.ext_response(ext_response),
.SZ(GPIO),
// SD block level interface // SD block level interface
.img_mounted(img_mounted[5:4]), // signaling that new image has been mounted .img_mounted(img_mounted[5:4]), // signaling that new image has been mounted
.img_readonly(img_readonly), // mounted as read only. valid only for active bit in img_mounted .img_readonly(img_readonly), // mounted as read only. valid only for active bit in img_mounted
@@ -2514,7 +2527,7 @@ begin
// MPI_CTS <= SWITCH[2:1]; // MPI_CTS <= SWITCH[2:1];
// FF8E-FF8F // FF8E-FF8F
GPIO_DIR <= 8'h00; GPIO_DIR <= 8'h00;
GPIO_OUT <= 8'h00; // GPIO_OUT <= 8'h00;
// FF90 // FF90
ROM <= 2'b00; ROM <= 2'b00;
ST_SCS <= 1'b0; ST_SCS <= 1'b0;
@@ -3498,28 +3511,28 @@ begin
dac_joya2[7:0] <= 8'd128; dac_joya2[7:0] <= 8'd128;
if (joy1[0]) // right if (joy1[0]) // right
dac_joya1[15:8] <= 8'd240; dac_joya1[15:8] <= 8'd255;
if (joy1[1]) // left if (joy1[1]) // left
dac_joya1[15:8] <= 8'd16; dac_joya1[15:8] <= 8'd0;
if (joy1[2]) // down if (joy1[2]) // down
dac_joya1[7:0] <= 8'd240; dac_joya1[7:0] <= 8'd255;
if (joy1[3]) // up if (joy1[3]) // up
dac_joya1[7:0] <= 8'd16; dac_joya1[7:0] <= 8'd0;
if (joy2[0]) // right if (joy2[0]) // right
dac_joya2[15:8] <= 8'd240; dac_joya2[15:8] <= 8'd255;
if (joy2[1]) // left if (joy2[1]) // left
dac_joya2[15:8] <= 8'd16; dac_joya2[15:8] <= 8'd0;
if (joy2[2]) // down if (joy2[2]) // down
dac_joya2[7:0] <= 8'd240; dac_joya2[7:0] <= 8'd255;
if (joy2[3]) // upimg_mounted if (joy2[3]) // upimg_mounted
dac_joya2[7:0] <= 8'd16; dac_joya2[7:0] <= 8'd0;
end end
else else
begin begin
+3 -3
View File
@@ -84,9 +84,9 @@
`set_feature(CoCo3_CYC_ACC_6809, FEATURE_3) // Use cycle accurate 6809 `set_feature(CoCo3_CYC_ACC_6809, FEATURE_3) // Use cycle accurate 6809
//`set_feature(CoCo3_sdc_override_size, FEATURE_4) // Define static size value `set_feature(CoCo3_sdc_override_size, FEATURE_4) // Define static size value
//`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, FEATURE_5) // fix sdc query disk size issue in llcocosdc driver in multipak enviroment
//`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, FEATURE_6)// Disable GIMEX ram transfers [GIMEX detection in OS( EOU]
+37 -17
View File
@@ -59,15 +59,20 @@ module sdc(
input SDC_WR, input SDC_WR,
input SDC_RD, input SDC_RD,
output sdc_always,
output reg sdc_HALT, output reg sdc_HALT,
output reg ext_response,
input [7:0] SZ,
output reg sdc_always,
// SD block level interface // SD block level interface
input [1:0] img_mounted, // signaling that new image has been mounted input [1:0] img_mounted, // signaling that new image has been mounted
input img_readonly, // mounted as read only. valid only for active bit in img_mounted input img_readonly, // mounted as read only. valid only for active bit in img_mounted
input [19:0] img_size, // size of image in bytes. 1MB MAX! input [63:0] img_size, // size of image in bytes. 1MB MAX!
output [31:0] sd_lba[2], output [31:0] sd_lba[2],
output reg [1:0] sd_rd, output reg [1:0] sd_rd,
@@ -87,11 +92,12 @@ reg [7:0] transfer_address;
reg new_cmd, new_cmd_d, cmd_done; reg new_cmd, new_cmd_d, cmd_done;
reg data_inc, run; reg data_inc, run;
reg rxt_res_end;
reg transfer_clear; reg transfer_clear;
reg [3:0] sdc_data_reg; reg [3:0] sdc_data_reg;
wire [7:0] sdc_status_reg = {sdc_data_reg, 4'h4}; wire [7:0] sdc_status_reg = {sdc_data_reg, 4'h4};
reg [15:0] drive_size[2]; reg [23:0] drive_size[2];
typedef enum typedef enum
{ {
@@ -133,13 +139,14 @@ begin
command <= 8'h00; command <= 8'h00;
new_cmd <= 1'b0; new_cmd <= 1'b0;
data_inc <= 1'b0; data_inc <= 1'b0;
rxt_res_end <= 1'b0;
transfer_address <= 8'h00; transfer_address <= 8'h00;
sdc_data_reg <= 4'h0; sdc_data_reg <= 4'h0;
end end
else else
begin begin
data_inc <= 1'b0; data_inc <= 1'b0;
rxt_res_end <= 1'b0;
if (cmd_done) if (cmd_done)
new_cmd <= 1'b0; new_cmd <= 1'b0;
@@ -188,6 +195,9 @@ begin
if (CLK_EN & SDC_RD & (ADDRESS[3:1] == 3'b101) & (run)) // Read @ $ff4A / $ff4B if (CLK_EN & SDC_RD & (ADDRESS[3:1] == 3'b101) & (run)) // Read @ $ff4A / $ff4B
data_inc <= 1'b1; data_inc <= 1'b1;
if (CLK_EN & SDC_RD & (ADDRESS[3:0] == 4'b1001) & (~run)) // Read @ $ff49 [last of size data]
rxt_res_end <= 1'b1;
if (data_inc) if (data_inc)
transfer_address <= transfer_address + 1'b1; transfer_address <= transfer_address + 1'b1;
@@ -205,7 +215,6 @@ localparam CMD_EXT = 5'b11000;
reg wr_cmd; reg wr_cmd;
reg ack_d; reg ack_d;
reg ext_response;
reg [23:0] response_reg; reg [23:0] response_reg;
wire end_ack = ~sd_ack[l_drive] & ack_d; wire end_ack = ~sd_ack[l_drive] & ack_d;
reg l_drive, buffer_upper; reg l_drive, buffer_upper;
@@ -250,6 +259,9 @@ begin
sdc_ready <= 1'b0; sdc_ready <= 1'b0;
end end
if (rxt_res_end) // If we read ff4b then we've read the ext_response
ext_response <= 1'b0;
case(state) case(state)
state_idle: state_idle:
begin begin
@@ -271,7 +283,10 @@ begin
state <= state_ext; state <= state_ext;
end end
else // no valid command found else // no valid command found
begin
sdc_fail <= 1'b1;
cmd_done <= 1'b1; cmd_done <= 1'b1;
end
end end
state_read: state_read:
begin begin
@@ -372,15 +387,16 @@ begin
sdc_busy <= 1'b1; sdc_busy <= 1'b1;
state <= state_e1; state <= state_e1;
end end
// else if (LSN[23:16] == 8'H67) // This is g [Disable FDC emulation] else if (LSN[23:16] == 8'H67) // This is g [Disable FDC emulation]
// begin begin
// cmd_done <= 1'b1; cmd_done <= 1'b1;
// sdc_always <= 1'b1; // Disable floppy sdc_always <= 1'b1; // Disable floppy
// state <= state_idle; state <= state_idle;
// end end
else else
begin begin
cmd_done <= 1'b1; // All other ext commands... cmd_done <= 1'b1; // All other ext commands...
sdc_fail <= 1'b1;
state <= state_idle; state <= state_idle;
end end
end end
@@ -389,7 +405,11 @@ begin
begin begin
sdc_busy <= 1'b0; sdc_busy <= 1'b0;
ext_response <= 1'b1; ext_response <= 1'b1;
response_reg <= {8'h00, drive_size[l_drive]}; `ifdef CoCo3_sdc_override_size
response_reg <= { SZ, SZ, SZ}; // This fixes a redirect error in OS9EOU - Value=no hardware
`else
response_reg <= drive_size[l_drive][31:8]; // This returns the correct size of the mounted drive in sectors
`endif
state <= state_e2; state <= state_e2;
end end
@@ -436,8 +456,8 @@ assign sdc_status = {sdc_fail, drive_wp[l_drive], 1'b0, ~drive_ready[l_drive], 2
assign SDC_READ_DATA = (ADDRESS == ADRS_FF42) ? {sdc_data_reg, 4'h0}: assign SDC_READ_DATA = (ADDRESS == ADRS_FF42) ? {sdc_data_reg, 4'h0}:
(ADDRESS == ADRS_FF43) ? sdc_status_reg: (ADDRESS == ADRS_FF43) ? sdc_status_reg:
((ADDRESS == ADRS_FF48) & ~ext_response) ? sdc_status: (ADDRESS == ADRS_FF48) ? sdc_status:
((ADDRESS == ADRS_FF48) & ext_response) ? response_reg[23:16]: (ADDRESS == ADRS_FF49) ? response_reg[23:16]:
((ADDRESS == ADRS_FF4A) & ~ext_response) ? hd_buff_data: ((ADDRESS == ADRS_FF4A) & ~ext_response) ? hd_buff_data:
((ADDRESS == ADRS_FF4A) & ext_response) ? response_reg[15:8]: ((ADDRESS == ADRS_FF4A) & ext_response) ? response_reg[15:8]:
((ADDRESS == ADRS_FF4B) & ~ext_response) ? hd_buff_data: ((ADDRESS == ADRS_FF4B) & ~ext_response) ? hd_buff_data:
@@ -450,7 +470,7 @@ always @(negedge img_mounted[0])
begin begin
drive_wp[0] <= img_readonly; drive_wp[0] <= img_readonly;
drive_ready[0] <= 1'b1; drive_ready[0] <= 1'b1;
drive_size[0] <= {4'h0, img_size[19:8]}; //Size / 256 drive_size[0] <= img_size[31:0];
end end
// SD Drive 1 // SD Drive 1
@@ -459,7 +479,7 @@ always @(negedge img_mounted[1])
begin begin
drive_wp[1] <= img_readonly; drive_wp[1] <= img_readonly;
drive_ready[1] <= 1'b1; drive_ready[1] <= 1'b1;
drive_size[1] <= {4'h0, img_size[19:8]}; //Size / 256 drive_size[1] <= img_size[31:0];
end end
endmodule endmodule
+12 -3
View File
@@ -77,6 +77,10 @@ module sdc_top(
input SDC_REG_W_ENA, input SDC_REG_W_ENA,
input SDC_REG_READ, input SDC_REG_READ,
output ext_response,
input [7:0] SZ,
// SD block level interface // SD block level interface
input [1:0] img_mounted, // signaling that new image has been mounted input [1:0] img_mounted, // signaling that new image has been mounted
@@ -126,14 +130,14 @@ end
localparam SDC_MAGIC_CMD = 8'h43; localparam SDC_MAGIC_CMD = 8'h43;
wire [7:0] FF40_READ_VALUE = {HALT_EN, DRIVE_SEL_EXT[3], DENSITY, WRT_PREC, MOTOR, DRIVE_SEL_EXT[2:0]}; wire [7:0] FF40_READ_VALUE = {HALT_EN, DRIVE_SEL_EXT[3], DENSITY, WRT_PREC, MOTOR, DRIVE_SEL_EXT[2:0]};
wire SDC_EN = (FF40_READ_VALUE == SDC_MAGIC_CMD); wire SDC_EN = ((FF40_READ_VALUE == SDC_MAGIC_CMD) | sdc_always);
wire [7:0] SDC_READ_DATA; wire [7:0] SDC_READ_DATA;
wire sdc_always; wire sdc_always;
wire FF40_RD = ({SDC_EN_CS, ADDRESS[3:0]} == 5'h10); wire FF40_RD = ({SDC_EN_CS, ADDRESS[3:0]} == 5'h10);
//FDC read data path. =$ff40 or wd1793(s) //FDC read data path. =$ff40 or wd1793(s)
assign DATA_HDD = (SDC_EN | sdc_always) ? SDC_READ_DATA: assign DATA_HDD = (SDC_EN | ext_response) ? SDC_READ_DATA:
(SDC_EN_CS & (ADDRESS[3:1] == 3'b001)) ? SDC_READ_DATA: // FF42 & FF43 (SDC_EN_CS & (ADDRESS[3:1] == 3'b001)) ? SDC_READ_DATA: // FF42 & FF43
(FF40_RD) ? FF40_READ_VALUE: (FF40_RD) ? FF40_READ_VALUE:
(WD1793_RD) ? DATA_1793: //(1793[s]) (WD1793_RD) ? DATA_1793: //(1793[s])
@@ -173,9 +177,14 @@ sdc coco_sdc(
.SDC_WR(SDC_REG_W_ENA), .SDC_WR(SDC_REG_W_ENA),
.SDC_RD(SDC_REG_READ), .SDC_RD(SDC_REG_READ),
.sdc_HALT(sdc_HALT),
.ext_response(ext_response),
.SZ(SZ),
.sdc_always(sdc_always), // SDC is active [output from sdc (sdc is turning off fdc)] .sdc_always(sdc_always), // SDC is active [output from sdc (sdc is turning off fdc)]
.sdc_HALT(sdc_HALT),
// SD block level interface // SD block level interface