Question: Q4. (5 pts) Parity-Bit Adding Program Write a program in 68K assembly code that adds an odd parity to each ASCII character. Your code must

Q4. (5 pts) Parity-Bit Adding Program

Write a program in 68K assembly code that adds an odd parity to each ASCII character. Your code must satisfy the following specifications:

  1. Define the following 64 characters in the SRC address.

SRC: DC.B 'Computing and Software Systems, University of Washington Bothell'

  1. Define the 64-byte space.

DST: DC.B 64

  1. Read each of the 64 characters, (i.e., each byte) into D0, check the number of 1s in it, set 1 to the MSB with "ORI.B #$80, D0" to create an odd parity, and save it to the 64-byte space defined above.
  2. You need to use ROL.B to count the number 1s in D0. Check with SCS.B if a carry occurs. For this purpose use D1.
  3. Use D0 - D4 as well as A0 - A1 registers as follows:

D0: reads the next character from SRC.

D1: checks with "SCS.B D1" if a carry was generated

D2: counts the number of 1s of the character D0 has.

D3: counts down from 64 to 0, (i.e., used for a loop to read the 64 characters).

D4: counts down from 8 to 0, (i.e., used for a loop to examine the lowest 8 bits in D0).

A0: points to the next character to read into D0

A1: points to the next space to write the character (with/without a parity) from D0

  1. You also need to use "LSR.B #1, D2" to check if the number of 1s in D2 is even.

ORG $1000

START: ; first instruction of program

MOVEA #SRC, A0 ; A0: points to the next charcater to read into D0

MOVEA #DST, A1 ; A1: points to the space to write D0's content

; ADD YOUR ODD PARITY GENERATION CODE HERE

* Put program code here

SIMHALT ; halt simulator

* Put variables and constants here

SRC:

DC.B 'Computing and Software Systems, University of Washington Bothell' ;64 bytes

DST:

DS.B 64

END START ; last line of source

Submit the followings:

  • Attach the source file (.X68) (If no source file, then you got zero point for this question)
  • Test your program and report the result with your user input. Capture the images of output window and memory view to support your results.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!