2 Replies - 3631 Views - Last Post: 16 September 2007 - 01:49 PM Rate Topic: -----

#1 kaufman  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 37
  • Joined: 29-April 07

Assembler operating system code

Post icon  Posted 11 September 2007 - 03:57 PM

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

#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 September 2007 - 12:35 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Assembler operating system code

#2 William_Wilson  Icon User is offline

  • lost in compilation
  • member icon

Reputation: 205
  • View blog
  • Posts: 4,807
  • Joined: 23-December 05

Re: Assembler operating system code

Posted 13 September 2007 - 06:59 PM

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
Was This Post Helpful? 0
  • +
  • -

#3 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: Assembler operating system code

Posted 16 September 2007 - 01:49 PM

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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1