2023 - 5.1 init...

CTF = Compile Time Feature...

1.	Interrupt system restored to previous code - improved compadibility.
2.	Changed to cycle accurate 6809 (Greg Miller) at speeds up to 9.56Mhz. [CTF]
3.	Recoded sdc and fdc to only have one instance of the wd1773.
4.	Re-added software disable in sdc [Ext 'g'].
5.	Recoded Cartridge bank switching to only exist when MiSTer slot 3 is selected. [removed soft multipak select]
6.	Moved CoCo Hardware RS-232 from always existing to only existing in multipak slot 1.
7.	Changed ADRS (SDS sig) decoding to = FF40-FF5f per hardware.
8.	Fixed coding problem in os9 driver llcocosdc to work with MPI properly. [CTF]
9.	Set default disk size to constant $555555 to fix os9 redirect problem. [CTF]
10	Disabled GART [GIMEX hardware DMA] to prevent OS9 from detecting GIMEX. [CTF]
11	Corrected missing begin statement in master timing loop.
12.	Fixed Donkey King DAPD issue in Tom Mix program [DPAD now moved joysticks to limits under dpad
13. Fixed incorrect addressing of FE00-FEFF for CARTs which gets PITFALL and RAMPAGE working
To Do
0.	Update framework
This commit is contained in:
shodge12 committed 2023-10-23 19:35:57 -04:00
1 parent 32aa486cdb
commit 7e58577658
17 files changed
+5456 -981

No files matched your search

+123 -235
View File
@@ -44,6 +44,8 @@
// make sure that this is not a derivative work and that
// you have the latest version of this file.
//
// Ver 2.0 Reduced 1793 instances
//
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
@@ -88,7 +90,6 @@ module fdc(
input [7:0] sd_buff_dout,
output [7:0] sd_buff_din[4],
input sd_buff_wr
);
wire [7:0] DRIVE_SEL_EXT;
@@ -128,19 +129,12 @@ assign DATA_HDD = (FF40_RD) ? FF40_READ_VALUE:
(WD1793_RD) ? DATA_1793: //(1793[s])
8'h00;
// $ff40 control register [part 1]
wire [3:0] DRIVE_SEL_EXT_PRE = {DATA_IN[6], DATA_IN[2:0]};
reg [2:0] drive_index;
// SD blk system is a array of 4 systems - one for each drive.
// To keep disk track memory, we created 4 wd1793's to match the sd block interfaces
// For the interface back to the coco - we need to isolate the wd1793 the computer is talking
// to and route those feedback signals back to the coco. This is accomplished via the drive
// select. 'drive_index' identifies which controller is addressd.
always @(negedge FF40_CLK or negedge RESET_N)
@@ -151,39 +145,40 @@ begin
MOTOR <= 1'b0;
WRT_PREC <= 1'b0;
DENSITY <= 1'b0;
drive_index <= 3'd0;
drive_index <= 3'd0; // no drive (illegal)
end
else
begin
if (FF40_ENA)
begin
DRIVE_SEL_EXT <= {4'b0000,
DATA_IN[6], // Drive Select [3] / Side Select
DATA_IN[2:0]}; // Drive Select [2:0]
MOTOR <= DATA_IN[3]; // Turn on motor, not used here just checked, 0=MotorOff 1=MotorOn
WRT_PREC <= DATA_IN[4]; // Write Precompensation, not used here
DENSITY <= DATA_IN[5]; // Density, not used here just checked
DRIVE_SEL_EXT_PRE};
MOTOR <= DATA_IN[3]; // Turn on motor, not used here just checked, 0=MotorOff 1=MotorOn
WRT_PREC <= DATA_IN[4]; // Write Precompensation, not used here
DENSITY <= DATA_IN[5]; // Density, not used here just checked
case(DRIVE_SEL_EXT_PRE)
4'b1000:
drive_index <= 3'd3;
drive_index <= 3'd4;
4'b0100:
drive_index <= 3'd2;
drive_index <= 3'd3;
4'b0010:
drive_index <= 3'd1;
4'b0001:
drive_index <= 3'd0;
4'b1100:
drive_index <= 3'd2;
4'b1010:
4'b0001:
drive_index <= 3'd1;
4'b1100:
drive_index <= 3'd3;
4'b1010:
drive_index <= 3'd2;
4'b1001:
drive_index <= 3'd0;
drive_index <= 3'd1;
default:
drive_index <= 3'd0; // Illegal
endcase
end
end
@@ -213,13 +208,12 @@ wire DRQ[4];
wire selected_DRQ;
wire selected_INTRQ;
wire WR[4];
wire RD[4];
wire RD_E[4];
wire WR;
wire RD;
wire RD_E;
//wire CE;
wire HALT_EN_RST;
wire [7:0] DATA_1793;
wire [7:0] dout[4];
reg read;
reg write;
reg read_d;
@@ -231,10 +225,7 @@ reg read1;
reg write1;
reg [1:0] ADDRESS_L;
assign RD[0] = (read || RD_E[0]) && (drive_index == 3'd0);
assign RD[1] = (read || RD_E[1]) && (drive_index == 3'd1);
assign RD[2] = (read || RD_E[2]) && (drive_index == 3'd2);
assign RD[3] = (read || RD_E[3]) && (drive_index == 3'd3);
assign RD = read || RD_E;
// The idea here is to "stretch" the CPU read and write signals to ensure we catch a 8 mhz enable.
// For writes we will buffer the data out to ensure it does not go away.
@@ -253,14 +244,8 @@ begin
write_d <= 1'b0;
r_w_active <= 1'b0;
clk_8Mhz_enable_found <= 1'b0;
WR[0] <= 1'b0;
WR[1] <= 1'b0;
WR[2] <= 1'b0;
WR[3] <= 1'b0;
RD_E[0] <= 1'b0;
RD_E[1] <= 1'b0;
RD_E[2] <= 1'b0;
RD_E[3] <= 1'b0;
WR <= 1'b0;
RD_E <= 1'b0;
read1 <= 1'b0;
write1 <= 1'b0;
read <= 1'b0;
@@ -280,7 +265,8 @@ begin
read_d <= read;
write_d <= write;
if ((read1 & ~read) | (write1 & ~write))
// if ((read1 & ~read) | (write1 & ~write))
if ((read1 & ~read) | WD1793_WR_CTRL)
begin
// Latch Address & Data
ADDRESS_L <= ADDRESS[1:0];
@@ -292,32 +278,14 @@ begin
begin
// Set Writes
r_w_active <= 1'b1;
case (drive_index)
3'd0:
WR[0] <= 1'b1;
3'd1:
WR[1] <= 1'b1;
3'd2:
WR[2] <= 1'b1;
3'd3:
WR[3] <= 1'b1;
endcase
WR <= 1'b1;
end
// Synchronus rising edge of read
if ((read == 1'b1) && (read_d == 1'b0))
begin
r_w_active <= 1'b1;
case (drive_index)
3'd0:
RD_E[0] <= 1'b1;
3'd1:
RD_E[1] <= 1'b1;
3'd2:
RD_E[2] <= 1'b1;
3'd3:
RD_E[3] <= 1'b1;
endcase
RD_E <= 1'b1;
end
// Clears
@@ -330,48 +298,55 @@ begin
clk_8Mhz_enable_found <= 1'b0;
r_w_active <= 1'b0;
WR[0] <= 1'b0;
WR[1] <= 1'b0;
WR[2] <= 1'b0;
WR[3] <= 1'b0;
WR <= 1'b0;
RD_E[0] <= 1'b0;
RD_E[1] <= 1'b0;
RD_E[2] <= 1'b0;
RD_E[3] <= 1'b0;
RD_E <= 1'b0;
end
end
end
// NMI from disk controller
// Selected INTRQ
assign selected_INTRQ = (drive_index == 3'd0) ? INTRQ[0]:
(drive_index == 3'd1) ? INTRQ[1]:
(drive_index == 3'd2) ? INTRQ[2]:
(drive_index == 3'd3) ? INTRQ[3]:
1'b0;
assign NMI_09 = DENSITY & selected_INTRQ; // Send NMI if Double Density (Halt Mode)
// HALT from disk controller
// Selected DRQ
assign selected_DRQ = (drive_index == 3'd0) ? DRQ[0]:
(drive_index == 3'd1) ? DRQ[1]:
(drive_index == 3'd2) ? DRQ[2]:
(drive_index == 3'd3) ? DRQ[3]:
1'b1;
assign HALT = (HALT_EN & ~selected_DRQ);
assign HALT_EN_RST = RESET_N & ~selected_INTRQ; // From controller schematic
// Data bus selection
assign DATA_1793 = (drive_index == 3'd0) ? dout[0]:
(drive_index == 3'd1) ? dout[1]:
(drive_index == 3'd2) ? dout[2]:
(drive_index == 3'd3) ? dout[3]:
8'd0;
assign sd_lba[0] = wd1793_sd_lba;
assign sd_lba[1] = wd1793_sd_lba;
assign sd_lba[2] = wd1793_sd_lba;
assign sd_lba[3] = wd1793_sd_lba;
assign sd_rd[0] = (drive_index == 3'd1) ? wd1793_sd_rd:
1'b0;
assign sd_rd[1] = (drive_index == 3'd2) ? wd1793_sd_rd:
1'b0;
assign sd_rd[2] = (drive_index == 3'd3) ? wd1793_sd_rd:
1'b0;
assign sd_rd[3] = (drive_index == 3'd4) ? wd1793_sd_rd:
1'b0;
assign sd_wr[0] = (drive_index == 3'd1) ? wd1793_sd_wr:
1'b0;
assign sd_wr[1] = (drive_index == 3'd2) ? wd1793_sd_wr:
1'b0;
assign sd_wr[2] = (drive_index == 3'd3) ? wd1793_sd_wr:
1'b0;
assign sd_wr[3] = (drive_index == 3'd4) ? wd1793_sd_wr:
1'b0;
assign wd1793_sd_ack = (drive_index == 3'd1) ? sd_ack[0]:
(drive_index == 3'd2) ? sd_ack[1]:
(drive_index == 3'd3) ? sd_ack[2]:
(drive_index == 3'd4) ? sd_ack[3]:
sd_ack[0]; // default is drive 1
assign sd_buff_din[0] = wd1793_sd_buff_din;
assign sd_buff_din[1] = wd1793_sd_buff_din;
assign sd_buff_din[2] = wd1793_sd_buff_din;
assign sd_buff_din[3] = wd1793_sd_buff_din;
// The SD_BLK interface and thus the wd1793 will allways transfer 1 blk. This is blk qty - 1 per spec.
assign sd_blk_cnt[3] = 6'd0;
@@ -379,9 +354,18 @@ assign sd_blk_cnt[2] = 6'd0;
assign sd_blk_cnt[1] = 6'd0;
assign sd_blk_cnt[0] = 6'd0;
reg drive_wp[4];
reg [3:0] drive_ready = 4'B0;
reg [3:0] double_sided = 4'B0;
reg drive_wp[4];
reg [3:0] drive_ready = 4'B0000;
reg [3:0] double_sided = 4'B0000;
reg [23:0] drive_size[4];
wire [23:0] selected_drive_size;
wire [31:0] wd1793_sd_lba;
wire wd1793_sd_rd;
wire wd1793_sd_wr;
wire wd1793_sd_ack;
wire [7:0] wd1793_sd_buff_din;
wire selected_drive_ready, selected_drive_wp, selected_double_sided;
// As drives are mounted in MISTer this logic saves the write protect and generates ready for
// changing drives to the wd1793.
@@ -395,6 +379,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:0]}; //Size / 256 on [19:8]
double_sided[0]<= (img_size > 64'd368600) & (img_size < 64'd740000);//20'd368640;
end
@@ -404,6 +389,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:0]}; //Size / 256 on [19:8]
double_sided[1]<= (img_size > 64'd368600) & (img_size < 64'd740000);//20'd368640;
end
@@ -413,6 +399,7 @@ always @(negedge img_mounted[2])
begin
drive_wp[2] <= img_readonly;
drive_ready[2] <= 1'b1;
drive_size[2] <= {4'h0, img_size[19:0]}; //Size / 256 on [19:8]
double_sided[2]<= (img_size > 64'd368600) & (img_size < 64'd740000);//20'd368640;
end
@@ -422,168 +409,69 @@ always @(negedge img_mounted[3])
begin
drive_wp[3] <= img_readonly;
drive_ready[3] <= 1'b1;
drive_size[3] <= {4'h0, img_size[19:0]}; //Size / 256 on [19:8]
//double_sided[3]<= img_size > 20'd368600;//20'd368640;
end
assign selected_drive_size = (drive_index == 3'd1) ? drive_size[0]:
(drive_index == 3'd2) ? drive_size[1]:
(drive_index == 3'd3) ? drive_size[2]:
(drive_index == 3'd4) ? drive_size[3]:
drive_size[0]; // default is drive 1
wd1793 #(1,1) coco_wd1793_0
assign selected_drive_wp = (drive_index == 3'd1) ? drive_wp[0]:
(drive_index == 3'd2) ? drive_wp[1]:
(drive_index == 3'd3) ? drive_wp[2]:
(drive_index == 3'd4) ? drive_wp[3]:
drive_wp[0]; // default is drive 1
assign selected_double_sided= (drive_index == 3'd1) ? double_sided[0]:
(drive_index == 3'd2) ? double_sided[1]:
(drive_index == 3'd3) ? double_sided[2]:
double_sided[0]; // default is drive 1
assign selected_drive_ready = (drive_index == 3'd1) ? drive_ready[0]:
(drive_index == 3'd2) ? drive_ready[1]:
(drive_index == 3'd3) ? drive_ready[2]:
(drive_index == 3'd4) ? drive_ready[3]:
1'b0; // default is not ready
wd1793 #(1,0) coco_wd1793_0
(
.clk_sys(~CLK),
.ce(ena_8Mhz),
.reset(~RESET_N),
.io_en(1'b1),
.rd(RD[0]),
.wr(WR[0]),
.rd(RD),
.wr(WR),
.addr(ADDRESS_L[1:0]),
.din(DATA_IN_L),
.dout(dout[0]),
.drq(DRQ[0]),
.intrq(INTRQ[0]),
.dout(DATA_1793),
.drq(selected_DRQ),
.intrq(selected_INTRQ),
.img_mounted(img_mounted[0]),
.img_size(img_size),
.img_mounted(1'b0),
.img_mounted_overide(1'b1),
.img_size(selected_drive_size[19:0]),
.sd_lba(sd_lba[0]),
.sd_rd(sd_rd[0]),
.sd_wr(sd_wr[0]),
.sd_ack(sd_ack[0]),
.sd_lba(wd1793_sd_lba),
.sd_rd(wd1793_sd_rd),
.sd_wr(wd1793_sd_wr),
.sd_ack(wd1793_sd_ack),
.sd_buff_addr(sd_buff_addr),
.sd_buff_dout(sd_buff_dout),
.sd_buff_din(sd_buff_din[0]),
.sd_buff_din(wd1793_sd_buff_din),
.sd_buff_wr(sd_buff_wr),
.wp(drive_wp[0]),
.wp(selected_drive_wp),
.size_code(3'd5), // 5 is 18 sector x 256 bits COCO standard
.layout(~double_sided[0]), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
.side(double_sided[0] & DRIVE_SEL_EXT[3]),
.ready(drive_ready[0]),
.size_code(3'd5), // 5 is 18 sector x 256 bits COCO standard
.layout(~selected_double_sided), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
.side(selected_double_sided & DRIVE_SEL_EXT[3]),
.ready(selected_drive_ready),
.input_active(0),
.input_addr(0),
.input_data(0),
.input_wr(0),
.buff_din(0)
);
wd1793 #(1,0) coco_wd1793_1
(
.clk_sys(~CLK),
.ce(ena_8Mhz),
.reset(~RESET_N),
.io_en(1'b1),
.rd(RD[1]),
.wr(WR[1]),
.addr(ADDRESS_L[1:0]),
.din(DATA_IN_L),
.dout(dout[1]),
.drq(DRQ[1]),
.intrq(INTRQ[1]),
.img_mounted(img_mounted[1]),
.img_size(img_size),
.sd_lba(sd_lba[1]),
.sd_rd(sd_rd[1]),
.sd_wr(sd_wr[1]),
.sd_ack(sd_ack[1]),
.sd_buff_addr(sd_buff_addr),
.sd_buff_dout(sd_buff_dout),
.sd_buff_din(sd_buff_din[1]),
.sd_buff_wr(sd_buff_wr),
.wp(drive_wp[1]),
.size_code(3'd5), // 5 is 18 sector x 256 bits COCO standard
.layout(~double_sided[1]), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
.side(double_sided[1] & DRIVE_SEL_EXT[3]),
.ready(drive_ready[1]),
.input_active(0),
.input_addr(0),
.input_data(0),
.input_wr(0),
.buff_din(0)
);
wd1793 #(1,0) coco_wd1793_2
(
.clk_sys(~CLK),
.ce(ena_8Mhz),
.reset(~RESET_N),
.io_en(1'b1),
.rd(RD[2]),
.wr(WR[2]),
.addr(ADDRESS_L[1:0]),
.din(DATA_IN_L),
.dout(dout[2]),
.drq(DRQ[2]),
.intrq(INTRQ[2]),
.img_mounted(img_mounted[2]),
.img_size(img_size),
.sd_lba(sd_lba[2]),
.sd_rd(sd_rd[2]),
.sd_wr(sd_wr[2]),
.sd_ack(sd_ack[2]),
.sd_buff_addr(sd_buff_addr),
.sd_buff_dout(sd_buff_dout),
.sd_buff_din(sd_buff_din[2]),
.sd_buff_wr(sd_buff_wr),
.wp(drive_wp[2]),
.size_code(3'd5), // 5 is 18 sector x 256 bits COCO standard
.layout(~double_sided[2]), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
.side(double_sided[2] & DRIVE_SEL_EXT[3]),
.ready(drive_ready[2]),
.input_active(0),
.input_addr(0),
.input_data(0),
.input_wr(0),
.buff_din(0)
);
wd1793 #(1,0) coco_wd1793_3
(
.clk_sys(~CLK),
.ce(ena_8Mhz),
.reset(~RESET_N),
.io_en(1'b1),
.rd(RD[3]),
.wr(WR[3]),
.addr(ADDRESS_L[1:0]),
.din(DATA_IN_L),
.dout(dout[3]),
.drq(DRQ[3]),
.intrq(INTRQ[3]),
.img_mounted(img_mounted[3]),
.img_size(img_size),
.sd_lba(sd_lba[3]),
.sd_rd(sd_rd[3]),
.sd_wr(sd_wr[3]),
.sd_ack(sd_ack[3]),
.sd_buff_addr(sd_buff_addr),
.sd_buff_dout(sd_buff_dout),
.sd_buff_din(sd_buff_din[3]),
.sd_buff_wr(sd_buff_wr),
.wp(drive_wp[3]),
.size_code(3'd5), // 5 is 18 sector x 256 bits COCO standard
.layout(1'b1), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
.side(1'b0), // DS can not be supported for drive 3.
.ready(drive_ready[3]),
.input_active(0),
.input_active(0), // Section not used
.input_addr(0),
.input_data(0),
.input_wr(0),