Fix PIA2 adrs, added Auto Run

1.	Changed PIA 2 addressing to align with real CoCo3 hardware and end at FF2F.
2.	Removal of 16 bit sound extentions as they overlap speach / sound cart.  This is
	accompanied by a rework of the sound mixing to be more correct.
3.	Re-arranged MiSTer drive LUNs to support future auto-boot from SDC drive 0
4.	Added 'Auto Run' feature.  You must use slot 2 [SDC].  Take your floopy or HD
	and copy it to a file name of 'boot.vhd'.  This will be auto mounted to drive 0
	on the SDC.  In the menu, find a new item Auto Run:.  It can be set to No, DOS or
	AUTO.BAS.  Choosing dos causes the 'DOS' command to be executed on power up.  Setting
	the option to 'AUTO.BAS' will cause a 'RUN"AUTO' command to be executed upon powerup.
	Save your settings to cause the changes to be remembered.  The Auto Run system re-arms
	upon using the 'Cold Boot' menu item.

To Do...
1.	Add Speech / Music cart
2.	Fix Color File II
3.	Fic Castle of Tharoggad
This commit is contained in:
shodge12 committed 2024-02-16 22:27:15 -05:00
1 parent 49a8aee74d
commit f93784660c
8 files changed
+376 -113

No files matched your search

BIN
View File
Binary file not shown.
-1
View File
@@ -318,7 +318,6 @@ set_global_assignment -name VHDL_FILE rtl/rom/coco_rom_16.vhd
set_global_assignment -name SDC_FILE rtl/CoCo3FPGA.sdc set_global_assignment -name SDC_FILE rtl/CoCo3FPGA.sdc
set_global_assignment -name ENABLE_SIGNALTAP ON set_global_assignment -name ENABLE_SIGNALTAP ON
set_global_assignment -name USE_SIGNALTAP_FILE Vsync.stp
set_global_assignment -name SIGNALTAP_FILE Video_Explorer.stp set_global_assignment -name SIGNALTAP_FILE Video_Explorer.stp
set_global_assignment -name SIGNALTAP_FILE rom_Exploror.stp1 set_global_assignment -name SIGNALTAP_FILE rom_Exploror.stp1
set_global_assignment -name SOURCE_FILE rom_Exploror.stp1 set_global_assignment -name SOURCE_FILE rom_Exploror.stp1
+15 -11
View File
@@ -194,20 +194,20 @@ localparam CONF_STR = {
"-;", "-;",
"OCD,Multi-Pak,(Slot 2) CoCoSDC,(Slot3) ECB /Cart,(Slot 4) Disk;", "OCD,Multi-Pak,(Slot 2) CoCoSDC,(Slot3) ECB /Cart,(Slot 4) Disk;",
"H3-;", "H3-;",
"H3S0,DSK,Load Disk Drive 0;", "H3S2,DSK,Load Disk Drive 0;",
"H3S1,DSK,Load Disk Drive 1;", "H3S3,DSK,Load Disk Drive 1;",
"H3S2,DSK,Load Disk Drive 2;", "H3S4,DSK,Load Disk Drive 2;",
"H3S3,DSK,Load Disk Drive 3;", "H3S5,DSK,Load Disk Drive 3;",
"H2-;", "H2-;",
"H2F1,CCC,Load Cartridge;", "H2F1,CCC,Load Cartridge;",
"H1-;", "H1-;",
"H1S4,DSKVHD,Load SDC Drive 0;", "H1S0,DSKVHD,Load SDC Drive 0;",
"H1S5,DSKVHD,Load SDC Drive 1;", "H1S1,DSKVHD,Load SDC Drive 1;",
"H1-;", "H1-;",
"H1S0,DSK,Load OS9 Floppy /d0;", "H1S2,DSK,Load OS9 Floppy /d0;",
"H1S1,DSK,Load OS9 Floppy /d1;", "H1S3,DSK,Load OS9 Floppy /d1;",
"H1S2,DSK,Load OS9 Floppy /d3;", "H1S4,DSK,Load OS9 Floppy /d3;",
"H1S3,DSK,Load OS9 Floppy /d4;", "H1S5,DSK,Load OS9 Floppy /d4;",
"-;", "-;",
"F2,CAS,Load Cassette;", "F2,CAS,Load Cassette;",
@@ -242,6 +242,7 @@ localparam CONF_STR = {
"OO,Force Turbo,No,Yes;", "OO,Force Turbo,No,Yes;",
"o02,Turbo Speed,CoCo Ctrl, 0.89 Mhz,1.78 Mhz,2.86 Mhz, 3.58 Mhz,7.16 Mhz,9.54 Mhz;", "o02,Turbo Speed,CoCo Ctrl, 0.89 Mhz,1.78 Mhz,2.86 Mhz, 3.58 Mhz,7.16 Mhz,9.54 Mhz;",
"OPR,Memory Size,512K,1M,2M,16M;", "OPR,Memory Size,512K,1M,2M,16M;",
"o89,Auto Run,No,DOS,AUTO.BAS;",
"-;", "-;",
"RM,Cold Boot;", "RM,Cold Boot;",
"R0,Reset;", "R0,Reset;",
@@ -260,7 +261,7 @@ localparam CONF_STR = {
// 0123456789ABCDEFGHIJKLMNOPQRSTUV 0123456789ABCDEFGHIJKLMNOPQRSTUV // 0123456789ABCDEFGHIJKLMNOPQRSTUV 0123456789ABCDEFGHIJKLMNOPQRSTUV
// //
// R OOOO OOR OO TOOOOOOROOOOOO ooo // R OOOO OOR OO TOOOOOOROOOOOO ooo oo oo
//F FF //F FF
//S SSSSSS //S SSSSSS
@@ -582,6 +583,8 @@ coco3fpga coco3 (
.Mem_Size(Mem_Size), .Mem_Size(Mem_Size),
.AUTO_MODE(Auto_Mode),
.UART_TXD(UART_TXD), .UART_TXD(UART_TXD),
.UART_RXD(UART_RXD), .UART_RXD(UART_RXD),
.UART_RTS(UART_RTS), .UART_RTS(UART_RTS),
@@ -597,6 +600,7 @@ wire [5:0] cocosound;
wire [2:0] turbo_speed = status[34:32]; wire [2:0] turbo_speed = status[34:32];
wire [2:0] assigned_turbo_speed; wire [2:0] assigned_turbo_speed;
wire [1:0] art = status[38:37]; wire [1:0] art = status[38:37];
wire [1:0] Auto_Mode = status[41:40];
wire AMW_ACK; wire AMW_ACK;
+23 -2
View File
@@ -1,3 +1,23 @@
1. Changed PIA 2 addressing to align with real CoCo3 hardware and end at FF2F.
2. Removal of 16 bit sound extentions as they overlap speach / sound cart. This is
accompanied by a rework of the sound mixing to be more correct.
3. Re-arranged MiSTer drive LUNs to support future auto-boot from SDC drive 0
4. Added 'Auto Run' feature. You must use slot 2 [SDC]. Take your floopy or HD
and copy it to a file name of 'boot.vhd'. This will be auto mounted to drive 0
on the SDC. In the menu, find a new item Auto Run:. It can be set to No, DOS or
AUTO.BAS. Choosing dos causes the 'DOS' command to be executed on power up. Setting
the option to 'AUTO.BAS' will cause a 'RUN"AUTO' command to be executed upon powerup.
Save your settings to cause the changes to be remembered. The Auto Run system re-arms
upon using the 'Cold Boot' menu item.
To Do...
1. Add Speech / Music cart
2. Fix Color File II
3. Fic Castle of Tharoggad
1. For cycle accurate 6809, changed PH2 to cpu_cycle_ena. (Improve timing of control register writes) 1. For cycle accurate 6809, changed PH2 to cpu_cycle_ena. (Improve timing of control register writes)
2. Changed PIA(s) addressing to allow complete mirror through FF00-FF3F 2. Changed PIA(s) addressing to allow complete mirror through FF00-FF3F
3. Corrected usage of SG6 enable (SW5 in orig code) which allows the usage of SG6. Formerly it was used to 3. Corrected usage of SG6 enable (SW5 in orig code) which allows the usage of SG6. Formerly it was used to
@@ -13,8 +33,9 @@
To Do... To Do...
1. Fix Color File II 1. Change PIA 2 addressing to align with real CoCo3 hardware and end at FF2F.
2. Fic Castle of Tharoggad 2. Fix Color File II
3. Fic Castle of Tharoggad
+1
View File
@@ -23,6 +23,7 @@ set_global_assignment -name VERILOG_FILE rtl/config.v
set_global_assignment -name SYSTEMVERILOG_FILE rtl/fdc.sv set_global_assignment -name SYSTEMVERILOG_FILE rtl/fdc.sv
set_global_assignment -name SYSTEMVERILOG_FILE rtl/sdc.sv set_global_assignment -name SYSTEMVERILOG_FILE rtl/sdc.sv
set_global_assignment -name SYSTEMVERILOG_FILE rtl/sdc_top.sv set_global_assignment -name SYSTEMVERILOG_FILE rtl/sdc_top.sv
set_global_assignment -name SYSTEMVERILOG_FILE rtl/Auto_Run.sv
set_global_assignment -name SYSTEMVERILOG_FILE rtl/ps2_mouse.v set_global_assignment -name SYSTEMVERILOG_FILE rtl/ps2_mouse.v
set_global_assignment -name SYSTEMVERILOG_FILE rtl/sdram/sdram2.sv set_global_assignment -name SYSTEMVERILOG_FILE rtl/sdram/sdram2.sv
set_global_assignment -name SYSTEMVERILOG_FILE rtl/wd1793.sv set_global_assignment -name SYSTEMVERILOG_FILE rtl/wd1793.sv
+264
View File
@@ -0,0 +1,264 @@
////////////////////////////////////////////////////////////////////////////////
// Project Name: CoCo3FPGA Version 5.x.x
// File Name: Auto_Run.sv
//
// 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
//
// Auto_Run by Stan Hodge 02/16/24
////////////////////////////////////////////////////////////////////////////////
module Auto_Run(
input RESET_N,
input CLK,
input CLK_1_78,
input [1:0] MPI_SCS, // slot id
input [1:0] MODE, // from MISTer subsystem 00=NONE, 01=DOS<RET>, 10=RUN"AUTO<RET>
input AMW_ACK, // from AMW subsystem - Cold Boot setup finished
input [72:0] KEY_IN, // Keystroke array
output [72:0] KEY_OUT // Modified Keystroke array
);
// Programs
// MODE = 01
// D O S <CR>
wire [7:0] DOS_KEYFILE[0:3] = '{8'd4, 8'd15, 8'd19, 8'd48};
// MODE = 10
// R U N <S> 2 A U T O <CR>
wire [7:0] RUN_KEYFILE[0:9] = '{8'd18, 8'd21, 8'd14, 8'd55, 8'd34, 8'd1, 8'd21, 8'd20, 8'd15, 8'd48};
localparam PRESS_KEY = 1'b1;
localparam RELEASE_KEY = 1'b0;
reg [3:0] index;
reg shift;
reg [7:0] char;
reg run; // 1=running
reg key_up_down;
reg timer_19_d;
// 300ms [600ms is aprox 1024000]
reg [19:0] timer;
// timer[19] changes state every 524288 counts, ~ 0.294 seconds.
reg timer_enable; // 1=run, 0=stop and clear
localparam st_beg0 = 4'd0;
localparam st_beg1 = 4'd1;
localparam st_beg2 = 4'd2;
localparam st_start = 4'd3;
localparam st_1 = 4'd4;
localparam st_2 = 4'd5;
localparam st_3 = 4'd6;
reg [3:0] state;
reg first_time = 1'b1;
/////////////////////////////////////////////////////////////
// Timer
always @ (negedge CLK or negedge RESET_N)
begin
if(!RESET_N)
begin
timer <= 20'b00000000000000000000;
end
else
begin
if (CLK_1_78)
begin
if (timer_enable)
timer <= timer + 1'b1;
else
timer <= 20'b00000000000000000000;
end
end
end
/////////////////////////////////////////////////////////////
// Output
always @(*)
begin
KEY_OUT <= KEY_IN;
if (run)
begin
if (shift)
begin
KEY_OUT[55] <= key_up_down;
KEY_OUT[char] <= key_up_down;
end
else
begin
KEY_OUT[char] <= key_up_down;
end
end
end
/////////////////////////////////////////////////////////////
// Main State Mach
always @ (negedge CLK or negedge RESET_N)
begin
if(!RESET_N)
begin
state <= st_beg0;
shift <= 1'b0;
index <= 4'd0;
run <= 1'b0;
timer_enable <= 1'b0;
key_up_down <= RELEASE_KEY;
timer_19_d <= 1'b0;
end
else
begin
if (AMW_ACK)
first_time <= 1'b1;
timer_19_d <= timer[19];
case(state)
st_beg0:
begin
timer_enable <= 1'b1;
if (!timer[19] && timer_19_d)
state <= st_beg1;
end
st_beg1:
begin
if (!timer[19] && timer_19_d)
state <= st_beg2;
end
st_beg2:
begin
if (!timer[19] && timer_19_d)
begin
state <= st_start;
timer_enable <= 1'b0;
end
end
st_start:
begin
if (first_time && (MPI_SCS == 2'b01))
begin
if (MODE == 2'b01) //DOS
begin
if (DOS_KEYFILE[index] == 8'd55)
shift <= 1'b1;
char <= DOS_KEYFILE[index];
run <= 1'b1;
state <= st_1;
end
else if (MODE == 2'b10) //RUN"AUTO
begin
if (RUN_KEYFILE[index] == 8'd55)
shift <= 1'b1;
char <= RUN_KEYFILE[index];
run <= 1'b1;
state <= st_1;
end
end
end
st_1:
begin
index <= index + 1'b1;
if (shift && (char == 8'd55)) // read next char
state <= st_start;
else
begin
timer_enable <= 1'b1;
key_up_down <= PRESS_KEY;
state <= st_2;
end
end
st_2:
begin
if (timer[18] == 1'b1) // 300ms time passed
begin
key_up_down <= RELEASE_KEY;
state <= st_3;
end
end
st_3:
begin
if (timer[18] == 1'b0) // 300ms time passed
begin
shift <= 1'b0;
timer_enable <= 1'b0;
if (char == 7'd48) // we are done
begin
first_time <= 1'b0;
run <= 1'b0;
end
state <= st_start;
end
end
default:;
endcase
end
end
endmodule
+72 -98
View File
@@ -201,7 +201,8 @@ input [64:0] RTC,
input F_Turbo, input F_Turbo,
input [2:0] turbo_speed, input [2:0] turbo_speed,
output [2:0] assigned_turbo_speed, output [2:0] assigned_turbo_speed,
input [2:0] Mem_Size input [2:0] Mem_Size,
input [1:0] AUTO_MODE
); );
@@ -323,7 +324,6 @@ wire HDD_EN_DATA;
reg [1:0] MPI_SCS; // IO select reg [1:0] MPI_SCS; // IO select
reg [1:0] MPI_CTS; // ROM select reg [1:0] MPI_CTS; // ROM select
reg [1:0] W_PROT;
reg SBS; reg SBS;
reg [11:0] SAM00; // 8MB 5:0 for 512kb reg [11:0] SAM00; // 8MB 5:0 for 512kb
reg [11:0] SAM01; reg [11:0] SAM01;
@@ -378,10 +378,6 @@ reg [18:0] LEFT_BUF2;
reg [18:0] RIGHT_BUF2; reg [18:0] RIGHT_BUF2;
reg [7:0] ORCH_LEFT; reg [7:0] ORCH_LEFT;
reg [7:0] ORCH_RIGHT; reg [7:0] ORCH_RIGHT;
reg [7:0] ORCH_LEFT_EXT;
reg [7:0] ORCH_RIGHT_EXT;
reg [7:0] ORCH_LEFT_EXT_BUF;
reg [7:0] ORCH_RIGHT_EXT_BUF;
reg DACLRCLK; reg DACLRCLK;
reg [5:0] DAC_STATE; reg [5:0] DAC_STATE;
wire H_FLAG; wire H_FLAG;
@@ -914,13 +910,13 @@ assign DATA_IN =
// FF03, FF07, FF0B, FF0F // FF03, FF07, FF0B, FF0F
({ADDRESS[15:5], ADDRESS[1:0]} == 13'b1111111100011) ? {!VSYNC1_IRQ_BUF[1], 3'b011, SEL[1], DDR2, VSYNC1_POL, VSYNC1_IRQ_INT}: ({ADDRESS[15:5], ADDRESS[1:0]} == 13'b1111111100011) ? {!VSYNC1_IRQ_BUF[1], 3'b011, SEL[1], DDR2, VSYNC1_POL, VSYNC1_IRQ_INT}:
// FF20, FF24, FF28, FF2C // FF20, FF24, FF28, FF2C
({ADDRESS[15:5], ADDRESS[1:0]} == 13'b1111111100100) ? DATA_REG3: ({ADDRESS[15:4], ADDRESS[1:0]} == 14'b11111111001000) ? DATA_REG3:
// FF21, FF25, FF29, FF2D // FF21, FF25, FF29, FF2D
({ADDRESS[15:5], ADDRESS[1:0]} == 13'b1111111100101) ? {4'b0011, CAS_MTR, DDR3, 2'b00}: // CD_POL, CD_INT}: ({ADDRESS[15:4], ADDRESS[1:0]} == 14'b11111111001001) ? {4'b0011, CAS_MTR, DDR3, 2'b00}: // CD_POL, CD_INT}:
// FF22, FF26, FF2A, FF2E // FF22, FF26, FF2A, FF2E
({ADDRESS[15:5], ADDRESS[1:0]} == 13'b1111111100110) ? DATA_REG4: ({ADDRESS[15:4], ADDRESS[1:0]} == 14'b11111111001010) ? DATA_REG4:
// FF23, FF27, FF2B, FF2F // FF23, FF27, FF2B, FF2F
({ADDRESS[15:5], ADDRESS[1:0]} == 13'b1111111100111) ? {!CART1_FIRQ_BUF[1], 3'b011, SOUND_EN, DDR4, CART1_POL, CART1_FIRQ_INT}: ({ADDRESS[15:4], ADDRESS[1:0]} == 14'b11111111001011) ? {!CART1_FIRQ_BUF[1], 3'b011, SOUND_EN, DDR4, CART1_POL, CART1_FIRQ_INT}:
// HiRes Joystick // HiRes Joystick
// ({PDL,ADDRESS} == 17'h0FF60) ? PADDLE_LATCH_0[11:4]: // ({PDL,ADDRESS} == 17'h0FF60) ? PADDLE_LATCH_0[11:4]:
// ({PDL,ADDRESS} == 17'h0FF61) ? {PADDLE_LATCH_0[3:0],4'b0000}: // ({PDL,ADDRESS} == 17'h0FF61) ? {PADDLE_LATCH_0[3:0],4'b0000}:
@@ -941,7 +937,7 @@ assign DATA_IN =
(ADDRESS == 16'hFF74) ? {1'b0, GART_READ[22:16]}: (ADDRESS == 16'hFF74) ? {1'b0, GART_READ[22:16]}:
(ADDRESS == 16'hFF75) ? { GART_READ[15:8]}: (ADDRESS == 16'hFF75) ? { GART_READ[15:8]}:
(ADDRESS == 16'hFF76) ? { GART_READ[7:0]}: (ADDRESS == 16'hFF76) ? { GART_READ[7:0]}:
(ADDRESS == 16'hFF7F) ? {2'b11, MPI_CTS, W_PROT, MPI_SCS}: (ADDRESS == 16'hFF7F) ? {2'b11, MPI_CTS, 2'b00, MPI_SCS}:
// (ADDRESS == 16'hFF80) ? {CK_DONE_BUF[1], // (ADDRESS == 16'hFF80) ? {CK_DONE_BUF[1],
// CK_FAIL, // CK_FAIL,
// CK_STATE}: // CK_STATE}:
@@ -1158,6 +1154,7 @@ assign cache_hit = (sdram_cpu_addr[24:1] == sdram_cpu_addr_L[24:1]);
// This sig is only used for the cycle accurate 09 // This sig is only used for the cycle accurate 09
reg cpu_cycle_ena; reg cpu_cycle_ena;
always @(negedge clk_sys or negedge RESET_N) always @(negedge clk_sys or negedge RESET_N)
begin begin
if(!RESET_N) if(!RESET_N)
@@ -1363,11 +1360,18 @@ end
assign RESET_P = !BUTTON_N[3] // Button assign RESET_P = !BUTTON_N[3] // Button
| RESET; // CTRL-ALT-DEL or CTRL-ALT-INS | RESET; // CTRL-ALT-DEL or CTRL-ALT-INS
reg first_time = 1'b1;
// Make sure all resets are enabled for a long enough time to allow voltages to settle // Make sure all resets are enabled for a long enough time to allow voltages to settle
always @ (posedge clk_sys) always @ (posedge clk_sys)
begin begin
if (RESET) if (RESET)
MUGS <= RESET_INS; //This is holding a <ctrl><alt><ins> across a reset to activate the Easter Egg MUGS <= RESET_INS; //This is holding a <ctrl><alt><ins> across a reset to activate the Easter Egg
if (first_time)
begin
MUGS <= 1'b0;
first_time = 1'b0;
end
end end
always @ (posedge clk_sys or posedge RESET_P) always @ (posedge clk_sys or posedge RESET_P)
@@ -1573,20 +1577,20 @@ fdc coco_fdc(
.WD1793_RD_CTRL(wd1793_read), .WD1793_RD_CTRL(wd1793_read),
// SD block level interface // SD block level interface
.img_mounted(img_mounted[3:0]), // signaling that new image has been mounted .img_mounted(img_mounted[5:2]), // 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
.img_size(img_size), // size of image in bytes. .img_size(img_size), // size of image in bytes.
.sd_lba(sd_lba[0:3]), .sd_lba(sd_lba[2:5]),
.sd_blk_cnt(sd_blk_cnt[0:3]), // number of blocks-1, total size ((sd_blk_cnt+1)*(1<<(BLKSZ+7))) must be <= 16384! .sd_blk_cnt(sd_blk_cnt[2:5]), // number of blocks-1, total size ((sd_blk_cnt+1)*(1<<(BLKSZ+7))) must be <= 16384!
.sd_rd(sd_rd[3:0]), .sd_rd(sd_rd[5:2]),
.sd_wr(sd_wr[3:0]), .sd_wr(sd_wr[5:2]),
.sd_ack(sd_ack[3:0]), .sd_ack(sd_ack[5:2]),
// SD byte level access. Signals for 2-PORT altsyncram. // SD byte level access. Signals for 2-PORT altsyncram.
.sd_buff_addr(sd_buff_addr), .sd_buff_addr(sd_buff_addr),
.sd_buff_dout(sd_buff_dout), .sd_buff_dout(sd_buff_dout),
.sd_buff_din(sd_buff_din[0:3]), .sd_buff_din(sd_buff_din[2:5]),
.sd_buff_wr(sd_buff_wr) .sd_buff_wr(sd_buff_wr)
); );
@@ -1623,20 +1627,20 @@ sdc_top coco_sdc_top(
.ext_response(ext_response), .ext_response(ext_response),
// 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[1:0]), // 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
.img_size(img_size), // size of image in bytes. .img_size(img_size), // size of image in bytes.
.sd_lba(sd_lba[4:5]), .sd_lba(sd_lba[0:1]),
.sd_blk_cnt(sd_blk_cnt[4:5]), // number of blocks-1, total size ((sd_blk_cnt+1)*(1<<(BLKSZ+7))) must be <= 16384! .sd_blk_cnt(sd_blk_cnt[0:1]), // number of blocks-1, total size ((sd_blk_cnt+1)*(1<<(BLKSZ+7))) must be <= 16384!
.sd_rd(sd_rd[5:4]), .sd_rd(sd_rd[1:0]),
.sd_wr(sd_wr[5:4]), .sd_wr(sd_wr[1:0]),
.sd_ack(sd_ack[5:4]), .sd_ack(sd_ack[1:0]),
// SD byte level access. Signals for 2-PORT altsyncram. // SD byte level access. Signals for 2-PORT altsyncram.
.sd_buff_addr(sd_buff_addr), .sd_buff_addr(sd_buff_addr),
.sd_buff_dout(sd_buff_dout), .sd_buff_dout(sd_buff_dout),
.sd_buff_din(sd_buff_din[4:5]), .sd_buff_din(sd_buff_din[0:1]),
.sd_buff_wr(sd_buff_wr) .sd_buff_wr(sd_buff_wr)
); );
@@ -1766,22 +1770,6 @@ begin
RST_FF02_N <= 1'b0; RST_FF02_N <= 1'b0;
17'h1FF1E: 17'h1FF1E:
RST_FF02_N <= 1'b0; RST_FF02_N <= 1'b0;
/* 17'h1FF20:
RST_FF20_N <= 1'b0;
17'h1FF24:
RST_FF20_N <= 1'b0;
17'h1FF28:
RST_FF20_N <= 1'b0;
17'h1FF2C:
RST_FF20_N <= 1'b0;
17'h1FF30:
RST_FF20_N <= 1'b0;
17'h1FF34:
RST_FF20_N <= 1'b0;
17'h1FF38:
RST_FF20_N <= 1'b0;
17'h1FF3C:
RST_FF20_N <= 1'b0; */
17'h1FF22: 17'h1FF22:
RST_FF22_N <= 1'b0; RST_FF22_N <= 1'b0;
17'h1FF26: 17'h1FF26:
@@ -1790,14 +1778,6 @@ begin
RST_FF22_N <= 1'b0; RST_FF22_N <= 1'b0;
17'h1FF2E: 17'h1FF2E:
RST_FF22_N <= 1'b0; RST_FF22_N <= 1'b0;
17'h1FF32:
RST_FF22_N <= 1'b0;
17'h1FF36:
RST_FF22_N <= 1'b0;
17'h1FF3A:
RST_FF22_N <= 1'b0;
17'h1FF3E:
RST_FF22_N <= 1'b0;
17'h0FF22: 17'h0FF22:
RST_FF22_N <= 1'b0; RST_FF22_N <= 1'b0;
17'h0FF26: 17'h0FF26:
@@ -1806,14 +1786,6 @@ begin
RST_FF22_N <= 1'b0; RST_FF22_N <= 1'b0;
17'h0FF2E: 17'h0FF2E:
RST_FF22_N <= 1'b0; RST_FF22_N <= 1'b0;
17'h0FF32:
RST_FF22_N <= 1'b0;
17'h0FF36:
RST_FF22_N <= 1'b0;
17'h0FF3A:
RST_FF22_N <= 1'b0;
17'h0FF3E:
RST_FF22_N <= 1'b0;
17'h1FF92: 17'h1FF92:
RST_FF92_N <= 1'b0; RST_FF92_N <= 1'b0;
17'h1FF93: 17'h1FF93:
@@ -2518,14 +2490,7 @@ begin
ORCH_LEFT <= 8'b10000000; ORCH_LEFT <= 8'b10000000;
// FF7B // FF7B
ORCH_RIGHT <= 8'b10000000; ORCH_RIGHT <= 8'b10000000;
// FF7C
ORCH_LEFT_EXT <= 8'b10000000;
ORCH_LEFT_EXT_BUF <= 8'b10000000;
// FF7D
ORCH_RIGHT_EXT <= 8'b10000000;
ORCH_RIGHT_EXT_BUF <= 8'b10000000;
// FF7F // FF7F
W_PROT <= 2'b11;
// MPI_SCS <= SWITCH[2:1]; // MPI_SCS <= SWITCH[2:1];
// MPI_CTS <= SWITCH[2:1]; // MPI_CTS <= SWITCH[2:1];
// FF8E-FF8F // FF8E-FF8F
@@ -2762,30 +2727,20 @@ begin
16'hFF20, 16'hFF20,
16'hFF24, 16'hFF24,
16'hFF28, 16'hFF28,
16'hFF2C, 16'hFF2C:
16'hFF30,
16'hFF34,
16'hFF38,
16'hFF3C:
begin begin
if(!DDR3) if(!DDR3)
DD_REG3 <= DATA_OUT; DD_REG3 <= DATA_OUT;
else else
begin begin
DTOA_CODE <= DATA_OUT[7:2]; DTOA_CODE <= DATA_OUT[7:2];
// if({SOUND_EN,SEL} == 3'b100)
// SOUND_DTOA <= DATA_OUT[7:2];
end end
end end
16'hFF21, 16'hFF21,
16'hFF25, 16'hFF25,
16'hFF29, 16'hFF29,
16'hFF2D, 16'hFF2D:
16'hFF31,
16'hFF35,
16'hFF39,
16'hFF3D:
begin begin
// CD_INT <= DATA_OUT[0]; // CD_INT <= DATA_OUT[0];
// CD_POL <= DATA_OUT[1]; // CD_POL <= DATA_OUT[1];
@@ -2796,11 +2751,7 @@ begin
16'hFF22, 16'hFF22,
16'hFF26, 16'hFF26,
16'hFF2A, 16'hFF2A,
16'hFF2E, 16'hFF2E:
16'hFF32,
16'hFF36,
16'hFF3A,
16'hFF3E:
begin begin
if(!DDR4) if(!DDR4)
DD_REG4 <= DATA_OUT; DD_REG4 <= DATA_OUT;
@@ -2815,11 +2766,7 @@ begin
16'hFF23, 16'hFF23,
16'hFF27, 16'hFF27,
16'hFF2B, 16'hFF2B,
16'hFF2F, 16'hFF2F:
16'hFF33,
16'hFF37,
16'hFF3B,
16'hFF3F:
begin begin
CART1_FIRQ_INT <= DATA_OUT[0]; CART1_FIRQ_INT <= DATA_OUT[0];
CART1_POL <= DATA_OUT[1]; CART1_POL <= DATA_OUT[1];
@@ -2831,21 +2778,13 @@ begin
16'hFF7A: 16'hFF7A:
begin begin
ORCH_LEFT <= DATA_OUT; ORCH_LEFT <= DATA_OUT;
ORCH_LEFT_EXT <= ORCH_LEFT_EXT_BUF;
end end
16'hFF7B: 16'hFF7B:
begin begin
ORCH_RIGHT <= DATA_OUT; ORCH_RIGHT <= DATA_OUT;
ORCH_RIGHT_EXT <= ORCH_RIGHT_EXT_BUF;
end end
16'hFF7C:
ORCH_LEFT_EXT_BUF <= DATA_OUT;
16'hFF7D:
ORCH_RIGHT_EXT_BUF <= DATA_OUT;
16'hFF7F: 16'hFF7F:
begin begin
W_PROT[0] <= DATA_OUT[2] | !DATA_OUT[3];
W_PROT[1] <= !DATA_OUT[2] | DATA_OUT[3] | W_PROT[0];
MPI_SCS <= DATA_OUT[1:0]; MPI_SCS <= DATA_OUT[1:0];
MPI_CTS <= DATA_OUT[5:4]; MPI_CTS <= DATA_OUT[5:4];
end end
@@ -3373,10 +3312,10 @@ end
// The code for the internal and Orchestra sound // The code for the internal and Orchestra sound
// Internal Sound generation // Internal Sound generation
assign SOUND = {1'b0, SBS, SOUND_DTOA}; assign SOUND = {SBS, 7'b0000000} + {SOUND_DTOA, SOUND_DTOA[5:4]};
assign SOUND_LEFT = {ORCH_LEFT, ORCH_LEFT_EXT} + {SOUND, 8'h00}; assign SOUND_LEFT = {ORCH_LEFT, ORCH_LEFT} + {SOUND, SOUND};
assign SOUND_RIGHT = {ORCH_RIGHT, ORCH_RIGHT_EXT} + {SOUND, 8'h00}; assign SOUND_RIGHT = {ORCH_RIGHT, ORCH_RIGHT} + {SOUND, SOUND};
// the DAC isn't really a DAC but represents the DAC chip on the schematic. // the DAC isn't really a DAC but represents the DAC chip on the schematic.
@@ -3545,13 +3484,48 @@ COCOKEY coco_keyboard(
.SLO_CLK(V_SYNC_N), .SLO_CLK(V_SYNC_N),
.PS2_CLK(ps2_clk), .PS2_CLK(ps2_clk),
.PS2_DATA(ps2_data), .PS2_DATA(ps2_data),
.KEY(KEY), .KEY(KEY_RCVD),
.SHIFT(SHIFT), .SHIFT(SHIFT),
.SHIFT_OVERRIDE(SHIFT_OVERRIDE), .SHIFT_OVERRIDE(SHIFT_OVERRIDE),
.RESET(RESET), .RESET(RESET),
.RESET_INS(RESET_INS) .RESET_INS(RESET_INS)
); );
wire [72:0] KEY_RCVD;
Auto_Run CoCo3_Auto_Run(
.RESET_N(RESET_N),
.CLK(clk_sys),
.CLK_1_78(clk_1_78),
.MPI_SCS(SWITCH[2:1]),
.MODE(AUTO_MODE),
.AMW_ACK(AMW_ACK),
.KEY_IN(KEY_RCVD),
.KEY_OUT(KEY)
);
// Generate 1.78 Mhz [enable] GP clk
reg clk_1_78;
reg [4:0] clk_178_ctr;
always @ (negedge clk_sys or negedge RESET_N)
begin
if(!RESET_N)
begin
clk_1_78 <= 1'b0;
clk_178_ctr <= 5'b00000;
end
else
begin
clk_1_78 <= 1'b0;
clk_178_ctr <= clk_178_ctr + 1'b1;
if (clk_178_ctr == 5'd27)
begin
clk_1_78 <= 1'b1;
end
end
end
// PS2 Mouse [MiSTer] // PS2 Mouse [MiSTer]
// Borrowed from MAC PLUS // Borrowed from MAC PLUS
+1 -1
View File
@@ -92,7 +92,7 @@ reg SHIFT;
output SHIFT_OVERRIDE; output SHIFT_OVERRIDE;
reg SHIFT_OVERRIDE; reg SHIFT_OVERRIDE;
output RESET; output RESET;
reg RESET; reg RESET = 1'b0;
output RESET_INS; output RESET_INS;
reg RESET_INS = 1'b0; reg RESET_INS = 1'b0;