summaryrefslogtreecommitdiff
path: root/bootblocks/trk_buf.c
diff options
context:
space:
mode:
Diffstat (limited to 'bootblocks/trk_buf.c')
-rw-r--r--bootblocks/trk_buf.c50
1 files changed, 44 insertions, 6 deletions
diff --git a/bootblocks/trk_buf.c b/bootblocks/trk_buf.c
index 86a6721..cfa1e93 100644
--- a/bootblocks/trk_buf.c
+++ b/bootblocks/trk_buf.c
@@ -92,7 +92,6 @@ void reset_disk()
char * read_lsector(sectno)
long sectno;
{
- int tries = 6;
int rv;
int phy_s = 1;
@@ -147,12 +146,26 @@ long sectno;
do
{
- rv = phy_read(disk_drive, phy_c, phy_h, phy_s+1, 1, data_buf1);
- tries--;
+ int v,tries = 6;
+ do
+ {
+ rv = phy_read(disk_drive, phy_c, phy_h, phy_s+1, 1, data_buf1);
+ tries--;
+ }
+ while(rv && tries > 0);
+ if( rv )
+ {
+ printf("Disk error 0x%02x %d:%d:%d:%d[%2d] -> 0x%04x[]\nRetry:",
+ rv, disk_drive, phy_c, phy_h, phy_s+1, 1, data_buf1);
+ fflush(stdout);
+
+ v = phy_reset(disk_drive);
+ v = (getch()&0x7F);
+ printf("\n");
+ if( v == 3 || v == 27 ) break;
+ }
}
- while(rv && tries > 0);
- if( rv ) printf("Disk error 0x%02x %d:%d:%d:%d[%2d] -> 0x%04x[]\n",
- rv, disk_drive, phy_c, phy_h, phy_s+1, 1, data_buf1);
+ while(rv);
check_motor = motor_running();
@@ -334,6 +347,31 @@ func_ok:
#endasm
}
+phy_reset(drive)
+{
+#asm
+ push bp
+ mov bp,sp
+
+ push di
+ push es
+
+ mov dl,[bp+2+_phy_reset.drive]
+
+ mov ah,#$08
+ int $13
+ jnc reset_ok
+ mov cx,ax
+ mov dx,#-1
+reset_ok:
+ mov ax,cx
+
+ pop es
+ pop di
+ pop bp
+#endasm
+}
+
motor_running()
{
#asm