[syslinux] Can not use read file SYSLINUX API call
Phung Chi Kien
kienpc at dubmail.net
Sun Sep 14 22:57:13 PDT 2003
Hi Peter Anvin
I tried to use open file and read file SYSLINUX API. But it always make my
PC104 freeze. My snip code :
================================================
int __start(void)
{
int ax,cx,dx,es,si,di,t;
com32sys_t inreg,outreg;
memset(&inreg, 0, sizeof inreg);
memset(&outreg, 0, sizeof outreg);
strcopy(__com32.cs_bounce, "test.txt");
inreg.eax.w[0] = 0x0006; // Open file
inreg.esi.w[0] = OFFS(__com32.cs_bounce);
inreg.es = SEG(__com32.cs_bounce);
__com32.cs_intcall(0x22, &inreg, &outreg);
si = outreg.esi.w[0];
cx = outreg.ecx.w[0];
ax = outreg.eax.w[0];
if ((ax % cx) == 0)
t = ax / cx;
else
t = (ax / cx) + 1;
memset(&inreg, 0, sizeof inreg);
inreg.esi.w[0] = si;
inreg.ecx.w[0] = t;
inreg.eax.w[0] = 0x0007; // Read file
inreg.ebx.w[0] = OFFS(__com32.cs_bounce);
inreg.es = SEG(__com32.cs_bounce);
__com32.cs_intcall(0x22, &inreg, NULL);
memset(&inreg, 0, sizeof inreg);
inreg.eax.w[0] = 0x0002; // Write content of file to console
inreg.ebx.w[0] = OFFS(__com32.cs_bounce);
inreg.es = SEG(__com32.cs_bounce);
__com32.cs_intcall(0x22, &inreg, NULL);
memset(&inreg, 0, sizeof inreg);
inreg.eax.w[0] = 0x000C; // Clean up
inreg.edx.w[0] = 0x0000;
__com32.cs_intcall(0x22, &inreg, NULL);
..........................
=========================================
Please tell me where is the error in my codes.
Thanks very much
Phung Chi Kien
Automation Institute
Hanoi
Vietnam
More information about the Syslinux
mailing list