DiskMonl Asm
DiskMonl Asm
;
; This software is provided "as-is".
;
; Distribution is permitted in accordance with the GNU Public License v2.0
; or later. See the file COPYING which should have come with this.
;
; 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.
;---------------------------------------------------------------------
; This is a TSR to monitor the floppy parameters.
; It only works with a text display mode and is designed for 80 column displays.
; Monitored values are displayed in Hex in the LOWER right corner of the
; screen. There is no support for unloading the TSR (use MARK/RELEASE)
; DISKMON displays in the UPPER right corner.
;
; This has been superceded by DISK_VU.
;---------------------------------------------------------------------
;
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
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 ?
;
;
;INT 40H handler
altd: 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
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
mov ax,cs:max_count
db 0c3h ; rets
;
bingo label near
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,40h
mov es,ax
assume cs:code_seg,ds:nothing,es:bios_data
push cs
pop ds
assume cs:code_seg,ds:code_seg,es:bios_data
;reset count for next round
mov ax,max_count
mov the_count,ax
;get BIOS DISK STATE MACHINE values
mov bx,word ptr es:[3eh]
call convert
mov al,21d
mov row,al
call display
; same for operation
mov bx,word ptr es:[41h]
call convert
mov al,22d
mov row,al
call display
; same for cylinders
mov bx,word ptr es:[43h]
call convert
mov al,23d
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,24d
mov row,al
call display
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
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