1,105,625 Community Members

simple Assembly OS

Member Avatar
stillfly122
Newbie Poster
3 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi guys. so i wanna code my own Simple Dos-like OS that boots to a prompt with the simple command of "Hello" which should load a message that says "Hello, World!". Would someone be generous enough to give me some source code that just boots and has the command "Hello". I can do everything else from there. all i need is basically the bootloader and the prompt. Thanks!

Member Avatar
stillfly122
Newbie Poster
3 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Oh and i want it to boot with a CD not a floppy cause my floppy drives busted

Member Avatar
Schol-R-LEA
Nearly a Posting Virtuoso
1,404 posts since Oct 2010
Reputation Points: 654 [?]
Q&As Helped to Solve: 227 [?]
Skill Endorsements: 28 [?]
 
2
 

You can find extensive information, including sample boot loaders, at OSDev.org. I would recommend being careful about posting to the fora there, however, as they expect you to carry your own weight, and a blanket request such as this one is likely to get negative reactions.

That having been said, I would recommend using GRUB as your bootloader rather than trying to roll your own. GRUB does many of the basic startup tasks for you, and let's you start from a fairly well-developed point.

As for a command-line action, you're on your own.

Member Avatar
stillfly122
Newbie Poster
3 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

You can find extensive information, including sample boot loaders, at OSDev.org. I would recommend being careful about posting to the fora there, however, as they expect you to carry your own weight, and a blanket request such as this one is likely to get negative reactions.

That having been said, I would recommend using GRUB as your bootloader rather than trying to roll your own. GRUB does many of the basic startup tasks for you, and let's you start from a fairly well-developed point.

As for a command-line action, you're on your own.

I totally forgot about grub haha. Thanks for the info

Member Avatar
shockna1
Newbie Poster
3 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

You should check out MikeOS. It's completely written in assembly, and I believe it can be booted from a floppy or a cd.
http://mikeos.berlios.de/

Member Avatar
Schol-R-LEA
Nearly a Posting Virtuoso
1,404 posts since Oct 2010
Reputation Points: 654 [?]
Q&As Helped to Solve: 227 [?]
Skill Endorsements: 28 [?]
 
0
 

I would also recommend using an emulator (e.g., Bochs) or virtualizer (e.g., VirtualBox, QEMU, VirtualPC) rather than running off of live hardware, at least while testing and debugging. If nothing else, it would save you the constant work of rebooting the system as you test it, as you will be able to run the OS inside of your development machine.

Member Avatar
ru60hz
Newbie Poster
12 posts since Nov 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I have bochs installed on my computer, and i have small boot disk OS from floppy.
Could someone help me how to boot floppy on bochs? I read the instructions from
bochs wiki but i'm still confuse.

Member Avatar
AceStryker
Light Poster
47 posts since Aug 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 4 [?]
Skill Endorsements: 0 [?]
 
0
 
; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« *

    .486
    .model flat, stdcall
    option casemap :none   ; case sensitive

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    include \masm32\include\windows.inc
    include \masm32\include\kernel32.inc
    include \masm32\include\msvcrt.inc

	includelib \masm32\lib\msvcrt.lib
    includelib \masm32\lib\kernel32.lib
	
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

	.data
		Str1		db	"Hello, World",0
		Str2		db	" ",0
		Str3		db    "Unkown Command ",0
		
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
	
    .code
	
ClearCIn proc

	PUSH STD_INPUT_HANDLE
	CALL GetStdHandle
	PUSH EAX
	CALL FlushConsoleInputBuffer
	RET

ClearCIn Endp	

main:

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
	
	PUSH OFFSET Str2
	CALL crt_scanf ;function Scanf from C, scan the written string and put into de Str2, this is located @\masm32\lib\msvcrt.lib
	ADD ESP,8	
	CMP Str2, "Hello"
	JE PrintHelloWorld
	PUSH OFFSET Str3
	CALL crt_printf
	ADD ESP, 4
	JMP main
	
	PrintHelloWorld :
	PUSH OFFSET Str1
	CALL crt_printf		
	ADD ESP,4			
	
         CALL ClearCIn
	;Clean the screen
	PUSH OFFSET Str8
	CALL crt_system
	ADD ESP,4
	
          ;;Start all over again
	JMP main
	;this ExitProcess is never gonna hapen,cause i always start all over again,but i put it anyway
		PUSH 0
	CALL ExitProcess

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

end main
Member Avatar
Schol-R-LEA
Nearly a Posting Virtuoso
1,404 posts since Oct 2010
Reputation Points: 654 [?]
Q&As Helped to Solve: 227 [?]
Skill Endorsements: 28 [?]
 
0
 

I have bochs installed on my computer, and i have small boot disk OS from floppy.
Could someone help me how to boot floppy on bochs? I read the instructions from
bochs wiki but i'm still confuse.

The main thing you need to do is create a disk image. Fortunately, Bochs comes with a tool, bximage, which makes it easy to create a blank disk image, or (if you already have a disk) copy a disk image to a file.

You can also use a physical disk with Bochs, if you prefer, rather than a disk image file.

Member Avatar
NotNull
Posting Whiz in Training
211 posts since Oct 2008
Reputation Points: 23 [?]
Q&As Helped to Solve: 21 [?]
Skill Endorsements: 0 [?]
 
0
 

To make a bootable 1.44MB disk image, create a binary file
exactly 1474560. The first 512 bytes of this image at the
very beginning will be the Boot Record.

Stack may not be initialized upon entry. If so set up
your own stack.

mov ax, cs
mov ss, ax ; will disable interrupts until end of next instruction.
mov sp, my_stack
ORG 7C00H ; The ROM will place your code at 07C00H
MyFirstBootLoader:
MOV SI, MSG  ; Load SI with offset of Message
CLD ; Clear DF bit for string operation
DisplayMessage:
LODSB ; Load byte of string into AL
CMP AL, 0
JZ BootOver ; Exit if byte was zero
MOV AH, 0EH ; Function 0EH Write in TTY Mode
MOV BH, 0 ; Display Page Zero (Should be current)
INT 10H ; Video Services Interrupt (BIOS)
JMP DisplayMessage
BootOver:
JMP BootOver ; Infinite Loop
MSG DB 'Hello World', 0DH, 0AH, 0
You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: