home *** CD-ROM | disk | FTP | other *** search
-
- PAGE 60,132
-
- ;* ------------------------------------------------------- *
- ; DRIVE720.ASM *
- ; DEVICE-Treiber zum Lesen/Schreiben von Disketten, *
- ; die auf 720 KB formatiert wurden (80 Tracks, 9 Secs), *
- ; in AT-kompatiblen Rechnern *
- ; Übersetzung: *
- ; MASM drive720; *
- ; LINK drive720; *
- ; EXE2BIN drive720.exe drive720.sys *
- ; (C) 1990 Jochen Loewer & toolbox *
- ;* ------------------------------------------------------- *
-
- cseg segment 'code'
- assume cs:cseg, ds:cseg
-
-
- org 0
-
- drive720 proc far
-
- header dd 0FFFFFFFFh ; Link to next driver
- db 01000000b ; Device attribute word
- db 00001000b ; Device with IOCTL
- dw strategy
- dw commands
-
- countlog db 1 ; driver for 1 new block
- ; device
-
- req_off dw 0 ; for adr of
- req_seg dw 0 ; DEVICE request header
-
- savespeed db 0 ; for old speed
- biosspeed dw 0090h ; adr of bios variable
- bios2 dw 0040h
-
- ; ---------------------------------------------------------
- strategy proc far
- mov cs:req_off,bx
- mov cs:req_seg,es
- ret
- strategy endp
-
-
- ; ----------------------------------------------------------
- commands proc far
- push es
- push bx
- push ax
-
- les bx,dword ptr cs:biosspeed
- mov al,es:[bx]
- mov byte ptr cs:savespeed,al
- mov byte ptr es:[bx],54h
-
- les bx,dword ptr cs:req_off
- cmp byte ptr es:[bx+2],0 ; Command: INIT ?
- jne do_rw ; no, do read/write
- jmp initial ; yes, jump to Initialize
- do_rw:
- mov al,cs:newdrive ; newdrive in blockunit
- mov es:[bx+1],al ; unit number of
- ; request header
-
- mov ax,802h ; 'magic' INT 2Fh 8(02)
- int 2Fh ; will make the job for us !!
-
- pushf ; clean stack after INT 2Fh
- pop bx
- add sp,2
- push bx
- popf
-
- leavedev:
- pushf
- les bx,dword ptr cs:biosspeed
- mov al,byte ptr cs:savespeed
- mov es:[bx],al
- popf
- pop ax
- pop bx
- pop es
- ret
- commands endp
-
- ttlink db 0FFh, 0FFh, 0FFh, 0FFh, 0 ,0
- bpb db 0, 2, 0FFh, 1, 0, 2
- db 64, 0,68h, 1
- db 0, 2, 0, 9, 0, 1, 0, 0, 0
- db 0,0,0,'NO NAME',32,32,32,32, 0, 2
- db 20h
- db 0, 50h, 0
- db 0, 2, 2, 1, 0, 2
- db 70h, 0, 0A0h, 5, 0F9h, 3, 0, 9, 0, 2
- db 15 dup (0)
- db 0FFh, 0FFh, 0FFh, 0FFh, 0FFh
- newdrive db 0
- resbpb dw bpb
-
- drive720 endp
-
- ; ----------------------------------------------------------
- ; End of resident part
- ; ----------------------------------------------------------
-
-
- strout proc near ; string in (cs:dx) to con:
- push ax
- push ds
- push cs
- pop ds
- mov ah,9
- int 21h
-
- pop ds
- pop ax
- ret
- strout endp
-
- error:
- mov ah,81h ; status : error+done
- jmp short err1
- good:
- mov ah,1 ; status : ok + done
- err1:
- lds bx,dword ptr cs:req_off
- xor al,al
- mov [bx+3],ax ; put into status field
- pop ds
- pop bp
- pop di
- pop dx
- pop cx
- pop ax
- pop si
- jmp leavedev
-
-
- ; ----------------------------------------------------------
- ; initialize and command line parsing
- ; ----------------------------------------------------------
-
- initial:
- push si
- push ax
- push cx
- push dx
- push di
- push bp
- push ds
- cld
-
- mov ax,800h ; test if INT 2Fh
- int 2Fh ; available ;* get installed status
- cmp al,0FFh
- jne errinit
-
- lds bx,dword ptr cs:req_off
- mov si,[bx+12h] ; get command line
- mov ax,[bx+14h] ; string in ds:si
- mov ds,ax
-
-
- scanchar:
- lodsb
- cmp al,'/'
- je getdrive ; get x in /D:x
- cmp al,0Dh ; end before /D:x ?
- je synerr
- cmp al,0Ah
- je synerr
- cmp al,0
- jne scanchar
-
- synerr: mov dx,offset syntax
- call strout
- errinit: stc
- jmp error
-
- getdrive:
- lodsb
- cmp al,'D'
- je ok1
- cmp al,'d'
- jne synerr
- ok1: lodsb
- cmp al,':'
- jne synerr
- lodsb
- cmp al,'0'
- je is_0
- cmp al,'1'
- jne synerr
-
- is_1: mov si,0091h
- mov ax,2001h
- jmp short store_dr
- is_0: mov si,0090h
- mov ax,1200h
- store_dr:
- push cs
- pop ds
- mov bx,offset biosspeed
- mov word ptr [bx],si
-
- mov di,offset ttlink
- push cs
- pop es
- mov es:[di+4],al
- mov es:[di+29h],ah
- lds bx,dword ptr cs:req_off
- mov al,[bx+16h] ; get logical dev.nr
- mov es:[di+5],al ; and store
- mov cs:newdrive,al
- add al,'A'
- mov cs:dr_char,al
-
- mov ax,801h ; parameters of new
- push cs ; drive passed to
- pop ds ; INT 2Fh 8(1)
- mov di,offset ttlink
- int 2Fh
-
- lds bx,dword ptr cs:req_off
- mov ah,1
- mov cs:countlog,ah
- mov [bx+0Dh],ah
- mov word ptr [bx+0Eh],offset good
- mov [bx+10h],cs
- mov word ptr [bx+12h],offset resbpb
- mov [bx+14h],cs
- push dx
- mov dx,offset mes_install
- call strout
- pop dx
- jmp good
-
- mes_install db 'DRIVE720 V1.2: 720 kB-Drive installed.'
- db 0Dh,0Ah
- db ' DEVICE = '
- dr_char db 'D'
- db ': ', 0Ah, 0Dh, 24h
-
- syntax db 0Dh,0Ah
- db 'DRIVE720: syntax error ',0Dh,0Ah
- db 'usage: DEVICE-DRIVE720 /D:x '
- db ' {x is 0 or 1 for dirve A or B}'
- db 0Dh,0Ah,24h
-
- cseg ends
-
- end
-
- ;* ------------------------------------------------------- *
- ;* Ende von DRIVE720.ASM *
- ;* ------------------------------------------------------- *