Browse Source

RomLoader changes to implement NVRAM config, and relatd changes to HBIOS/SysConfig

pull/455/head
Mark Pruden 1 year ago
parent
commit
7a87dd6805
  1. 13
      Source/HBIOS/SysConfig/sysconfig.asm
  2. 45
      Source/HBIOS/hbios.asm
  3. 101
      Source/HBIOS/romldr.asm

13
Source/HBIOS/SysConfig/sysconfig.asm

@ -152,6 +152,7 @@ main:
call prtstr
;
CALL PRT_STATUS ; PRINT STATUS
RET NZ ; status failed complely, SO EXIT
ld de,MSG_MENU ; Print the Main Menu
CALL prtstr
;
@ -275,9 +276,20 @@ PRT_STATUS:
;
CALL prtcrlf
RET
;
; Error status handling
;
STAT_NOTFOUND:
CP 0 ; if status is ZERO then this is fatal
JR Z,STAT_NOTFOUND1
LD de,MSG_NOTF
CALL prtstr
XOR A ; success
RET
STAT_NOTFOUND1:
LD de,MSG_NONVR ; print failure status
CALL prtstr
OR $FF ; failure
RET
;
; ======================================================================
@ -500,6 +512,7 @@ MSG_PROMPT: .DB "\r\n"
.DB "$", 0
MSG_STAT: .DB "\r\nCurrent Configuration: ",0
MSG_NOTF: .DB "Config Not Found.\r\n",0
MSG_NONVR: .DB "NVRAM Not Found. Exiting.\r\n",0
MSG_QUESTION .DB "\r\n?\r\n",0
;
;MSG_PAK: .DB "\r\nPress Any Key ...",0

45
Source/HBIOS/hbios.asm

@ -3393,7 +3393,7 @@ NVR_INIT:
JR NZ, NVR_INIT_DEF ; failed to correclty read data
;
CALL NVSW_CHECKSUM ; checksum calc into A
LD HL,CB_SWITCHCK ; address of HCB value
LD HL,CB_SWITCHCK ; address of HCB switch checksum value
CP (HL) ; compare Caculated Check, with hcb Check Value
JR Z,NVR_INIT_END ; The same so success
NVR_INIT_DEF:
@ -5697,14 +5697,9 @@ SYS_GETFN:
; HL: SWITCH VALUE 8/16 BIT
;
SYS_GETSWITCH:
; PUSH DE
; CALL NVSW_CONFIG ; make sure shadow copy is inited
; POP DE ;
; RET NZ ; Configuration Failed, thus cant continue
;
LD A,D
CP $FF ; test if want to just get NVRAM status
JP Z,NVSW_STATUS ; Check the Status - Call and Return
JR Z,SYS_GETSWITCH3 ; Check the Status - Call and Return
;
CALL SWITCH_RES ; D SWITCH NUMBER -> OUT HL address, E FLAGS
RET NZ ; IF NZ FLAG SET THEN ISSUE
@ -5722,6 +5717,20 @@ SYS_GETSWITCH2:
LD L,C
XOR A ; signal success
RET
;
; Return Status
; A=0 if NVRAM does not exist. with NZ flag set
; A=1 if NVRAM exists, not inited. with NZ flag set
; A='W' if NVRAM is fully inited. with Z flag set
;
; Note the NZ flag can be used to detect and return an error condition
; where the NVRAM is not fully initialised
;
SYS_GETSWITCH3:
LD A,(CB_SWITCHES) ; the status byte
CP 'W' ; set NZ based on A = W
RET
;
#IF ((CPUFAM == CPU_EZ80) & (EZ80TIMER == EZ80TMR_FIRM))
; IMPLEMENTED IN EZ80DRV.ASM
;
@ -5974,12 +5983,16 @@ SYS_SET:
; HL: SWITCH VALUE 8/16 BIT
;
SYS_SETSWITCH:
CALL NVSW_STATUS ; Check the status of NV RAM
RET NZ ; IF NZ then we cant continue, return NZ at this point
LD A,(CB_SWITCHES) ; Check the basic status of NV RAM
CP 0 ; no nv ram is present. ( if = 0 )
JR Z,SWITCH_RES1 ; then we cant continue, return NZ at this point
;
LD A,D ; switch # argument
CP $FF ; test if want to reset NVRAM
JP Z,NVSW_RESET ; then perform reset function. CALL AND RETURN
;
CALL SYS_GETSWITCH3 ; Check the Full status of NV RAM
RET NZ ; is not fully initialised, so return
;
LD B,H ; move value to write into BC
LD C,L
@ -7571,20 +7584,6 @@ Z2DMAADR2:
; ROUTINES FOR NON VOLITILE (NVRAM) SWITCHES
;--------------------------------------------------------------------------------------------------
;
; Return Status
; A=0 if no NVRAM exists. with NZ flag set
; A=1 if NVRAM is present. with Z flag set
; A='W' if NVRAM is fullly inited. with Z flag set
; Note the NZ flag can be used to detect and return an error condition
;
NVSW_STATUS:
LD A,(CB_SWITCHES) ; the status byte
LD B,A ; save it
AND 1 ; applies to 'W' and $01 status, -> 1
CP 1 ; set NZ based on A = 1
LD A,B ; return the
RET
;
; RESET CONTENTS OF NVRAM, STORING INTO
; RETURN NONZERO IF WRITTEN - ZERO IF NOT WRITTEN
;

101
Source/HBIOS/romldr.asm

@ -249,13 +249,88 @@ nofp:
;
#endif
;
;=======================================================================
; INITIALISE BOOT PROMPT (acmd_*) FROM CONFIG
;=======================================================================
#if (BIOS == BIOS_WBW)
;
; NVRAM AUTO BOOT CONFIGURATION
;
nvrswitch:
ld bc,BC_SYSGET_SWITCH ; HBIOS SysGet NVRAM Switches
ld D,$FF ; get NVR Status - Is NVRam initialised
rst 08
CP 'W' ; is NV RAM fully inited.
JR NZ,nonvrswitch ; NOT So - Skip the int from nvram
nvrsw_def:
;
call nl ; display message to indicate switches found
ld hl,str_nvswitches
call pstr
;
ld bc,BC_SYSGET_SWITCH ; HBIOS SysGet NVRAM Switches
ld D,NVSW_DEFBOOT ; Read Default Boot (disk/Rom) switch
rst 08
LD A,H
AND DBOOT_ROM ; Get the Default Boot from ROM Flag
JR NZ,nvrsw_rom ; IF Set as ROM App BOOT, otherwise Disk
nvrsw_disk:
LD A,H ; (H contains the Disk Unit 0-127)
LD (bootunit),A ; copy the NVRam Unit and Slice
LD A,L ; (L contains the boot slice 0-255)
LD (bootslice),A ; directly into the selected boot
LD L,'~' ; We use the "~" char to signal, DISK BOOT
; setting it a the auto cmd (string/char)
nvrsw_rom:
LD H,0 ; Clear high orer byte, leaving L intact
LD (acmd),HL ; Load the Character into auto command
; Thus (acma) = L (the boot character)
; (acma+1) = H=0 (string terminator)
nvrsw_auto:
ld bc,BC_SYSGET_SWITCH ; HBIOS SysGet NVRAM Switches
ld D,NVSW_AUTOBOOT ; GET Autoboot switch
rst 08
ld A,L
AND ABOOT_AUTO ; Get the autoboot flag
JR Z,prompt ; not set, so directly prompt
;
or $FF ; auto cmd active value
ld (acmd_act),a ; set the auto command active flag
;
LD A,L ; the low order byte from SWITCHES
AND ABOOT_TIMEOUT ; Mask out the Timeout
LD B,A ; timeout to high order B.C byte -> x 256
XOR A
LD C,A ; and clear low order C byte
SRL B ; Shift 2 right by 2 bits -> /4
RR C
SRL B
RR C ; BC should now contain timeout * 64
ld (acmd_to),bc ; save auto cmd timeout 64ths of second
;
JR initautoboot ; init auto boot from NVRAM, ignore Build Config
;
nonvrswitch:
; no NVRAM switches found, or disabled, continue process from Buid Config
#endif
;
#if (BOOT_TIMEOUT != -1)
;
; BUILD CONFIGURATION
;
; Initialize auto command timeout downcounter
or $FF ; auto cmd active value
ld (acmd_act),a ; set flag
ld bc,BOOT_TIMEOUT * 100 ; hundredths of seconds
ld bc,BOOT_TIMEOUT * 64 ; 1/64's of a second
ld (acmd_to),bc ; save auto cmd timeout
; fall through and initialise Auto boot.
#endif
;
;=======================================================================
; INIT AUTO BOOT - If autoboot was detected.
;=======================================================================
;
initautoboot:
; If timeout is zero, boot auto command immediately
ld a,b ; check for
or c ; ... zero
@ -265,7 +340,10 @@ nofp:
call pstr ; show it
call autocmd ; handle w/o prompt
jr reprompt ; restart w/ autocmd disable
#endif
;
;=======================================================================
; BOOT PROMPT
;=======================================================================
;
prompt:
ld hl,reprompt ; adr of prompt restart routine
@ -319,7 +397,6 @@ wtkey:
#endif
#endif
;
#if (BOOT_TIMEOUT != -1)
; check for timeout and handle auto boot here
ld a,(acmd_act) ; get auto cmd active flag
or a ; set flags
@ -330,9 +407,8 @@ wtkey:
jr z,autocmd ; if so, handle it
dec bc ; decrement
ld (acmd_to),bc ; resave it
ld de,625 ; 16us * 625 = 10ms
call vdelay ; 10ms delay
#endif
ld de,976 ; 16us * 976 -> 1/64th of a second.
call vdelay ; 15.6ms delay, 64 in 1 second
;
jr wtkey ; loop
;
@ -451,6 +527,9 @@ runcmd:
ld a,(de) ; get character
call upcase ; make upper case
;
; Auto Command (probably) from NVR default Disk Boot
CP '~' ; We use the "~" char to signal, DISK
JP Z,diskboot ; noting the - (bootunit) (bootslice) have inited.
; Attempt built-in commands
cp 'H' ; H = display help
jp z,help ; if so, do it
@ -2298,8 +2377,13 @@ str_err_api .db "Unexpected hardware BIOS API failure",0
acmd .db BOOT_DEFAULT ; auto cmd string
.db 0
acmd_len .equ $ - acmd ; len of auto cmd
acmd_act .db $FF ; auto cmd active
acmd_to .dw BOOT_TIMEOUT ; auto cmd timeout
acmd_act .dw $00 ; inactive by default
#if (BOOT_TIMEOUT > 0)
acmd_to .dw BOOT_TIMEOUT * 64 ; auto cmd timeout (1/64's of sec)
#else
acmd_to .dw BOOT_TIMEOUT ; auto cmd timeout -1 DISABLE, 0 IMMEDIATE
#endif
;
;=======================================================================
; Strings
@ -2490,6 +2574,7 @@ str_user .db "User App",0
str_egg .db "",0
str_net .db "Network Boot",0
str_switches .db "FP Switches = 0x",0
str_nvswitches .db "NV Switches Found",0
newcon .db 0
newspeed .db 0
;

Loading…
Cancel
Save