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.
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
Write an assembly language program (using MC6800 instruction set) which will do the following: We are going to add two n...
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 ß (a * b) * (c * d). The computer will read in the input values a, b, c, and d from the keyboard, and the final result (z) has to be displayed. In addition, every time an input value is read in, it must be displayed on the screen. Each time a multiplication of two numbers is needed, it has to be done using...
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 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...
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 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...
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...
Assembly lang multiple choice Suppose we have the following pseudo-instruction in our program: push {r0, r2, r4} ..... Which of the following instructions would be the appropriate instruction to use when cleaning up the stack space used by the three register values that were pushed onto the stack? Group of answer choices sub sp, #12 add sp, #12 add lr, #12 2) Suppose we are comparing registers R1 and R2 and we want to branch if equal to the label...
Can someone please help me with this problem? We are using
CodeWarrior to write this program in assembly language.
The array sample contains eight 8-bit signed binary numbers (integers) as shown below. Write a program which stores the negative numbers in the array nelements, computes the sum of the positive numbens to be stored in the variable psum and stores the number of the positive numbers in the variable pnumber. Note that a zero is ther positive nor negative. Your...
Complete the following Intel assembly language program which determines whether the byte sized operand stored in memory location 'number' is prime or not. The program will write the value of 0 into the memory location 'answer' if the number is not prime, otherwise the initial value of '1' will be left unmodified (indicating that the number is prime). The program makes use of the DIV instruction to determine the value of quotient and remainder when dividing the number by 2,3,4,......