Tutorial by Examples

# make this routine available outside this translation unit .globl string_to_integer string_to_integer: # function prologue push %ebp mov %esp, %ebp push %esi # initialize result (%eax) to zero xor %eax, %eax # fetch pointer to the string mov 8(%ebp), %e...
Read a 16-bit unsigned integer from input. This function uses the interrupt service Int 21/AH=0Ah for reading a buffered string. The use of a buffered string let the user review what they had typed before passing it to the program for processing. Up to six digits are read (as 65535 = 216 - 1 has ...
Print a number in binary, quaternary, octal, hexadecimal and a general power of two All the bases that are a power of two, like the binary (21), quaternary (22), octal (23), hexadecimal (24) bases, have an integral number of bits per digit1. Thus to retrieve each digit2 of a numeral we simply brea...
Print a 16-bit unsigned number in decimal The interrupt service Int 21/AH=02h is used to print the digits. The standard conversion from number to numeral is performed with the div instruction, the dividend is initially the highest power of ten fitting 16 bits (104) and it is reduced to lower power...

Page 1 of 1