I/O Problem
Posted: Sun Dec 30, 2001 12:00 am
Hello,
I've posted a problem with my printf() and
haven't heard any response so I skipped printf()
and begin initializing the system by enabling A20,
implementing other input functions like getch().
My initializer is jump by doing the following:
; transfer control to kernel setup program
mov ax,0x4000
mov es,ax
mov ds,ax
cli
mov ss,ax
mov sp,0x0000
sti
push ax
mov ax,0
push ax
retf
The targeted code is then written with DJGPP gcc using
-ffreestanding and linked with other assembly and
gcc pieces compiles as coff.
I've implemented some simple I/O function as cli(),sti(),
iret(),putc(),puts(), and getc(). But for some reason
all output is ok and all input gives me forever loops
when booting. I tried the codes on Bochs, and it gave
me an error message of trying to output to port 0x00000083
with a value of 0x02. Sometimes it gave me an error
code with CS.limit>(a number, which I think is 64k or something like that).
After skipping most of the keyboard input stuff, I then
begin thinking of trying to get my memory design started
with A20, but then I discoveed that all outputs with
outb or inb is not really working and they all give
an error message of output to port 0x00000082 (somewhere close to this port)
and with the value 0x02. Is there anything that have
to be done before the c code can come in and take over?
Because it seemed to me that I need to setup something before
the C code function properly.
There is a CVS and download copy of the codes mentioned above at
http://zoftos.sf.net/ , the CVS is the newest with
the printf() and several new I/O I've just implemented.
The download version is a booting version that does not
have all the I/O implemented. I've written the compilation
procedures in DOS batch files, and nasm, gcc, and partcopy is
required to do compilation. Meanwhile, I'll be trying
out going into pmode and intializes A20 with assembly
before jumping into the C code and see what happens.
Any comment or help is appreciated, Thanks!
Ben Hsu
I've posted a problem with my printf() and
haven't heard any response so I skipped printf()
and begin initializing the system by enabling A20,
implementing other input functions like getch().
My initializer is jump by doing the following:
; transfer control to kernel setup program
mov ax,0x4000
mov es,ax
mov ds,ax
cli
mov ss,ax
mov sp,0x0000
sti
push ax
mov ax,0
push ax
retf
The targeted code is then written with DJGPP gcc using
-ffreestanding and linked with other assembly and
gcc pieces compiles as coff.
I've implemented some simple I/O function as cli(),sti(),
iret(),putc(),puts(), and getc(). But for some reason
all output is ok and all input gives me forever loops
when booting. I tried the codes on Bochs, and it gave
me an error message of trying to output to port 0x00000083
with a value of 0x02. Sometimes it gave me an error
code with CS.limit>(a number, which I think is 64k or something like that).
After skipping most of the keyboard input stuff, I then
begin thinking of trying to get my memory design started
with A20, but then I discoveed that all outputs with
outb or inb is not really working and they all give
an error message of output to port 0x00000082 (somewhere close to this port)
and with the value 0x02. Is there anything that have
to be done before the c code can come in and take over?
Because it seemed to me that I need to setup something before
the C code function properly.
There is a CVS and download copy of the codes mentioned above at
http://zoftos.sf.net/ , the CVS is the newest with
the printf() and several new I/O I've just implemented.
The download version is a booting version that does not
have all the I/O implemented. I've written the compilation
procedures in DOS batch files, and nasm, gcc, and partcopy is
required to do compilation. Meanwhile, I'll be trying
out going into pmode and intializes A20 with assembly
before jumping into the C code and see what happens.
Any comment or help is appreciated, Thanks!
Ben Hsu