1. Boot&Euphoria...

------=_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>&nbsp;</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>&nbsp;</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 &lt;bios.h&gt; <BR>#include=20
&lt;stdio.h&gt; <BR>&nbsp;<BR>void main() <BR>{=20
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FILE *in;=20
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned char=20
buffer[520];&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if((in =
=3D=20
fopen("bootsect", "rb"))=3D=3DNULL) =
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {=20
sp;&nbsp;&nbsp;&nbsp;=20
printf("Error loading file\n");=20
sp;&nbsp;&nbsp;&nbsp;=20
exit(0); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fread(&amp;buffer, =
512, 1,=20
in);&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
while(biosdisk(3, 0, 0,=20
0, 1, 1, buffer));&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
fclose(in); <BR>} </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3DArial=20
NT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>PQ</FONT></DIV>

------=_NextPart_000_001F_01BF4E57.3717A140--

new topic     » topic index » view message » categorize

2. Re: Boot&Euphoria...

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/

new topic     » goto parent     » topic index » view message » categorize

3. Re: Boot&Euphoria...

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/

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu