Pre-release check-in

This is a check-in prior to release.  This version has the orch-90 rom.  The release will not.
This commit is contained in:
shodge12 committed 2022-01-24 19:14:43 -05:00
1 parent 3d5b904290
commit f73e6fd93d
11 files changed
+850 -130

No files matched your search

+221
View File
@@ -0,0 +1,221 @@
////////////////////////////////////////////////////////////////////////////////
// Project Name: CoCo3FPGA Version 5.0
// File Name: AMW.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
//
// Automated Memory Write by Stan Hodge 1/20/22
////////////////////////////////////////////////////////////////////////////////
module AMW(
input CLK,
input RESET_N,
input Trigger,
input Restart,
input Cycle_Run, // AMW_WR shows cycle in process
output reg [24:0] AMW_Adrs,
output reg [7:0] AMW_Data,
output reg AMW_EN,
output reg AMW_Ready,
output reg AMW_End
);
////////////////////////////////////////////////////////////
COCO_ROM_16 COCO3_ROM_Instructions (
.ADDR(pgm_address),
.DATA(DOUT)
);
wire [7:0] DOUT;
// Instructions are 5 bytes
// valid, nc, nc, nc, nc, nc, nc, a24
// a23, a22, a21, a20, a19, a18, a17, a16
// a15, a14, a13, a12, a11, a10, a09, a08
// a07, a06, a05, a04, a03, a02, a01, a00
// d07, d06, d05, d04, d03, d02, d01, d00
////////////////////////////////////////////////////////////
localparam AMW_START = 4'd0;
localparam AMW_F1 = 4'd1;
localparam AMW_F2 = 4'd2;
localparam AMW_F3 = 4'd3;
localparam AMW_F4 = 4'd4;
localparam AMW_F5 = 4'd5;
localparam AMW_WAIT = 4'd6;
localparam AMW_W1 = 4'd7;
localparam AMW_W2 = 4'd8;
localparam AMW_ST_END = 4'd9;
reg [3:0] state;
reg [3:0] pgm_address;
reg valid;
reg Trigger_D;
reg run;
always @(negedge CLK or negedge RESET_N)
begin
if(!RESET_N)
begin
state <= AMW_START;
pgm_address <= 4'b0000;
AMW_Ready <= 1'b0;
valid <= 1'b0;
AMW_End <= 1'b0;
AMW_EN <= 1'b0;
run <= 1'b0;
end
else
begin
Trigger_D <= Trigger;
case(state)
AMW_START:
begin
pgm_address <= 4'b0000;
AMW_Ready <= 1'b0;
AMW_EN <= 1'b0;
state <= AMW_F1;
run <= 1'b0;
end
AMW_F1:
begin
AMW_Ready <= 1'b0;
valid <= DOUT[7];
AMW_Adrs[24] <= DOUT[0];
pgm_address <= pgm_address + 1'b1;
state <= AMW_F2;
end
AMW_F2:
begin
if (~valid)
state <= AMW_ST_END;
else
begin
AMW_Adrs[23:16] <= DOUT[7:0];
pgm_address <= pgm_address + 1'b1;
state <= AMW_F3;
end
end
AMW_F3:
begin
AMW_Adrs[15:8] <= DOUT[7:0];
pgm_address <= pgm_address + 1'b1;
state <= AMW_F4;
end
AMW_F4:
begin
AMW_Adrs[7:0] <= DOUT[7:0];
pgm_address <= pgm_address + 1'b1;
state <= AMW_F5;
end
AMW_F5:
begin
AMW_Data <= DOUT[7:0];
pgm_address <= pgm_address + 1'b1;
AMW_Ready <= 1'b1;
state <= AMW_WAIT;
end
AMW_WAIT:
begin
if (run | (Trigger == 1'b1 && Trigger_D == 1'b0))
begin
run <= 1'b1;
AMW_EN <= 1'b1;
AMW_Ready <= 1'b0;
state <= AMW_W1;
end
end
AMW_W1:
begin
if (Cycle_Run) // Processing
begin
AMW_EN <= 1'b0;
state <= AMW_W2;
end
end
AMW_W2:
begin
if (~Cycle_Run) // Write Done
begin
state <= AMW_F1; // Get next inst
end
end
AMW_ST_END:
begin
AMW_End <= 1'b1;
if (Restart)
begin
AMW_End <= 1'b0;
state <= AMW_START;
end
end
default:;
endcase
end
end
endmodule
+5 -2
View File
@@ -87,8 +87,11 @@ localparam LONG_TIME = 24'h418D40; // .3 sec @ 14.32 Mhz
localparam EE_PROG = {20'h00000, inst_EE_INACTIVE, inst_LONG_TIMER, inst_RESET_INACTIVE, inst_SHORT_TIMER, inst_RESET_ACTIVE,
inst_EE_ACTIVE, inst_START};
localparam Cold_Boot_PROG = {1'h0, inst_RESET_INACTIVE, inst_SHORT_TIMER, inst_RESET_ACTIVE, inst_SHORT_TIMER, inst_EE_INACTIVE,
inst_LONG_TIMER, inst_RESET_INACTIVE, inst_SHORT_TIMER, inst_RESET_ACTIVE, inst_EE_ACTIVE, inst_START};
// Orignal Easter Egg Cold Boot
//localparam Cold_Boot_PROG = {1'h0, inst_RESET_INACTIVE, inst_SHORT_TIMER, inst_RESET_ACTIVE, inst_SHORT_TIMER, inst_EE_INACTIVE,
// inst_LONG_TIMER, inst_RESET_INACTIVE, inst_SHORT_TIMER, inst_RESET_ACTIVE, inst_EE_ACTIVE, inst_START};
localparam Cold_Boot_PROG = {28'h0000000,
inst_LONG_TIMER, inst_RESET_INACTIVE, inst_SHORT_TIMER, inst_RESET_ACTIVE, inst_START};
localparam inst_NULL = 4'd0;
localparam inst_EE_ACTIVE = 4'd1;
+130 -123
View File
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// Project Name: CoCo3FPGA Version 5.x.x
// File Name: coco3fpga.v
// File Name: coco3fpga.sv
//
// CoCo3 in an FPGA
//
@@ -120,14 +120,14 @@ output [15:0] SOUND_RIGHT,
// Needs removal.... ???
input [3:0] PADDLE_CLK,
input [3:0] P_SWITCH,
// joystick input
// digital for buttons
input [15:0] joy1,
input [15:0] joy2,
// analog for position
input [15:0] joya1,
input [15:0] joya2,
input joy_use_dpad,
// joystick input
// digital for buttons
input [15:0] joy1,
input [15:0] joy2,
// analog for position
input [15:0] joya1,
input [15:0] joya2,
input joy_use_dpad,
// Config Static switches
input [9:0] SWITCH,
@@ -187,9 +187,14 @@ input sdram_vid_ready,
input sdram_busy,
input AMW_Trigger,
output AMW_ACK,
input [64:0] RTC,
input [1:0] turbo_speed
input F_Turbo,
input [1:0] turbo_speed,
input [2:0] Mem_Size
);
@@ -227,13 +232,6 @@ wire [21:0] FLASH_ADDRESS;
wire [7:0] FLASH_DATA;
// LEDs
// SRH DE2-115 has one extra Green LED
wire [8:0] LEDG;
//output [9:0] LEDR;
// SRH DE2-115 has 10 extra Red LED
wire [17:0] LEDR;
// Extra Buttons and Switches
// SRH MISTer
@@ -246,7 +244,6 @@ wire EF;
wire PH_2;
reg PH_2_RAW;
reg RESET_N;
reg [13:0] RESET_SM;
reg [6:0] CPU_RESET_SM;
reg CPU_RESET;
wire RESET_INS;
@@ -519,8 +516,6 @@ wire RDFIFO_WRFULL;
wire WRFIFO_RDEMPTY;
wire WRFIFO_WRFULL;
reg BI_IRQ_EN;
reg [19:0] MCLOCK;
reg [19:0] MCLOCK_DELAY;
wire I2C_SCL_EN;
wire I2C_DAT_EN;
reg [7:0] I2C_DEVICE;
@@ -657,7 +652,7 @@ wire [4:0] HOUR;
wire [5:0] MIN;
wire [5:0] SEC;
// This is a Real Time Clock. It is initialized by RTC which is provided by MISTER
// This is a Real Time Clock. It is initialized by RTC which is provided by MISTER.
// RTC is provided only once after reset to initialize the clock. RTC is in BCD
// format. The output here is in BIN values. Note while CENT will roll in the clock
// it is NOT initialized from MiSTer. As such - it is a static value set to 5'd20.
@@ -682,61 +677,15 @@ rtc #(50000000) CC3_rtc(
//assign PROBE[6:0] = {CART1_POL, CART1_BUF_RESET_N, CART1_FIRQ_STAT_N, CART1_CLK_N, CART1_FIRQ_N, RESET_N, PH_2};
//assign PROBE[7:0] = {1'b0, CART1_POL, CART1_FIRQ_N, CART1_FIRQ_BUF[0], CART1_CLK_N_D, CART1_FIRQ_RESET_N, CART1_CLK_N, PH_2};
assign PROBE[7:0] = {2'b00, cache_hit, COCO3_ROM_WRITE, ioctl_wr, ioctl_download, ioctl_index[7], ioctl_index[6]};
assign PROBE[15:8] = LEDR[7:0];
assign PROBE[23:16] = LEDG[7:0];
assign PROBE[15:8] = 8'h00;
assign PROBE[23:16] = 8'h00;
//assign PROBE[31:24] = {3'b000, DATA_OUT[3], MOTOR, DRIVE_SEL_EXT[0], HDD_EN, ADDRESS[0]};
assign PROBE[31:24] = {2'b00, fdc_probe[5:0]};
assign clk_sys = CLK_57;
assign BUTTON_N[3:0] = {COCO_RESET_N, 2'b1,EE_N};
//assign LEDG = TRACE; // Floppy Trace
assign LEDG[0] = 1'b0;
assign LEDG[1] = 1'b0;
assign LEDG[2] = 1'b0;
assign LEDG[3] = FLASH_CE_S;
assign LEDG[4] = (ADDRESS == 16'hFF84); // SDRAM
assign LEDG[5] = 1'b0;
assign LEDG[6] = 1'b0; // SD Card activity
assign LEDG[7] = 1'b0;
// SRH DE2-115 Extra Green LED is unused and off
assign LEDG[8] = 1'b0;
assign LEDR[0] = 1'b0;
assign LEDR[1] = 1'b0;
assign LEDR[2] = 1'b0;
assign LEDR[3] = 1'b0;
assign LEDR[4] = 1'b0;
assign LEDR[5] = SWITCH[6]; // SD Card inserted
assign LEDR[6] = RESET_N;
assign LEDR[7] = KEY[55]; // Shift Lock
// SRH DE2-115 Extra Red LEDs are unused and off
assign LEDR[17:8] = 10'b0000000000;
//Master clock divider chain
// MCLOCK[0] = 50/2 = 25 MHz
// MCLOCK[1] = 50/4 = 12.5 MHz
// MCLOCK[2] = 50/8 = 6.25 MHz
// MCLOCK[3] = 50/16 = 3.125 MHz
// MCLOCK[4] = 50/32 = 1.5625 MHz
// MCLOCK[5] = 50/64 = 781.25 KHz
// MCLOCK[6] = 50/128 = 390.625 KHz
// MCLOCK[7] = 50/256 = 195.125 KHz
// MCLOCK[8] = 50/512 = 97.65625 KHz
// MCLOCK[9] = 50/1024 = 48.828125 KHz
// MCLOCK[10] = 50/2048 = 24.4140625 KHz
// MCLOCK[11] = 50/4096 = 12.20703125 KHz
always @ (negedge clk_sys) //50 MHz
begin
MCLOCK <= MCLOCK + 1'b1;
MCLOCK_DELAY <= MCLOCK;
end
/*****************************************************************************
* RAM signals
@@ -769,8 +718,8 @@ assign BLOCK_ADDRESS = ({MMU_EN, MMU_TR, ADDRESS[15:13]} == 5'b1
({VEC_PAG_RAM, MMU_EN, MMU_TR, ADDRESS[15:8]} ==11'b01111111110) ? SAM17: // 011 1111 1110 FE00-FEFF RAM Vector page
{9'h007, ADDRESS[15:13]};
assign RAM_CS = (ADDRESS[15:0]== 18'h2FFE8) ? 1'b1: // GART 1
(ADDRESS[15:0]== 18'h2FFE9) ? 1'b1: // GART 2
assign RAM_CS = (ADDRESS[15:0]== 16'hFFE8) ? 1'b1: // GART 1
(ADDRESS[15:0]== 16'hFFE9) ? 1'b1: // GART 2
({ADDRESS[15:8]}== 8'hFF) ? 1'b0: // Hardware (FF00-FFFF) always Excluded
ROM_SEL ? 1'b0: // Internal ROM
FLASH_CE_S ? 1'b0: // Cart ROM
@@ -899,11 +848,11 @@ 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[0], ADDRESS[15:4]} == 13'b1111111110100) ? 1'b1: // FF40-FF4F with MPI switch = 2 or 4
assign HDD_EN = ({MPI_SCS[0], ADDRESS[15:4]} == 13'b1111111110100) ? 1'b1: // FF40-FF4F with MPI switch = 2 or 4
1'b0;
assign RS232_EN = (ADDRESS[15:2] == 14'b11111111011010) ? 1'b1: //FF68-FF6B
1'b0;
assign SLOT3_HW = ({MPI_SCS, ADDRESS[15:5]} == 13'b1011111111010) ? 1'b1: // FF40-FF5F
assign SLOT3_HW = ({MPI_SCS, ADDRESS[15:5]} == 13'b1011111111010) ? 1'b1: // FF40-FF5F
1'b0;
assign VDAC_EN = ({RW_N,ADDRESS[15:0]} == 17'H0FF7E) ? 1'b1: // FF7E
1'b0;
@@ -917,12 +866,12 @@ begin
else
begin
if({PH_2, SLOT3_HW, RW_N} == 3'b110)
// case (ADDRESS[4:0])
// 5'h00:
// begin
case (ADDRESS[4:0])
5'h00:
begin
ROM_BANK <= DATA_OUT[2:0];
// end
// endcase
end
endcase
end
end
@@ -1022,7 +971,7 @@ assign DATA_IN =
// (ADDRESS == 16'hFF88) ? BUFF_DATA[7:0]:
(ADDRESS == 16'hFF8E) ? GPIO_DIR:
(ADDRESS == 16'hFF8F) ? GPIO:
(ADDRESS == 16'hFF8F) ? {GPIO[7:0]}:
(ADDRESS == 16'hFF90) ? {COCO1, MMU_EN, GIME_IRQ, GIME_FIRQ, VEC_PAG_RAM, ST_SCS, ROM}:
(ADDRESS == 16'hFF91) ? {2'b00, TIMER_INS, 4'b0000, MMU_TR}:
@@ -1140,6 +1089,27 @@ assign GPIO[6] = GPIO_DIR[6] ? GPIO_OUT[6]:
assign GPIO[7] = GPIO_DIR[7] ? GPIO_OUT[7]:
1'bZ;
wire [24:0] AMW_Adrs;
wire [7:0] AMW_Data;
wire AMW_EN;
wire AMW_Ready;
wire AMW_End;
assign AMW_ACK = AMW_End;
AMW coco_AMW (
.CLK(clk_sys),
.RESET_N(RESET_N),
.Trigger(AMW_Trigger),
.Restart(1'b0),
.Cycle_Run(AMW_WR),
.AMW_Adrs(AMW_Adrs),
.AMW_Data(AMW_Data),
.AMW_EN(AMW_EN),
.AMW_Ready(AMW_Ready),
.AMW_End(AMW_End)
);
reg end_hold;
reg [15:0] hold_data, hold_data_L;
@@ -1160,14 +1130,29 @@ begin
end
end
// Original SRH 1/16/22
//assign sdram_cpu_addr = {4'b0000, BLOCK_ADDRESS[7:0], ADDRESS[12:1], ADDRESS[0]};
assign sdram_cpu_addr = {BLOCK_ADDRESS[11:0], ADDRESS[12:1], ADDRESS[0]};
assign sdram_cpu_din = DATA_OUT;
localparam Sz_512K = 3'b000;
localparam Sz_1M = 3'b001;
localparam Sz_2M = 3'b010;
assign sdram_cpu_addr = (Mem_Size == Sz_512K) ? {6'h00, sdram_cpu_addr_i[18:0]}:
(Mem_Size == Sz_1M) ? {5'b00000, sdram_cpu_addr_i[19:0]}:
(Mem_Size == Sz_2M) ? {4'h0, sdram_cpu_addr_i[20:0]}:
sdram_cpu_addr_i[24:0]; // 32MB space but we only have MMU addressing for 16MB
assign sdram_cpu_addr_i = (AMW_WR) ? AMW_Adrs:
(GART_RD) ? {2'b00, GART_READ}:
(GART_WR) ? {2'b00, GART_WRITE}:
{BLOCK_ADDRESS[11:0], ADDRESS[12:1], ADDRESS[0]};
assign sdram_cpu_din = (AMW_WR) ? AMW_Data:
DATA_OUT;
reg [24:0] sdram_cpu_addr_i;
reg [24:0] sdram_cpu_addr_L;
reg last_write;
reg sdram_BE_0, sdram_BE_1;
reg GART_RD, GART_WR;
reg AMW_WR;
wire cache_hit /* synthesis preserve */;
assign cache_hit = (sdram_cpu_addr[24:1] == sdram_cpu_addr_L[24:1]);
@@ -1194,6 +1179,9 @@ begin
last_write <= 1'b1;
sdram_BE_0 <= 1'b0;
sdram_BE_1 <= 1'b0;
GART_WR <= 1'b0;
GART_RD <= 1'b0;
AMW_WR <= 1'b0;
end
else
begin
@@ -1224,12 +1212,17 @@ begin
end
if (sdram_cpu_ack)
begin
sdram_cpu_req <= 1'b0;
GART_WR <= 1'b0; // GART address has already been used in the sdram controller so - de-select it
GART_RD <= 1'b0;
AMW_WR <= 1'b0;
end
case (CLK)
6'h00:
begin
SWITCH_L <= {turbo_speed, RATE}; // Normal speed
SWITCH_L <= {turbo_speed, (RATE | F_Turbo)}; // Normal speed
CLK <= 6'h01;
PH_2_RAW <= 1'b1;
@@ -1238,27 +1231,40 @@ begin
begin
cpu_ena <= 1'b1;
if (VMA & RAM_CS) // FFE8 is now in RAM_CS
if (AMW_EN) // Automated Memory Write ?
begin
AMW_WR <= 1'b1;
cpu_ena <= 1'b0; // Kill cpu enable
// Start AMW cycle
RAM0_BE0_L <= !AMW_Adrs[0];
RAM0_BE1_L <= AMW_Adrs[0];
last_write <= 1'b1; // Kill cache hit
hold <= 1'b1;
sdram_cpu_req <= 1'b1;
sdram_cpu_rnw <= 1'b0;
end
else if (VMA & RAM_CS) // FFE8 / FFE9 is now in RAM_CS
begin
// sdram memory cycle
if (ADDRESS[15:0] == 18'h2FFE8) // GART
if ((ADDRESS[15:0] == 16'hFFE8) | (ADDRESS[15:0] == 16'hFFE9)) // GART
begin
if (~RW_N)
begin // Gart Write
RAM0_BE0_L <= !GART_WRITE[0];
RAM0_BE1_L <= GART_WRITE[0];
sdram_cpu_addr_L <= {2'b00, GART_WRITE};
GART_WR <= 1'b1;
end
else
begin // Gart Read
RAM0_BE0_L <= !GART_READ[0];
RAM0_BE1_L <= GART_READ[0];
sdram_cpu_addr_L <= {2'b00, GART_READ};
GART_RD <= 1'b1;
end
hold <= 1'b1;
sdram_cpu_req <= 1'b1;
sdram_cpu_rnw <= RW_N;
last_write <= ~RW_N;
last_write <= 1'b1; // Kill cache hit on any access after GART
end
else // Normal CPU cycle
// get which byte
@@ -1332,34 +1338,34 @@ assign RESET_P = !BUTTON_N[3] // Button
| RESET; // CTRL-ALT-DEL or CTRL-ALT-INS
// Make sure all resets are enabled for a long enough time to allow voltages to settle
always @ (negedge clk_sys or posedge RESET_P) // 50 MHz / 64
always @ (negedge clk_sys or posedge RESET_P)
begin
reg [24:0] RESET_SM;
if(RESET_P)
begin
RESET_SM <= 14'h0000;
RESET_SM <= 25'd0;
CPU_RESET <= 1'b1;
RESET_N <= 1'b0;
MUGS <= RESET_INS; //This is holding a <ctrl><alt><ins> across a reset to activate the Easter Egg
end
else
begin
if (MCLOCK[9] == 1'b0 && MCLOCK_DELAY[9] == 1'b1)
case (RESET_SM)
14'h1FFF: // time = 1.28 uS * 14336 = 18350.08 uS
begin
RESET_N <= 1'b1;
CPU_RESET <= 1'b1;
RESET_SM <= 14'h3800;
end
14'h3FFF: // time = 1.28 uS * 16383 = 20970.24 uS
begin
RESET_N <= 1'b1;
CPU_RESET <= 1'b0;
RESET_SM <= 14'h3FFF;
end
default:
RESET_SM <= RESET_SM + 1'b1;
endcase
case (RESET_SM)
25'h0800000: // time = 143 mS
begin
RESET_N <= 1'b1;
CPU_RESET <= 1'b1;
RESET_SM <= RESET_SM + 1'b1;
end
25'h1000000: // time = 286 mS
begin
RESET_N <= 1'b1;
CPU_RESET <= 1'b0;
end
default:
RESET_SM <= RESET_SM + 1'b1;
endcase
end
end
@@ -2357,7 +2363,7 @@ begin
MPI_CTS <= SWITCH[2:1];
// FF8E-FF8F
GPIO_DIR <= 8'h00;
GPIO_OUT <= 8'h55;
GPIO_OUT <= 8'h00;
// FF90
ROM <= 2'b00;
ST_SCS <= 1'b0;
@@ -3311,10 +3317,11 @@ assign SOUND_RIGHT = {ORCH_RIGHT, ORCH_RIGHT_EXT} + {SOUND, 8'h00};
reg [15:0] dac_joya1;
reg [15:0] dac_joya2;
always @(clk_sys) begin
always @ (negedge clk_sys)
begin
if (joy_use_dpad)
begin
begin
dac_joya1[15:8] <= 8'd128;
dac_joya1[7:0] <= 8'd128;
@@ -3344,33 +3351,34 @@ always @(clk_sys) begin
if (joy2[3]) // upimg_mounted
dac_joya2[7:0] <= 8'd16;
end
end
else
begin
begin
dac_joya1 <= joya1;
dac_joya2 <= joya2;
end
end
end
always @(posedge clk_sys) begin
case (SEL)
2'b00:
always @(negedge clk_sys)
begin
case (SEL)
2'b00:
if (dac_joya2[15:10] > DTOA_CODE)
JSTICK<=1;
else
JSTICK<=0;
2'b01:
2'b01:
if (dac_joya2[7:2] > DTOA_CODE)
JSTICK<=1;
else
JSTICK<=0;
2'b10:
2'b10:
if (dac_joya1[15:10] > DTOA_CODE)
JSTICK<=1;
else
JSTICK<=0;
2'b11:
2'b11:
if (dac_joya1[7:2] > DTOA_CODE)
JSTICK<=1;
else
@@ -3379,7 +3387,6 @@ always @(posedge clk_sys) begin
end
/*****************************************************************************
* Convert PS/2 keyboard to CoCo keyboard
* Buttons
+107
View File
@@ -0,0 +1,107 @@
--//////////////////////////////////////////////////////////////////////////////
-- Project Name: CoCo3FPGA Version Mister
-- File Name: coco_rom_16.vhd
--
-- 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.
--
-- The latest version of this file can be found at:
-- http://groups.yahoo.com/group/CoCo3FPGA
--
-- File history :
--
--//////////////////////////////////////////////////////////////////////////////
-- Gary Becker
-- [email protected]
--//////////////////////////////////////////////////////////////////////////////
--//////////////////////////////////////////////////////////////////////////////
-- MISTer conversion work by Stan Hodge and Alan Steremberg
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.numeric_std.all;
entity COCO_ROM_16 is
port (
-- Main CPU Port
ADDR : in std_logic_vector(3 downto 0);
DATA : out std_logic_vector(7 downto 0)
);
end;
architecture RTL of COCO_ROM_16 is
type ROM_ARRAY is array(0 to 15) of std_logic_vector(7 downto 0);
signal ROM : ROM_ARRAY:= (
// Clear $71 [Warm Start Flag]
x"80",x"07",x"00",x"71",x"00", -- valid, nc, nc, nc, nc, nc, nc, a24
-- a23, a22, a21, a20, a19, a18, a17, a16
-- a15, a14, a13, a12, a11, a10, a09, a08
-- a07, a06, a05, a04, a03, a02, a01, a00
-- d07, d06, d05, d04, d03, d02, d01, d00
// Set $C000 <- $55 [Clear D in DK identifier in rom]
x"80",x"07",x"C0",x"00",x"55", -- valid, nc, nc, nc, nc, nc, nc, a24
-- a23, a22, a21, a20, a19, a18, a17, a16
-- a15, a14, a13, a12, a11, a10, a09, a08
-- a07, a06, a05, a04, a03, a02, a01, a00
-- d07, d06, d05, d04, d03, d02, d01, d00
x"00",x"00",x"00",x"00",x"00", -- valid, nc, nc, nc, nc, nc, nc, a24
-- a23, a22, a21, a20, a19, a18, a17, a16
-- a15, a14, a13, a12, a11, a10, a09, a08
-- a07, a06, a05, a04, a03, a02, a01, a00
-- d07, d06, d05, d04, d03, d02, d01, d00
x"00" -- valid, nc, nc, nc, nc, nc, nc, a24
);
begin
DATA <= ROM(to_integer(unsigned(ADDR)));
end RTL;