1. Boot&Euphoria...
- Posted by PQ <quistnet at HOTMAIL.COM> Dec 24, 1999
- 432 views
- Last edited Dec 25, 1999
------=_NextPart_000_001F_01BF4E57.3717A140 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hy, It's been a long time since I checked the mailing list, so I'm not so up = to date of the newest development, but I have a question... Is there a way to change this C code into Euphoria without using ASM, = and with? ----------------------------------------------------- #include <bios.h>=20 #include <stdio.h>=20 =20 void main()=20 {=20 FILE *in;=20 unsigned char buffer[520];=20 if((in =3D fopen("bootsect", "rb"))=3D=3DNULL)=20 {=20 printf("Error loading file\n");=20 exit(0);=20 }=20 fread(&buffer, 512, 1, in);=20 while(biosdisk(3, 0, 0, 0, 1, 1, buffer));=20 fclose(in);=20 }=20 ----------------------------------------------------- Thanks, PQ QC ------=_NextPart_000_001F_01BF4E57.3717A140 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-1" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>Hy,</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>It's been a long time since I checked = the mailing=20 list, so I'm not so up to date of the newest development, but I have a=20 question...</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>Is there a way to change this C code = into Euphoria=20 without using ASM, and with?</FONT></DIV> <DIV><FONT face=3DArial=20 V> <DIV><FONT face=3DArial size=3D2>#include <bios.h> <BR>#include=20 <stdio.h> <BR> <BR>void main() <BR>{=20 <BR> FILE *in;=20 <BR> unsigned char=20 buffer[520]; <BR> if((in = =3D=20 fopen("bootsect", "rb"))=3D=3DNULL) = <BR> {=20 sp; =20 printf("Error loading file\n");=20 sp; =20 exit(0); <BR> =20 } <BR> fread(&buffer, = 512, 1,=20 in); <BR> = while(biosdisk(3, 0, 0,=20 0, 1, 1, buffer)); <BR> =20 fclose(in); <BR>} </FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2><FONT face=3DArial=20 NT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>PQ</FONT></DIV> ------=_NextPart_000_001F_01BF4E57.3717A140--
2. Re: Boot&Euphoria...
- Posted by JJProg at CYBERBURY.NET Dec 24, 1999
- 370 views
- Last edited Dec 25, 1999
EU>Hy, EU>It's been a long time since I checked the mailing list, so I'm not so up to EU>Is there a way to change this C code into Euphoria without using ASM, and wi EU>----------------------------------------------------- EU>#include <bios.h> EU>#include <stdio.h> EU> EU>void main() EU>{ EU> FILE *in; EU> unsigned char buffer[520]; EU> if((in = fopen("bootsect", "rb"))==NULL) EU> { EU> printf("Error loading file\n"); EU> exit(0); EU> } EU> fread(&buffer, 512, 1, in); EU> while(biosdisk(3, 0, 0, 0, 1, 1, buffer)); EU> fclose(in); EU>} EU>----------------------------------------------------- EU>Thanks, EU>PQ EU>QC biosdisk calls the bios disk interrupt (13h). I don't think it is possible to do without ASM, but it should be fairly simple. I'm no ASM expert, but I think you could probably do something like this: pushad ; save all the registers mov register, 0 ; put the right values into the registers int 13h ; call the interrupt mov edi 0 ; put the address for the return value here mov BYTE PTR [edi], ah ; put the return value into memory Then compile it with asm.e, and find where series of 0's are, and poke in the appropriate values. Then poke in the address returned by allocate(0) where 0 in mov edi, 0 is, and call it. Jeffrey Fielding JJProg at cyberbury.net http://members.tripod.com/~JJProg/
3. Re: Boot&Euphoria...
- Posted by JJProg at CYBERBURY.NET Dec 24, 1999
- 382 views
- Last edited Dec 25, 1999
A word of caution: make sure you are using the right disk number. According to the libc reference in RHIDE, 0x80 can be used as a disk number. I would guess that this is either the first floppy disk or the first hard disk, and that 0 is not either of these (you're using 0 as the second argument in the code you sent). Jeffrey Fielding JJProg at cyberbury.net http://members.tripod.com/~JJProg/