bits 16 org 0x7c00 ; main code init: mov si,mesg call puts mov di,save call gets mov si,more call puts mov si,save call puts mov si,next call puts ; hang around hang: jmp hang ; message mesg: db 13,10,"Enter your name: ",0 more: db 13,10,"Hello, ",0 next: db "!",13,10,0 save: times 20 db 0 ; sub-routine to print string pointed by si puts: lodsb or al,al jz .done mov ah,0x0e ; function: display char (tty?) int 0x10 ; video display interrupt jmp puts .done: ret ; sub-routine to get a string and save to mem pointer by di gets: mov ah,0 ; function: read scancode (blocking) int 0x16 ; keyboard interrupt cmp al,13 jz .done stosb mov ah,0x0e ; function: display char (tty?) int 0x10 ; video display interrupt jmp gets .done: xor al,al stosb ret ; filler times 510-($-$$) db 0 ; the boot signature db 0x55,0xAA