• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[ASM] Simple bootloader FASM

Custom Title Activated
Loyal Member
Joined
Oct 26, 2012
Messages
2,357
Reaction score
1,086
Hello guys,

Recently I've been making a simple bootloader in FASM. I want to improve my assembly and I want to start a simple DOS-OS.
I want to share my code and please review it!

PHP:
start:
	mov ax, 07C0h
	add ax, 288	
	mov ss, ax
	mov sp, 4096
	mov ax, 07C0h
	mov ds, ax
	mov si, text_string
	call print_string	
	jmp $	
	text_string db 'I like dis shiz', 13, 10, 0

print_string:	
	mov ah, 0Eh

.repeat:
	lodsb	
	cmp al, 0
	je .done
	int 10h 
	jmp .repeat

.done:
	ret


	times 510-($-$$) db 0
	dw 0xAA55

I KNOW it's not really good but I want a review!
I like to improve it a lot.

Thanks already. Have a good day.
 
Newbie Spellweaver
Joined
Apr 20, 2014
Messages
7
Reaction score
0
Your sample starts bei setting the stack location & segments to hogwarts. Means, it uses some "magic".


You are using the BIOS interrupt call 10h, but you're not initializing the BX register. Depending on certain video modes, it wouldn't even work.


Performance tips:

  1. Video mode setting
  2. Pointing registers to the main memory location (shared with the video card)
  3. Writing characters into the video memory


But don't worry, your sample is okay.
I'll expand my post soon, I haven't got much time for the moment.


// Some pretty useful resources:


 
Last edited:
Custom Title Activated
Loyal Member
Joined
Oct 26, 2012
Messages
2,357
Reaction score
1,086
Your sample starts bei setting the stack location & segments to hogwarts. Means, it uses some "magic".


You are using the BIOS interrupt call 10h, but you're not initializing the BX register. Depending on certain video modes, it wouldn't even work.


Performance tips:

  1. Video mode setting
  2. Pointing registers to the main memory location (shared with the video card)
  3. Writing characters into the video memory


But don't worry, your sample is okay.
I'll expand my post soon, I haven't got much time for the moment.


// Some pretty useful resources:


Thanks for your review.
I know it's not the best but all this is for is just to learn. When I've learnt more in the future I might concider a real OS, but for now, just a simple, small one is enough.
Will take a look at the links you gave me.
 
Back
Top