Welcome to Dream.In.Code
Become an Expert!

Join 149,617 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,873 people online right now. Registration is fast and FREE... Join Now!




Assembler operating system code

 
Reply to this topicStart new topic

Assembler operating system code, i need some help

kaufman
11 Sep, 2007 - 02:57 PM
Post #1

New D.I.C Head
Group Icon

Joined: 29 Apr, 2007
Posts: 37


Dream Kudos: 25
My Contributions
Well, i made the program so the OS boots up when the comp turns on , making it a operating system, it runs on a floppy, like a OS.

So it is a os.

heres the code, i need some help importing C code into it though

CODE

#make_boot#


ORG 7C00h

PUSH    CS  ; make sure DS=CS
POP     DS

LEA SI, msg

; teletype function id:
MOV AH, 0Eh

print:   MOV AL, [SI]
         CMP AL, 0
         JZ done
         INT 10h  ; print using teletype.
         INC SI
         JMP print


done:      MOV AH, 0
           INT 16h



MOV     AX, 0040h
MOV     DS, AX
MOV     w.[0072h], 0000h; cold boot.

JMP    0FFFFh:0000h    ; reboot!


new_line EQU 13, 10

msg DB  'HOS 1.0 - BY NOLAN HAMILTON'
    DB  new_line, '-->', 0

I need help importing some C code into there for some of the more "high level" stuff.

if you can help me, well... Thanks!


ps:I didnt make this code i copied it from a tut.

but i added a little

This post has been edited by NickDMax: 12 Sep, 2007 - 11:35 AM
User is offlineProfile CardPM
+Quote Post

William_Wilson
RE: Assembler Operating System Code
13 Sep, 2007 - 05:59 PM
Post #2

lost in compilation
Group Icon

Joined: 23 Dec, 2005
Posts: 4,101



Thanked: 25 times
Dream Kudos: 3275
Expert In: Java, C, Javascript

My Contributions
you would be best to compile it and link it into assembly. Running C without an active kernel to handle the high level things, is basically impossible.. unless you want to write one yourself

User is offlineProfile CardPM
+Quote Post

NickDMax
RE: Assembler Operating System Code
16 Sep, 2007 - 12:49 PM
Post #3

2B||!2B
Group Icon

Joined: 18 Feb, 2007
Posts: 2,869



Thanked: 53 times
Dream Kudos: 550
My Contributions
Basically you can use C fairly easily. The basic way would be to have your compiler generate an assembly file, and then incorperate that code into your assembly.

HOWEVER!

You can't really use all the basic libraries. The reason is that these tend to (at some level) depend upon operating system level features (such as memory allocation). It is not hard to find the source to the basic libraries and to make them work within your own operating system, then you recompile the libraries...

Another thing you may have to worry about is the linker... You need to ensure that the linker provides you with a format that your operating system can use.

There are actually quite a few basic operating system kernels you can use as a base. These tend to come with the libraries and tools you would want to get off the ground.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 12:36AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month