Question

Write an assembly language program (using MC6800 instruction set) which will do the following: We are going to add two n...

Write an assembly language program (using MC6800 instruction set) which will do the

following:

We are going to add two numbers 0x4AC0EA (addend) and 0x661B93 (augend). The three byte

addend is to be stored in locations $0100 through $0102 while the augend is to be stored in

locations $0103 through $0105. The three byte result must be stored in locations $0106

through $0108.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer :- The code has been written below-

; store 0x4AC0EA to the memory location $0100

LDA A, #$EA ; Accumulator A = 0xEA

STA A, $0100 ; keep 0xEA at memory address $0100

LDA A, #$C0 ; Accumulator A = 0xC0

STA A, $0101 ; keep 0xC0 at memory address $0101

LDA A, #$4A ; Accumulator A = 0x4A

STA A, $0102 ; keep 0x4A at memory address $0102

; store 0x661B93 to the memory location $0103

LDA A, #$93 ; Accumulator A = 0x93

STA A, $0103 ; keep 0x93 at memory address $0103

LDA A, #$1B ; Accumulator A = 0x1B

STA A, $0104 ; keep 0x1B at memory address $0104

LDA A, #$66 ; Accumulator A = 0x66

STA A, $0105 ; keep 0x66 at memory address $0105

; add the two numbers

LDA A, $0100 ; get the first addend byte in A

LDA B, $0103 ; get the first augend byte in B

ABA ; A = A + B

STA A, $0106 ; keep the added value at memory address 0x0106

LDA A, $0101 ; get the 2nd addend byte in A

LDA B, $0104 ; get the 2nd augend byte in B

ADC A, #0 ; Add the prevoius carry first (if there was any carry)

ABA ; A = A + B

STA A, $0107 ; keep the added value to location 0x0107

LDA A, $0102 ; get the 3rd addend byte in A

LDA B, $0105 ; get the 3rd augend byte in B

ADC A, #0 ; Add the prevoius carry first (if there was any carry)

ABA ; A = A + B

STA A, $0108 ; keep the added value to location 0x0107

Add a comment
Know the answer?
Add Answer to:
Write an assembly language program (using MC6800 instruction set) which will do the following: We are going to add two n...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Section B - ARM Assembly Language (25 marks) An ARM instruction set summary is provided at...

    Section B - ARM Assembly Language (25 marks) An ARM instruction set summary is provided at the end of this paper 1. (5 marks) Consider the following assembly instruction STMFD r13!, (r5-6} Before executing this instruction, registers hold the following values: Register Value Register r9 Value r4 0x00400040 0x00000000 r5 r10 0x11223344 0x00800080 r6 0x55667788 r11 0x10001000 r7 0x99aabbcc r12 0x20002000 r8 exddeeff00 r13 ex40004000 What memory locations are affected after executing the above instruction? In a table, with a...

  • Using the MARIE computer assembly language, write a program that computes the following expression: z =...

    Using the MARIE computer assembly language, write a program that computes the following expression: z = a * b * c. The computer will read in the input values a, b, and c from the keyboard and the final result (z) have to be displayed. In addition, every time an input value is read in, it must be displayed on the screen. Remember that the instruction set does not have an instruction to execute multiplication. The program must be tested...

  • Write a simple program in arm, assembly language , using only Registers, to test if 371...

    Write a simple program in arm, assembly language , using only Registers, to test if 371 is an Armstrong number. The program written should only have instruction set from the Cortex m0+. And then put a 1 in a register to show it It is, or 0 if it isn’t. The second program is about the Armstrong numbers. You assume it will be a 3-digit number which will be entered through the data area. You can use a register so...

  • The AVR provides a rich instruction set to support high-level languages. The AVR address- ing modes...

    The AVR provides a rich instruction set to support high-level languages. The AVR address- ing modes also simplify the access of complex data structures. The AVR has a version of the ADD instruction that includes the C flag as one of the source operands, which enables multiple- precision addition operation. The AVR also has a version of the SUB instruction that includes the C flag as one of source operands and hence is used to perform multiprecision subtraction operation. The...

  • 1. Write a program in Assembly language using MIPS instruction set that reads two integer numbers...

    1. Write a program in Assembly language using MIPS instruction set that reads two integer numbers from the user named as start and end number and finds out all the prime numbers between start and end (including start and end). Your program should do the validation of both the numbers as follows: i. start number must be smaller or equal to the end number. ii. Both numbers must be positive. iii. The maximum value for the end number is 10000...

  • Q-1: Write a program in Assembly language using MIPS instruction set that reads 15 integer numbers...

    Q-1: Write a program in Assembly language using MIPS instruction set that reads 15 integer numbers from user and stores all the numbers in the array intArray. Now, read another integer number N from the user, find the total number of array elements that are greater or equal to the number N, and the total number of array elements that are lower than the number N You must have two procedures: i. ReadIntegerArray: this procedure should read integer array elements...

  • Write a NASM assembly language(run it on DOSBOX) procedure using string instruction. Given two strings, S1...

    Write a NASM assembly language(run it on DOSBOX) procedure using string instruction. Given two strings, S1 and S2, determine if S2 is a sub string of S1. Sub string example: S1: ‘I am happy today’, S2: ‘happy’, S2 is a substring of S1. S1: ‘I am happy today’, S2: ‘sad’, S2 is not a substring of S1. Call above procedure in an assembly language program and show the result of the procedure.

  • MIPS ASSEMBLY PROGRAM: PLEASE Write in MIPS Assembly language. Take strings as input and calculate and...

    MIPS ASSEMBLY PROGRAM: PLEASE Write in MIPS Assembly language. Take strings as input and calculate and print a simple checksum for each string. Make your string long enough to hold 50 characters. Don't forget to leave space for the null byte. Our checksum algorithm will produce a value which you can print with the syscall for printing a character. Stop reading strings when the user enters ".". The syscall to read a string (sycall code 8) adds a newline to...

  • Write a program in assembly language that loads register R2 with the word in memory location...

    Write a program in assembly language that loads register R2 with the word in memory location which is 10 bytes above the address in R0; and loads register R3 with the word in memory location which is 10 bytes below the address in R1. Your program must compare the two numbers in R2 and R3. If number in R2 is less than or equal to the number in R3 it must add the two numbers and save the result in...

  • Write a program using PIC24 instructions yo add three 8-bit numbers stored in the successive memory...

    Write a program using PIC24 instructions yo add three 8-bit numbers stored in the successive memory locations starting from 0x0800. Store the result in the memory lpcation 0x0855.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT