You are on page 1of 9

; DSMMON (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 (DSMMON.asm), binary
; (DSMMON.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.
;
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 ?
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
mov cs:ax_save,ax
mov ax,cs:the_count
dec ax
jnz no_bingo
call near ptr bingo
no_bingo label near
mov cs:the_count,ax
mov ax,cs:ax_save
jmp dword ptr cs:[oldtick]
;
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
;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:[90h]
call convert
mov al,0d
mov row,al
call display
; same for operation
mov bx,word ptr es:[92h]
call convert
mov al,1d
mov row,al
call display
; same for cylinders
mov bx,word ptr es:[94h]
call convert
mov al,2d
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,3d
mov row,al
call display
; restore and exit
assume cs:code_seg,ds:nothing,es:nothing
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
;
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:[romdisk]
;; mov word ptr olddisko,di
;; mov di,es
;; mov word ptr olddisks,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 disk
;; mov word ptr es:diskoff,ax
;; mov ax,cs
;; mov word ptr es:diskseg,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
sti
mov dx,offset init
int 27h
entry_point endp
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 090h
a_state db ?
b_state db ?
a_state_op db ?
b_state_op db ?
a_cyl db ?
b_cyl db ?
bios_data ends
end entry_point

You might also like