In the above example value of AL register is update every time the
procedure is called, BL register stays unchanged, so this algorithm
calculates 2 in power of 4, so final result in AX register is 16 (or 10h).
Here goes another example,
that uses a procedure to print a Hello World! message:
ORG 100h
LEA SI, msg ; load address of msg to SI.
CALL print_me
RET ; return to operating system.
; ==========================================================
; this procedure prints a string, the string should be null
; terminated (have zero in the end),
; the string address should be in SI register:
print_me PROC
next_char:
CMP b.[SI], 0 ; check for zero to stop
JE stop ;
MOV AL, [SI] ; next get ASCII char.
MOV AH, 0Eh ; teletype function number.
INT 10h ; using interrupt to print a char in AL.
ADD SI, 1 ; advance index of string array