Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with questions 2-4. Write assembly code to find absolute values of a data word (2 byte word) stored at address $0200 and write

image text in transcribed
Need help with questions 2-4.
Write assembly code to find absolute values of a data word (2 byte word) stored at address $0200 and write the absolute value at $0300. Two 16-bit signed values are stored at $0A00 (they each take 2 bytes). Please write assembly code to sort them in descending order (so that $0A02 has the smallest, and $0A00 has the largest). Could you sort the same way for 50 such words? Write a piece of Assembly code to (a) allocate a string named message to contain good day! (all the underlined characters) at location $0F00; (b) How many bytes would it need?; (c) The rest of the code you write should compare the contents in register A with each character in this message. If a match is found, put the NULL character in register A, and get register B to contain the character G (ascii value). Write HCS12 assembly code to do the following. Using ORG and DC.W directives declare and initialize a data array of 8 words (1 word = 1 integer in I ICS 12 - 2 bytes) starting at address S0200. Their initial values are to be A367, F238,0012, 1972, 1132, AB88, 7399, and 1864. You can name the array EightInts (see class notes or text examples). Now start your program code at $4000 (ORG directive). Configure the direction of port A, port B, and port H to be inputs (i.e. set data directional registers). We are going to consider port A as the high byte, and port B as low byte of data words we want to read and compare against eighties using a loop. The idea is to see whether port A and port B values taken as a 2 byte integer is equal to any of the values in eightins. Before starting to compare values, the program waits until port H is all 1's then it reads port A, and port B before comparing against eighties. if a match is found, your program branches to label found and stay at that instruction. If no match, the program should branch to no luck label and stay there. Write assembly code to find absolute values of a data word (2 byte word) stored at address $0200 and write the absolute value at $0300. Two 16-bit signed values are stored at $0A00 (they each take 2 bytes). Please write assembly code to sort them in descending order (so that $0A02 has the smallest, and $0A00 has the largest). Could you sort the same way for 50 such words? Write a piece of Assembly code to (a) allocate a string named message to contain good day! (all the underlined characters) at location $0F00; (b) How many bytes would it need?; (c) The rest of the code you write should compare the contents in register A with each character in this message. If a match is found, put the NULL character in register A, and get register B to contain the character G (ascii value). Write HCS12 assembly code to do the following. Using ORG and DC.W directives declare and initialize a data array of 8 words (1 word = 1 integer in I ICS 12 - 2 bytes) starting at address S0200. Their initial values are to be A367, F238,0012, 1972, 1132, AB88, 7399, and 1864. You can name the array EightInts (see class notes or text examples). Now start your program code at $4000 (ORG directive). Configure the direction of port A, port B, and port H to be inputs (i.e. set data directional registers). We are going to consider port A as the high byte, and port B as low byte of data words we want to read and compare against eighties using a loop. The idea is to see whether port A and port B values taken as a 2 byte integer is equal to any of the values in eightins. Before starting to compare values, the program waits until port H is all 1's then it reads port A, and port B before comparing against eighties. if a match is found, your program branches to label found and stay at that instruction. If no match, the program should branch to no luck label and stay there

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

Database Design Using Entity Relationship Diagrams

Authors: Sikha Saha Bagui, Richard Walsh Earp

3rd Edition

103201718X, 978-1032017181

More Books

Students also viewed these Databases questions