Skip to contentSkip to conversation

prog for no OS. language?

DISCUSSION samson swanson 5 participants 5 messages Dec 31, 2001 – Jan 1, 2002

lore
Share & tools
lore
#0 lore raw

hello,

I had a quick question. Say I want to write a program to run without an OS, what language/tools do i need?

linus (if you read this) what language/means did you use to make your terminal emulation program before linux?

__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

#1 lore raw
Quoted 4 lines · samson swanson

hello,

I had a quick question. Say I want to write a program to run without an OS, what language/tools do i need?

None. Just a cpu, and some toogle switches and lights. 8-)

Signature · 3 lines
Brian Litzinger <[email protected]>

    Copyright (c) 2001 By Brian Litzinger, All Rights Reserved
#2 lore raw
In reply to samson swanson
Quoted 4 lines · samson swanson

hello,

I had a quick question. Say I want to write a program to run without an OS, what language/tools do i need?

Well, a language which is known by you :) And you should write some boot loader or something. Imho every beginnger programmer is planning to write an OS. I did a simple OS too (assembly, nasm). It's quite interesting task, but it doesn't worth: your OS may be not supported by any others than you :) [well, for contrast: every OS can begin in this way though]

- Gabor

#3 lore raw
In reply to samson swanson
Quoted 4 lines

hello,

I had a quick question. Say I want to write a program to run without an OS, what language/tools do i need?

Well ... *my* personal preference for such things is Forth :-). Forth runs even on such "tiny" machines as 8051 micro-controllers and there are probably a dozen good Forth environments, ranging in cost from free to thousands of US dollars. I have Forth, Inc. SwiftForth for Windows, but for what you want, you might head over to

http://www.taygeta.com/forthcomp.html

for a comprehensive list of Forth compilers and tutorial information. There is a Gnu / GPL Forth called "gforth" that will run on Linux (and Windows) but I've never used it, so I can't comment on it. Other Forth folk have told me that it's inferior to their own pet versions.

Obligatory warning for those with families: like Linux kernel hacking, Forth hacking on small computers that can barely support a hex keypad, let alone an OS, is *highly addictive*! <vbg>

: TARGET FOOT FIND ;
: LOAD BULLET FIND CHAMBER INSERT ;
: SHOOT LOAD TARGET GUN AIM TRIGGER PULL ;

--
M. Edward Borasky

[email protected]
http://www.borasky-research.net

#4 lore raw
In reply to samson swanson
Quoted 4 lines · samson swanson

hello,

I had a quick question. Say I want to write a program to run without an OS, what language/tools do i need?

The first thing you have to write is a boot sector. On Intel, this will be written in 16 bit assembler.

Quoted 3 lines

linus (if you read this) what language/means did you use to make your terminal emulation program before linux?

Linus wrote a book, you know. "Just for fun". Amazon should have it...

Or, if you don't have the patience, you could read this:

http://www.li.org/linuxhistory.php

Basically, if you're writing code without ANY OS behind it, you'll be doing it in assembler, and in order to use 32 bit assembler, you first have to set up the page tables and interrupt handlers (and know what the A20 line is for, although you do NOT have to know why the heck it seems to live on the keyboard controller...), set up your own scheduler (or pretty much disable interrupts), and basically re-implement a small operating system in order to get to the point where you can write in some other language (like C).

Linus did it because he was bored, and a college student. It took him 3 months (summer off from school). Why write a term program you boot into? Becaue he was using minix as his os, and minix sucks at handling interrupts. You try doing serial IO (to talk to the school's unix box through a modem) when your serial port drops characters left and right. (I don't think he even had a 16550a uart at the time... :)

To see what's involved when Linux boots up, read
http://www.moses.uklinux.net/patches/lki.html

You could also go look at the freedos project...

Just getting to 32 bit mode is a bit of an accomplishment, actually. Booting modern intel hardware recapitulates phylogeny...

Rob