Printing To Screen: Difference between revisions

[unchecked revision][unchecked revision]
Line 54:
 
Main:
mov dx, 0xb800 ; put address into data register
mov es, dx ; data register into extra segment
 
mov si, msg ; our message
mov cx, 0
 
Print:
lodsb ; loads a char from si to al
lodsb
cmp al, 0 ; are we done? reached the null terminator?
cmp al, 0
je Done ; if yes, jump
 
mov di, cx
Line 79:
msg db 'Hello World!', 0
</source>
 
This does the same as the example in C. It simply cycles through each character in the string.
 
==Printing Integers==
Anonymous user