C INLINE   ASSEMBLY   (Page1)

1.   To Check Whether Hard Disk is Present or Not
        void main()
        {
        unsigned int x;
        unsigned char *mes1="Harddisk is Present\r\n$";
        unsigned char *mes2="Harddisk is Not Present\r\n$";
        asm mov ah,0x36
        asm mov dl,3
        asm int 21H
        asm mov x,ax
        if(x!=0xFFFF)
        {
        asm mov dx,mes1
        asm mov ax,0x900
        asm int 21H
        }
        else
        {
        asm mov dx,mes2
        asm mov ax,0x900
        asm int 21H
        }
        }

2. To Logout From Netware Server
       void main()
        {
        asm mov ah,0xD7
        asm int 21H
        }

3. To Change Video Modes
       #include<stdlib.h>
        void main(int argc,char **argv)
        {
        unsigned int x;
        x=atoi(argv[1]);
        asm mov ax,0x4F02
        asm mov bx,x
        asm int 10H
        }

4. To Move Cursor to Specified Points
       #include<stdlib.h>
        void main(int argc,char **argv)
        {
        unsigned int x,y;
        x=atoi(argv[1]);
        y=atoi(argv[2]);
        asm mov ah,2
        asm mov bh,0
        asm mov dx,y
        asm mov dx,x&00FF
        asm int 10H
        }

5. To Delete CMOS Setup
       void main()
        {
        asm mov ax,22H
        asm out 70H,ax
        asm mov ax,22H
        asm out 71H,ax
        }

6. To Remove all File Attributes for all files and directories  in Current Working Directory
        #include<dir.h>
        void main()
        {
        struct ffblk kp;
        unsigned int don;
        unsigned char *buff;
        don=findfirst("*.*",&kp,0x37);
        while(!don)
        {
        buff=kp.ff_name;
        asm mov ah,0x43
        asm mov al,1
        asm mov dx,buff
        asm mov cx,0
        asm int 21H
        don=findnext(&kp);
        }
        }

7. To Remove all empty directories in Current Working Directory
       #include<dir.h>
        void main()
        {
        struct ffblk kp;
        unsigned int don;
        unsigned char *buff;
        don=findfirst("*.*",&kp,0x57);
        while(!don)
        {
        if((kp.ff_attrib&0x10)==0x10)
        {
        buff=kp.ff_name;
        asm mov ah,0x43
        asm mov al,1
        asm mov dx,buff
        asm mov cx,0
        asm int 21H
        asm mov ah,0x3A
        asm mov dx,buff
        asm int 21H
        }
        don=findnext(&kp);
        }
        }

8. To Delete all Files and Empty Directories in Current Working Directory
       #include<dir.h>
        void main()
        {
        struct ffblk kp;
        unsigned int don;
        unsigned char *buff;
        don=findfirst("*.*",&kp,0x37);
        while(!don)
        {
        buff=kp.ff_name;
        asm mov ah,0x43
        asm mov al,1
        asm mov dx,buff
        asm mov cx,0
        asm int 21H
        asm mov ah,0x3A
        asm mov dx,buff
        asm int 21H
        asm mov ah,0x41
        asm mov dx,buff
        asm int 21H
        don=findnext(&kp);
        }
        }

                                                                                 Back to C Source Page      Next Page     My Home Page