; un exemple de fichier executable par notre secteur de boot
; just a simple sample of executable file that can be loaded by our boot sector


;       Auteur: Benoit Papillault
;       Date de creation: 20 Juillet 1997

;       Just prints a message , wait a key and prints the message again
;       forever

;       History:
;       01/11/1998: replace an infinite loop by a return to the caller.
;       Compiling with: tasm bootload, tlink -t -x bootload

;       03/11/1998: convert to compile with NASM, add some dummy data
;       to check if the bootsector can load a large file

        segment .text
        org     100h

        jmp     start

        times 30000 db 'a'

start:
        push    cs
        pop     ds
        mov     si,msg
        call    prints
        xor     ah,ah
        int     16h

; For debugging, return to the caller (MS-DOS or boot sector).

        ret

prints:
        lodsb   ; equivalent de mov al,ds:si et inc si mais en moins d'octets
        cmp     al,0
        je      short fin_prints
        call    printc
        jmp     short prints
fin_prints:
        ret

        ; affiche le caractere AL
        ; la position du curseur est mise a jour
        ; on utilise la fonction 0eh de l'interruption 10h
        ; avec AH=0eh, AL=caractere, BH=page (ici 0) et
        ; BL=couleur d'ecriture (ici 7=blanc)

printc:
        push    ax
        push    bx
        mov     ah,0eh
        mov     bx,7
        int     10h
        pop     bx
        pop     ax
        ret
        
msg     db      'Coucou, le message de BOOTLOAD.COM',13,10,0

