0% found this document useful (0 votes)
16 views4 pages

Lab-03-Memory Access in Assembly Language

The document outlines Lab 3 for the CS-235 course at the National University of Sciences and Technology, focusing on memory access in assembly language. It includes objectives, exercises related to data transfer and manipulation instructions, and procedures for displaying register or memory contents. The lab report requires students to perform tasks such as inserting values in hexadecimal format and displaying strings and register contents using specific assembly instructions.

Uploaded by

abrarbuttmi7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views4 pages

Lab-03-Memory Access in Assembly Language

The document outlines Lab 3 for the CS-235 course at the National University of Sciences and Technology, focusing on memory access in assembly language. It includes objectives, exercises related to data transfer and manipulation instructions, and procedures for displaying register or memory contents. The lab report requires students to perform tasks such as inserting values in hexadecimal format and displaying strings and register contents using specific assembly instructions.

Uploaded by

abrarbuttmi7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

National University of Sciences and Technology

School of Electrical Engineering and Computer Science


Department of Electrical Engineering

CS-235: Computer Organization and Assembly Language


Faculty Member Semester
4th

Class/Section Date
C 2/13/2025

Lab 3: Memory Access in Assembly Language

Grading
Report Marks Viva Marks Total
Name Registration No.
(Max. 8) (Max. 7) (Max. 15)
Abrar butt 460297

Lab 3: Memory Access in Assembly Language


National University of Sciences and Technology

Objective

The aim of this lab is to use some of the data transfer and manipulation instructions, and to use
some assembler operators.

Exercise 1: In the memory list shown, insert the values of the variables as declared below, in
hexadecimal format:

.data

mbyte BYTE 05,12,100 offse Conten Offse Conte


t t t nt
Align 2 00 10
01 11
mword WORD 50h, 60h 02 12
03 13
mdouble DWORD 0A0908070h 04 14
05 15
greetings BYTE "Hi There",0 06 16
07 17
Response TEXTEQU <'Hi, Thanks.'>
08 18
Reply BYTE Response 09 19
0A 1A
Note: No ASCII table is to be used, wait to fill the text 0B 1B
character codes after the exercise where the textstrings have 0C 1C
been used, and the .lst file can be used to see these codes). 0D 1D
DO NOT FORGET 0E 1E
0F 1F
20

Source: Assembly Language for x86 Systems, Kip Irvine

CS-235: Computer Organization and Assembly Language 2


National University of Sciences and Technology

Exercise 2: Without writing any code, write down the expected contents of the register after the
instruction is executed:

a. Mov al,mbyte ;AL=

b. Movsx ax, mbyte+1 ;AX=

Exercise 3: In this exercise we will learn about and use some new procedures that can be called
to display register or memory contents.

Writing strings to display:

Declare/define the string: mystring BYTE “How are you?”0


Get the offset of string into EDX: mov edx, offset mystring
Call the procedure to display: call writestring
(Note that writestring only works with EDX holding the offset)

Writing register constents to display:

Get the contents to display in AL,AX, or EAX.


Ensure the bits not used are set/reset so as to improve readability.
Call the procedure to display: a. writeint to print in decimal format
b. writehex to print in hexadecimal format
c. writebin to print in binary format
d. writechar to print a character, the LSD of EAX
(Note that all these writexxx display EAX contents)

A call to crlf adds carraige return followed by a linefeed, eg., call crlf.

Step1: Write code to get Byte No 2 of mbyte into AL and byte No 1 of mbyte into AH. Ensure
that the higher order bits of EAX are cleared. Display EAX to verify that the correct bytes are in
the locations specified. Use all four write procedures to see the various output formats, with a
call to crlf after each writexxx to make the output easy to read.
(Note Use the data given in Exercise No. 1)

Note down the outputs bvelow:


a. EAX=
b. EAX=
c. EAX=
d. ------= ;Explain what is it.

Step2: Extend program to display the length and size of the string variable “greetings” in
decimal format, and then print the first string

CS-235: Computer Organization and Assembly Language 3


National University of Sciences and Technology

Step3: Display the second string defined by the TEXTEQU operator

CS-235: Computer Organization and Assembly Language 4

You might also like