On (13 Jun 97) Kurt Wismer wrote to All...
KW> ok, can someone tell me what i'm doing wrong here? the problematic
KW> behaviour is described below...
I see a couple of problems, though I'm not sure if they're related to
the symptoms you're seeing or not.
KW> inc dx ;move sector pointer forward by 1
KW> mov cx, 1h ;read 1 sector
KW> mov bx, offset buff ;set read buffer
KW> int 25h ;absolute disk read cx sectors starting
KW> ;at dx
int 25h leaves an extra word on the stack - if you don't get rid of it
(typically by popping it into a register) you'll eventually run into
problems.
KW> jc close ;close and exit on error
KW> mov bx, offset buff ;prep buffer for comparison
KW> mov cx, 200h ;200h byte string comparisons between
KW> buffer
KW> loop1:
KW> cmp byte ptr[bx], 0f6h ;compare the sector to the hex byte f6
KW> (empty)
KW> jne writ ;write sector at first instance of a
KW> difference
KW> inc bx
KW> loop loop1
KW> jmp arge ;skip sector save routine if the sector is
KW> ;full of f6h's
This isn't a bug as such, but I'd rewrite this loop:
mov si, offset buff
mov cx, 100h
loop1:
lodsw
cmp ax, 0f6f6h
loopz loop1
The conditional forms of `loop' are _really_ handy instructions at
times. Doing comparisons on words instead of bytes should roughly
double the overall speed as well.
KW> writ:
KW> push dx ;save sector index
KW> mov bx, offset buff + 200h ;append sector index to buffered
KW> mov byte ptr[bx], dh ;sector for later recovery
KW> mov byte ptr[bx + 1], dl
Umm...unless I'm mistaken, this is overwriting the last byte of the
sector with the first byte of the sector index number.
KW> buff db 202 dup(?)
In your program you're using 202 HEX bytes, but you're only reserving
202 DECIMAL bytes for the buffer...
Later,
Jerry.
... The Universe is a figment of its own imagination.
--- PPoint 1.90
---------------
* Origin: Point Pointedly Pointless (1:128/166.5)
|