Here is a boot sector code that prints out dots on the screen and does nothing else ;)
_Text SEGMENT PUBLIC USE16
;************************************************************
; Program entry point
; Currently we are at 0:7C00
;************************************************************
org 0
EntryPoint:
; Would have preferred 07C0:0000
; Dealing with an offset that starts at 0 is easier
; So do a far jump to 07C0:????
jmp 0x07C0:AfterData
; Your Data goes here!
BOOT_MSG db 'Welcome to BOOT SECTOR CODE!',10,13,0
ACTIVITY db '. ',0
AfterData:
; update DS to be 7C0 instead of 0
push CS
pop DS
; update ES also
push CS
pop ES
; create stack
mov ax, 0x0000
mov ss, ax
mov sp, 0xFFFF
; display boot message...
lea si, [BOOT_MSG]
call Print
; Go into a hang printing dots
DIE_LOOP:
lea si, [ACTIVITY]
call Print
mov cx, 0xffff
delay1:
mov bx, 0xfff
delay2:
dec bx
jnz delay2
dec cx
jnz delay1
jmp DIE_LOOP
;************************************************************
; Procedure print
; prints a zero terminated string pointed to by si
;************************************************************
Print:
push ax
mov ah, 14 ; BIOS code for screen display
cld
print_loop:
lodsb ; moving the character to be displayed to al
or al, al ; checking if the char is NULL
jz printdone
int 10h ; Calling BIOS routine
JMP print_loop
printdone:
pop ax
ret
; End of print procedure...
; Make the file 512 bytes long
TIMES 510-($-$$) DB 0
; Add the boot signature
dw 0AA55h
Click here to contact me.
Last updated on 08-November-2002
Back to Boot Sector Main Page