Mixing I/Os...
Posted: Fri Nov 23, 2001 12:00 am
Hello,
I just wrote out a simple OS laoder and kernel,
loader in asm (by nasm), kernel in c (by gcc). And
I've defined my I/Os - the two very basic ones, getc(),
and putc(). When I do my getc(), the code I've defined
looks like (in c):
char getch(void)
{
char ch;
ch=getc();
putc(ch);
return ch;
}
void setup()
{
char ch;
/* putc(some info) */
/* this is the problem */
ch=getch();
/* the program froze after this point */
puts("whatever...\n\r");
}
and the asm definition of getc() is:
global _getc
_getc:
push bp
mov bp,sp
xor ax,ax
int 0x16
leave
ret
for some reason, the code works if i directly use
it in my setup() function.. and does not work when
i try to make a function and use getc() in it...
you can see a copy of the entire OS on
http://www.sf.net/projects/zoftos/
and try to find the release section...
Thanks,
Ben Hsu
I just wrote out a simple OS laoder and kernel,
loader in asm (by nasm), kernel in c (by gcc). And
I've defined my I/Os - the two very basic ones, getc(),
and putc(). When I do my getc(), the code I've defined
looks like (in c):
char getch(void)
{
char ch;
ch=getc();
putc(ch);
return ch;
}
void setup()
{
char ch;
/* putc(some info) */
/* this is the problem */
ch=getch();
/* the program froze after this point */
puts("whatever...\n\r");
}
and the asm definition of getc() is:
global _getc
_getc:
push bp
mov bp,sp
xor ax,ax
int 0x16
leave
ret
for some reason, the code works if i directly use
it in my setup() function.. and does not work when
i try to make a function and use getc() in it...
you can see a copy of the entire OS on
http://www.sf.net/projects/zoftos/
and try to find the release section...
Thanks,
Ben Hsu