diff --git a/TSConf.sv b/TSConf.sv index 3516703..0072020 100644 --- a/TSConf.sv +++ b/TSConf.sv @@ -62,8 +62,7 @@ localparam VGA_BITS = 6; localparam bit BIG_OSD = 1; -assign LED = ~ioctl_download & ~ioctl_upload & UART_TX & UART_RX; -assign UART_TX = 1'b1; +assign LED = ~ioctl_download & ~ioctl_upload & UART_RX; `include "build_id.v" @@ -296,6 +295,7 @@ wire [7:0] R,G,B; wire VS, HS; wire [15:0] SOUND_L; wire [15:0] SOUND_R; +wire tape_out, midi_out; tsconf tsconf ( @@ -332,6 +332,8 @@ tsconf tsconf .WARM_RESET(buttons[1]), .RTC(rtc), .TAPE_IN(UART_RX), + .TAPE_OUT(tape_out), + .MIDI_OUT(midi_out), .CFG_OUT0(st_out0), .CFG_60HZ(st_60hz), @@ -356,14 +358,32 @@ tsconf tsconf ); +////////////////// UART_TX ////////////////// +reg uart_tx = 1'b1; +reg tape_out_old = 1'b0; +reg midi_out_old = 1'b0; + +always @(posedge clk_sys) begin + if (tape_out_old != tape_out) begin + tape_out_old <= tape_out; + uart_tx <= tape_out; + end + if (midi_out_old != midi_out) begin + midi_out_old <= midi_out; + uart_tx <= midi_out; + end +end + +assign UART_TX = uart_tx; + + +////////////////// VIDEO /////////////////// reg VSync, HSync; always @(posedge clk_sys) begin HSync <= HS; if(~HSync & HS) VSync <= VS; end - -////////////////// VIDEO /////////////////// mist_video #(.COLOR_DEPTH(8), .SD_HCNT_WIDTH(11), .OUT_COLOR_DEPTH(VGA_BITS), .BIG_OSD(BIG_OSD)) mist_video ( .clk_sys ( clk_sys ), diff --git a/rtl/tsconf.v b/rtl/tsconf.v index 42e4ade..031f724 100644 --- a/rtl/tsconf.v +++ b/rtl/tsconf.v @@ -45,6 +45,8 @@ module tsconf input WARM_RESET, input [64:0] RTC, input TAPE_IN, + output TAPE_OUT, + output MIDI_OUT, // Configuration bits input CFG_OUT0, @@ -1014,6 +1016,8 @@ module tsconf wire [11:0] ts_l, ts_r; wire [7:0] ts_do; + wire [7:0] ioa_out; + assign MIDI_OUT = ioa_out[2]; turbosound turbosound ( @@ -1025,7 +1029,8 @@ module tsconf .DI(d), .DO(ts_do), .CHANNEL_L(ts_l), - .CHANNEL_R(ts_r) + .CHANNEL_R(ts_r), + .IOA_out(ioa_out) ); @@ -1102,7 +1107,7 @@ module tsconf // Beeper and Tape out reg [7:0] port_xxfe_reg; always @(posedge fclk) if (beeper_wr) port_xxfe_reg <= d; - + assign TAPE_OUT = port_xxfe_reg[3]; // Audio output wire [11:0] audio_l = ts_l + {gs_l[14], gs_l[14:4]} + {2'b00, covox_a, 2'b00} + {2'b00, covox_b, 2'b00} + {1'b0, saa_out_l, 3'b000} + {3'b000, port_xxfe_reg[4], 8'b00000000};