Make you're own OS

gooooogle

New member
Well another of my strange interests is how things works and so I've been looking at the source code of a hello world operating system. The code is written in assembly and compiled using NASM.

[BITS 16] ; 16 bit code generation
[ORG 0x7C00] ; Origin location

; Main program
main: ; Label for the start of the main program

mov ax,0x0000 ; Setup the Data Segment register
; Location of data is DS:Offset
mov ds,ax ; This can not be loaded directly it has to be in two steps.
; 'mov ds, 0x0000' will NOT work due to limitations on the CPU

mov si, HelloWorld ; Load the string into position for the procedure.
call PutStr ; Call/start the procedure

jmp $ ; Never ending loop

; Procedures
PutStr: ; Procedure label/start
; Set up the registers for the interrupt call
mov ah,0x0E ; The function to display a chacter (teletype)
mov bh,0x00 ; Page number
mov bl,0x07 ; Normal text attribute

.nextchar ; Internal label (needed to loop round for the next character)
lodsb ; I think of this as LOaD String Block
; (Not sure if thats the real meaning though)
; Loads [SI] into AL and increases SI by one
; Check for end of string '0'
or al,al ; Sets the zero flag if al = 0
; (OR outputs 0's where there is a zero bit in the register)
jz .return ; If the zero flag has been set go to the end of the procedure.
; Zero flag gets set when an instruction returns 0 as the answer.
int 0x10 ; Run the BIOS video interrupt
jmp .nextchar ; Loop back round tothe top
.return ; Label at the end to jump to when complete
ret ; Return to main program

; Data

HelloWorld db 'Saluton Mondo',13,10,0

; End Matter
times 510-($-$$) db 0 ; Fill the rest with zeros
dw 0xAA55 ; Boot loader signature

I've compiled and run this operating system from a diskette and it works. Although technically speaking this is only a bootloader and not a complete os as there is no actual kernel involved.

Note: Saluton Mondo is Hello World in esperanto.
Note Again: This code was written by Daniel Faulkner and is available at osdever.net.
 
The only windows/app/exe code I can do is Delphi
Releasing a program today which was coded in Delphi actually ;)

I have never looked at the source for a OS, mainly because I wouldnt understand other languages totally, some is simlar to delphi in ways though
 
Yeah it uses pascal
Just released www.billvoice.com a few minutes ago :)
Will take a good while for it to get going I think, especially since this is the first beta.

I hate reading anything more than 2 pages long on the net so that guide would kill me hehe
 
If you also made hostingrefuge.com the forum for billvoice you will have one less forum to manage and people using the program might start posting under other topics as well.

Just a thought.
 
If its a commercial program I dont think that would be a good idea to mix it with here.
I think it would also add too many forums onto HostingRefuge.com if all forums from that forum on that site are added here.

Do you code gooooogle?
 
I'm learning to code. Currently looking at C ANSI and Python. But I'm c**p. The code above is from a web page I found.
 
Ah Assembly code, you made an old man happy :bow:

I came across an OS on one floppy a while ago, full blown GUI the lot - including a browser and mail client :eek:

I'll have to look that one out again - last time I tried it was on an old P1 166 laptop and it ran fine, wonder what it would do on my systems now :p
 
Stephen said:
Whats C ANSI?

What kind ofthings can you do using Python?
I have heard about it but never seen any code and dont know anything about it

ANSI C is basicly C code that meets the requiremants of the ANSI standard. So in short it's normal everyday C.

Python is a programming language which is usually run through an interpreter. The language is very logic. A hello world program would be

PRINT "Hello World"

while in ANSI C this would be

#include <stdio.h>
main()
{
printf("Hello World/n");
}
 
Back
Top