Questions about x86
Moderator: Moderators
Re: Questions about x86
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.
Yes, you're mostly programming it in C instead of asm, but whatever.
- rainwarrior
- Posts: 8735
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: Questions about x86
Oh I think we can find more recent examples than that.dougeff wrote:When was the last time someone programmed an OS all by himself? 1970?
http://www.templeos.org/
Edit: oh, gauauu already mentioned it.
Re: Questions about x86
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:How would I know what memory addresses to use for variables?
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'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.
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:I also want to get into programming BIOS' and operating systems, which leads me to even more questions.
This is not something I could explain in a single post!DementedPurple wrote:How do I read and write from a hard disk or CD?
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:And how do I know what memory addresses to use for code and variables?
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:How would I run C code?
We all start somewhere.DementedPurple wrote:I'm kind of a noob.
Re: Questions about x86
Pedantry: You described relocatable code. Position-independent can execute at an arbitrary address, without needing relocation patches.Joe wrote:The label is replaced with the exact address (...) when the executable file is loaded by Windows (for position-independent code).
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
Re: Questions about x86
nesdoug.com -- blog/tutorial on programming for the NES
Re: Questions about x86
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.
Re: Questions about x86
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.0Punch wrote:I've always wondered if a vanity OS project for the NES would be possible, especially one of the multitasking kind.
Preemptive multitasking isn't necessarily required...How would you switch between processes? APU timer?
You're correct; you can't provide protection without a hardware assist, or running everything in a VM of some sort.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?
-
- Posts: 318
- Joined: Mon Jan 30, 2017 5:20 pm
- Location: Colorado USA
Re: Questions about x86
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.
Re: Questions about x86
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.
Re: Questions about x86
You'd love Graph Theory where everyone uses their own incompatible terms... complex papers are basically 50% explaining your own notationDementedPurple 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.
This is a block of text that can be added to posts you make. There is a 255 character limit.
-
- Posts: 271
- Joined: Sun Mar 27, 2011 10:49 am
- Location: Victoria, BC
Re: Questions about x86
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.
- GradualGames
- Posts: 1106
- Joined: Sun Nov 09, 2008 9:18 pm
- Location: Pennsylvania, USA
- Contact:
Re: Questions about x86
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.
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.
Re: Questions about x86
I agree. Pico-8 is the best platform to get started in game programming nowadays.