Where would I learn C and Assembly?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
john765
Member
Member
Posts: 44
Joined: Mon May 01, 2017 3:56 am

Re: Where would I learn C and Assembly?

Post 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?
no92
Member
Member
Posts: 307
Joined: Wed Oct 30, 2013 1:57 pm
Libera.chat IRC: no92
Location: Germany
Contact:

Re: Where would I learn C and Assembly?

Post 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.
OSwhatever
Member
Member
Posts: 595
Joined: Mon Jul 05, 2010 4:15 pm

Re: Where would I learn C and Assembly?

Post 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.
User avatar
Schol-R-LEA
Member
Member
Posts: 1925
Joined: Fri Oct 27, 2006 9:42 am
Location: Athens, GA, USA

Re: Where would I learn C and Assembly?

Post 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.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
User avatar
MichaelFarthing
Member
Member
Posts: 167
Joined: Thu Mar 10, 2016 7:35 am
Location: Lancaster, England, Disunited Kingdom

Re: Where would I learn C and Assembly?

Post 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.
john765
Member
Member
Posts: 44
Joined: Mon May 01, 2017 3:56 am

Re: Where would I learn C and Assembly?

Post 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?
User avatar
iansjack
Member
Member
Posts: 4706
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Where would I learn C and Assembly?

Post by iansjack »

Why not try it and see?
john765
Member
Member
Posts: 44
Joined: Mon May 01, 2017 3:56 am

Re: Where would I learn C and Assembly?

Post by john765 »

iansjack wrote:Why not try it and see?
It didn't work! :( what else could I use? Please help.
no92
Member
Member
Posts: 307
Joined: Wed Oct 30, 2013 1:57 pm
Libera.chat IRC: no92
Location: Germany
Contact:

Re: Where would I learn C and Assembly?

Post 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 #-o
Lesson: never write forum posts after more than a day's worth of work.
User avatar
iansjack
Member
Member
Posts: 4706
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Where would I learn C and Assembly?

Post 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.
john765
Member
Member
Posts: 44
Joined: Mon May 01, 2017 3:56 am

Re: Where would I learn C and Assembly?

Post 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.
User avatar
eryjus
Member
Member
Posts: 286
Joined: Fri Oct 21, 2011 9:47 pm
Libera.chat IRC: eryjus
Location: Tustin, CA USA

Re: Where would I learn C and Assembly?

Post by eryjus »

john765 wrote:I want to learn C and Assembly
john765 wrote:I know C and Assembly.
In just over 24 hours....
Adam

The name is fitting: Century Hobby OS -- At this rate, it's gonna take me that long!
Read about my mistakes and missteps with this iteration: Journal

"Sometimes things just don't make sense until you figure them out." -- Phil Stahlheber
User avatar
iansjack
Member
Member
Posts: 4706
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Where would I learn C and Assembly?

Post 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. =D>

It's your option; it's your religion; it's your choice. So just do it.
User avatar
matt11235
Member
Member
Posts: 286
Joined: Tue Aug 02, 2016 1:52 pm
Location: East Riding of Yorkshire, UK

Re: Where would I learn C and Assembly?

Post by matt11235 »

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.
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.
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Forum
User avatar
obiwac
Member
Member
Posts: 149
Joined: Fri Jan 27, 2017 12:15 pm
Libera.chat IRC: obiwac
Location: Belgium

Re: Where would I learn C and Assembly?

Post 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.
Post Reply