Page 2 of 5
Re: Where would I learn C and Assembly?
Posted: Tue May 02, 2017 8:28 am
by john765
obiwac wrote:john765 wrote:obiwac wrote:Not to let you down or be mean or anything, but developing an os without any experience with C is probably not a good idea. You should start with smaller projects, so that you can gain experience, and then once you feel comfortable, start the ambitious project of making and os.
Thank you for the advice. By the way, I've tried out AquaOS. It's great. However, there are a few bugs (like when you go into some programs, the OS freezes). Is the shell being worked on because it doesn't work?
Thanks! Indeed there are a lot of bugs and unimplemented features.
. 0xB800 is hexadecimal. You should also probably get used to that. It's quite important.
http://www.wikihow.com/Understand-Hexadecimal The 0x in C just means that what you write after will be considered as hexadecimal.
Good luck!
I know that is hex. I'm fully aware. I know you add a h on the end of something in x86 assembly language. I actually think B8 is the mov instruction. It's a memory address, right?
Re: Where would I learn C and Assembly?
Posted: Tue May 02, 2017 8:58 am
by no92
john765 wrote:I actually think B8 is the mov instruction. It's a memory address, right?
The phrasing of this is really confusing to me. Yes, the primary opcode B8 moves a imm16/32 into eax. However, this is completely unrelated. Going back, apparently you extracted this value from Bare Bones. It is the address of the VGA video buffer. If you would have read
the page that was linked to you, you'd be aware of that. Also, you didn't read Bare Bones thoroughly. It explains why 0xB8000 is relevant and what writing there does. Long story short: yes, it's a memory address, and it's completely unrelated to instruction encoding.
john765 wrote:I know you add a h on the end of something in x86 assembly language.
I'm really picky about this: it depends on the syntax. If you use AT&T syntax (GAS uses this), yes. If you use Intel syntax (nasm, yasm), hex values are written C-Style with the '0x' prefix.
john765 wrote:StudlyCaps, the code in Bare Bones is insane. How did someone know how to do that? What do you have to read to make it run?
You can learn that by reading. You've been pointed to the wiki, so use it. It's the best place to start. After that, some of the most valueable information is obtainable by reading specs and Linux or FreeBSD drivers.
To pick up the title of this thread: you definitely shouldn't (and probably can't) learn C and Assembly on here or the wiki. There are resources dedicated to this, and osdev.org doesn't belong into that category for sure. Also, does this thread have anything to do with Operating System Development? My guess would be that this belongs into General Programming.
Re: Where would I learn C and Assembly?
Posted: Tue May 02, 2017 9:23 am
by OSwhatever
Back in the day when I was a cub I wanted to learn C, however in absence of literature (computer science books was hard to obtain back then) I got to lend a book "Peter Norton's Assembly Language Book for the IBM PC". The book uses an MS-DOS command "debug" which every MS-DOS is shipped with, a simple version of gdb. With that program the book actually goes through the basics and an interactive way and you get a hands on what happens. Despite it is old and uses 16-bit real mode I think that the basics of assembly language is still valid today. After you have read that book you will understand assembler language. This book is good for people who don't understand hexadecimal, 2-complement values, op-codes, registers and so on. If you have already the basics, you will not find the book that informative.
Then you can learn C. I'm not sure what order is the best C first or assembler first.
Re: Where would I learn C and Assembly?
Posted: Tue May 02, 2017 9:46 am
by Schol-R-LEA
no92 wrote:john765 wrote:I know you add a h on the end of something in x86 assembly language.
I'm really picky about this: it depends on the syntax. If you use AT&T syntax (GAS uses this), yes. If you use Intel syntax (nasm, yasm), hex values are written C-Style with the '0x' prefix.
You have it backwards, I'm afraid, though that isn't hard to do. GAS, being a distant descendant the original Unix assembler, uses the C '0x' prefix, while Intel's own assembler, and the Microsoft Macro Assembler (MASM), use the postfix 'h'. Most of the other x86 assemblers, such as NASM or FASM, can use either, though the C format is usually preferred.
Re: Where would I learn C and Assembly?
Posted: Tue May 02, 2017 10:34 am
by MichaelFarthing
And just to be awkward my assembler uses a dollar. I picked this up from Borland's Pascal and find it easier to type and easier to recognise.
Re: Where would I learn C and Assembly?
Posted: Tue May 02, 2017 10:53 am
by john765
http://wiki.osdev.org/Printing_to_Screen seems hard. How do I do the parameter for write_string() function? In my main, do I do
Code: Select all
write_string(0x07, "Hello World!");
or not?
Re: Where would I learn C and Assembly?
Posted: Tue May 02, 2017 11:21 am
by iansjack
Why not try it and see?
Re: Where would I learn C and Assembly?
Posted: Tue May 02, 2017 11:27 am
by john765
iansjack wrote:Why not try it and see?
It didn't work!
what else could I use? Please help.
Re: Where would I learn C and Assembly?
Posted: Tue May 02, 2017 11:27 am
by no92
Schol-R-LEA wrote:You have it backwards, I'm afraid, though that isn't hard to do. GAS, being a distant descendant the original Unix assembler, uses the C '0x' prefix, while Intel's own assembler, and the Microsoft Macro Assembler (MASM), use the postfix 'h'. Most of the other x86 assemblers, such as NASM or FASM, can use either, though the C format is usually preferred.
Oops, appears that I've messed up there. It's the other way around, of course
Lesson: never write forum posts after more than a day's worth of work.
Re: Where would I learn C and Assembly?
Posted: Tue May 02, 2017 11:42 am
by iansjack
john765 wrote:iansjack wrote:Why not try it and see?
It didn't work!
what else could I use? Please help.
Honestly, the Bare Bones tutorial is about as simple as it gets.
You are coming over as wanting hand-holding through the process of writing an OS. It's just not going to happen; there's too much to learn, and this isn't a site for programming beginners.
I think you need to learn how to use C and assembler by writing simple user programs before you get into the relatively advanced world of OS development.
I don't mean to be rude, just realistic.
Re: Where would I learn C and Assembly?
Posted: Tue May 02, 2017 12:43 pm
by john765
iansjack wrote:john765 wrote:iansjack wrote:Why not try it and see?
It didn't work!
what else could I use? Please help.
Honestly, the Bare Bones tutorial is about as simple as it gets.
You are coming over as wanting hand-holding through the process of writing an OS. It's just not going to happen; there's too much to learn, and this isn't a site for programming beginners.
I think you need to learn how to use C and assembler by writing simple user programs before you get into the relatively advanced world of OS development.
I don't mean to be rude, just realistic.
I know C and Assembly.
Also, I didn't ask for your stupid opinion. I asked how to do the thing for write_string() in C from
http://wiki.osdev.org/Printing_to_Screen. You can't even tell me? Insane. I am in reality by the way. It is my option.
That's like judging on my religion. I want to waste my life on OSDev. Otherwise, I wouldn't come here.
Re: Where would I learn C and Assembly?
Posted: Tue May 02, 2017 12:56 pm
by eryjus
john765 wrote:I want to learn C and Assembly
john765 wrote:I know C and Assembly.
In just over 24 hours....
Re: Where would I learn C and Assembly?
Posted: Tue May 02, 2017 1:08 pm
by iansjack
john765 wrote:Also, I didn't ask for your stupid opinion. I asked how to do the thing for write_string() in C from
http://wiki.osdev.org/Printing_to_Screen. You can't even tell me? Insane. I am in reality by the way. It is my option.
That's like judging on my religion. I want to waste my life on OSDev. Otherwise, I wouldn't come here.
How to win friends and influence people.
It's your option; it's your religion; it's your choice. So just do it.
Re: Where would I learn C and Assembly?
Posted: Tue May 02, 2017 1:10 pm
by matt11235
You just said "It didn't work!". As smart as iansjack is, I don't think that he has any telepathic abilities. Maybe if you weren't so rude and actually put some effort in yourself, you'd get some better help.
Re: Where would I learn C and Assembly?
Posted: Tue May 02, 2017 1:22 pm
by obiwac
I really hope this isn't going the luca1 way.
http://forum.osdev.org/viewtopic.php?f= ... 83#p273583
And yes, you are entitled to your opinion. Were just giving advice.