It is currently Thu Dec 14, 2017 6:28 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Questions about x86
PostPosted: Mon Apr 17, 2017 12:26 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6520
Location: Seattle
Developing your own kernel from scratch is a not-infrequent CS class at college.

Yes, you're mostly programming it in C instead of asm, but whatever.


Top
 Profile  
 
 Post subject: Re: Questions about x86
PostPosted: Mon Apr 17, 2017 12:36 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5896
Location: Canada
dougeff wrote:
When was the last time someone programmed an OS all by himself? 1970?

Oh I think we can find more recent examples than that. ;)
http://www.templeos.org/

Edit: oh, gauauu already mentioned it.


Top
 Profile  
 
 Post subject: Re: Questions about x86
PostPosted: Tue Apr 18, 2017 4:24 am 
Offline

Joined: Mon Apr 01, 2013 11:17 pm
Posts: 437
DementedPurple wrote:
How would I know what memory addresses to use for variables?

You would reserve space for them in your data section and then access them by label. The label is replaced with the exact address either when you link your executable file (in most cases), or when the executable file is loaded by Windows (for position-independent code). If you really wanted to, you could tell the linker to put your data at a specific address, but the defaults are good enough most of the time.

DementedPurple wrote:
I'll have to keep in mind that I'll have to have RAM to store the code, and that Windows will be running in the background as well as a few other apps. You could say that I've been spoiled by NES programming by having the code stored in a ROM as well as having the entire system dedicated to your program and not having to share system resources.

Well then, I've got good news for you: Windows provides a dedicated virtual computer for your program to run. You don't have to worry about sharing resources at all.

DementedPurple wrote:
I also want to get into programming BIOS' and operating systems, which leads me to even more questions.

BIOS programming depends on a lot of hardware documentation, which isn't always available. By comparison, operating system programming is a lot more reasonable. Most of the information you need for that is freely available (someone else already linked osdev.org).

DementedPurple wrote:
How do I read and write from a hard disk or CD?

This is not something I could explain in a single post!

DementedPurple wrote:
And how do I know what memory addresses to use for code and variables?

If you're developing a BIOS, you would know what memory is available because you've configured the hardware and determined how much memory is available and where it's mapped. If you're developing an operating system, you would know because the BIOS will tell you (but you might need to ask it in a specific way).

DementedPurple wrote:
How would I run C code?

Load the code to its expected memory address (applying relocations if necessary), set up any other initial things it expects (e.g. a stack), and call its entry point.

DementedPurple wrote:
I'm kind of a noob.

We all start somewhere.


Top
 Profile  
 
 Post subject: Re: Questions about x86
PostPosted: Tue Apr 18, 2017 7:43 am 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2982
Location: Tampere, Finland
Joe wrote:
The label is replaced with the exact address (...) when the executable file is loaded by Windows (for position-independent code).

Pedantry: You described relocatable code. Position-independent can execute at an arbitrary address, without needing relocation patches.

_________________
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: kkfos.aspekt.fi


Top
 Profile  
 
 Post subject: Re: Questions about x86
PostPosted: Wed Apr 19, 2017 6:37 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1868
Location: DIGDUG
http://mikeos.sourceforge.net/write-your-own-os.html

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
 Post subject: Re: Questions about x86
PostPosted: Fri Apr 21, 2017 7:15 pm 
Offline
User avatar

Joined: Sat Feb 16, 2013 11:52 am
Posts: 235
I've always wondered if a vanity OS project for the NES would be possible, especially one of the multitasking kind. How would you switch between processes? APU timer? How do you protect the system against code writing to hardware directly when there's absolutely no way you'd be able to check code against it in a viable manner?

_________________
This is a block of text that can be added to posts you make. There is a 255 character limit.


Top
 Profile  
 
 Post subject: Re: Questions about x86
PostPosted: Fri Apr 21, 2017 7:23 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6520
Location: Seattle
Punch wrote:
I've always wondered if a vanity OS project for the NES would be possible, especially one of the multitasking kind.
There used to be a port of Contiki to the NES (and a bunch of other ridiculous other 6502-based systems) but they weren't very useful and weren't maintained when Contiki went from version 1.0 to version 2.0

Quote:
How would you switch between processes? APU timer?
Preemptive multitasking isn't necessarily required...

Quote:
How do you protect the system against code writing to hardware directly when there's absolutely no way you'd be able to check code against it in a viable manner?
You're correct; you can't provide protection without a hardware assist, or running everything in a VM of some sort.


Top
 Profile  
 
 Post subject: Re: Questions about x86
PostPosted: Mon Apr 24, 2017 10:29 am 
Offline

Joined: Mon Jan 30, 2017 5:20 pm
Posts: 303
Location: Colorado USA
One of the problems I have is that when I look up how to do stuff, It comes up with a bombardment of big words I don't understand, and when I look up those terms, I get one bombardment answered with another bombardment of complicated terms, in other words, It's practically impossible to get basic answers to basic questions.


Top
 Profile  
 
 Post subject: Re: Questions about x86
PostPosted: Mon Apr 24, 2017 10:36 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6520
Location: Seattle
x86, such as it is, is the result of 36 years of gradual evolution and rarely any deprecation. Learning, from scratch, how to write something for the modern version we interact with is going to be much harder than, say, trying to write something that would target the PCjr's game cartridges.


Top
 Profile  
 
 Post subject: Re: Questions about x86
PostPosted: Mon Apr 24, 2017 10:38 am 
Offline
User avatar

Joined: Sat Feb 16, 2013 11:52 am
Posts: 235
DementedPurple wrote:
One of the problems I have is that when I look up how to do stuff, It comes up with a bombardment of big words I don't understand, and when I look up those terms, I get one bombardment answered with another bombardment of complicated terms, in other words, It's practically impossible to get basic answers to basic questions.


You'd love Graph Theory where everyone uses their own incompatible terms... complex papers are basically 50% explaining your own notation :lol:

_________________
This is a block of text that can be added to posts you make. There is a 255 character limit.


Top
 Profile  
 
 Post subject: Re: Questions about x86
PostPosted: Mon Apr 24, 2017 10:39 am 
Offline

Joined: Sun Mar 27, 2011 10:49 am
Posts: 219
Location: NYC
Put another way, you're trying to do really hard stuff, so questions you think are basic just plain aren't, and that's why there's no basic answers.


Top
 Profile  
 
 Post subject: Re: Questions about x86
PostPosted: Thu May 11, 2017 10:57 am 
Offline
User avatar

Joined: Sun Nov 09, 2008 9:18 pm
Posts: 1013
Location: Pennsylvania, USA
The following book may interest you: Assembly Language: Step by Step. With the modern version, you'd have to install VirtualBox and put Linux on it on your windows machine (or dual boot) to work through the tutorials. Alternatively, you could use the old Dos version of the book and a VirtualBox image I prepared with all the necessary tools (except the text editor shown in the old book, instead edit.com is provided).

One problem with getting into coding at a young age today is I imagine one feels quite overwhelmed with options. When I was 13, pretty much the only thing readily available at the time with a reasonable learning curve was QBasic. As mentioned in another thread, I personally think Pico-8 (also: video series) probably is best these days, but, dive into a few things and see which one you enjoy most/progress in most and then stick with that for a while. :)


Top
 Profile  
 
 Post subject: Re: Questions about x86
PostPosted: Fri May 12, 2017 5:00 am 
Offline

Joined: Mon May 27, 2013 9:40 am
Posts: 363
I agree. Pico-8 is the best platform to get started in game programming nowadays.

_________________
http://www.mojontwins.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: Bing [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group