Page 1 of 1
Strange start
Posted: Fri Jul 05, 2002 3:25 pm
by cometkeeper
I have a strange problem with my loader. I'm using the gcc compiler. I simply want to write a string when the boot starts. I used the int 10h services to changing video modes, moving cursor position and writing characters on screen. I noticed a strange fact: There are some int 10h services that seem do not work. the 0x0 function, for example works, but the 0x2 and 0x9 functions seem don't work. a simple trace of the code I'm using is:
mov ah,0x0
mov al,0x1
int 10h
this works, I can see the video mode changes.
mov ah,0x02
mov bh,0x0
mov dx,0x0505
int 10h
This seems do not work because the cursor stays where it is.
The strange fact is that when I compile it and run on windows, with gcc the program works correctly, when I compile it for the loader it doesn't work. To compile a binary version I use the command:
gcc -c loader.c
ld loader.o -o loader.bin -oformat binary -Ttext 0x100000
Maybe there is some thing I bad understood.
Can someone help me?
Thank you...
Re:Strange start
Posted: Mon Jul 08, 2002 5:29 am
by Pype.Clicker
calling BIOS (16 bits service in real-mode) from gcc-generated (32bits protected mode compiler) seems a weird mixing IMHO...
Re:Strange start
Posted: Mon Jul 08, 2002 10:41 am
by Comet Keeper
You were right... I wrote a simple program in asm to simply move the cursor position (one of things that didn't work). I tired to compile it with Nasm (16-bit I suppos !?) and the program works right.
So, is there a different int service for protected mode?
Where can I found information about calling 32bit services?
Thank you...
- Sorry, but I'm quite out from protected mode
-
Comet Keeper - Italy
Re:Strange start
Posted: Tue Jul 09, 2002 1:43 am
by Pype.Clicker
Well, you basically have 2 options:
- dive into the wonderland of VGA register, find out what a CRT and a character sequencer are and directly talk to your hardware with an opcode-gun on his head and tell him "now move the cursor at (40,12)" ... A google search on "VGA registers" should save your life (lot of PC bibles have very clear infos on this ...)
- just use the "virtual mode" (v86) to call realmode services from protected mode. Environment like DPMI allows you to do this (for instance), but be aware that reimplementing a good V86 manager is tricky as hell! Thus if what you plan to do is a brand-new OS that will kill Windows, this might not be the right option as you'll become dependent on Windows/DjDelorie ...
Re:Strange start
Posted: Mon Jul 15, 2002 9:50 am
by cometkeeper
Heeeelp!!!!
I'm still having problems with my compilers. The syntax seems to be different between the compilers. NASM gives errors that gcc doesn't give. I'd like to mix C with asm, so I'm trying to use gcc under Linux, but when I boot the kernel I don't see any result.
The question is:
What is the best compiler to writing an OS?
I also would like to be able to use BIOS services like int 10, to write less code etc...
Thenk you
Comet - Italy
Re:Strange start
Posted: Mon Jul 15, 2002 12:44 pm
by Pype.Clicker
cometkeeper wrote:
Heeeelp!!!!
I'm still having problems with my compilers. The syntax seems to be different between the compilers. NASM gives errors that gcc doesn't give. I'd like to mix C with asm, so I'm trying to use gcc under Linux, but when I boot the kernel I don't see any result.
The syntax *is* different: Nasm uses a variant of Intel syntax (mov eax,[ebx+12]) while gcc uses AT&T syntax, as well as GAS does (movl 12(%ebx), %eax).
If you're happy with AT&T syntax, GAS+GCC will be the best choice. If you need to do some inline-assembly in C (gcc) and that you're a nasm-friend, i suggest you to write your code in nasm, assemble it, and disassemble it with objdump to get the AT&T syntax
see
this post for more infos...
Re:Strange start
Posted: Tue Jul 16, 2002 9:36 am
by cometkeeper
OK, I think it would better explain things as they really are:
I have some eyesight problems, so it is quite hard sailing through the internet to search for docs, apps, etc...
I would be very glad if anyone could give me the right web-addresses for docs and apps. Thus I could optimize my eyesight use.
I think the better way for me would be intel asm, but I believe I don't having a good NASM distribution...
I'm sorry to mention these kind of argoments in this topics, but this is the truth
Thank you very much...
Comet - Italy