Sie sind auf Seite 1von 14

; DISK_VU (c) copyright 1992 Kevin G. Rhoads, all rights reserved.

; This code is copyrighted, all rights reserved except as stated below.


;
; This software is provided "as-is".
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;---------------------------------------------------------------------
;
; Permission to copy and distribute source (DISK_VU.asm), binary
; (DISK_VU.com) and documentation is
; granted to any individuals or companies who do so in accordance with
; the GNU Public License v 2.0 or later.
;
;
;quiet_quiet equ 1
;
code_seg segment
assume cs:code_seg,ds:nothing,es:nothing
ORG 100H
entry_point proc near
jmp init
oldtick label dword ;saved vector for int 1cH
oldticko dw ?
oldticks dw ?
;olddisk label dword ;saved vector for int 13h
;olddisko dw ?
;olddisks dw ?
altdisk label dword ;saved vector for int 40h
altdisko dw ?
altdisks dw ?
;
the_count dw 0
max_count dw 09h
active db 1
hex_dig db '0123456789ABCDEF'
string db ' '
;
ax_save dw ?
bx_save dw ?
cx_save dw ?
dx_save dw ?
ds_save dw ?
es_save dw ?
si_save dw ?
di_save dw ?
bp_save dw ?
ax_savw dw ?
bx_savw dw ?
cx_savw dw ?
dx_savw dw ?
ds_savw dw ?
es_savw dw ?
si_savw dw ?
di_savw dw ?
bp_savw dw ?
it dw ?
cursor dw ?
row db ?
;al db ?
;

toggle_active:
mov dl,cs:active
xor dl,01
mov cs:active,dl
jmp bye_bye_

install_check:
cmp bx,'Di'
jne pass_it_on
cmp cx,'Vu'
jne pass_it_on
cmp dl,7eh
je toggle_active
cmp dl,7fh
jne pass_it_on
bye_bye_:
mov bx,'dI'
mov cx,'vU'
mov ah,01
stc
db 0caH ;retf 2
dw 2

;
;INT 40H handler
altd:
; mov cs:al,al
cmp ah,10h
jne pass_it_on
jmp install_check
pass_it_on:
pushf
call dword ptr altdisk
pushf
mov cs:ax_save,ax
call near ptr bingo
mov cs:the_count,ax
mov ax,cs:ax_save
popf
db 0caH ;retf 2
dw 2
;
;INT 1cH HANDLER
counter label near
cli
mov cs:ax_savw,ax
mov ax,cs:the_count
dec ax
jnz no_bingo
call near ptr bingow
no_bingo label near
mov cs:the_count,ax
mov ax,cs:ax_savw
jmp dword ptr cs:[oldtick]
;
bingow label near
cmp cs:active,0
je rets_
mov cs:bx_savw,bx
mov cs:cx_savw,cx
mov cs:dx_savw,dx
mov cs:si_savw,si
mov cs:di_savw,di
mov cs:bp_savw,bp
mov cs:ds_savw,ds
mov cs:es_savw,es
call near ptr bingoc
; restore and exit
mov es,cs:es_savw
mov ds,cs:ds_savw
mov bp,cs:bp_savw
mov di,cs:di_savw
mov si,cs:si_savw
mov dx,cs:dx_savw
mov cx,cs:cx_savw
mov bx,cs:bx_savw
rets_:
mov ax,cs:max_count
db 0c3h ; rets
;
bingo label near
cmp cs:active,0
je rets_
mov cs:bx_save,bx
mov cs:cx_save,cx
mov cs:dx_save,dx
mov cs:si_save,si
mov cs:di_save,di
mov cs:bp_save,bp
mov cs:ds_save,ds
mov cs:es_save,es
call near ptr bingoc
; restore and exit
mov es,cs:es_save
mov ds,cs:ds_save
mov bp,cs:bp_save
mov di,cs:di_save
mov si,cs:si_save
mov dx,cs:dx_save
mov cx,cs:cx_save
mov bx,cs:bx_save
mov ax,cs:max_count
db 0c3h ; rets
;
;
bingoc label near
;have saved - set up addressing
mov ax,0
mov es,ax
assume cs:code_seg,ds:nothing,es:abs0
push cs
pop ds
;reset count for next round
mov ax,max_count
mov the_count,ax
;get SRT & hd unload/ hd load & DMA
les bx,dword ptr es:[78h]
mov bx,word ptr es:[bx]
call convert
mov al,0
mov row,al
call display
; get motor wait / sector size
mov ax,0
mov es,ax
les bx,dword ptr es:[78h]
mov bx,word ptr es:[bx+2]
call convert
mov al,1
mov row,al
call display
;now do sectors/track & r/w/v gap
mov ax,0
mov es,ax
les bx,dword ptr es:[78h]
mov bx,word ptr es:[bx+4]
call convert
mov al,2
mov row,al
call display
;now do DTL / format gap
mov ax,0
mov es,ax
les bx,dword ptr es:[78h]
mov bx,word ptr es:[bx+6]
call convert
mov al,3
mov row,al
call display
call blankit
mov al,4
mov row,al
call display
;get BIOS DISK STATE MACHINE values
mov ax,40h
mov es,ax
assume cs:code_seg,ds:code_seg,es:bios_data
mov bx,es:[states]
call convert
mov al,5d
mov row,al
call display
; same for operation
mov bx,es:[state_ops]
call convert
mov al,6d
mov row,al
call display
; same for cylinders
mov bx,es:[cylinders]
call convert
mov al,7d
mov row,al
call display
; same for
mov bh,es:[media_control]
mov bl,es:[diskette_info]
call convert
mov al,8d
mov row,al
call display

call blankit
mov al,9
mov row,al
call display
;get BIOS DISK data values -- recal status / motor status
mov bx,word ptr es:[3eh]
call convert
mov al,10d
mov row,al
call display
; 41/42 diskette status/NEC status byte 1
; diskette status: 80 = timeout
; 40 = bad seek
; 20 = bad NEC
; 10 = bad CRC
; 09 = DMA bounds (cross 64k boundary)
; 08 = DMA overrun
; 04 = sector not found
; 03 = write protect violation
; 02 = address mark not found
; 01 = bad command to NEC
mov bx,word ptr es:[41h]
call convert
mov al,11d
mov row,al
call display
; 43/44 NEC status bytes 2 & 3
mov bx,word ptr es:[43h]
call convert
mov al,12d
mov row,al
call display
; 45/46 NEC status bytes 4 & 5
mov bx,word ptr es:[45h]
call convert
mov al,13d
mov row,al
call display
; 47/48 NEC status bytes 6 & 7
mov bx,word ptr es:[47h]
call convert
mov al,14d
mov row,al
call display
call blankit
mov al,15d
mov row,al
call display
; exit
assume cs:code_seg,ds:nothing,es:nothing
db 0c3h ; rets
;
assume cs:code_seg,ds:code_seg
blankit label near
mov al,' '
mov string[0],al
mov string[1],al
; mov string[2],al
mov string[3],al
mov string[4],al
db 0c3h ; rets
;
;
convert label near
mov si,offset hex_dig
mov it,bx
and bx,0fH
add bx,si
mov al,byte ptr ds:[bx]
mov string[1],al
mov bx,it
shr bl,1
shr bl,1
shr bl,1
shr bl,1
and bx,0fH
add bx,si
mov al,byte ptr ds:[bx]
mov string,al
mov bx,it
mov bl,bh
mov it,bx
and bx,0fH
add bx,si
mov al,byte ptr ds:[bx]
mov string[4],al
mov bx,it
shr bl,1
shr bl,1
shr bl,1
shr bl,1
and bx,0fH
add bx,si
mov al,byte ptr ds:[bx]
mov string[3],al
db 0c3h ; rets
;
;
display label near
mov ah,3
xor bx,bx
int 10h
mov cursor,dx
mov ah,2
mov bh,0
mov dl,075d
mov dh,row
int 10h
mov ah,10d
mov al,string
mov bx,070
mov cx,1
int 10h
mov ah,2
mov bh,0
mov dl,076d
mov dh,row
int 10h
mov ah,10d
mov al,string[1]
mov bx,070
mov cx,1
int 10h
mov ah,2
mov bh,0
mov dl,077d
mov dh,row
int 10h
mov ah,10d
mov al,string[2]
mov bx,070
mov cx,1
int 10h
mov ah,2
mov bh,0
mov dl,078d
mov dh,row
int 10h
mov ah,10d
mov al,string[3]
mov bx,070
mov cx,1
int 10h
mov ah,2
mov bh,0
mov dl,079d
mov dh,row
int 10h
mov ah,10d
mov al,string[4]
mov bx,070
mov cx,1
int 10h
mov ah,2
xor bx,bx
mov dx,cursor
int 10h
db 0c3h ; rets
;
init label near
mov bx,'Di' ;install check, are we already installed?
mov cx,'Vu'
mov dl,7fh
mov ah,10h
int 40h
cmp bx,'dI'
jne can_do_install
cmp cx,'vU'
jne can_do_install
push cs
pop ds
lea dx,id_mess
mov ah,9
int 21h

mov bx,'Di' ;we are already installed


mov cx,'Vu' ;toggle active state
mov dl,7eh
mov ah,10h
int 40h
mov ah,9
cmp dl,0
jne is_active
lea dx,is_off
jmp display_status
is_active:
lea dx,is_on
display_status:
int 21h

mov ax,4c01h
int 21h
int 20h

can_do_install:
assume cs:code_seg,ds:code_seg,es:nothing
xor ax,ax
mov es,ax
assume cs:code_seg,ds:code_seg,es:abs0
les di,dword ptr es:[timertk]
mov word ptr oldticko,di
mov di,es
mov word ptr oldticks,di
xor ax,ax
mov es,ax
les di,dword ptr es:[diskalt]
mov word ptr altdisko,di
mov di,es
mov word ptr altdisks,di
xor ax,ax
mov es,ax
cli
mov ax,offset counter
mov word ptr es:tickoff,ax
mov ax,cs
mov word ptr es:tickseg,ax
mov ax,offset altd
mov word ptr es:altoff,ax
mov ax,cs
mov word ptr es:altseg,ax
mov ax,max_count
mov the_count,ax
push cs
pop ds
push cs
pop es
assume cs:code_seg,ds:code_seg,es:code_seg
mov di,0081H ;copy an ID mess to command line buffer
mov si,offset id_mess
mov cx,(offset id_end) - (offset id_mess)
mov byte ptr ds:[080H],cl
cld
rep movsb

lea dx,sign_on
mov ah,09
int 21h

mov ah,30h ;DOS 2.0 or higher?


int 21h ; if so close handles 0 .. 4
cmp al,0
je bye_bye ; is DOS 1.x

mov bx,0 ; handle 0


mov ah,3eh ; close
int 21h
mov bx,1 ; handle 1
mov ah,3eh ; close
int 21h
mov bx,2 ; handle 2
mov ah,3eh ; close
int 21h
mov bx,3 ; handle 3
mov ah,3eh ; close
int 21h
mov bx,4 ; handle 4
mov ah,3eh ; close
int 21h
;;
ifdef quiet_quiet
mov bx,cs:[2Ch] ; get environment seg from PSP
mov es,bx ; and free it
mov ah,49h
int 21h
endif ; ifdef quiet_quiet
;;
mov dx,offset init ;get offset
add dx,0Fh ; will convert bytes to paragraphs
shr dx,1 ; so add 15 to avoid truncation
shr dx,1 ; error then divide by 16, implemented
shr dx,1 ; as four successive 1 bit shifts
shr dx,1
mov ax,3100h ; DOS 2.0+ TSR
int 21h
; if DOS 2.0+ TSR call returns (? how) will fall through to INT 27h
bye_bye label near
sti
mov dx,offset init
int 27h
entry_point endp

id_mess label near


db 'Disk_Vu - Floppy DSM and parameter watch v1.05 ',10d,13d
id_end label near
db 'is ALREADY INSTALLED - INSTALLATION ABORTING $'
;id_len equ (offset id_end) - (offset id_mess)
is_on db 10d,10d,13d,'Disk_Vu has been activated',10d,13d,'$'
is_off db 10d,10d,13d,'Disk_Vu has been DE-activated',10d,13d,'$'
sign_on db 10d,13d,'Disk_Vu - Realtime Floppy Disk State Machine and parameter display
',10d,13d
db 'Display activity can be turned off & back on by running Disk_Vu again.',10d,13d
db ' DISK_VU (c) copyright 1992 Kevin G. Rhoads, all rights reserved.',10d,13d,'$'

code_seg ends
;
;
abs0 segment at 0
org 4ch
romdisk label dword
diskoff dw ?
diskseg label word
org 70h
timertk label dword
tickoff dw ?
tickseg label word
org 78h
dskparm label dword
parmoff dw ?
parmseg label word
org 100h
diskalt label dword
altoff dw ?
altseg label word
abs0 ends
;
bios_data segment at 040h
org 08bh
media_control db ? ;bits 7-6 last data rate [00=500 01=300 10=250 11=reserved]
;bits 5-4 last drive step rate
;bits 3-2 {data rate at start of operation}
;bits 1-0 reserved
org 08fh
diskette_info db ? ;bit 7 reserved
;bit 6 =1 if drive 1 determined
;bit 5 =1 if multi-rate valid only if determined
;bit 4 =1 if drive 1 does 80 tracks, always valid
;bit 3 reserved
;bit 2 =1 if drive 0 determined
;bit 1 =1 if multi-rate valid only if determined
;bit 0 =1 if drive 0 does 80 tracks, always valid
org 090h
states label word
a_state db ?
b_state db ?
state_ops label word
a_state_op db ?
b_state_op db ?
cylinders label word
a_cyl db ?
b_cyl db ?
bios_data ends
end entry_point
_

Das könnte Ihnen auch gefallen