Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Produce Your Own Source Code Write programs that accomplish the tasks listed on the following pages. Assemble and link each program and verify that it

Produce Your Own Source Code Write programs that accomplish the tasks listed on the following pages. Assemble and link each program and verify that it works using the stepi command in gdb. Create a subfolder in Q:/CISDATA/COMP256AB1/Your Name/assignment1/ To hand in put the source code for each of the programs below in another subfolder names as indicated below.

Register addressing Write a program register.asm that adds register AH to register AL, only use the values that are currently in these registers. Save the reg.s source file as Q:/CISDATA/COMP256AB1/Your Name/assignment1/reg.s

Immediate Addressing Write a program immediate.asm that adds the number 5 to a constant called first1. Note that this arithmetic must take place in a register. Save the imm.s source file as Q:/CISDATA/COMP256AB1/Your Name/assignment2/imm.s Direct Addressing Write a program direct.asm that subtracts var2 from var1, then places the result in answer. Declare all three variables in the data segment as words. Inititalize var1 as 3231H and var2 as 2217H. Save the direct.s source file as Q:/CISDATA/COMP256AB1/Your Name/assignment1/direct.s

Register Indirect Addressing Declare an array that contains the numbers: 1,2,3,4 (byte size). Use BX to point to the first array element initially. Subtract the second array element from the first, and store the result in the fourth element. Use the INC and DEC commands to change the array element that is pointed to. Save the indirect.s source file as Q:/CISDATA/COMP256AB1/Your Name/assignment1/indirect.s

Indexed Relative Addressing Repeat the previous problem, but use SI to point to the first array element. Use indexed addressing with a displacement value to access other array elements. E.g. do not change the contents of the SI register. Save the indexed.s source file as Q:/CISDATA/COMP256AB1/Your Name/assignment1/indexed.s

Based Relative Addressing Copy the top 2 words from the stack into registers AX and CX respectively. Do this without changing the stack pointer do not use POP instructions! Use BP as the base register. How will your program know what value to place in BP? To ensure that the stack contains some known values, place the following code at the beginning of your program: mov dx, 1234H push dx mov dx, 0ABCDH push dx

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Experts Guide To SQL

Authors: Frank Lusardi

1st Edition

0070390029, 978-0070390027

Students also viewed these Databases questions