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

rom: minor refactors

This commit is contained in:
Eugene Lozovoy
2024-01-07 17:22:00 +03:00
parent a942f43c5a
commit e7552c5743
4 changed files with 93 additions and 138 deletions

View File

@ -1,7 +1,11 @@
ifneq ($(wildcard ../.git),)
VERSION := $(shell git describe --abbrev=6 --long --dirty --always --tags --first-parent)
endif
export PATH:=/cygdrive/c/Hwdev/sjasmplus/:/cygdrive/c/Dev/srec/:${PATH}
REV=D
SJOPTS=-DSIZIFXXS -DREV_${REV}
SJOPTS=-DSIZIFXXS -DREV_${REV} -DVERSION=\"${VERSION}\"
.PHONY: all clean .FORCE
.FORCE:
@ -19,3 +23,5 @@ clean:
srec_cat $< -binary -o $@ -intel
test: main_test.bin
-include Makefile.local

View File

@ -1,5 +1,6 @@
ASSERT __SJASMPLUS__ >= 0x011402 ; SjASMPlus 1.20.2
OPT --syntax=abf
DEVICE ZXSPECTRUM48
OPT --syntax=F
; Startup handler
ORG #0000
@ -76,7 +77,7 @@ nmi_handler:
call check_entering_pause ; A[1] == 1 if pause button is pressed
bit 1, a ; ...
jp nz, .enter_pause ; ...
call delay_10ms ;
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 ; ...
@ -89,14 +90,14 @@ nmi_handler:
ld bc, #00ff ; ...
in a, (c) ; if divmmc paged - just do retn
bit 3, a ; ...
jr nz, exit_with_ret ; ...
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
jr .enter
.enter_menu:
ld hl, nmi_menu
ld (var_main_fun), hl
@ -130,7 +131,7 @@ nmi_handler:
out (c), a ; ...
.leave_without_reboot:
pop af ; A = I
push af ;
push af ;
call get_im2_handler ; HL = default im2 handler address
ld (var_int_vector), hl
xor a ; disable border
@ -208,7 +209,7 @@ load_config:
save_config:
ld bc, CFG_T ; cfg_saved = cfg
ld de, cfg_saved ; ...
ld hl, cfg ; ...
ld hl, cfg ; ...
ldir ; ...
ret
@ -230,7 +231,7 @@ init_cpld:
out (c), a ; ...
.do_load:
ld b, CFG_T ; B = registers count
ld c, #ff ;
ld c, #ff ;
ld hl, cfg+CFG_T-1 ; HL = &cfg[registers count-1]
otdr ; do { b--; out(bc, *hl); hl--; } while(b)
ret
@ -259,7 +260,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:
check_entering_menu:
xor a ; read magic key state in bit 0 of #00FF port
in a, (#ff) ; ...
bit 0, a ; check key is hold
@ -497,13 +498,22 @@ wait_for_keys_release:
include font.asm
include strings.asm
DISPLAY "Free space: ",/D,#1FE8-$
ASSERT $ < #1FE8
DISPLAY "Free space: ",/D,fwinfo-$," (",$,")"
ASSERT $ < fwinfo
; Just some string at the end of ROM
ORG #1FE8
DB 0,"End of Sizif Magic ROM",0
; Just some firmware info at the end of ROM
ORG #2000-(fwinfo.end-fwinfo)
fwinfo:
DB 0
.version:
DB VERSION, 0
.date
DB __DATE__, 0
.time:
DB __TIME__, 0
DB "End of Sizif Magic ROM", 0
.end
; Variables
ORG #C000
@ -514,7 +524,7 @@ var_ram_func:
; Magic vectors
ORG #F000
Exit_vector:
Exit_vector:
ORG #F008
Readout_vector:

View File

@ -48,73 +48,73 @@ menu_machine_value_cb:
ld a, (cfg.machine)
jp menu_value_get
.values_table:
DW str_machine_48_end-2
DW str_machine_128_end-2
DW str_machine_3e_end-2
DW str_machine_pentagon_end-2
DW str_machine_48.end-2
DW str_machine_128.end-2
DW str_machine_3e.end-2
DW str_machine_pentagon.end-2
menu_clock_value_cb:
ld ix, .values_table
ld a, (cfg.clock)
jp menu_value_get
.values_table:
DW str_cpu_35_end-2
DW str_cpu_44_end-2
DW str_cpu_52_end-2
DW str_cpu_7_end-2
DW str_cpu_14_end-2
DW str_cpu_35.end-2
DW str_cpu_44.end-2
DW str_cpu_52.end-2
DW str_cpu_7.end-2
DW str_cpu_14.end-2
menu_panning_value_cb:
ld ix, .values_table
ld a, (cfg.panning)
jp menu_value_get
.values_table:
DW str_panning_mono_end-2
DW str_panning_abc_end-2
DW str_panning_acb_end-2
DW str_panning_mono.end-2
DW str_panning_abc.end-2
DW str_panning_acb.end-2
menu_joystick_value_cb:
ld ix, .values_table
ld a, (cfg.joystick)
jp menu_value_get
.values_table:
DW str_joystick_kempston_end-2
DW str_joystick_sinclair_end-2
DW str_joystick_kempston.end-2
DW str_joystick_sinclair.end-2
menu_sd_value_cb:
ld ix, .values_table
ld a, (cfg.sd)
jp menu_value_get
.values_table:
DW str_off_end-2
DW str_divmmc_end-2
DW str_zc3e_end-2
DW str_off.end-2
DW str_divmmc.end-2
DW str_zc3e.end-2
menu_ulaplus_value_cb:
ld ix, .values_table
ld a, (cfg.ulaplus)
jp menu_value_get
.values_table:
DW str_off_end-2
DW str_on_end-2
DW str_off.end-2
DW str_on.end-2
menu_dac_value_cb:
ld ix, .values_table
ld a, (cfg.dac)
jp menu_value_get
.values_table:
DW str_off_end-2
DW str_dac_covox_end-2
DW str_dac_sd_end-2
DW str_dac_covoxsd_end-2
DW str_off.end-2
DW str_dac_covox.end-2
DW str_dac_sd.end-2
DW str_dac_covoxsd.end-2
menu_exit_value_cb:
ld ix, .values_table
ld a, (var_exit_reboot)
jp menu_value_get
.values_table:
DW str_exit_no_reboot_end-2
DW str_exit_reboot_end-2
DW str_exit_no_reboot.end-2
DW str_exit_reboot.end-2
menu_value_get:
sla a

View File

@ -1,100 +1,39 @@
MACRO DEFSTR _string
DB _string,0
@.end:
ENDM
DB 0
str_sizif: DB "SIZIF-XXS",0
str_sizif_end:
str_pause DB " PAUSE ",0
str_pause_end:
str_exit: DB "Exit",0
str_exit_end:
str_exit_reboot: DB "& reboot ",0
str_exit_reboot_end:
str_exit_no_reboot: DB " ",0
str_exit_no_reboot_end:
str_on: DB " ON",0
str_on_end:
str_off: DB " OFF",0
str_off_end:
str_machine: DB "Machine",0
str_machine_end:
str_machine_48: DB " 48",0
str_machine_48_end:
str_machine_128: DB " 128",0
str_machine_128_end:
str_machine_3e: DB " +3e",0
str_machine_3e_end:
str_machine_pentagon: DB "Pentagon",0
str_machine_pentagon_end:
str_cpu: DB "CPU freq",0
str_cpu_end:
str_cpu_35: DB "3.5MHz",0
str_cpu_35_end:
str_cpu_44: DB "4.4MHz",0
str_cpu_44_end:
str_cpu_52: DB "5.2MHz",0
str_cpu_52_end:
str_cpu_7: DB " 7MHz",0
str_cpu_7_end:
str_cpu_14: DB " 14MHz",0
str_cpu_14_end:
str_panning: DB "Panning",0
str_panning_end:
str_panning_abc: DB " ABC",0
str_panning_abc_end:
str_panning_acb: DB " ACB",0
str_panning_acb_end:
str_panning_mono: DB "Mono",0
str_panning_mono_end:
str_joystick: DB "Joystick",0
str_joystick_end:
str_joystick_kempston: DB "Kempston",0
str_joystick_kempston_end:
str_joystick_sinclair: DB "Sinclair",0
str_joystick_sinclair_end:
str_sd: DB "SD card",0
str_sd_end:
str_divmmc: DB "DivMMC",0
str_divmmc_end:
str_zc3e: DB "ZC/+3e",0
str_zc3e_end:
str_ulaplus: DB "ULA+",0
str_ulaplus_end
str_dac: DB "DAC",0
str_dac_end
str_dac_covox: DB " Covox",0
str_dac_covox_end
str_dac_sd: DB " SD",0
str_dac_sd_end
str_dac_covoxsd: DB "Covox+SD",0
str_dac_covoxsd_end
str_sizif: DEFSTR "SIZIF-XXS"
str_pause: DEFSTR " PAUSE "
str_exit: DEFSTR "Exit"
str_exit_reboot: DEFSTR "& reboot "
str_exit_no_reboot: DEFSTR " "
str_on: DEFSTR " ON"
str_off: DEFSTR " OFF"
str_machine: DEFSTR "Machine"
str_machine_48: DEFSTR " 48"
str_machine_128: DEFSTR " 128"
str_machine_3e: DEFSTR " +3e"
str_machine_pentagon: DEFSTR "Pentagon"
str_cpu: DEFSTR "CPU freq"
str_cpu_35: DEFSTR "3.5MHz"
str_cpu_44: DEFSTR "4.4MHz"
str_cpu_52: DEFSTR "5.2MHz"
str_cpu_7: DEFSTR " 7MHz"
str_cpu_14: DEFSTR " 14MHz"
str_panning: DEFSTR "Panning"
str_panning_abc: DEFSTR " ABC"
str_panning_acb: DEFSTR " ACB"
str_panning_mono: DEFSTR "Mono"
str_joystick: DEFSTR "Joystick"
str_joystick_kempston: DEFSTR "Kempston"
str_joystick_sinclair: DEFSTR "Sinclair"
str_sd: DEFSTR "SD card"
str_divmmc: DEFSTR "DivMMC"
str_zc3e: DEFSTR "ZC/+3e"
str_ulaplus: DEFSTR "ULA+"
str_dac: DEFSTR "DAC"
str_dac_covox: DEFSTR " Covox"
str_dac_sd: DEFSTR " SD"
str_dac_covoxsd: DEFSTR "Covox+SD"