Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Int 13h function 15h

Status
Not open for further replies.

killdog

IS-IT--Management
Jun 23, 2001
1
AU
I am learning assembly and I need to write a program linking c and assembly. Starting at c, the user is required to enter a drive number (1=a, 2=b, 3=c etc.) then down in assembly, using Int 13h function 15h, report back what type of drive that was selected (00h=Drive not present, 01h & 02h = Diskette and 03h = fixed disk). At present my program always reports back the code 00h for Drive not present, no matter what is entered. I would like to use an error code as well, but for now would be happy just getting the interrupt to work properly.

Following is my c and assembly code so far. It is still in the working and will compile as it is, but any help or suggestions would be greatly appreciated.

C

#include <stdio.h>
extern int GetDriveType(int*, int);
void main(void)


{
int drivetype;
int drivenum;

printf(&quot;Select a drive number, 1=a: 2=b: 3=c: and so on\n&quot;);
scanf(&quot;%d&quot;, &drivenum);
printf(&quot;The drive type is %d\n&quot;, drivetype);
printf(&quot;0=No Drive, 1&2=Floppy drive, 3=fixed disk.\n&quot;);
}

Assembly


.model large
.stack 100h

public _GetDriveType
vdrivenum equ [bp+10]
adrivetype equ [bp+6]

.data


.code
_GetDriveType proc

push bp
mov bp, sp
push ds
mov dl, vdrivenum
mov ah, 15h
int 13h

mov bh, 0
mov bl, ah
lds si, adrivetype
mov ds:[si], bx

pop ds
pop bp
ret

_GetDriveType endp
end _GetDriveType


If you can help me, I will be one happy chappy.


 
Maybe it is a type error :)
....
GetDriveType(&drivetype,drivenum);
printf(&quot;The drive type is %d\n&quot;, drivetype);
...

Regards! zallen@cmmail.com
Long live of freedom!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top