<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Thu, 07 Jan 1988 22:25:16 GMT
From   : codas!burl!clyde!watmath!watdragon!vaxtrain!mdapoz@bikini.cis.ufl.edu (Mark Dapoz)
Subject: Z80DOS Bug Report

The distributed versions of Z80DOS (both version 1.0 and 1.1) have a slight 
problem when a read or write error occurs.  When a disk error occurs, your
machine will most likely crash (if you're lucky) but in some instances it 
will continue to run, but with unpredictable results.  An examination of the
code within Z80DOS reveals a rather serious bug within the error recovery/
reporting routine.  As can be seen from the code in example 1 (taken from the
Z80DDISK.Z80 file), the HL register pair is loaded with the contents of the 
address specified by the RDERR (or WRTERR) label.  Later, in the error recovery
routine, execution is passed to the address contained in the HL register
pair.  This clearly does not work as it has the result of performing a double
indirect jump whereas what was really intended was a single indirect jump.
To fix the problem, you must modify the code to read as in example 2.  It
would be appreciated if this information could be passed on to the author so
that it may be included in any future releases.
       -Mark

  Example 1 - Original code with bug present
;
; Read sector from drive
;
; readr and writer modified to give separate error message--b.h.
;
READR: CALL    READ            ; BIOS call read sector
       LD      HL,(RDERR)
       JR      WRITE0          ; Test exit code
;
; Write sector on drive
;
WRITER:        CALL    WRITE           ; BIOS call write sector
       LD      HL,(WRTERR)
WRITE0:        OR      A               ; Test exit code
       RET     Z               ; Exit if ok
       LD      (RETFLG),A      ; Allow retry for read/write errors
       JP      (HL)            ; DOS error on d: write error


  Example 2 - New code with bug fixed
;
; Read sector from drive
;
; readr and writer modified to give separate error message--b.h.
;
readr: call    read                    ; BIOS call read sector
       ld      hl,rderr                ; Fix indirect load - MD
       jr      write0                  ; Test exit code
;
; Write sector on drive
;
writer:        call    write                   ; BIOS call write sector
       ld      hl,wrterr               ; Fix indirect load - MD
write0:        or      a                       ; Test exit code
       ret     z                       ; Exit if ok
       ld      (retflg),a              ; Allow retry for read/write errors
       jp      (hl)                    ; DOS error on d: write error
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>