#include <stdio.h> #include <conio.h> #include <dos.h> #include <mem.

h> unsigned char startbootmask[] = { 0xeb, 0x35 , 0x90, }; /* 0000 /* 0002 jmp nop 0037 */ */

unsigned char progbootmask[] = { 0xfa, /* 0037 cli(clear interrupt) interrupt'i saglayan bayrak temizlenir */ 0xb8 , 0x30,0x00, /* 0038 mov ax,0030 stackayarlari yapiliyor*/ 0x8e, 0xd0, /* 003b mov ss,ax */ 0xbc,0xfc, 0x00, /* 003d mov sp,00fc */ 0xfb, /* 0040 sti(set interrupt) interrupt'larin olanakli olmasini saglar */ 0x0e, /* 0041 push cs */ 0x1f, /* 0042 pop ds */ 0xbe,0x66,0x7c, /* 0043 mov si,7c66 */ 0xb4,0x0e, /* 0046 mov ah,0e */ 0xfc, /* 0048 cld(clear direction flag) */ 0xac, /* 0049 lodsb */ 0x0a,0xc0, /* 004a or al,al */ 0x74,0x04, /* 004c jz 0052sifir ise atla */ 0xcd,0x10, /* 004e int 10 */ 0xeb,0xf7, /* 0050 jmp 0049 */ 0x9b, /* 0052 wait */ }; char goru_nen[]="duygu dos system is starting...."; int islem(){ int i; char bellek[512]; memset(bellek, 0, (int) 512 );//bellek ile belirtilen adresi 512 tane 0 karekteri basar. if (absread(0, 1, 0, &bellek) != 0)//diski okuyarak hata kontrolu yapar. perror("disket yok yada bozuk"); else { memcpy( bellek,startbootmask,sizeof(startbootmask)); memcpy( &bellek[102-sizeof(progbootmask)], progbootmask, sizeof(progbootmask)); memcpy( &bellek[102],goru_nen,sizeof(goru_nen)); printf("yaziliyor..."); delay(1000); if (abswrite(0, 1, 0,&bellek) != 0) perror ("\r diskette hata var"); else printf("\r yazildi. \n"); gotoxy(12,12);printf("devam etmek icin bir tusa basiniz..."); getch(); } return 0; }

int main () { char bellek[512]; clrscr(); printf("bir disket yerlestirip herhangi bir tusa basiniz\n"); getch(); islem(); return 0; }

Sign up to vote on this title
UsefulNot useful