Write ARM7 assembly programs use the Keil assembler discuss

Write ARM7 assembly programs - use the Keil assembler discussed in class and use the program shell from Assembly2.s as a starting point for each program.

1. Write a program called SUB64 to subtract the 64-bit integer in memory locations 0x40001000 and 0x40001004 from the 64-bit integer in 0x40001010H and 0x40001014. Store the result in memory location 0x40001020 and 0x40001024.

Assembly2.s:

;Simple Keil tools demonstration program
;
   AREA   Assembly1, CODE, READONLY
   EXPORT   __main
__main  
   ENTRY
mystart   LDR r3,= 0x40001000   ;point to RAM location
;
;************************************************************************
; For other programs (projects) replace the code below with new code.
; Leave the code outside the ******* lines as is for all programs.
; begin initialize data
       LDR r4,= 0x25       ;set first operand = 0x100
       LDR r5,= 0x50       ;set second operand to 0x50
       STRB r4,[r3,#0]       ;write first operand to memory
       STRB r5,[r3,#1]       ;write second operqand to memory
; end initialize data
       LDRB r0,[r3,#0]       ;get first operand
       LDRB r1,[r3,#1]       ;get second operand
       ADD   r2,r0,r1       ;form the sum of the two values
       STRB r2,[r3,#2]       ;save sum
;        STRB r2,[r3,#3]       ;save sum
;************************************************************************
;
; an infinite loop because the processor continues to fetch instructions
stop   BAL   stop
   END           ;END directive to show nothing more in file

Solution

64 bit subtraction

TTL 64bitsub

AREA program, CODE, READONLY

ENTRY

Main

ADR   R0 , Value;

LDMIA R0 {R1,R2};

ADR R0, Value2;

LDMIA R0 , {R3,R4};

SUBS R6, {R4, R2 };

SUB R5 , {R3,R1}

ADR R0, Result;

STMIA R0, { R5,R6 };

ADR R5 , 0x40001020;

ADR R6 , 0x40001024.;

SWI &5

SWI &11

value1 : SUB &0x40001010H , &0x40001014

value2 : SUB &0x40001000 , &0x40001004

DCD 0

END

Write ARM7 assembly programs - use the Keil assembler discussed in class and use the program shell from Assembly2.s as a starting point for each program. 1. Wri
Write ARM7 assembly programs - use the Keil assembler discussed in class and use the program shell from Assembly2.s as a starting point for each program. 1. Wri

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site