Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Beeping Bootloader (Intel x86)

I finally understood the basics of Assembly and bare-metal programming. Or at least this is what I thought. I wrote this (myself for the first time :))

[BITS 16]
[ORG 0X7C00]

Yaz:    MOV SI, Msa
MOV AL, [SI]
INC SI
INT 0x10
OR AL, AL
JZ Yaz
JMP Halt        

Halt:   hlt

Msa db "Test Successful", 0 

TIMES 510 - ($ - $$) DB 0   
DW 0xAA55   

I burned this into a USB (I am well aware testing those in real hardware isn't such a good idea), and rebooted. BIOS performed it's tests, and booted into my bootloader (or rather "program" as it doesn't actually boot sth). It printed out nothing, and my PC started to beep.

I've disabled boot sector virus protection, quick booting, I literally tried everything but every time I boot into my thing it just beeps in my face 'till I CTRL+ALT+DELETE out of it.

What did I do wrong? Thanks in advance.

like image 389
ArdaGuler Avatar asked Jul 02 '26 19:07

ArdaGuler


1 Answers

After reviewing the comments the working code that doesn't beep my PC and instead prints out the string I was looking for:

org 7c00h
bits 16
main:
xor ax, ax
mov ds, ax
mov es, ax         
mov ss, ax
mov sp, 7c00h      
cld                
xor bx, bx        
mov si, MESAJ      
call yaz
cli
durdur:
hlt
jmp durdur
yaz:
push ax
mov  ah, 0Eh       
yenikarakter:
lodsb                                
test al, al
je   bitir         
int  10h           
jmp  yenikarakter     
bitir:
pop ax
ret
MESAJ:
db "Test basarili!", 10, 13, 0
times 510-($-$$) db 00h
dw 0xAA55 
like image 62
Michael Petch Avatar answered Jul 05 '26 12:07

Michael Petch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!