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
+76 -34

No files matched your search

BIN
View File
Binary file not shown.
+24 -11
View File
@@ -842,11 +842,19 @@ assign ENA_PAK = ({CART_SEL, MPI_CTS} == 3'b110) ? 1'b1: // ROM SLOT 3
1'b0;
assign ENA_DSK = ({CART_SEL, MPI_CTS} == 3'b111) ? 1'b1: // Disk C000-DFFF Slot 4
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
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) |
((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
1'b0;
@@ -889,8 +897,8 @@ assign DATA_IN =
(sdram_BE_0) ? hold_data_L[7:0]:
(sdram_BE_1) ? hold_data_L[15:8]:
FLASH_CE_S ? FLASH_DATA:
SDC_EN_CS ? DATA_SDC: // needs priority due to nitros9 llcocosdc ddriver bug
HDD_EN ? DATA_HDD:
SDC_EN_CS ? DATA_SDC:
RS232_EN ? DATA_RS232:
SLOT3_HW ? {5'b00000, ROM_BANK}:
// FF00, FF04, FF08, FF0C
@@ -1512,6 +1520,7 @@ wire HALT_sdc, HALT_fdc;
wire NMI_09_sdc, NMI_09_fdc;
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:
1'b0;
@@ -1603,6 +1612,10 @@ sdc_top coco_sdc_top(
.SDC_REG_W_ENA(SDC_REG_W_ENA),
.SDC_REG_READ(SDC_REG_READ),
.ext_response(ext_response),
.SZ(GPIO),
// SD block level interface
.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
@@ -2514,7 +2527,7 @@ begin
// MPI_CTS <= SWITCH[2:1];
// FF8E-FF8F
GPIO_DIR <= 8'h00;
GPIO_OUT <= 8'h00;
// GPIO_OUT <= 8'h00;
// FF90
ROM <= 2'b00;
ST_SCS <= 1'b0;
@@ -3498,28 +3511,28 @@ begin
dac_joya2[7:0] <= 8'd128;
if (joy1[0]) // right
dac_joya1[15:8] <= 8'd240;
dac_joya1[15:8] <= 8'd255;
if (joy1[1]) // left
dac_joya1[15:8] <= 8'd16;
dac_joya1[15:8] <= 8'd0;
if (joy1[2]) // down
dac_joya1[7:0] <= 8'd240;
dac_joya1[7:0] <= 8'd255;
if (joy1[3]) // up
dac_joya1[7:0] <= 8'd16;
dac_joya1[7:0] <= 8'd0;
if (joy2[0]) // right
dac_joya2[15:8] <= 8'd240;
dac_joya2[15:8] <= 8'd255;
if (joy2[1]) // left
dac_joya2[15:8] <= 8'd16;
dac_joya2[15:8] <= 8'd0;
if (joy2[2]) // down
dac_joya2[7:0] <= 8'd240;
dac_joya2[7:0] <= 8'd255;
if (joy2[3]) // upimg_mounted
dac_joya2[7:0] <= 8'd16;
dac_joya2[7:0] <= 8'd0;
end
else
begin
+3 -3
View File
@@ -84,9 +84,9 @@
`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_RD,
output sdc_always,
output reg sdc_HALT,
output reg ext_response,
input [7:0] SZ,
output reg sdc_always,
// SD block level interface
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 [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 reg [1:0] sd_rd,
@@ -87,11 +92,12 @@ reg [7:0] transfer_address;
reg new_cmd, new_cmd_d, cmd_done;
reg data_inc, run;
reg rxt_res_end;
reg transfer_clear;
reg [3:0] sdc_data_reg;
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
{
@@ -133,13 +139,14 @@ begin
command <= 8'h00;
new_cmd <= 1'b0;
data_inc <= 1'b0;
rxt_res_end <= 1'b0;
transfer_address <= 8'h00;
sdc_data_reg <= 4'h0;
end
else
begin
data_inc <= 1'b0;
rxt_res_end <= 1'b0;
if (cmd_done)
new_cmd <= 1'b0;
@@ -188,6 +195,9 @@ begin
if (CLK_EN & SDC_RD & (ADDRESS[3:1] == 3'b101) & (run)) // Read @ $ff4A / $ff4B
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)
transfer_address <= transfer_address + 1'b1;
@@ -205,7 +215,6 @@ localparam CMD_EXT = 5'b11000;
reg wr_cmd;
reg ack_d;
reg ext_response;
reg [23:0] response_reg;
wire end_ack = ~sd_ack[l_drive] & ack_d;
reg l_drive, buffer_upper;
@@ -250,6 +259,9 @@ begin
sdc_ready <= 1'b0;
end
if (rxt_res_end) // If we read ff4b then we've read the ext_response
ext_response <= 1'b0;
case(state)
state_idle:
begin
@@ -271,8 +283,11 @@ begin
state <= state_ext;
end
else // no valid command found
begin
sdc_fail <= 1'b1;
cmd_done <= 1'b1;
end
end
state_read:
begin
sdc_busy <= 1'b1;
@@ -372,15 +387,16 @@ begin
sdc_busy <= 1'b1;
state <= state_e1;
end
// else if (LSN[23:16] == 8'H67) // This is g [Disable FDC emulation]
// begin
// cmd_done <= 1'b1;
// sdc_always <= 1'b1; // Disable floppy
// state <= state_idle;
// end
else if (LSN[23:16] == 8'H67) // This is g [Disable FDC emulation]
begin
cmd_done <= 1'b1;
sdc_always <= 1'b1; // Disable floppy
state <= state_idle;
end
else
begin
cmd_done <= 1'b1; // All other ext commands...
sdc_fail <= 1'b1;
state <= state_idle;
end
end
@@ -389,7 +405,11 @@ begin
begin
sdc_busy <= 1'b0;
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;
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}:
(ADDRESS == ADRS_FF43) ? sdc_status_reg:
((ADDRESS == ADRS_FF48) & ~ext_response) ? sdc_status:
((ADDRESS == ADRS_FF48) & ext_response) ? response_reg[23:16]:
(ADDRESS == ADRS_FF48) ? sdc_status:
(ADDRESS == ADRS_FF49) ? response_reg[23:16]:
((ADDRESS == ADRS_FF4A) & ~ext_response) ? hd_buff_data:
((ADDRESS == ADRS_FF4A) & ext_response) ? response_reg[15:8]:
((ADDRESS == ADRS_FF4B) & ~ext_response) ? hd_buff_data:
@@ -450,7 +470,7 @@ always @(negedge img_mounted[0])
begin
drive_wp[0] <= img_readonly;
drive_ready[0] <= 1'b1;
drive_size[0] <= {4'h0, img_size[19:8]}; //Size / 256
drive_size[0] <= img_size[31:0];
end
// SD Drive 1
@@ -459,7 +479,7 @@ always @(negedge img_mounted[1])
begin
drive_wp[1] <= img_readonly;
drive_ready[1] <= 1'b1;
drive_size[1] <= {4'h0, img_size[19:8]}; //Size / 256
drive_size[1] <= img_size[31:0];
end
endmodule
+12 -3
View File
@@ -77,6 +77,10 @@ module sdc_top(
input SDC_REG_W_ENA,
input SDC_REG_READ,
output ext_response,
input [7:0] SZ,
// SD block level interface
input [1:0] img_mounted, // signaling that new image has been mounted
@@ -126,14 +130,14 @@ end
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 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 sdc_always;
wire FF40_RD = ({SDC_EN_CS, ADDRESS[3:0]} == 5'h10);
//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
(FF40_RD) ? FF40_READ_VALUE:
(WD1793_RD) ? DATA_1793: //(1793[s])
@@ -173,9 +177,14 @@ sdc coco_sdc(
.SDC_WR(SDC_REG_W_ENA),
.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_HALT(sdc_HALT),
// SD block level interface