Skip to content

Commit

Permalink
Merge pull request #431 from kiwisincebirth/map/romldr-sysget-diomed
Browse files Browse the repository at this point in the history
RomLdr.asm now uses HBIOS SYSGET DIOMED to discover Slice Sector offset
  • Loading branch information
wwarthen authored Oct 7, 2024
2 parents a5c68c6 + 2ca487b commit ecc7a15
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 35 deletions.
1 change: 1 addition & 0 deletions Doc/ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Version 3.5
- D?N: Added support for eZ80 CPU
- MAP: Contributed COPYSL utility
- MAP: Added new HBIOS function SYSGET_DIOMED
- MAP: ROMLDR now uses SYSGET_DIOMED to get Slice Sector for boot

Version 3.4
-----------
Expand Down
71 changes: 38 additions & 33 deletions Source/HBIOS/romldr.asm
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ prompt:
ld hl,reprompt ; adr of prompt restart routine
push hl ; put it on stack
call nl2 ; formatting
ld hl,str_prompt ; display boot prompt
ld hl,str_prompt ; display boot prompt "Boot [H=Help]:"
call pstr ; do it
call clrbuf ; zero fill the cmd buffer
;
Expand Down Expand Up @@ -305,6 +305,7 @@ wtkey:
; wait for a key or timeout
call cst ; check for keyboard key
jr nz,concmd ; if pending, do console command
; NOTE Above is like a CALL, with a RET to reprompt: (manually pushed)
;
#if (DSKYENABLE)
call dsky_stat ; check DSKY for keypress
Expand All @@ -314,7 +315,7 @@ wtkey:
#if (BIOS == BIOS_WBW)
#if (AUTOCON)
call conpoll ; poll for console takeover
jp nz,docon ; if requested, takeover
jp nz,docon ; if requested, takeover
#endif
#endif
;
Expand Down Expand Up @@ -884,13 +885,13 @@ getbnum2:
or a ; with flags set, CF is cleared
ret
;
tmpbcd: .db 0
tmpbcd: .db 0
;
#DEFINE PACK(a,b,c,d,e,f,g) \
#DEFCONT \ .db (16*('0'-'0'))+(a-'0'))
#DEFCONT \ .db (16*(b-'0'))+(c-'0'))
#DEFCONT \ .db (16*(d-'0'))+(e-'0'))
#DEFCONT \ .db (16*(f-'0'))+(g-'0'))
#DEFCONT \ .db (16*(f-'0'))+(g-'0'))
;
tbl_baud:
PACK('0','0','0','0','0','7','5') ; 75 0 > 0
Expand Down Expand Up @@ -1106,11 +1107,11 @@ romload1:
diskboot:
;
; Notify user
ld hl,str_boot1
ld hl,str_boot1 ; "Booting Disk Unit"
call pstr
ld a,(bootunit)
call prtdecb
ld hl,str_boot2
ld hl,str_boot2 ; "Slice"
call pstr
ld a,(bootslice)
call prtdecb
Expand All @@ -1122,34 +1123,27 @@ diskboot:
;
#if (BIOS == BIOS_WBW)
;
; Check that drive actually exists
; Get Extended information for the Device, and Slice
ld b,BF_SYSGET ; HBIOS func: sys get
ld c,BF_SYSGET_DIOCNT ; HBIOS sub-func: disk count
rst 08 ; do it, E=disk count
ld a,(bootunit) ; get boot disk unit
cp e ; compare to count
jp nc,err_nodisk ; handle no disk err
;
; If non-zero slice requested, confirm device can handle it
ld a,(bootslice) ; get slice
or a ; set flags
jr z,diskboot0 ; slice 0, skip slice check
ld a,(bootunit) ; get disk unit
ld c,a ; put in C for func call
ld b,BF_DIODEVICE ; HBIOS func: device info
ld c,BF_SYSGET_DIOMED ; HBIOS sub-func: get extended disk info
ld a,(bootunit) ; passing boot unit
ld d,a
ld a,(bootslice) ; and slice
ld e,a
rst 08 ; do it
bit 5,c ; high capacity device?
jp z,err_noslice ; no such slice, handle err

; Check errors from the Function
cp ERR_NOUNIT ; compare to no unit error
jp z,err_nodisk ; handle no disk err
cp ERR_NOMEDIA ; no media in the device
jp z,err_nomedia ; handle the error
cp ERR_RANGE ; slice is invalid
jp z,err_badslice ; bad slice, handle err
or a ; any other error
jp nz,err_diskio ; handle as general IO error
;
diskboot0:
; Sense media
ld a,(bootunit) ; get boot disk unit
ld c,a ; put in C for func call
ld b,BF_DIOMEDIA ; HBIOS func: media
ld e,1 ; enable media check/discovery
rst 08 ; do it
jp nz,err_diskio ; handle error
ld a,e ; media id to A
ld a,c ; media id to A
ld (mediaid),a ; save media id
;
#endif
Expand Down Expand Up @@ -1186,8 +1180,6 @@ diskboot0:
ld a,4 ; assume legacy hard disk
ld (mediaid),a ; save media id
;
#endif
;
diskboot1:
; Initialize working LBA value
ld hl,0 ; zero HL
Expand Down Expand Up @@ -1262,13 +1254,15 @@ diskboot6:
dec a ; dec loop downcounter
jr diskboot5 ; and loop
;
#endif
;
diskboot7:
ld (lba),hl ; update lba, low word
ld (lba+2),de ; update lba, high word
;
diskboot8:
; Note that we could be coming from diskboot1!
ld hl,str_ldsec ; display prefix
ld hl,str_ldsec ; display prefix "Sector Ox"
call pstr ; do it
ld hl,(lba) ; recover lba loword
ld de,(lba+2) ; recover lba hiword
Expand Down Expand Up @@ -1408,6 +1402,8 @@ diskboot10:
ld hl,(bb_cpment) ; get entry vector
jp (hl) ; and go there
;
;-----------------------------------------------------------------------
;
; Read disk sector(s)
; DE:HL is LBA, B is sector count, C is disk unit
;
Expand Down Expand Up @@ -2254,10 +2250,17 @@ err_nodisk:
ld hl,str_err_nodisk
jr err
;
err_nomedia:
ld hl,str_err_nomedia
jr err
;
err_noslice:
ld hl,str_err_noslice
jr err
;
err_badslice:
ld hl,str_err_badslice
jr err
err_nocon:
ld hl,str_err_nocon
jr err
Expand Down Expand Up @@ -2291,7 +2294,9 @@ err:
str_err_prefix .db bel,"\r\n\r\n*** ",0
str_err_invcmd .db "Invalid command",0
str_err_nodisk .db "Disk unit not available",0
str_err_nomedia .db "Media not present",0
str_err_noslice .db "Disk unit does not support slices",0
str_err_badslice .db "Slice specified is illegal",0
str_err_nocon .db "Invalid character unit specification",0
str_err_diskio .db "Disk I/O failure",0
str_err_sig .db "No system image on disk",0
Expand Down
2 changes: 1 addition & 1 deletion Source/ver.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#DEFINE RMN 5
#DEFINE RUP 0
#DEFINE RTP 0
#DEFINE BIOSVER "3.5.0-dev.88"
#DEFINE BIOSVER "3.5.0-dev.89"
#define rmj RMJ
#define rmn RMN
#define rup RUP
Expand Down
2 changes: 1 addition & 1 deletion Source/ver.lib
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ rmn equ 5
rup equ 0
rtp equ 0
biosver macro
db "3.5.0-dev.88"
db "3.5.0-dev.89"
endm

0 comments on commit ecc7a15

Please sign in to comment.