;Copyright (C) 2007 by Mattia Monga <mattia.monga@unimi.it>
bits 16                         ; 16 bit real mode
org 0x7C00                      ; origine indirizzo 0000:7C00

start:
	mov ax, 0xb800   ; text video memory dest array index [ES:DI]
        mov es, ax
        mov di, 0        ; start of video memory

        cld             ; clears direction flag (index regs incremented)
        mov ah, 0x0F    ; attrib = white on black
        mov si, msg
        call message
        hlt
        
message:
        lodsb                   ; carica un byte da [DS:SI] in AL e inc SI
        cmp al, 0
        jz done
        stosw                   ; memorizza una word da [ES:DI] in AL e inc SI 
        jmp message
done:   ret


msg   db "Hello world from the bare machine!!!", 0      
        
        times 510-($-$$) db 0
        dw 0xAA55
