#include "stdio.h"
#include "conio.h"
#include <stdio.h>
#include <dos.h>
#include <conio.h>
#ifdef _cplusplus
#define _CPPARGS ...
#else
#define _CPPARGS
#endif
unsigned char m[512];
void far interrupt (*old)();
void far interrupt new1()
{ int i=0;unsigned char one;
for(i=0;i<512;i++)
{asm mov dx,0x1f0
asm in al,dx
asm mov one ,al
m[i]=one;
}
setvect(0xd,new1);
for(i=0;i<512;i++)
printf("%x",m[i]);
printf("read over");
}
void readdisk(int a,int b,int c,unsigned char *p)
{
one:
asm mov dx,0x1f7
asm in al,dx
asm test al,0x80
asm jnz one
asm mov al,0xa0
asm mov ah,a
asm and al,ah
asm mov dx,0x1f6
asm out dx,al
asm mov al,1
asm mov dx,0x1f2
asm out dx,al
asm mov al,c
asm mov dx,0x1f3
asm out dx,al
asm mov al,b
asm mov dx,0x1f4
asm out dx,al
asm mov al,0
asm mov dx,0x1f5
asm out dx,al
asm mov al,0x20
asm mov dx,0x1f7
asm out dx,al
old=getvect(0xd);
setvect(0xd,new1);
printf("%s",m);
return ;
}
main()
{
printf("Hello, world\n");
readdisk(0,0,1,m);
getch();
}
#include "stdio.h"
#include "conio.h"
#include <stdio.h>
#include <dos.h>
#include <conio.h>
#ifdef _cplusplus
#define _CPPARGS ...
#else
#define _CPPARGS
#endif
unsigned char m[512];
void far interrupt (*old)();
void far interrupt new1()
{ int i=0;unsigned char one;
asm mov al,4
asm out 8,al
asm mov al,0
asm out 0xd,al
asm out 2,al
asm mov al,0x7c
asm out 2,al
asm mov al,0
asm out 0x82,al
asm mov ax,0xff
asm dec ax
asm out 3,al
asm mov al,ah
asm out 3,al
asm mov al,0x49
asm out 0xb,al
asm mov al,0x40
asm out 8,al
asm mov al,3
asm out 0xa,al
two:
asm in al,8
asm and al,8
asm jz two
asm mov al,7
asm out 0xa,al
for(i=0;i<512;i++)
{asm mov dx,0x1f0
asm in al,dx
asm mov one ,al
m[i]=one;
}
setvect(0xd,new1);
for(i=0;i<512;i++)
printf("%x",peekb(0x0,0x7c00+i));
printf("read over");
}
void readdisk(int a,int b,int c,unsigned char *p)
{ int i=0;
asm mov al,4
asm out 8,al
asm mov al,0
asm out 0xd,al
asm out 2,al
asm mov al,0x7c
asm out 2,al
asm mov al,0
asm out 0x82,al
asm mov ax,0xff
asm dec ax
asm out 3,al
asm mov al,ah
asm out 3,al
asm mov al,0x49
asm out 0xb,al
asm mov al,0x40
asm out 8,al
asm mov al,3
asm out 0xa,al
two:
asm in al,8
asm and al,8
asm jz two
asm mov al,7
asm out 0xa,al
for(i=0;i<512;i++)
printf("%x",peekb(0x0,0x7c00+i));