FujiNet Update.

Added slot1 transmit of $FF upon Cold Boot to Fujinet daemon.  Fixed set / clear of CoCo3 SAM registers to work with both reads and writes.
This commit is contained in:
shodge12 committed 2026-11-10 20:22:47 -05:00
1 parent bbbee96a30
commit 5e1b2e4c33
4 files changed
+387 -29

No files matched your search

+196
View File
@@ -0,0 +1,196 @@
////////////////////////////////////////////////////////////////////////////////
// Project Name: CoCo3FPGA Version 5.0
// File Name: UIM.v
//
// CoCo3 in an FPGA
//
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
// Color Computer 3 compatible system on a chip
//
//
// 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.
//
//
////////////////////////////////////////////////////////////////////////////////
// Stan Hodge
//
// UART Injection Module by Stan Hodge 11/8/26
//
// This module uses the AMW_END chain to cause a $FF to be written to the 6551
// uart, then delay until that transmission has been made, then pass on the AMW_END.
// This only occurs in slot 1. In other slots, AMW_END_OUT = AMW_END_IN.
//
////////////////////////////////////////////////////////////////////////////////
module UIM(
input CLK,
input RESET_N,
input [1:0] MPI_SCS,
input PH_2,
input AMW_END_IN,
input ENABLE_IN,
input RW_N_IN,
input [1:0] ADDRESS_IN,
input [7:0] DATA_IN,
output AMW_END_OUT,
output ENABLE_OUT,
output RW_N_OUT,
output [1:0] ADDRESS_OUT,
output [7:0] DATA_OUT
);
////////////////////////////////////////////////////////////
localparam UIM_START = 3'd0;
localparam UIM_F1 = 3'd1;
localparam UIM_F2 = 3'd2;
localparam UIM_F3 = 3'd3;
localparam UIM_F4 = 3'd4;
localparam UIM_F5 = 3'd5;
localparam UIM_F6 = 3'd6;
localparam UIM_ST_END = 3'd7;
reg [2:0] state;
reg mux,rw,ena,timer_ena, AMW_END_OUT_ST;
reg [13:0] timer;
assign ADDRESS_OUT = (mux == 1'b0) ? ADDRESS_IN:
2'b00;
assign DATA_OUT = (mux == 1'b0) ? DATA_IN:
8'b11111111;
assign RW_N_OUT = (mux == 1'b0) ? RW_N_IN:
rw;
assign ENABLE_OUT = (mux == 1'b0) ? ENABLE_IN:
ena;
assign AMW_END_OUT = (MPI_SCS == 2'b00) ? AMW_END_OUT_ST:
AMW_END_IN;
always @(negedge CLK or negedge RESET_N)
begin
if(!RESET_N)
begin
state <= UIM_START;
mux <= 1'b0;
rw <= 1'b1;
ena <= 1'b0;
timer <= 14'b00000000000000;
timer_ena <=1'b0;
AMW_END_OUT_ST <= 1'b0;
end
else
begin
if (timer_ena == 1'b1)
timer <= timer + 1'b1;
case(state)
UIM_START:
begin
if ((MPI_SCS == 2'b00) && (AMW_END_IN == 1'b1))
state <= UIM_F1;
end
UIM_F1:
begin
mux <= 1'b1;
state <= UIM_F2;
end
UIM_F2:
begin
ena <= 1'b1;
state <= UIM_F3;
end
UIM_F3:
begin
rw <= 1'b0;
state <= UIM_F4;
end
UIM_F4:
begin
if (PH_2)
begin
rw <= 1'b1;
state <= UIM_F5;
end
end
UIM_F5:
begin
ena <= 1'b0;
state <= UIM_F6;
end
UIM_F6:
begin
mux <= 1'b0;
timer_ena <= 1'b1;
state <= UIM_ST_END;
end
UIM_ST_END:
begin
if (timer[13] == 1'b1)
begin
AMW_END_OUT_ST <= 1'b1;
timer_ena <= 1'b0;
end
end
default:;
endcase
end
end
endmodule
+168 -25
View File
@@ -106,7 +106,7 @@ input ps2_data,
input [24:0] ps2_mouse,
input Display_Debug,
input SAM_WO,
// RS-232
output UART_TXD,
@@ -698,6 +698,7 @@ assign BUTTON_N[3:0] = {COCO_RESET_N, 2'b1,EE_N};
wire UART_TXD_I;
wire UART_RXD_I;
assign UART_TXD = SWITCH[4]? coco_rs232_out:
UART_TXD_I;
@@ -1024,7 +1025,7 @@ always @(negedge clk_sys or negedge RESET_N)
begin
if(!RESET_N)
begin
Build_Info_Count <= 4'b0000;
Build_Info_Count <= 5'b00000;
Build_Info <= 8'h00;
Build_Info_Read <= 1'b0;
Build_Info_Read_Delay <= 1'b0;
@@ -1070,6 +1071,25 @@ begin
4'd13:
Build_Info <= (Version_Lo + BOARD_TYPE);
// RTC Moved here so not to collide with SAM reads
4'd14:
Build_Info <= {3'b000, CENT};
4'd15:
Build_Info <= {1'b0, YEAR};
4'd16:
Build_Info <= {4'b0000, MNTH};
4'd17:
Build_Info <= {3'b000, DMTH};
4'd18:
Build_Info <= {5'b00000, DWK};
4'd19:
Build_Info <= {3'b000, HOUR};
4'd20:
Build_Info <= {2'b00, MIN};
4'd21:
Build_Info <= {2'b00, SEC};
default:
Build_Info <= 8'h00;
endcase
@@ -1171,16 +1191,6 @@ assign DATA_IN =
(ADDRESS == 16'hFFBD) ? {2'b00, PALETTE[13][5:0]}:
(ADDRESS == 16'hFFBE) ? {2'b00, PALETTE[14][5:0]}:
(ADDRESS == 16'hFFBF) ? {2'b00, PALETTE[15][5:0]}:
(ADDRESS == 16'hFFC0) ? {3'b000, CENT}:
(ADDRESS == 16'hFFC1) ? {1'b0, YEAR}:
(ADDRESS == 16'hFFC2) ? {4'h0, MNTH}:
(ADDRESS == 16'hFFC3) ? {3'b000, DMTH}:
(ADDRESS == 16'hFFC4) ? {5'b00000, DWK}:
(ADDRESS == 16'hFFC5) ? {3'b000, HOUR}:
(ADDRESS == 16'hFFC6) ? {2'b00, MIN}:
(ADDRESS == 16'hFFC7) ? {2'b00, SEC}:
(ADDRESS == 16'hFFD9) ? {5'h00, RATE_PGM}:
(ADDRESS == 16'hFFEF) ? Build_Info:
8'hAA;
@@ -1225,7 +1235,7 @@ wire AMW_EN;
wire AMW_Ready;
wire AMW_End;
assign AMW_ACK = AMW_End;
//assign AMW_ACK = AMW_End;
AMW coco_AMW (
.CLK(clk_sys),
@@ -3553,19 +3563,125 @@ begin
end
else
begin
if(ADDRESS == 16'hFFE8)
// Register reads
if (~SAM_WO)
begin
case (ADDRESS)
16'hFFC0:
begin
V[0] <= 1'b0;
end
16'hFFC1:
begin
V[0] <= 1'b1;
end
16'hFFC2:
begin
V[1] <= 1'b0;
end
16'hFFC3:
begin
V[1] <= 1'b1;
end
16'hFFC4:
begin
V[2] <= 1'b0;
end
16'hFFC5:
begin
V[2] <= 1'b1;
end
16'hFFC6:
begin
VERT[0] <= 1'b0;
end
16'hFFC7:
begin
VERT[0] <= 1'b1;
end
16'hFFC8:
begin
VERT[1] <= 1'b0;
end
16'hFFC9:
begin
VERT[1] <= 1'b1;
end
16'hFFCA:
begin
VERT[2] <= 1'b0;
end
16'hFFCB:
begin
VERT[2] <= 1'b1;
end
16'hFFCC:
begin
VERT[3] <= 1'b0;
end
16'hFFCD:
begin
VERT[3] <= 1'b1;
end
16'hFFCE:
begin
VERT[4] <= 1'b0;
end
16'hFFCF:
begin
VERT[4] <= 1'b1;
end
16'hFFD0:
begin
VERT[5] <= 1'b0;
end
16'hFFD1:
begin
VERT[5] <= 1'b1;
end
16'hFFD2:
begin
VERT[6] <= 1'b0;
end
16'hFFD3:
begin
VERT[6] <= 1'b1;
end
16'hFFD8:
begin
RATE <= 1'b0;
RATE_PGM <= 3'b010;
end
16'hFFD9:
begin
RATE <= 1'b1;
RATE_PGM <= 3'b010; // Normal Turbo
end
16'hFFDE:
begin
RAM <= 1'b0;
end
16'hFFDF:
begin
RAM <= 1'b1;
end
endcase
end
case (ADDRESS)
16'hFFE8:
begin
if(GART_INC[1])
GART_READ <= GART_READ + 1'b1;
end
else
16'hFFE9:
begin
if(ADDRESS == 16'hFFE9)
begin
if(GART_INC[1])
GART_READ <= GART_READ + 1'b1;
end
if(GART_INC[1])
GART_READ <= GART_READ + 1'b1;
end
endcase
end
end
end
@@ -4240,6 +4356,33 @@ begin
end
UIM UIM_COCO3(
.CLK(clk_sys),
.RESET_N(RESET_N),
.MPI_SCS(MPI_SCS),
.PH_2(PH_2),
.AMW_END_IN(AMW_End),
.ENABLE_IN(RS232_EN),
.RW_N_IN(RW_N),
.ADDRESS_IN(ADDRESS[1:0]),
.DATA_IN(DATA_OUT),
.AMW_END_OUT(AMW_ACK),
.ENABLE_OUT(RS232_EN_ST),
.RW_N_OUT(RW_N_ST),
.ADDRESS_OUT(ADDRESS_ST),
.DATA_OUT(DATA_OUT_ST)
);
wire RS232_EN_ST;
wire RW_N_ST;
wire [1:0] ADDRESS_ST;
wire [7:0] DATA_OUT_ST;
// RS232PAK UART
glb6551 RS232(
.RESET_N(RESET_N),
@@ -4248,12 +4391,12 @@ glb6551 RS232(
.RX_CLK_IN(CLK_6551_EN), // These are now enables
.XTAL_CLK_IN(CLK_6551_EN),
.PH_2(PH_2),
.DI(DATA_OUT),
.DI(DATA_OUT_ST),
.DO(DATA_RS232),
.IRQ(SER_IRQ),
.CS({1'b0, RS232_EN}),
.RW_N(RW_N),
.RS(ADDRESS[1:0]),
.CS({1'b0, RS232_EN_ST}),
.RW_N(RW_N_ST),
.RS(ADDRESS_ST[1:0]),
.TXDATA_OUT(UART_TXD_I),
.RXDATA_IN(UART_RXD_I),
.RTS(UART_RTS),
@@ -4320,7 +4463,7 @@ ovo #(.COLS(32), .LINES(23)) NOROMOVO
.i_Hcount({1'b0, PIXEL_COUNT[10:1]}),
.i_VCount(LINE),
.o_r(CN_R),
.ena(Display_Debug || ((!rom_loaded) && SEC[0])),
.ena((!rom_loaded) && SEC[0]),
.in0(NOrom1),
.in1(NOrom2)
);