Docsity

Link Library Overview-Assembly Language, Microprocessors and Computer Architecture-Lab Mannual, Exercises of Computer Architecture and Organization

Toggle sidebar
bg1
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
1) Clrscr - Clears the console and locates the cursor at the upper left corner.
Example:
call clrscr
2) Crlf - Writes an end of line sequence to standard output.
Example:
call crlf
3) Delay - Pauses the program execution for a specified n millisecond interval.
Example:
Mov ax,1000 ;1000 milisecond
call crlf
4) DumpMem - Writes a block of memory to standard output in hexadecimal.
5) 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.
6) WriteBin - Writes an unsigned 32-bit integer to standard output in ASCII binary
format.
docsity.com
pf2

Partial preview of the text

Download Link Library Overview-Assembly Language, Microprocessors and Computer Architecture-Lab Mannual and more Exercises Computer Architecture and Organization in PDF only on Docsity!

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

  1. Clrscr - Clears the console and locates the cursor at the upper left corner. Example: call clrscr

  2. Crlf - Writes an end of line sequence to standard output. Example: call crlf

  3. Delay - Pauses the program execution for a specified n millisecond interval. Example: Mov ax,1000 ;1000 milisecond call crlf

  4. DumpMem - Writes a block of memory to standard output in hexadecimal.

  5. 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.

  6. WriteBin - Writes an unsigned 32-bit integer to standard output in ASCII binary format.

docsity.com

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.

  1. WriteHex - Writes an unsigned 32-bit integer to standard output in hexadecimal format.

  2. WriteInt - Writes a signed 32-bit integer to standard output in decimal format.

  3. 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

1. Experimental Work

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.

docsity.com