; Tiny ShowDisk by Tom Hanlin 09/20/90 for the Public Domain ; displays letter of the drive being accessed in the upper right corner ; assembled with OPTASM by SLR RESLEN equ (Install - ShowDisk + 100h + 0Fh) shr 4 Sseg segment byte stack 'prog' ; dummy stack segment Sseg ends Cseg segment byte public 'prog' assume cs:Cseg, ds:Cseg, ss:Sseg org 100h ShowDisk proc far jmp Install ShowDisk endp INTdisk proc far ; new INT 13H hook push ax ; push bx ; push ds ; xor ax,ax ; establish BIOS data segment mov ds,ax ; mov al,ds:[0449h] ; get video mode cmp al,3 ; text mode? jbe #GotMode ; yep, it's fine cmp al,7 ; text mode? je #GotMode ; yep, it's fine mov byte ptr cs:VidSeg+1,0 ; flag "no display done" jmp #StartDone ; skip out #GotMode: mov al,0B8h ; assume color cmp byte ptr ds:[0463h],0D4h; is it color? je #GotSeg ; yep, we're set mov al,0B0h ; must be mono #GotSeg: mov cs:VidSeg+1,al ; save video segment call GetPosn ; get video offset mov ds,cs:VidSeg ; establish video segment mov ax,ds:[bx] ; get char/attr mov cs:OldChar,ax ; save it mov ax,ds:2[bx] ; get char/attr mov cs:OldChar+2,ax; save it mov ah,7 ; display in white on black mov al,dl ; drive number... add al,"A" ; convert to floppy letter test al,80h ; hard drive? jz #GotDrive ; no, we're set sub al,126 ; convert to hard drive letter #GotDrive: mov ds:[bx],ax ; write first char/attr mov al,":" ; mov ds:2[bx],ax ; write second char/attr #StartDone: pop ds ; pop bx ; pop ax ; ; pushf ; db 9Ah ; *** self-modifying code OldDisk dw ? ; *** CALL FAR PTR xxxx:yyyy dw ? ; (original INT 13h vector) ; push ax ; push bx ; push cx ; push bp ; push ds ; lahf ; put flags in AH mov bp,sp ; mov -19[bp],ah ; set it so we'll return flags mov cx,cs:VidSeg ; get video segment jcxz #Done ; if none, we're done xor ax,ax ; establish BIOS data segment mov ds,ax ; call GetPosn ; get video offset mov ds,cx ; establish video segment mov ax,cs:OldChar ; restore chars/attrs mov ds:[bx],ax ; mov ax,cs:OldChar+2; mov ds:2[bx],ax ; #Done: pop ds ; pop bp ; pop cx ; pop bx ; pop ax ; iret ; all done INTdisk endp ; new INT 13H hook GetPosn proc near ; get video offset for drive spec mov bx,ds:[044Eh] ; offset of current video page mov ax,ds:[044Ah] ; columns sub ax,2 ; shl ax,1 ; add bx,ax ; where to read/write ret ; GetPosn endp ; get video offset for drive spec OldChar dw ?, ? ; saved characters and attributes VidSeg dw 0B800h ; video display segment (0 if nothing displayed) ; ------------------- non-resident portion ---------------------------- Install proc near ; installation routine mov es,ds:[002Ch] ; mov ah,49h ; release the environment int 21h ; mov ax,3513h ; get disk handler vector (INT 13h) int 21h ; mov OldDisk,bx ; save old disk handler vector mov OldDisk+2,es ; mov ax,2513h ; install new disk handler vector lea dx,INTdisk ; ptr to our routine int 21h ; mov dx,RESLEN ; size of interrupt handler (parag) mov ax,3100h ; terminate and stay resident int 21h ; Install endp ; installation routine Cseg ends end ShowDisk