Page 2 of 3

Re: Help with binary (loops?)

Posted: Wed Apr 06, 2011 5:11 am
by Chandra
abraker95 wrote:Opening a nutshell might be a VERY big struggle, but with a nutcracker or another reasonable tool you can easily get to the good stuff inside... in this case I'm trying to do it with bare hands, with everybody turning their back on me
No, no one is turning their back. That simply is your perception. Searching is the first step to learning, which you obviously lack. How wise is it to chose Turbo C as a tool to develop an OS? I know you've lots of options with compiler (GCC, Watcom C or probably Intel C Compiler) but I'm sure Turbo C comes nowhere in that list. Moreover, you seem to lack dedication and the reason being, if you'd ever glanced at the Wiki, I'm sure you'd have been pointed out to GCC. So, my recommendation here, is to grab a better tool (most of us prefer GNU C Compiler) read its manual, write plenty of user space programs with it and when you're ready, take off.

Best Regards,
Chandra

Re: Help with binary (loops?)

Posted: Wed Apr 06, 2011 6:21 am
by abraker95
Then using a MinGW compiler, how do you generate a 16 bit file?

Re: Help with binary (loops?)

Posted: Wed Apr 06, 2011 6:59 am
by Combuster
*waves hand*
They be not the 16-bit apps you are looking for.


Seriously, follow the tutorial before trying to deviate from it.

Re: Help with binary (loops?)

Posted: Thu Apr 07, 2011 5:32 am
by Chandra
abraker95 wrote:Then using a MinGW compiler, how do you generate a 16 bit file?
.code16gcc can help to some extent, if used correctly. It tells the GNU assembler to generate 16-bit instructions. But if you plan to run you code on anything before 80386, it won't work. The only remaining option is to drop down to an assembler and take control over your machine.

Re: Help with binary (loops?)

Posted: Thu Apr 07, 2011 6:47 am
by abraker95
Isn't Intel 80386 AKA i386 32 bit (the first 32 bit processor by Intel)? So I don't see the connection between the 32 bit processor I have right now and i386 and 16 bit. :?

I know Turbo C allows me to do operations such as write to vid ram, which I've never found how to do in MinGW. That's why I use it instead of MinGW. AT&T ASM is also annoying in MinGW.

Re: Help with binary (loops?)

Posted: Thu Apr 07, 2011 7:22 am
by Solar
i386 is a synonym for IA32, Intel's 32bit architecture that was introduced with the Intel 80386.

But even a Pentium IV starts in real mode, i.e. running in 16bit mode until triggered to switch to 32bit mode (something most bootloaders can do for you, or you could do yourself with a couple of lines of ASM).

Not being able to figure something out (writing to video mem) is a reason to ask for help. Doing a workaround (TurboC) and then asking how to get the workaround going as you encounter problems will result in people poking you for the core of the problem (writing to video mem...).

Re: Help with binary (loops?)

Posted: Thu Apr 07, 2011 8:47 am
by abraker95
Ok, how do you do access vid ram in MinGW using C++?

Re: Help with binary (loops?)

Posted: Thu Apr 07, 2011 9:34 am
by Solar
Have you had a look at the Wiki?
However, I recommend starting at the Main Page...

Re: Help with binary (loops?)

Posted: Thu Apr 07, 2011 11:56 am
by abraker95
Just tried the following:
Printing to Screen
Drawing In Protected Mode

Runtime error... I'm in protected mode. I don't know how to easily switch to real mode.

Translating this: http://wiki.osdev.org/Real_Mode to AT&T might be a pain :(

Re: Help with binary (loops?)

Posted: Thu Apr 07, 2011 3:35 pm
by Combuster
abraker95 wrote:Drawing In Protected Mode
Runtime error... I'm in protected mode. I don't know how to easily switch to real mode.
You have the right tutorial for the right mode, and you still want to switch to real mode to execute protected mode code?!

Image

Seriously, OS Development has an IQ requirement. You don't seem to meet it, or you pretend not to meet it as Chandra pointed out. If you either can't or don't want to, both options mean that you're better off doing something else.

Re: Help with binary (loops?)

Posted: Thu Apr 07, 2011 7:29 pm
by abraker95
:shock: :oops:
You have the right tutorial for the right mode, and you still want to switch to real mode to execute protected mode code?!
:?: I guess I need more description on how to do it.

How about putting it baby steps?
Step 1: How to enter the real mode
Step 2: Using C++ write/access vid mem
Step 3: Any compile/link options?
Step 4: Making sure that runtime error won't appear

Honestly I like when stuff are straight forward, having to search all over the place and trying 10+ examples to get the same result gets a bit tiring.

Re: Help with binary (loops?)

Posted: Thu Apr 07, 2011 9:03 pm
by gerryg400
Writing a simple O/S takes many hundreds (maybe thousands) of man-hours. If you're finding it a 'bit tiring' at this point trying 10+ examples then you have a problem. I'm not sure you will make it.

Re: Help with binary (loops?)

Posted: Fri Apr 08, 2011 6:17 am
by abraker95
Writing a simple O/S takes many hundreds (maybe thousands) of man-hours. If you're finding it a 'bit tiring' at this point trying 10+ examples then you have a problem. I'm not sure you will make it.
I think there is a difference between searching and coding.
It is also on the wiki.
Where do you see THESE baby steps in there:
Step 1: How to enter the real mode
Step 2: Using C++ write/access vid mem
Step 3: Any compile/link options?
Step 4: Making sure that runtime error won't appear
You gave me asm not c++

Re: Help with binary (loops?)

Posted: Fri Apr 08, 2011 6:49 am
by Karlosoft
If you read the articles perhaps you can find the information you need.
http://wiki.osdev.org/Real_mode
Go a bit down, there is the code to return in real mode. Oh yes no C++ code here, some operation are better performed in ASM.
Step 2: Using C++ write/access vid mem
With a pointer? The video mem is mapped in your ram at the addresses you can find in the wiki
However... 0xb8000 physical address for textual modes and 0xa0000 for graphic modes. This is all.

I used TCC too to write my bootoloader, but I got no error at compiling time and linking time. Can you show us your current configuration?

Re: Help with binary (loops?)

Posted: Fri Apr 08, 2011 7:03 am
by neon
I think there is a difference between searching and coding.
Yes, and programming involves both. Get used to it.
Step 1: How to enter the real mode
The CPU starts in real mode. Unless you have already entered protected mode, there is no reason nor necessity to enter real mode.