Question

This code needs to be written in Assembly language using Keil uvision 5. Please use Keil Assembler. Or ARM assembly.
Thanks.

int main(void) { // initializing int R0 = 5; int R1 = 10; // for loop addition with CMP while(RO <=| 10) R$++; // for loop su

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

ASSEMBLY LANGUAGE PROGRAM FOR MULTIBYTE ADDITION

AIM: Write an assembly language program for multibyte addition using keil software (AT89C51).

APPARATUS: 1. Keil software

2. P.C.

PROGRAM:

MOV R0,#20H

MOV R1,#30H

MOV R3,#04H

CLR C

CLR A

AGAIN: MOV A,@R0

ADDC A,@R1

MOV @R1,A

INC R0

INC R1 DJNZ R3,

AGAIN

END

RESULT:

Inputs: i: 0x20 -- 01h, 02h, 03h, 04h

i: 0x30 -- 05h, 06h, 07h, 08h

Output: i: 0x30 -- 06h, 08h, 0Ah, 0Ch

Add a comment
Know the answer?
Add Answer to:
This code needs to be written in Assembly language using Keil uvision 5. Please use Keil...
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
  • Find out what the following assembly code calculates AREA my code, CODE EXPORT main ALIGN ENTRY...

    Find out what the following assembly code calculates AREA my code, CODE EXPORT main ALIGN ENTRY main PROC MOVS MOVS MOVS r0,#0 r1,#15 r2,#0 loop CMP BGT MLA ADDS r2,r1 stop re,r2,r2,ro r2,r2,#1 loop % The final result is saved in register r0 stop B stop ENDP END

  • 13) (4 pts) Squaring a number is useful in many other algorithms. This assembly routine calculates...

    13) (4 pts) Squaring a number is useful in many other algorithms. This assembly routine calculates the square of an unsigned integer. How long does this take in clock cycles (worst case). Assume ARM 32 bit instruction set and the integer is in R0 before we begin. AREA L.textl, CODE, READONLY PROC EXPORT square square MOV R1,RO; CMP R1, #0 ANDS R3,RO,R1 BNE skip ADD RO,R1, LSL R3; MOV R2,R2, LSL #1 CMP R2, #0 BNE loop BX LR loop...

  • Step 1: Create a new ASSEMBLY project using Keil Software (1) Make sure you use the M3 option St...

    Step 1: Create a new ASSEMBLY project using Keil Software (1) Make sure you use the M3 option Step 2: “Write an ARM assembly language program that counts the number of 1’s for any value in R0. The program must assemble/compile in KEIL and must be able to run in the KEIL simulator. Generally, R0 may contain any value, but for purpose of this exercise, you may move 0x2345ABCD into R0. The number in R0 does not need be preserved....

  • 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...

  • This program is supposed to set RO-1 if there's a 5 in one of ten memory locations, starting at x...

       write a LC-3 program This program is supposed to set RO-1 if there's a 5 in one of ten memory locations, starting at x3100 Else, it should set RO to 0. R0 1, R1-5, R3 10 R4x3100, R2 MIR4] No R4 R41 R3 R3-1 R2 MIR4] Yes HALT Output the adress of the 5 to the console. The console should display A five found at x3107 (if the five is at x3107) If no five found, display No five found...

  • Question 2 ARM Assembly Language (25 marks) An ARM instruction set summary is provided at the...

    Question 2 ARM Assembly Language (25 marks) An ARM instruction set summary is provided at the end of this paper. (5 marks) Explain the difference between eor and eors instruction. Use an example to show why both forms are useful. а. b. (5 marks) Explain using an example what the "Idr r3, [r7,#4]" instruction does. c. (10 marks) The following is the assembly language generated by a C compile type mystery, %function mystery: args 0, pretend = 0, frame =...

  • I need help with a code in assembly language MASM (x86)

    write an assembly language (x86) program to input in a string 10 multi-digit integers and displays them in ascending order. Modify the code below to comply with the requirement..model small.stack 100h.datastrg1 DB 'Insert numbers: $'strg2 DB 'Sorted numbers: $'Arr Db 10 dup(?)v dw ?.codemain procmov ax,@datamov ds,axmov ah,9lea dx,strg1int 21hmov dl,0ahmov ah,2int 21h;inputsmov di,0mov cx,10Input_loop:mov ah,1int 21hmov arr[di],almov dl,0ahmov ah,2int 21hinc diloop Input_loopmov v,0sort:mov di,0mov cx,10sub cx,vB:mov al,Arr[di]cmp al,Arr[di+1]jng Cmov al,Arr[di]xchg al,Arr[di+1]mov Arr[di],alc:inc diloop Binc vcmp v,10jne sort;Outputmov ah,9lea dx,strg2int...

  • EXPLAIN HOW THIS PROGRAM WORKS, USING DEV C++ #include <iostream> #include <cmath> #define PI 3.1415926535897 using...

    EXPLAIN HOW THIS PROGRAM WORKS, USING DEV C++ #include <iostream> #include <cmath> #define PI 3.1415926535897 using namespace std; typedef struct ComplexRectStruct {    double real;    double imaginary; } ComplexRect; typedef struct ComplexPolarStruct {    double magnitude;    double angle; } ComplexPolar; double radToDegree (double rad) {    return (180.00 * rad) / PI; } double degToRadian (double deg) {    return (deg * PI) / 180; } ComplexPolar toPolar (ComplexRect r) {    ComplexPolar p;    p.magnitude = round(sqrt(pow(r.real,...

  • Problem 1 Consider the piece of ARM Cortex MO+ assembly code given below and answer the...

    Problem 1 Consider the piece of ARM Cortex MO+ assembly code given below and answer the following questions: mw 1.AGAIN CMP RO, #10 BLE LESSEQUAL MOVS RO, #0 B DONE LESSEQUAL ADDS RO, RO, R1 B AGAIN 5. DONE 1. Assume RO is initialized with the value 20, what is the value of RO when the code above completes execution? How many times is Instruction 5 executed? Assume RO is initialized with the value o, and R1 with the value...

  • LC3 stack (factorial) I need help in writing factorial in Lc3 language by using stack.. ; Begin ...

    LC3 stack (factorial) I need help in writing factorial in Lc3 language by using stack.. ; Begin reserved section: do not change ANYTHING in reserved section! .ORIG x3000 BR Main ; Parameter and result Param .FILL x0004 Result .BLKW 1 ; Constants Stack .FILL x4000 One .FILL #1 MinusOne .FILL #-1 ; End reserved section: do not change ANYTHING in reserved section! ;------------------------------------------------------------------------------- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; int Factorial(int N) ; Returns N! (must be a recursive function) ; Factorial ;__________________...

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