

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


2.1. Link Library Overview
A Link Library is a file containing procedures that have been compiled into machine code. The code in a library begins as one or more source files containing procedures, constants, and variables. The source files are assembled into object files, and the object files are inserted into the library.
2.3.1 Calling a Library Procedure
Call a library procedure using the CALL instruction. Some procedures require input arguments. The INCLUDE directive copies in the procedure prototypes (declarations). The following example displays "1234" on the console:
INCLUDE Irvine16.inc .code mov ax,1234h ; input argument call WriteHex ; show hex number call Crlf ; end of line
2.3.2 Library Procedures - Overview
Clrscr - Clears the console and locates the cursor at the upper left corner. Example: call clrscr
Crlf - Writes an end of line sequence to standard output. Example: call crlf
Delay - Pauses the program execution for a specified n millisecond interval. Example: Mov ax,1000 ;1000 milisecond call crlf
DumpMem - Writes a block of memory to standard output in hexadecimal.
DumpRegs - Displays the AX, BX, CX, DX, SI, DI, BP, SP, EFLAGS, and IP registers in hexadecimal. Also displays the Carry, Sign, Zero, and Overflow flags.
WriteBin - Writes an unsigned 32-bit integer to standard output in ASCII binary format.
7) WriteChar - Writes a single character to standard output. 8) ReadChar - Reads a single character from standard input and the returns the character in AL register. Example: .data char byte? .code call ReadChar mov char , al 9) WriteDec - Writes an unsigned 32-bit integer to standard output in decimal format.
WriteHex - Writes an unsigned 32-bit integer to standard output in hexadecimal format.
WriteInt - Writes a signed 32-bit integer to standard output in decimal format.
WriteString - Writes a null-terminated string to standard output. When calling it, place the string’s offset in EDX. For example
. data Prompt BYTE “Enter Your Name: ”, .code mov edx, OFFSET Prompt call WriteString
Question 1: Write a program to display the multiplication table for a given number using MUL instruction inside a LOOP. Use library functions ReadInt, WriteString and WriteInt for input and output.
Question 2: Write a program that takes an input string and reverses the string using push and POP operations with loop instruction. Use library functions ReadString and WriteString for input and output.
Question 3 Write a program that reads a single character form the user and gives output
“UpperCase character” If user enter upper case character “LowerCase character” If user enter Lower case character “not character” If any other key pressed
Write a Procedure named Upper_or_Lower which returns 1 in AL register for uppercase character and 2 for lowercase character.