Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The program looks like that gand ORG $1000 LDAA #SC8 ADDA #$48 STAA immediate mode immediate mode direct mode 503 SWI The first instruction states.

The program looks like that

gand

ORG $1000

LDAA #SC8

ADDA #$48

STAA

immediate mode immediate mode direct mode

503

SWI

The first instruction states. Load ACCA with data ca (hex) The second states: Add to ACCA data 48 hex. The addition is done inside ACCA which is 10 hex. Then both C flag and the H -lag are set. The third states: store contents of ACCA (10 hex) intcadress $03. The forth states: branch to itself or loop to it self ie the program

ends.

  1. Before using the trace (T) command, enter the program starting address into the program counter (P) so the executic. will start from the beginning. Using the comnand RM
  2. At the prompt, type T, then enter.

The first instruction will be

executed. Check contents of ACCA in the first 2 instructions and the contents of memory $0003 at the end. The content of ACCA and memory $0003 should be the same ($10).

  1. Check the contents of the condition code register and find out which flags are set. You find out that H and C flags are set. Add the two numbers $C8 and $48 by hand and compare the results.
  2. You can execute the whole program at once by using the command "con (G) . At the prompt, type:

G C000

This will execute the program from the beginning $C000 to the end $coos and stops right there. Verify the CPU's registers and renory contents again.

8. Let's change the previous program and enter the new one using ASH cormand:

ORG $ 1000

LDAA Soo

ADDA So1

STAR. Sca

SWE

direct node direct mode direct mode

Before executing this progran, must be entered manually. as follows:

contents or locations 0000 and 0001

> MM 0000

0000 XX C8 XX 43 XX

it

  1. This progran uses direct node. In the first instruct 0000 itates; Load accumulatot modith contents of address 0000 which 16 tes) lone accumilator a with contentmulator a contente of address (location) 0001 Whichdd to sc une addition result will be in AccA which is 10 hex. The carry C is set as shownt The third instruction states. store contents of ACCA into location 0003. thus the result is 110.
  2. Use trace (T) and co G) sommand for execution as explained

11. Addition of unsigned 16-bit numbers: Usually in dealing with 2-bvte data (16-bit), we use ACCD which combines ACCA and ACCB. Enter the following program: ORG . 000

LDD #$C891

ADDD #$48A2

Converted de

STD # S0003

51345

SWI

1155441

1/133

The ACCD consists of ACCA (hi byte) and ACCB (low byte). In the addition problen, the contents of ACCD 10 byte (91) of ACCD is first added to the memory low byte (A) of the 16-bit number as shown. The result is stored back into ACCB. Then the contents of ACCD hi byte (C8) is added to the memory hi byte (48). If there is a carry resulted from the low bytes addition, it will be added to the hi bytes addition. The result of these hi bytes is stored back into ACCA. Now ACCD has a content of 1131 hex.

In storing a 16-bit number, the hi-byte (11) is stored back into location $0003 and the lo-byte (31) is stored back into the next location $0004. Thus, when ACCD is loaded from memory or stored into memory, it deals with 2 consecutive memory locations M and M+1. M is the hi-byte and M+1 is the low-byte.

Problem

Rewrite the previous program using the direct modes.

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_2

Step: 3

blur-text-image_3

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

Essentials of business communication

Authors: Mary Ellen guffey, Dana loewy

8th Edition

1285094085, 9780324588002, 9781305081857, 9781285094083, 324588003, 130508185, 978-1111821227

More Books

Students also viewed these Business Communication questions