Displaying Source Code(s)
|
|
Program to Implement Seek Command.
--------------------------------------------------------------------------------
# include<iostream.h>
# include<stdio.h>
# include<conio.h>
# include<stdlib.h>
# include<dos.h>
void main()
{
clrscr();
union REGS regs;
int ans;
char arr[1000];
outp(0x3f2,0x1c); //Motor On
delay(200);
outp(0x3f5,0x0f); //Command Code
delay(200);
outp(0x3f5,0x00); //Command Code
delay(200);
outp(0x3f5,0x0b); //Cylinder no.
delay(200);
outp(0x3f5,0x08); //Sense Interrupt Command
delay(200);
ans=inp(0x3f5); //Reading ST0 in data register
// cout<<endl<<hex<<ans;
delay(100);
ans=inp(0x3f5); //pcn
cout<<endl<<hex<<ans;
outportb(0x12,0); /*initialization of DMA Mode*/
outportb(0x11,10); /*supplying Mode Byte*/
clrscr();
int ar=FP_OFF(arr);
int ar1=FP_SEG(arr);
printf(" %x",ar1);
regs.h.ch = (ar1)&(0x0f00);
printf(" %x",(regs.h.ch));
regs.x.ax = regs.h.ah+ar;
(regs.h.ch)++;
printf(" %x",regs.x.ax);
int z = (regs.x.ax) & (0x0f00);
cout<<"<BR><<z;
getch();
outportb(0x04,regs.h.al);
outportb(0x04,regs.h.ah);
outportb(0x81,regs.h.ch);
outportb(0x05,1);
// dma end
outp(0x3f2,0x0c); //Motor off
return;
}
|
|
|