From 76b4d4d838007f27d677552229a5278a90134e92 Mon Sep 17 00:00:00 2001 From: Eugene Lozovoy Date: Sun, 7 Jan 2024 17:47:20 +0300 Subject: [PATCH] add option to disable sd indication on border --- fpga/rtl/magic.sv | 5 ++++- fpga/rtl/top.sv | 13 ++++++++----- rom_src/config.asm | 1 + rom_src/menu_structure.asm | 33 +++++++++++++++++++++++++++++++++ rom_src/strings.asm | 5 +++++ 5 files changed, 51 insertions(+), 6 deletions(-) diff --git a/fpga/rtl/magic.sv b/fpga/rtl/magic.sv index 2a1b716..e7b70f6 100755 --- a/fpga/rtl/magic.sv +++ b/fpga/rtl/magic.sv @@ -29,7 +29,8 @@ module magic( output reg ulaplus_en, output reg ay_en, output reg covox_en, - output reg soundrive_en + output reg soundrive_en, + output reg sd_indication_en ); localparam magic_on_start = 1'b1; @@ -92,6 +93,7 @@ always @(posedge clk28 or negedge rst_n) begin ay_en <= 1'b1; covox_en <= 1'b1; soundrive_en <= 1'b1; + sd_indication_en <= 1'b1; end else if (config_cs && bus.wr) case (bus.a[15:8]) 8'h01: {magic_reboot, magic_beeper} <= bus.d[1:0]; @@ -103,6 +105,7 @@ always @(posedge clk28 or negedge rst_n) begin 8'h09: {zc_en, divmmc_en} <= bus.d[1:0]; 8'h0A: ulaplus_en <= bus.d[0]; 8'h0B: {soundrive_en, covox_en} <= bus.d[1:0]; + 8'h0C: sd_indication_en <= bus.d[0]; endcase end diff --git a/fpga/rtl/top.sv b/fpga/rtl/top.sv index a4f67da..af9673a 100755 --- a/fpga/rtl/top.sv +++ b/fpga/rtl/top.sv @@ -62,6 +62,7 @@ wire clkcpu_stall; wire [2:0] ram_page128; wire init_done; wire video_read_req, video_read_req_next; +wire sd_indication; /* CPU BUS */ @@ -116,7 +117,7 @@ video video0( .machine(machine), .turbo(turbo), - .border({border[2] ^ ~sd_cs, border[1] ^ magic_beeper, border[0]}), + .border({border[2] ^ sd_indication, border[1] ^ magic_beeper, border[0]}), .r(r), .g(g), @@ -227,7 +228,8 @@ wire magic_dout_active; wire magic_mode, magic_map; wire joy_sinclair, up_en, ay_en, covox_en, soundrive_en; panning_t panning; -wire divmmc_en, zc_en; +wire divmmc_en, zc_en, sd_indication_en; +assign sd_indication = sd_indication_en & ~sd_cs; magic magic0( .rst_n(n_rstcpu), @@ -259,7 +261,8 @@ magic magic0( .ulaplus_en(up_en), .ay_en(ay_en), .covox_en(covox_en), - .soundrive_en(soundrive_en) + .soundrive_en(soundrive_en), + .sd_indication_en(sd_indication_en) ); @@ -352,7 +355,7 @@ mixer mixer0( .beeper(beeper ^ magic_beeper), .tape_out(tape_out), - .tape_in(sd_miso_tape_in), + .tape_in((divmmc_en || zc_en)? sd_indication : sd_miso_tape_in), .ay_a0(ay_a0), .ay_b0(ay_b0), .ay_c0(ay_c0), @@ -406,7 +409,7 @@ divmmc divmmc0( .ram(div_ram), .ramwr_mask(div_ramwr_mask) ); -assign sd_mosi_tape_out = (!divmmc_en && !zc_en)? tape_out : sd_mosi0; +assign sd_mosi_tape_out = (divmmc_en || zc_en)? sd_mosi0 : tape_out; /* ULAPLUS */ diff --git a/rom_src/config.asm b/rom_src/config.asm index 25dcfb0..1f1f9c4 100644 --- a/rom_src/config.asm +++ b/rom_src/config.asm @@ -31,6 +31,7 @@ ay DB 1 sd DB 2 ulaplus DB 1 dac DB 3 +sdind DB 1 ENDS CFG_DEFAULT CFG_T diff --git a/rom_src/menu_structure.asm b/rom_src/menu_structure.asm index 79c491d..3f00c3b 100644 --- a/rom_src/menu_structure.asm +++ b/rom_src/menu_structure.asm @@ -37,10 +37,17 @@ menudefault: MENU_DEF 20 MENUENTRY_T str_sd menu_sd_value_cb menu_sd_cb MENUENTRY_T str_ulaplus menu_ulaplus_value_cb menu_ulaplus_cb MENUENTRY_T str_dac menu_dac_value_cb menu_dac_cb + MENUENTRY_T str_menuadv 0 menu_menuadv_cb MENUENTRY_T str_exit menu_exit_value_cb menu_exit_cb MENUENTRY_T 0 .end: +menuadv: MENU_DEF 22 + MENUENTRY_T str_sd_indication menu_sdind_value_cb menu_sdind_cb + MENUENTRY_T str_back 0 menu_back_cb + MENUENTRY_T 0 +.end: + menu_machine_value_cb: @@ -116,6 +123,13 @@ menu_exit_value_cb: DW str_exit_no_reboot.end-2 DW str_exit_reboot.end-2 +menu_sdind_value_cb: + ld ix, .values_table + ld a, (cfg.sdind) + jp menu_value_get +.values_table: + DW str_off_short.end-2 + DW str_on_short.end-2 menu_value_get: sla a ld c, a @@ -203,6 +217,25 @@ menu_exit_cb: ld (var_exit_flag), a ret +menu_menuadv_cb: + ld hl, menuadv + call menu_init + ret + +menu_sdind_cb: + ld a, (cfg.sdind) + ld c, 1 + call menu_handle_press + ld (cfg.sdind), a + ld bc, #0cff + out (c), a + ret + +menu_back_cb: + call restore_screen + ld hl, (var_menumain) + jp menu_init + ; IN - A - variable to change ; IN - C - max value diff --git a/rom_src/strings.asm b/rom_src/strings.asm index 57fd3e1..9dc0bd7 100644 --- a/rom_src/strings.asm +++ b/rom_src/strings.asm @@ -11,6 +11,8 @@ str_exit_reboot: DEFSTR "& reboot " str_exit_no_reboot: DEFSTR " " str_on: DEFSTR " ON" str_off: DEFSTR " OFF" +str_on_short: DEFSTR " ON" +str_off_short: DEFSTR "OFF" str_machine: DEFSTR "Machine" str_machine_48: DEFSTR " 48" str_machine_128: DEFSTR " 128" @@ -37,3 +39,6 @@ str_dac: DEFSTR "DAC" str_dac_covox: DEFSTR " Covox" str_dac_sd: DEFSTR " SD" str_dac_covoxsd: DEFSTR "Covox+SD" +str_menuadv: DEFSTR "Advanced..." +str_sd_indication: DEFSTR "SD indication" +str_back: DEFSTR "Go back..."