home *** CD-ROM | disk | FTP | other *** search
- PAGE 58,132
- TITLE BUGTEST 6-23-91 [7-1-91]
- ; Toad Hall disassembly and comment, 1 Jul 91
- ; David Kirschbaum
- ; kirsch@usasoc.soc.mil
-
- LF EQU 0AH
- CR EQU 0DH
-
- CSEG SEGMENT
- ASSUME DS:CSEG, SS:CSEG ,CS:CSEG ,ES:CSEG
-
- org 5CH
- drv1_05C label byte
- org 6CH
- drv2_06C label byte
-
- ORG 100H
-
- BugTest proc near
- MOV AL,drv1_05C ;DS:5CH PSP drive 1 char
- MOV AH,drv2_06C ;DS:6CH PSP drive 2 char
- MOV BX,AX
- ADD AX,4040H ;'@@' asciify
- CMP AL,'A'
- JNB Skp112
- MOV AL,'?'
- Skp112: MOV L072F,AL ;stuff drive 1 char in text
- CMP AH,'A'
- JNB Skp11C
- MOV AH,'?'
- Skp11C: MOV L076B,AH ;stuff drive 2 char in text
- MOV AL,BL ;original drive 1 binary value
- CALL Hexify_139 ;hexify it
- MOV L074C,AX ;stuff drive 1 hex value into text
- MOV AL,BH ;original drive 2 binary value
- CALL Hexify_139 ;hexify it
- MOV L0788,AX ;stuff drive 2 hex value into text
-
- MOV AH,9
- ;v1.1 LEA DX,L015A
- mov dx,offset L015A ;text message to display
- INT 21H
- ;ugh RET_NEAR
- mov ax,4C00H ;terminate properly v1.1
- int 21H ; v1.1
-
- BugTest ENDP
-
-
- Hexify_139 proc near
- MOV AH,AL ;into AH
- AND AH,0F0H ;mask to hi bits
- AND AL,0FH ;mask to lo bits
- MOV CL,4
- SHR AH,CL ;shift hi bits right
- ADD AX,3030H ;Asciify
- CMP AH,'9'
- JBE Skp14F
- ADD AH,7 ;hexify it
- Skp14F: CMP AL,'9'
- JBE Skp155
- ADD AL,7 ;hexify it
- Skp155: XCHG AH,AL ;swap
- RET
- Hexify_139 ENDP
-
-
- ; DB CR,LF
- L015A label byte
- DB 'DOS PROGRAMMERS, NOTE: The purpose of this program is to demonstrate a bug I',CR,LF
- DB 'have noticed in the way MS-DOS Version 5.00 loads a program into an Upper',CR,LF
- DB 'Memory Block (UMB). You may want to write a few extra lines of code to',CR,LF
- DB 'compensate for it. Here is what happens: When a user enters a DOS command',CR,LF
- DB 'followed immediately by filenames or drive letters in the format '
- db 22H,0EBH, ':filename',22H,CR,LF
- DB '(i.e. drive letter followed by a colon), DOS is supposed to encode each drive',CR,LF
- DB 'letter in the bytes at offsets 5Ch and 6Ch, respectively, in the program',CR,LF
- DB 'segment prefix (PSP) as the first byte of an unopened FCB. An entry of "A:" is',CR,LF
- DB 'supposed to give you 01h, "B:" yields 02h, and so forth. However, when MS-DOS',CR,LF
- DB 'Version 5.00 is running and your program has been loaded into a UMB using the',CR,LF
- DB 'LOADHIGH or LH command, DOS falls down. The byte at 5Ch always remains a zero',CR,LF
- DB 'no matter what, and the byte at 6Ch is coded for the *first* drive specified!',CR,LF
- DB '(If you specify a second drive, it ends up who-knows-where.) If you enter',CR,LF
- DB '"BUGTEST a: b:" under DOS Version 5.00, it will correctly return the specified',CR,LF
- DB 'drives. But if you enter "LOADHIGH BUGTEST a: b:" instead, you',27H,'ll notice that',CR,LF
- DB 'DOS reports no first drive and the wrong second drive. Probably nobody uses',CR,LF
- DB 'FCBs anymore, but those drive bytes come in very handy sometimes. Grrrrr!',CR,LF
- DB CR,LF
- DB ' -- Jerry Monroe, CIS # 72321,1257',CR,LF
- DB ' June 23, 1991',CR,LF
- DB CR,LF
- DB 'First drive specified: '
- L072F DB ' (byte at PSP offset 5Ch = '
- L074C label word
- DB '00h)',CR,LF
- DB 'Second drive specified: '
- L076B DB ' (byte at PSP offset 6Ch = '
- L0788 label word
- DB '00h)',CR,LF,'$'
-
- CSEG ENDS
- END BugTest