Changes to fix Rs232 switch and add FijiNet

Fixed Rs-232 Physical/MiSTer Switch
Fixed 6551 UART to support 115200
Added slot 1 config and extra ROM [boot2.rom] to support FujiNet.
Cleaned up some suttle errors and compatibility with verilator
This commit is contained in:
shodge12 committed 2026-10-08 17:50:28 -04:00
1 parent 8b8cf72d1f
commit bbbee96a30
6 files changed
+56 -12

No files matched your search

+5 -3
View File
@@ -198,7 +198,7 @@ assign VIDEO_ARY = (!ar) ? 12'd3 : 12'd0;
localparam CONF_STR = { localparam CONF_STR = {
"COCO3;UART19200:9600:4800:2400:1200:300;", "COCO3;UART19200:9600:4800:2400:1200:300;",
"-;", "-;",
"OCD,Multi-Pak,(Slot 2) CoCoSDC,(Slot3) ECB /Cart,(Slot 4) Disk;", "OCD,Multi-Pak,(Slot 1) FujiNet,(Slot 2) CoCoSDC,(Slot3) ECB /Cart,(Slot 4) Disk;",
"H3-;", "H3-;",
"H3S2,DSK,Load Disk Drive 0;", "H3S2,DSK,Load Disk Drive 0;",
"H3S3,DSK,Load Disk Drive 1;", "H3S3,DSK,Load Disk Drive 1;",
@@ -214,6 +214,7 @@ localparam CONF_STR = {
"H1S3,DSK,Load OS9 Floppy /d1;", "H1S3,DSK,Load OS9 Floppy /d1;",
"H1S4,DSK,Load OS9 Floppy /d3;", "H1S4,DSK,Load OS9 Floppy /d3;",
"H1S5,DSK,Load OS9 Floppy /d4;", "H1S5,DSK,Load OS9 Floppy /d4;",
"H0-;",
"-;", "-;",
"F2,CAS,Load Cassette;", "F2,CAS,Load Cassette;",
@@ -339,7 +340,7 @@ hps_io #(.CONF_STR(CONF_STR),.PS2DIV(2400), .VDNUM(7), .BLKSZ(2)) hps_io
.status_in(status_in), .status_in(status_in),
.status_set(status_set), .status_set(status_set),
.status_menumask({ ~(mpi == 2'b11), ~(mpi == 2'b10),~(mpi == 2'b01), 1'b1}), .status_menumask({ ~(mpi == 2'b11), ~(mpi == 2'b10),~(mpi == 2'b01), ~(mpi == 2'b00)}),
.forced_scandoubler(forced_scandoubler), .forced_scandoubler(forced_scandoubler),
.RTC(RTC), .RTC(RTC),
.gamma_bus(gamma_bus), .gamma_bus(gamma_bus),
@@ -636,7 +637,8 @@ wire AMW_ACK;
//wire cpu_speed = status[11]; //wire cpu_speed = status[11];
wire [1:0] mpi = status[13:12] + 1'b1; //wire [1:0] mpi = status[13:12] + 1'b1;
wire [1:0] mpi = status[13:12];
//wire video=status[14]; //wire video=status[14];
wire CASS_REW_RECORD=status[14]; wire CASS_REW_RECORD=status[14];
wire rs_swap=status[16]; wire rs_swap=status[16];
+1 -1
View File
@@ -1 +1 @@
`define BUILD_NUMBER "001" `define BUILD_NUMBER "003"
+9 -2
View File
@@ -308,8 +308,15 @@ end
assign TX_CLK = (CTL_REG[3:0] == 4'h0) ? XTAL_CLK_IN: assign TX_CLK = (CTL_REG[3:0] == 4'h0) ? XTAL_CLK_IN:
TX_CLK_REG; TX_CLK_REG;
assign RX_CLK = (CTL_REG[4] == 1'b0) ? RX_CLK_IN: //assign RX_CLK = (CTL_REG[4] == 1'b0) ? RX_CLK_IN:
TX_CLK; // TX_CLK;
// Receiver clock. CTL bit 4 = 0 selects the external RxC input, which used to
// be the fixed 1.8475 MHz enable (115,200 baud): a program writing CTL=$0F
// (19,200, bit 4 clear -- the FujiNet HDB-DOS L3 cart) then transmitted at
// 19,200 but received at 115,200. RxC is taken from the baud generator
// instead; for CTL[3:0]=0 that is the same 1.8475 MHz clock as before.
assign RX_CLK = TX_CLK;
assign RESET_X = RESET_NX ? 1'b0: assign RESET_X = RESET_NX ? 1'b0:
RESET_N; RESET_N;
+25 -3
View File
@@ -328,6 +328,7 @@ wire FLASH_CE_S;
wire ENA_DSK; wire ENA_DSK;
wire ENA_DISK2; wire ENA_DISK2;
wire ENA_SLT0;
wire ENA_PAK; wire ENA_PAK;
wire HDD_EN; wire HDD_EN;
@@ -700,7 +701,7 @@ wire UART_RXD_I;
assign UART_TXD = SWITCH[4]? coco_rs232_out: assign UART_TXD = SWITCH[4]? coco_rs232_out:
UART_TXD_I; UART_TXD_I;
assign uart_input = SWITCH[8]? PROBE_I[1]: assign uart_input = ~SWITCH[8]? PROBE_I[1]:
UART_RXD; UART_RXD;
@@ -801,10 +802,12 @@ assign FLASH_CE_S = ROM_SEL ? 1'b1:
ENA_DISK2 ? 1'b1: ENA_DISK2 ? 1'b1:
ENA_PAK ? 1'b1: ENA_PAK ? 1'b1:
ENA_DSK ? 1'b1: ENA_DSK ? 1'b1:
ENA_SLT0 ? 1'b1:
1'b0; 1'b0;
wire [7:0] COCO3_ROM_DATA; wire [7:0] COCO3_ROM_DATA;
wire [7:0] COCO3_DISK_ROM_DATA; wire [7:0] COCO3_DISK_ROM_DATA;
wire [7:0] COCO3_HDB_DISK_ROM_DATA;
localparam [1:0] BOOT0 = 2'd0; localparam [1:0] BOOT0 = 2'd0;
localparam [1:0] BOOT1 = 2'd1; localparam [1:0] BOOT1 = 2'd1;
@@ -815,6 +818,7 @@ localparam [5:0] BOOT = 6'd0;
wire COCO3_ROM_WRITE = (ioctl_index[7:0] == {BOOT0, BOOT}) & ioctl_wr; wire COCO3_ROM_WRITE = (ioctl_index[7:0] == {BOOT0, BOOT}) & ioctl_wr;
wire COCO3_DISKROM_WRITE = (ioctl_index[7:0] == {BOOT1, BOOT}) & ioctl_wr; wire COCO3_DISKROM_WRITE = (ioctl_index[7:0] == {BOOT1, BOOT}) & ioctl_wr;
wire COCO3_HDB_DISKROM_WRITE = (ioctl_index[7:0] == {BOOT2, BOOT}) & ioctl_wr;
wire COCO3_CART_WRITE = (ioctl_index[5:0] == 6'd1) & ioctl_wr & !cart_lock; wire COCO3_CART_WRITE = (ioctl_index[5:0] == 6'd1) & ioctl_wr & !cart_lock;
reg rom_loaded = 1'b0; reg rom_loaded = 1'b0;
@@ -826,7 +830,7 @@ begin
end end
// A decision. // A decision.
// Looking at this logic it is fairly obvious that the 8Kx8 ROM is not needed. // Looking at this logic it is fairly obvious that the disk 8Kx8 ROM is not needed.
// Physically (bus wise) it sits in the same place as the CART rom and is obviously // Physically (bus wise) it sits in the same place as the CART rom and is obviously
// smaller. I have made these changes at least twice during the development of // smaller. I have made these changes at least twice during the development of
// this code. While it works and saves the resources of a 8kx8 sram, it does not // this code. While it works and saves the resources of a 8kx8 sram, it does not
@@ -857,9 +861,21 @@ COCO_ROM_8K CC3_DISK_ROM(
.WRITE(COCO3_DISKROM_WRITE) .WRITE(COCO3_DISKROM_WRITE)
); );
// DOS Cart for slot 1
COCO_ROM_8K CC3_HDB_DISK_ROM(
.ADDR(FLASH_ADDRESS[12:0]),
.DATA(COCO3_HDB_DISK_ROM_DATA),
.CLK(~clk_sys),
.WR_ADDR(ioctl_addr[12:0]),
.WR_DATA(ioctl_data[7:0]),
.WRITE(COCO3_HDB_DISKROM_WRITE)
);
assign FLASH_DATA = ENA_PAK ? CART_DATA: assign FLASH_DATA = ENA_PAK ? CART_DATA:
(ENA_DSK || ENA_DISK2) ? COCO3_DISK_ROM_DATA: (ENA_DSK || ENA_DISK2) ? COCO3_DISK_ROM_DATA:
ENA_SLT0 ? COCO3_HDB_DISK_ROM_DATA:
COCO3_ROM_DATA; COCO3_ROM_DATA;
@@ -874,6 +890,9 @@ COCO_ROM_CART CC3_ROM_CART(
wire SDC_EN_CS; wire SDC_EN_CS;
assign ENA_SLT0 = ({CART_SEL, MPI_CTS} == 3'b100) ? 1'b1: // Disk C000-DFFF Slot 1
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;
@@ -899,7 +918,10 @@ assign SDC_EN_CS = ({MPI_SCS, ADDRESS[15:5]} == 13'b0111111111010) ? 1'b1:
//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 RS232_EN = ({MPI_SCS[0], ADDRESS[15:2]} == 15'b111111111011010) ? 1'b1: //FF68-FF6B - Now in slot 2 and 4 //assign RS232_EN = ({MPI_SCS[0], ADDRESS[15:2]} == 15'b111111111011010) ? 1'b1: //FF68-FF6B - Now in slot 2 and 4
// 1'b0;
assign RS232_EN = (ADDRESS[15:2] == 14'b11111111011010) ? 1'b1: //FF68-FF6B - Now in all slots
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
+8 -1
View File
@@ -84,6 +84,11 @@ reg [8:0] read_count;
reg [4:0] state; reg [4:0] state;
reg second_write; reg second_write;
reg init_offset_a0; reg init_offset_a0;
// End-of-line test for the fetch being requested, registered in state_start.
// read_count only changes on SDRAM_VID_ACK, so this equals the old in-line
// compare; it takes the 9-bit compare off the ACK -> VID_READ_OFFSET path,
// which missed timing at 114 MHz.
reg last_fetch;
reg [4:0] a0_delay; reg [4:0] a0_delay;
localparam state_pre_start = 4'd0; localparam state_pre_start = 4'd0;
@@ -161,6 +166,7 @@ begin
SDRAM_VID_REQ <= 1'b1; SDRAM_VID_REQ <= 1'b1;
state <= state_wait_accept; state <= state_wait_accept;
init_offset_a0 <= PHY_VID_ADD[1]; init_offset_a0 <= PHY_VID_ADD[1];
last_fetch <= (read_count >= WORD_END_COUNT);
end end
end end
@@ -170,7 +176,8 @@ begin
begin begin
SDRAM_VID_REQ <= 1'b0; SDRAM_VID_REQ <= 1'b0;
if (read_count >= WORD_END_COUNT) // if (read_count >= WORD_END_COUNT)
if (last_fetch)
begin begin
read_count <= 9'h000; read_count <= 9'h000;
state <= state_done; state <= state_done;
+8 -2
View File
@@ -99,6 +99,7 @@ reg [1:0] wd_size_code;
wire [7:0] buff_dout; wire [7:0] buff_dout;
reg [1:0] sd_block = 0; reg [1:0] sd_block = 0;
reg format; reg format;
reg buff_wr;
generate generate
if(RWMODE) begin if(RWMODE) begin
wd1793_dpram sbuf wd1793_dpram sbuf
@@ -115,7 +116,6 @@ generate
.wren_b(wre & buff_wr & (addr == A_DATA) & ~scan_active), .wren_b(wre & buff_wr & (addr == A_DATA) & ~scan_active),
.q_b(buff_dout) .q_b(buff_dout)
); );
reg buff_wr;
end else begin end else begin
assign buff_dout = 0; assign buff_dout = 0;
assign sd_buff_din = 0; assign sd_buff_din = 0;
@@ -788,13 +788,19 @@ wire[10:0] edsk_next = ((edsk_addr + 1'd1) >= edsk_size) ? 11'd0 : edsk_addr + 1
reg [7:0] spt_size = 0; reg [7:0] spt_size = 0;
// spt_addr is assigned from the always block above, outside the
// `generate if(EDSK)` scope it used to be declared in. Quartus tolerates that,
// but Verilator rejects it ("Can't find definition of variable: 'spt_addr'"),
// so it lives at module scope, next to spt_size. No behavioural change.
reg [7:0] spt_addr;
generate generate
if(EDSK) begin if(EDSK) begin
wire [7:0] scan_data = RWMODE ? buff_dout : input_data; wire [7:0] scan_data = RWMODE ? buff_dout : input_data;
reg [53:0] edsk[1992]; reg [53:0] edsk[1992];
reg [7:0] spt[166]; reg [7:0] spt[166];
reg [7:0] spt_addr; // reg [7:0] spt_addr;
always @(posedge clk_sys) begin always @(posedge clk_sys) begin
{edsk_track,edsk_side,edsk_trackf,edsk_sidef,edsk_sector,edsk_sizecode,edsk_offset} <= edsk[edsk_addr]; {edsk_track,edsk_side,edsk_trackf,edsk_sidef,edsk_sector,edsk_sizecode,edsk_offset} <= edsk[edsk_addr];
edsk_spt <= spt[spt_addr]; edsk_spt <= spt[spt_addr];