Starting from:

$30

CSC 3210 – Assignment #2

CSC 3210 – Assignment #2

Objective: Learn memory organization/layout, data transfer concepts and instructions, direct memory access,
memory allocation.
Requirements:
1. (5 points) Implement the following expression in assembly language:
 AL = (val3 + 7) - (var2 + val1) + (5/3)*7
- Assume that val1, val2, and val3 are 8-bit integer variables
- Initialize val1 with 12, val2 with 9, and val3 with 2
- You are only allowed to use 8-bit registers.
- Use ONLY mov, add, sub instructions whenever needed.
- Use the debugger to verify your answer.
o Submit the following:
§ Save your source code as Lastname1.asm and upload the Lastname1.asm
§ Screenshot showing that AL register contains the correct result.
2. (5 points) Implement the following expression in assembly language:
 BX = –val2 + 7 - (- val3 + val1)
- Assume that val1, val2, and val3 are 8-bit integer variables
- Initialize val1 with 12, val2 with 9, and val3 with 2
- You are only allowed to use 16-bit registers to hold intermediate results, whenever needed.
- Use mov, add, sub, movzx, movzx, or neg instructions whenever needed.
- Use the debugger to verify your answer.
o Submit the following:
§ Save your source code as Lastname2.asm and upload the Lastname2.asm
§ Screenshot showing that BX register contains the correct result.
3. (3 points) True/False
(2.1) The instruction, var BYTE A
Stores character ‘A’ in to variable named var.
(2.2) The instruction, var WORD “ABC”
stores the string ‘ABC’ in to variable named var.
(2.3) The instruction, var DWORD “ABCD”
stores the characters ‘A’,’B’,’C’,’D’ in to variable named var.
4. (2 points) Declare a variable:
Var1 WORD 4 DUP (5 DUP (7) )
What is the total size of the array Var1? Explain your answer.
Note:
§ Submit your source code by only uploading .ASM file using iCollege in the respective assignment dropbox:
§ Lastname1.ASM, Lastname2.ASM
§ Comment header for .ASM files:
 Student: Full name
 Class: CSC3210
 Assignment#: 2
 Description: This program ………….
§ Follow the program standards as presented in your book. Pay more attention to code comments and
 consistent indentation.

More products