Skip to content

Instantly share code, notes, and snippets.

@KowalczykBartek
Created June 9, 2019 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KowalczykBartek/0ebcc6e96c360dd6130c0f9c69c535af to your computer and use it in GitHub Desktop.
Save KowalczykBartek/0ebcc6e96c360dd6130c0f9c69c535af to your computer and use it in GitHub Desktop.
[org 0x7c00]
mov bx, HELLO_MSG
call print_string
mov bx, GOODBYE_MSG
call print_string
jmp $
; arg0: bx - pointer to string to be printed
print_string:
pusha
iteration:
mov cx, [bx]
cmp cl, 0
je end
; print character
mov al, cl
mov ah, 0x0e
int 0x10
; increment string pointer
add bx, 1
jmp iteration
end:
popa
ret
HELLO_MSG:
db 'Hello, World !', 0
GOODBYE_MSG:
db 'Goodby!', 0
times 510-($-$$) db 0
dw 0xaa55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment