Browse Source

HBIOS Disk R/W w/ Sec Cnt = 0, Discussion #632

Check for a length of zero in HBIOS disk read and write calls.  Such calls will perform no read/write actions and return success.

Thanks and credit to @hubertushirsch.
pull/633/head
Wayne Warthen 2 months ago
parent
commit
2ac394f22b
No known key found for this signature in database GPG Key ID: 8B34ED29C07EEB0A
  1. BIN
      Doc/RomWBW Applications.pdf
  2. BIN
      Doc/RomWBW Disk Catalog.pdf
  3. BIN
      Doc/RomWBW Hardware.pdf
  4. BIN
      Doc/RomWBW Introduction.pdf
  5. BIN
      Doc/RomWBW System Guide.pdf
  6. BIN
      Doc/RomWBW User Guide.pdf
  7. 2
      ReadMe.md
  8. 2
      ReadMe.txt
  9. 37
      Source/Doc/SystemGuide.md
  10. 24
      Source/HBIOS/hbios.asm

BIN
Doc/RomWBW Applications.pdf

Binary file not shown.

BIN
Doc/RomWBW Disk Catalog.pdf

Binary file not shown.

BIN
Doc/RomWBW Hardware.pdf

Binary file not shown.

BIN
Doc/RomWBW Introduction.pdf

Binary file not shown.

BIN
Doc/RomWBW System Guide.pdf

Binary file not shown.

BIN
Doc/RomWBW User Guide.pdf

Binary file not shown.

2
ReadMe.md

@ -7,7 +7,7 @@
**RomWBW Introduction** \
Version 3.6 \
Wayne Warthen ([wwarthen@gmail.com](mailto:wwarthen@gmail.com)) \
14 Nov 2025
21 Nov 2025
# Overview

2
ReadMe.txt

@ -1,6 +1,6 @@
RomWBW Introduction
Wayne Warthen (wwarthen@gmail.com)
14 Nov 2025
21 Nov 2025

37
Source/Doc/SystemGuide.md

@ -1208,8 +1208,8 @@ point, all disk drivers support both LBA and CHS addressing.
| E: Sector Count | |
| HL: Buffer Address | |
Read Sector Count (E) sectors into the buffer located in Buffer Bank ID (D)
at Buffer Address (HL) starting at the Current Sector. The returned
Read Sector Count (E) sectors into the buffer located in Buffer Bank ID
(D) at Buffer Address (HL) starting at the Current Sector. The returned
Status (A) is a standard HBIOS result code.
The Current Sector is established by a prior DIOSEEK function call;
@ -1219,18 +1219,21 @@ successfully read. On error, the Current Sector will be the sector where
the error occurred. Sectors Read (E) indicates the number of sectors
successfully read.
A Sector Count of zero will result in no sectors being read and a
status of success. The buffer will not be modified.
For buffers in the bottom 32KB ram, the Bank ID is used to identify the
bank to use for the buffer. If the buffer is located in your current
active bank, you will need to provide the current Bank ID, which can be
obtained using [Function 0xF3 -- System Get Bank (SYSGETBNK)]. For
buffers in the top 32K of memory the Bank ID is not strictly required as
this memory is always mapped to the common bank.
The caller must ensure that the Buffer Address is large enough to
contain all sectors requested. Disk data transfers will be faster if
the buffer resides in the top 32K of memory because it avoids a
double buffer copy.
Also for buffers in the top 32K of memory the Bank ID is not
strictly required as this memory is alway mapped to the common bank.
For buffers in the bottom 32KB ram, the Bank ID is used to identify
the bank to use for the buffer. If you do not wih to use banked memory
you will need to provide the current Bank ID, which can be obtained
using [Function 0xF3 -- System Get Bank (SYSGETBNK)]
### Function 0x14 -- Disk Write (DIOWRITE)
| **Entry Parameters** | **Returned Values** |
@ -1241,9 +1244,9 @@ using [Function 0xF3 -- System Get Bank (SYSGETBNK)]
| E: Sector Count | |
| HL: Buffer Address | |
Write Sector Count (E) sectors from the buffer located in Buffer Bank ID (D)
at Buffer Address (HL) starting at the Current Sector. The returned
Status (A) is a standard HBIOS result code.
Write Sector Count (E) sectors from the buffer located in Buffer Bank ID
(D) at Buffer Address (HL) starting at the Current Sector. The
returned Status (A) is a standard HBIOS result code.
The Current Sector is established by a prior DIOSEEK function call;
however, multiple read/write/verify function calls can be made after a
@ -1252,6 +1255,16 @@ successfully written. On error, the Current Sector will be the sector
where the error occurred. Sectors Written (E) indicates the number of
sectors successfully written.
A Sector Count of zero will result in no sectors being written and a
status of success. The buffer will not be modified.
For buffers in the bottom 32KB ram, the Bank ID is used to identify the
bank to use for the buffer. If the buffer is located in your current
active bank, you will need to provide the current Bank ID, which can be
obtained using [Function 0xF3 -- System Get Bank (SYSGETBNK)]. For
buffers in the top 32K of memory the Bank ID is not strictly required as
this memory is always mapped to the common bank.
Disk data transfers will be faster if the buffer resides in the top 32K
of memory because it avoids a double copy.

24
Source/HBIOS/hbios.asm

@ -4647,6 +4647,13 @@ HB_DSKREAD0:
LD B,E ; SEC LOOP COUNTER
LD C,0 ; SEC COMPLETE COUNTER
;
#IF TRUE
; ZERO SECTOR COUNT CHECK
LD A,B ; SEC COUNT TO ACCUM
OR A ; SET FLAGS
JR Z,HB_DSKREAD2 ; SKIP I/O IF ZERO
#ENDIF
;
HB_DSKREAD1:
LD HL,HB_WRKBUF ; USE WORK BUF REAL I/O
;
@ -4673,6 +4680,7 @@ HB_DSKREAD1:
; INC READ COUNT
INC C ; BUMP SEC READ COUNT
DJNZ HB_DSKREAD1 ; LOOP AS NEEDED
HB_DSKREAD2:
XOR A ; SIGNAL SUCCESS
;
HB_DSKREADX:
@ -4738,6 +4746,13 @@ HB_DSKWRITE0:
LD B,E ; SEC LOOP COUNTER
LD C,0 ; SEC COMPLETE COUNTER
;
#IF TRUE
; ZERO SECTOR COUNT CHECK
LD A,B ; SEC COUNT TO ACCUM
OR A ; SET FLAGS
JR Z,HB_DSKWRITE2 ; SKIP I/O IF ZERO
#ENDIF
;
HB_DSKWRITE1:
; BNKCPY SEC DATA TO WORK BANK/BUF & INC BUF ADR
PUSH BC ; SAVE COUNTERS
@ -4763,6 +4778,7 @@ HB_DSKWRITE1:
; INC WRITE COUNT
INC C ; BUMP SEC WRITE COUNT
DJNZ HB_DSKWRITE1 ; LOOP AS NEEDED
HB_DSKWRITE2:
XOR A ; SIGNAL SUCCESS
;
HB_DSKWRITEX:
@ -4779,6 +4795,13 @@ HB_DSKIO:
LD B,E ; SEC LOOP COUNTER
LD C,0 ; SEC COMPLETE COUNTER
;
#IF TRUE
; ZERO SECTOR COUNT CHECK
LD A,B ; SEC COUNT TO ACCUM
OR A ; SET FLAGS
JR Z,HB_DSKIO2 ; SKIP I/O IF ZERO
#ENDIF
;
HB_DSKIO1:
; CALL READ/WRITE FN
LD E,1 ; READ/WRITE EXACTLY 1 SECTOR
@ -4790,6 +4813,7 @@ HB_DSKIO1:
; INC SECTOR COUNT
INC C ; BUMP SEC READ/WRITE COUNT
DJNZ HB_DSKIO1 ; LOOP AS NEEDED
HB_DSKIO2:
XOR A ; SIGNAL SUCCESS
;
HB_DSKIOX:

Loading…
Cancel
Save