1
0
mirror of https://github.com/UzixLS/zx-sizif-xxs.git synced 2025-07-18 23:01:40 +03:00

magic rom: refactor

This commit is contained in:
UzixLS
2022-01-31 21:32:14 +03:00
parent a371e5ec4c
commit d6a31c0502
10 changed files with 208 additions and 427 deletions

View File

@ -87,8 +87,7 @@ always @(posedge clk28 or negedge rst_n) begin
soundrive_en <= 1'b1;
end
else if (config_cs && bus.wr) case (bus.a_reg[15:8])
8'h00: magic_reboot <= bus.d_reg[0];
8'h01: magic_beeper <= bus.d_reg[0];
8'h01: {magic_reboot, magic_beeper} <= bus.d_reg[1:0];
8'h02: machine <= machine_t'(bus.d_reg[2:0]);
8'h03: turbo <= turbo_t'(bus.d_reg[2:0]);
8'h04: panning <= panning_t'(bus.d_reg[1:0]);
@ -106,7 +105,7 @@ always @(posedge clk28 or negedge rst_n) begin
if (!rst_n)
config_rd <= 0;
else
config_rd <= config_cs && bus.rd && bus.a_reg[15:8] == 8'hFF;
config_rd <= config_cs && bus.rd && bus.a_reg[15:8] == 8'h00;
end

View File

@ -7,8 +7,6 @@ INPUT_REPEAT EQU 2
INPUT_REPEAT_FIRST EQU 11
INPUT_BEEP_DELAY EQU 255
MENU_WIDTH EQU 20
MENU_X EQU (32-MENU_WIDTH)/2
MENU_HEADER_ATTR EQU #47
MENU_BODY_ATTR EQU #78
MENU_SELECT_ATTR EQU #68
@ -26,8 +24,8 @@ _reserv1 DB 0
machine DB 3
clock DB 0
panning DB 1
custom_rom DB 0
rom48 DB 0
_reserv2 DB 0
_reserv3 DB 0
joystick DB 0
ay DB 1
divmmc DB 2
@ -35,11 +33,4 @@ ulaplus DB 1
dac DB 3
ENDS
STRUCT CFGEXT_T
tsfm DB 1
saa DB 1
gs DB 1
ENDS
CFG_DEFAULT CFG_T
CFGEXT_DEFAULT CFGEXT_T

View File

@ -184,6 +184,9 @@ input_process:
ret
;var_input_key: DB 0
;var_input_key_last: DB 0
;var_input_key_hold_timer: DB 0
input_init:
xor a
ld (var_input_key), a
ld (var_input_key_last), a
ld (var_input_key_hold_timer), a
ret

View File

@ -1,7 +1,6 @@
DEVICE ZXSPECTRUM48
OPT --syntax=F
app_begin:
; Startup handler
ORG #0000
ex de, hl ; EB opcode used by CPLD to determine magic ROM presence
@ -28,12 +27,13 @@ app_begin:
ret
; INT IM2 vector table
ORG #0600
ORG #0200
.257 db #01 ; by Z80 user manual int vector is I * 256 + (D & 0xFE)
; but by other references and by T80/A-Z80 implementation int vector is I * 256 + D
; so we just play safe and use symmetric int handler address and vector table with one extra byte
ORG #0570 ; this address chosen to do not overlap with divmmc entrypoints
startup_handler:
ld sp, Stack_top
ld ix, #5800 ; draw 4 rygb boxes on left top corner to indicate boot
@ -49,13 +49,11 @@ startup_handler:
djnz .loop ; ...
call init_default_config
call detect_sd_card
call detect_ext_board
call check_custom_rom
.warm_boot:
call load_config
call init_cpld
call save_initialized
call mute_saa1099 ; saa1099 does not have reset pin
ld ix, #5800 ; draw 4 rygb boxes on left top corner to indicate boot
ld (ix+2), #E4 ; g
ld (ix+3), #C9 ; b
ld hl, 0
@ -68,31 +66,86 @@ nmi_handler:
push af
push hl
push bc
ld a, #01 ; show magic border
out (#ff), a ; ...
ld a, 1 ; show magic border
ld bc, #01ff ; ...
out (c), a ; ...
xor a
ld (var_magic_enter_cnt), a
ld (var_magic_leave_cnt), a
.loop:
.key_wait_loop:
call check_entering_pause ; A[1] == 1 if pause button is pressed
bit 1, a ; ...
jp nz, enter_pause ; ...
jp nz, .enter_pause ; ...
call delay_10ms ;
call check_entering_menu ; A == 1 if we are entering menu, A == 2 if we are leaving to...
bit 0, a ; ...default nmi handler, A == 0 otherwise
jp nz, enter_menu ; ...
jp nz, .enter_menu ; ...
bit 1, a ; ...
jr z, .loop ; ...
jr z, .key_wait_loop ; ...
.leave_no_key:
xor a ; disable border
ld bc, #01ff ; ...
out (c), a ; ...
ld bc, #00ff ; ...
in a, (c) ; if divmmc paged - just do retn
bit 3, a ; ...
jr nz, exit_with_ret ; ...
ld hl, #0066 ; otherwise jump to default nmi handler
jr exit_with_jp ; ...
.enter_pause:
ld hl, nmi_pause
ld (var_main_fun), hl
jr .enter
.enter_menu:
ld hl, nmi_menu
ld (var_main_fun), hl
;jr .enter
.enter:
push de
push ix
push iy
ld a, i ; save I reg and IFF2
push af ; ...
ld a, #02 ; set our IM2 interrupt table address (#02xx)
ld i, a ; ...
xor a
ld (var_exit_flag), a
ld (var_exit_reboot), a
call input_init
call save
.run_fun:
ld hl, .leave ; place ret address to stack
push hl ; ...
ld hl, (var_main_fun) ; jump to our loop function
jp (hl) ; ...
.leave:
xor a ; disable border
ld bc, #01ff ; ...
out (c), a ; ...
ld bc, #ffff ; if divmmc paged - just do retn
in a, (c) ; ...
bit 3, a ; ...
jr nz, exit_with_ret ; ...
ld hl, #0066 ; otherwise jump to default nmi handler
jr exit_with_jp ; ...
call save_config
call restore
ld a, (var_exit_reboot) ; should we reboot?
or a ; ...
jr z, .leave_without_reboot ; ...
ld a, 2 ; reboot
ld bc, #01ff ; ...
out (c), a ; ...
.leave_without_reboot:
pop af ; A = I
push af ;
call get_im2_handler ; HL = default im2 handler address
ld (var_int_vector), hl
xor a ; disable border
ld bc, #01ff ; ...
out (c), a ; ...
pop af
pop iy
pop ix
pop de
ei ; wait for int just for safety
halt ; ...
ld i, a ; restore default interrupt table address
jp po, exit_with_ret ; check int was enabled by default. no? just do retn
ld hl, (var_int_vector) ; ...
jp exit_with_jp ; yes? goto default int handler
; IN - HL - jump address
@ -118,6 +171,7 @@ exit_with_ret:
check_initialized:
ld hl, cfg_initialized ; if (cfg_initialized == "magic word") Z = 0, else Z = 1
.check:
ld a, #B1 ; ...
cpi ; ... hl++
ret nz ; ...
@ -139,20 +193,20 @@ save_initialized:
ret
init_default_config:
ld bc, CFG_T+CFGEXT_T ; cfg_saved = cfg_default
ld bc, CFG_T ; cfg_saved = cfg_default
ld de, cfg_saved ; ...
ld hl, CFG_DEFAULT ; ...
ldir ; ...
load_config:
ld bc, CFG_T+CFGEXT_T ; cfg = cfg_saved
ld bc, CFG_T ; cfg = cfg_saved
ld de, cfg ; ...
ld hl, cfg_saved ; ...
ldir ; ...
ret ; ...
save_config:
ld bc, CFG_T+CFGEXT_T ; cfg_saved = cfg
ld bc, CFG_T ; cfg_saved = cfg
ld de, cfg_saved ; ...
ld hl, cfg ; ...
ldir ; ...
@ -160,16 +214,6 @@ save_config:
init_cpld:
.check_alt48rom:
ld a, (cfg.rom48) ; if alternative 48k rom enabled - disable 128 menu
or a ; ... this is required because 128 menu isn't compatible
jr z, .check_7ffd_disabled ; ... with currently used Looking Glass 48K rom
ld a, (cfg.machine) ; ... however +3e works with looking glass flawlessly
cp 2 ; ...
jr z, .check_7ffd_disabled ; ...
ld a, #10 ; ...
ld bc, #7ffd ; ...
out (c), a ; ...
.check_7ffd_disabled:
ld a, (cfg.machine) ; if machine == 48 - set 7ffd rom to basic48
or a ; ... this is required for case when machine will be
@ -189,18 +233,6 @@ init_cpld:
ld c, #ff ;
ld hl, cfg+CFG_T-1 ; HL = &cfg[registers count-1]
otdr ; do { b--; out(bc, *hl); hl--; } while(b)
.do_load_ext: ; same for extension board
ld d, CFGEXT_T ; ...
ld b, #e1 ; ...
ld c, #ff ; ...
ld hl, cfgext ; ...
.do_load_ext_loop: ; ...
ld a, (hl) ; ...
out (c), a ; ...
inc hl ; ...
inc b ; ...
dec d ; ...
jr nz, .do_load_ext_loop ; ...
ret
@ -219,79 +251,9 @@ detect_sd_card:
ret
; OUT - A = 1 if ext board present, 0 otherwise
; OUT - F - garbage
; OUT - BC - garbage
detect_ext_board:
ld b, #e0 ; read port #e0ff
ld c, #ff ; ...
in a, (c) ; ...
ld b, a ; if (result & 0xF0 != 0) - return
and #f0 ; ...
jr z, .detected ; ...
.not_detected:
xor a
ld (var_ext_presence), a
ret
.detected
ld a, 1
ld (var_ext_presence), a
xor a
bit 0, b ; check TSFM jumper
jr z, .cfg_tsfm
ld a, 1
.cfg_tsfm:
ld (cfgext_saved.tsfm), a
xor a
bit 1, b ; check SAA jumper
jr z, .cfg_saa
ld a, 1
.cfg_saa:
ld (cfgext_saved.saa), a
xor a
bit 2, b ; check GS jumper
jr z, .cfg_gs
ld a, 1
.cfg_gs:
ld (cfgext_saved.gs), a
ret
; Check if user holds 1/2/3/4 key on poweron. If true - boot with custom rom
check_custom_rom:
ld a, #f7 ; read 1-5 keys
in a, (#fe) ; ...
bit 0, a ; check key 1 pressed
jr z, .key1 ; ...
bit 1, a ; check key 2 pressed
jr z, .key2 ; ...
bit 2, a ; check key 3 pressed
jr z, .key3 ; ...
bit 3, a ; check key 4 pressed
jr z, .key4 ; ...
ret
.key1:
ld a, #80 ; rom #0
jr .reconfig
.key2:
ld a, #81 ; rom #1
jr .reconfig
.key3:
ld a, #82 ; rom #2
jr .reconfig
.key4:
ld a, #83 ; rom #3
.reconfig:
ld (cfg_saved.custom_rom), a ; set custom rom
xor a
ld (cfg_saved.divmmc), a ; disable divmmc
ld (cfg_saved.ulaplus), a ; disable ula+
ret
; OUT - A bit 1 if we are entering pause, 0 otherwise
check_entering_pause:
ld a, #ff ; read pause key state in bit 1 of #FFFF port
xor a ; read pause key state in bit 1 of #00FF port
in a, (#ff) ; ...
ret
@ -299,7 +261,7 @@ check_entering_pause:
; OUT - A = 1 if we are entering menu, A = 2 if we are leaving menu, A = 0 otherwise
; OUT - F - garbage
check_entering_menu:
ld a, #ff ; read magic key state in bit 0 of #FFFF port
xor a ; read magic key state in bit 0 of #00FF port
in a, (#ff) ; ...
bit 0, a ; check key is hold
jr nz, .is_hold ; yes?
@ -368,27 +330,7 @@ get_im2_handler:
ret
mute_saa1099:
ld bc, #ffff ; select saa register
ld a, #1c ; ...
out (c), a ; ...
ld b, #fe ; mute
xor a ; ...
out (c), a ; ...
ret
save:
.mute_gs:
ld a, (var_ext_presence) ; if (no_ext_pcb || gs_is_disabled) - skip gs
or a ; ...this is required to be compatible with DivIDE
jr z, .mute_saa1099 ; ...which uses same port #bb
ld a, (cfgext.gs) ; ...
or a ; ...
jr z, .mute_saa1099 ; ...
ld a, #fa ; send command Out zero_to_zero
out (#bb), a ; ...
.mute_saa1099:
call mute_saa1099
.save_ay:
ld hl, var_save_ay ; select first AY chip in TurboSound
ld a, #ff ; ...
@ -443,10 +385,7 @@ restore:
ld a, (var_save_ulaplus) ; ...
out (c), a ; ...
.restore_screen:
ld bc, 6912
ld de, #4000
ld hl, var_save_screen
ldir
call restore_screen
.restore_ay:
ld hl, var_save_ay+16 ; select second AY chip in TurboSound
ld a, #fe ; ...
@ -454,15 +393,6 @@ restore:
ld hl, var_save_ay ; select first AY chip in TurboSound
ld a, #ff ; ...
call .restore_ay_sub
.restore_gs:
ld a, (var_ext_presence) ; if (no_ext_pcb || gs_is_disabled) - skip gs
or a ; ...this is required to be compatible with DivIDE
jr z, .restore_ret ; ...which uses same port #bb
ld a, (cfgext.gs) ; ...
or a ; ...
jr z, .restore_ret ; ...
ld a, #60 ; send command Get Song Position
out (#bb), a ; ...
.restore_ret:
ret
@ -483,113 +413,79 @@ restore:
jr nz, .restore_ay_sub_loop ;
ret
restore_screen:
ld bc, 6912
ld de, #4000
ld hl, var_save_screen
ldir
ret
enter_pause:
ld a, 1
ld (var_pause_flag), a
jr main
enter_menu:
xor a
ld (var_pause_flag), a
jr main
; Main program
main:
push de
push ix
push iy
ld a, i ; save I reg and IFF2
push af ; ...
ld a, #06 ; set our interrupt table address (#06xx)
ld i, a ; ...
nmi_pause:
xor a
ld (var_exit_flag), a
ld (var_exit_reboot), a
ld (var_input_key), a
ld (var_input_key_last), a
ld (var_input_key_hold_timer), a
ld (var_pause_is_released), a
ld (var_menu_current_item), a
ld (var_menu_animate_cnt), a
call save
ld a, (var_pause_flag)
or a
jr z, .menu_init
.pause_init:
call pause_init
.pause_loop:
.loop:
ei
halt
call pause_process
ld a, (var_exit_flag)
or a
jr z, .pause_loop
jr .wait_for_keys_release
jr z, .loop
.wait_for_pause_key_release:
xor a ; read magic/pause keys state from port #00FF
in a, (#ff) ; ...
and #03 ; ...
jr nz, .wait_for_pause_key_release
ret
.menu_init:
nmi_menu:
call check_initialized
jr z, .menu_init1
jr z, .init1
call init_default_config
call detect_ext_board
call load_config
call save_initialized
.menu_init1:
.init1:
ld hl, menudefault
ld (var_menumain), hl
call menu_init
.menu_loop:
.loop:
call menu_input_loop
call wait_for_keys_release
ret
menu_input_loop:
xor a
ld (var_exit_flag), a
ld (var_exit_reboot), a
.loop:
ei
halt
call input_process ; B = 32 if exit key pressed
call input_process ; B = 32 if exit key pressed
bit 5, b
jr nz, .wait_for_keys_release
ret nz
call menu_process
ld a, (var_exit_flag)
or a
jr z, .menu_loop
jr z, .loop
ret
.wait_for_keys_release:
wait_for_keys_release:
.loop:
ei
halt
call input_process ; B = 0 if no keys pressed
call input_process ; B = 0 if no keys pressed
xor a
or b
jr nz, .wait_for_keys_release
ld a, #ff ; read magic/pause keys state
in a, (#ff) ; ...
and #03 ; ...
jr nz, .wait_for_keys_release
.leave:
call save_config
call restore
ld a, (var_exit_reboot) ; should we reboot?
or a ; ...
jr z, .leave_without_reboot ; ...
ld a, 1 ; reboot
ld bc, #00ff ; ...
out (c), a ; ...
.leave_without_reboot:
pop af ; A = I
push af ;
call get_im2_handler ; HL = default im2 handler address
ld (var_int_vector), hl
xor a ; disable border
ld bc, #01ff ; ...
out (c), a ; ...
pop af
pop iy
pop ix
pop de
ei ; wait for int just for safety
halt ; ...
ld i, a ; restore default interrupt table address
jp po, exit_with_ret ; check int was enabled by default. no? just do retn
ld hl, (var_int_vector) ; ...
jp exit_with_jp ; yes? goto default int handler
jr nz, .loop
xor a ; read magic/pause keys state from port #00FF
in a, (#ff) ; ...
and #03 ; ...
jr nz, .loop
ret
; Includes
@ -602,19 +498,26 @@ main:
include font.asm
include strings.asm
app_end:
DISPLAY "Free space: ",/D,#3FE8-$
ASSERT $ < #3FE8
; Just some string at the end of ROM
ORG #3FE8
DB 0,"End of Sizif Magic ROM",0
; Magic vectors
Exit_vector EQU #F000
Readout_vector EQU #F008
; Variables
ORG #D500
var_save_screen: .6912 DB 0
ORG #F020
ORG #C000
include variables.asm
var_ram_func:
.256 DB 0
ASSERT $ < #EFF0
; Magic vectors
ORG #F000
Exit_vector:
ORG #F008
Readout_vector:
ORG #FFBE
Stack_top:
@ -623,6 +526,5 @@ Ulaplus_pallete:
.64 DB 0
DISPLAY "Application size: ",/D,app_end-app_begin
CSPECTMAP "main.map"
SAVEBIN "main.bin",0,16384

View File

@ -19,6 +19,9 @@ int_handler:
org #8000
app_begin:
di
call save_screen
ld hl, menudefault
ld (var_menumain), hl
call menu_init
ld a, #7e ; set our interrupt table address (#7Fxx)
@ -38,6 +41,18 @@ app_begin:
save_variables:
ret
save_screen:
ld bc, 6912
ld de, var_save_screen
ld hl, #4000
ldir
ret
restore_screen:
ld bc, 6912
ld de, #4000
ld hl, var_save_screen
ldir
ret
includes:
include config.asm

View File

@ -1,30 +1,29 @@
; IN - HL - pointer to menu
menu_init:
ld bc, MENU_T ; if (ext board present) var_menu = menuext; else var_menu = menu;
ld bc, MENU_T ; copy menu descriptor from (hl) to (var_menu)
ld de, var_menu ; ...
ld hl, menu ; ...
ld a, (var_ext_presence) ; ...
or a ; ...
jr z, .set_menu ; ...
ld hl, menuext ; ...
.set_menu: ; ...
ldir ; ...
xor a
ld (var_menu_current_item), a
ld (var_menu_animate_cnt), a
ld ix, var_menu
ld b, (ix+MENU_T.y_row)
ld c, MENU_X
ld c, (ix+MENU_T.x)
ld d, (ix+MENU_T.height)
ld e, MENU_WIDTH
ld e, (ix+MENU_T.width)
call draw_box
ld ix, var_menu
ld hl, str_sizif
ld b, (ix+MENU_T.y_pixel)
ld c, MENU_X
ld c, (ix+MENU_T.x)
call print_string
ld ix, var_menu
ld b, (ix+MENU_T.y_pixel)
ld c, MENU_X+MENU_WIDTH-6
ld c, (ix+MENU_T.x_logo)
ld e, 0
call draw_logo
@ -64,7 +63,7 @@ menu_animate_logo:
ld e, a ; ...
ld ix, var_menu ;
ld b, (ix+MENU_T.y_pixel) ; draw logo
ld c, MENU_X+MENU_WIDTH-6 ; ...
ld c, (ix+MENU_T.x_logo) ; ...
call draw_logo ; ...
.return:
; ret ; pass to menu_handle_updown
@ -158,8 +157,8 @@ menu_draw_selected_item:
inc b
add b
ld b, a
ld c, MENU_X
ld e, MENU_WIDTH
ld c, (ix+MENU_T.x)
ld e, (ix+MENU_T.width)
call draw_attribute_line
pop af
ret
@ -170,8 +169,9 @@ menu_draw_menu:
ld a, (ix+MENU_T.y_pixel)
add a, 8
ld b, a
ld c, MENU_X+1
ld e, MENU_WIDTH
ld c, (ix+MENU_T.x)
inc c
ld e, (ix+MENU_T.width)
ld l, (ix+MENU_T.addr+0)
ld h, (ix+MENU_T.addr+1)
call draw_menu

View File

@ -4,6 +4,9 @@ items DB
height DB
y_row DB
y_pixel DB
width DB
x DB
x_logo DB
ENDS
STRUCT MENUENTRY_T
@ -13,40 +16,31 @@ callback DW
reserved DW
ENDS
MACRO MENUDESCR label_addr, items
MENU_T (label_addr) (items) (items+2) ((24-(items+2))/2) (((24-(items+2))/2)*8)
MACRO MENU_DEF width
MENU_T {
($+MENU_T)
(((.end-$)/MENUENTRY_T-1))
(((.end-$)/MENUENTRY_T-1)+2)
( (24-(((.end-$)/MENUENTRY_T-1)+2))/2)
(((24-(((.end-$)/MENUENTRY_T-1)+2))/2)*8)
(width)
( (32-width)/2)
(((32-width)/2)+width-6)
}
ENDM
.menu:
MENUENTRY_T str_machine menu_machine_value_cb menu_machine_cb
menudefault: MENU_DEF 20
MENUENTRY_T str_cpu menu_clock_value_cb menu_clock_cb
MENUENTRY_T str_machine menu_machine_value_cb menu_machine_cb
MENUENTRY_T str_panning menu_panning_value_cb menu_panning_cb
MENUENTRY_T str_joystick menu_joystick_value_cb menu_joystick_cb
IFNDEF SIZIFXXS
MENUENTRY_T str_rom48 menu_rom48_value_cb menu_rom48_cb
ENDIF
MENUENTRY_T str_divmmc menu_divmmc_value_cb menu_divmmc_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_exit menu_exit_value_cb menu_exit_cb
MENUENTRY_T 0
!menu: MENUDESCR .menu, ($-.menu)/MENUENTRY_T-1
.end:
.menuext:
MENUENTRY_T str_machine menu_machine_value_cb menu_machine_cb
MENUENTRY_T str_cpu menu_clock_value_cb menu_clock_cb
MENUENTRY_T str_panning menu_panning_value_cb menu_panning_cb
MENUENTRY_T str_joystick menu_joystick_value_cb menu_joystick_cb
MENUENTRY_T str_rom48 menu_rom48_value_cb menu_rom48_cb
MENUENTRY_T str_divmmc menu_divmmc_value_cb menu_divmmc_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_tsfm menu_tsfm_value_cb menu_tsfm_cb
MENUENTRY_T str_saa menu_saa_value_cb menu_saa_cb
MENUENTRY_T str_gs menu_gs_value_cb menu_gs_cb
MENUENTRY_T str_exit menu_exit_value_cb menu_exit_cb
MENUENTRY_T 0
!menuext: MENUDESCR .menuext, ($-.menuext)/MENUENTRY_T-1
menu_machine_value_cb:
@ -72,19 +66,6 @@ menu_clock_value_cb:
menu_panning_value_cb:
ld ix, .values_table
ld a, (var_ext_presence) ; if (ext_board && tsfm) - use ABC instead of ACB panning
or a ; ...
jr z, .no_tsfm ; ...
ld a, (cfgext.tsfm) ; ...
or a ; ...
jr z, .no_tsfm ; ...
ld a, (cfg.panning)
cp a, 2 ; if (panning == acb) panning = abc
jr c, .get ; ...
dec a ; ...
.get
jp menu_value_get
.no_tsfm:
ld a, (cfg.panning)
jp menu_value_get
.values_table:
@ -100,15 +81,6 @@ menu_joystick_value_cb:
DW str_joystick_kempston_end-2
DW str_joystick_sinclair_end-2
menu_rom48_value_cb:
ld ix, .values_table
ld a, (cfg.rom48)
jp menu_value_get
.values_table:
DW str_rom48_default_end-2
DW str_rom48_lg_end-2
DW str_rom48_opense_end-2
menu_divmmc_value_cb:
ld ix, .values_table
ld a, (cfg.divmmc)
@ -136,31 +108,6 @@ menu_dac_value_cb:
DW str_dac_sd_end-2
DW str_dac_covoxsd_end-2
menu_tsfm_value_cb:
ld ix, .values_table
ld a, (cfgext.tsfm)
jp menu_value_get
.values_table:
DW str_off_end-2
DW str_on_end-2
menu_saa_value_cb:
ld ix, .values_table
ld a, (cfgext.saa)
jp menu_value_get
.values_table:
DW str_off_end-2
DW str_on_end-2
menu_gs_value_cb:
ld ix, .values_table
ld a, (cfgext.gs)
jp menu_value_get
.values_table:
DW str_off_end-2
DW str_on_end-2
menu_exit_value_cb:
ld ix, .values_table
ld a, (var_exit_reboot)
@ -179,6 +126,7 @@ menu_value_get:
ret
menu_machine_cb:
ld a, (cfg.machine)
ld c, 3
@ -198,19 +146,8 @@ menu_clock_cb:
ret
menu_panning_cb:
ld a, (var_ext_presence) ; if (ext_board && tsfm) - do not allow to set ACB panning
or a ; ...
jr z, .no_tsfm ; ...
ld a, (cfgext.tsfm) ; ...
or a ; ...
jr z, .no_tsfm ; ...
ld a, (cfg.panning) ; ...
ld c, 1 ; ...
jr .load
.no_tsfm:
ld a, (cfg.panning)
ld c, 2
.load:
call menu_handle_press
ld (cfg.panning), a
ld bc, #04ff
@ -226,19 +163,6 @@ menu_joystick_cb:
out (c), a
ret
menu_rom48_cb:
ld a, (cfg.rom48)
IFDEF REV_C
ld c, 1
ELSE
ld c, 2
ENDIF
call menu_handle_press
ld (cfg.rom48), a
ld bc, #06ff
out (c), a
ret
menu_divmmc_cb:
ld a, (cfg.divmmc)
ld c, 2
@ -266,33 +190,6 @@ menu_dac_cb:
out (c), a
ret
menu_tsfm_cb:
ld a, (cfgext.tsfm)
ld c, 1
call menu_handle_press
ld (cfgext.tsfm), a
ld bc, #e1ff
out (c), a
ret
menu_saa_cb:
ld a, (cfgext.saa)
ld c, 1
call menu_handle_press
ld (cfgext.saa), a
ld bc, #e2ff
out (c), a
ret
menu_gs_cb:
ld a, (cfgext.gs)
ld c, 1
call menu_handle_press
ld (cfgext.gs), a
ld bc, #e3ff
out (c), a
ret
menu_exit_cb:
bit 4, d ; action?
jr nz, .exit

View File

@ -1,4 +1,6 @@
pause_init:
xor a
ld (var_pause_is_released), a
ld d, PAUSE_BODY_ATTR
ld c, PAUSE_X
ld b, PAUSE_Y
@ -17,7 +19,7 @@ pause_init:
ret
pause_process:
ld a, #ff ; read pause key state in bit 1 of #FFFF port
xor a ; read pause key state in bit 1 of #00FF port
in a, (#ff) ; ...
bit 1, a ; check key is hold
jr nz, .is_hold ; yes?

View File

@ -1,14 +1,7 @@
DB 0
IFDEF SIZIFXXS
str_sizif: DB "SIZIF-XXS",0
str_sizif_end:
ENDIF
IFDEF SIZIF512
str_sizif: DB "SIZIF-512",0
str_sizif_end:
ENDIF
str_pause DB " PAUSE ",0
str_pause_end:
@ -82,18 +75,6 @@ str_joystick_kempston_end:
str_joystick_sinclair: DB "Sinclair",0
str_joystick_sinclair_end:
str_rom48: DB "48K ROM",0
str_rom48_end:
str_rom48_default: DB "Default",0
str_rom48_default_end:
str_rom48_lg: DB " LG",0
str_rom48_lg_end:
str_rom48_opense: DB " OpenSE",0
str_rom48_opense_end:
str_divmmc: DB "DivMMC",0
str_divmmc_end:
@ -114,12 +95,3 @@ str_dac_sd_end
str_dac_covoxsd: DB "Covox+SD",0
str_dac_covoxsd_end
str_tsfm: DB "TSFM+MIDI",0
str_tsfm_end
str_saa: DB "SAA1099",0
str_saa_end
str_gs: DB "GS",0
str_gs_end

View File

@ -9,15 +9,15 @@ var_exit_reboot: DB 0
var_input_key: DB 0
var_input_key_last: DB 0
var_input_key_hold_timer: DB 0
var_pause_flag: DB 0
var_pause_is_released: DB 0
var_main_fun: DW 0
var_menumain: DW 0
var_menu: MENU_T
var_menu_current_item: DB 0
var_menu_animate_cnt: DB 0
var_menu: MENU_T
var_ext_presence: DB 1
cfg CFG_T
cfgext CFGEXT_T
cfg_saved CFG_T
cfgext_saved CFGEXT_T
cfg_initialized: DB #B1, #5B, #00, #B5
var_save_screen: .6912 DB 0