; Filename: HW2prob6.s ; Author: Eric Hoffman ; Description: Solution to bunch of random meaningless tasks ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Constant definitions below: ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Assembler Driectives below: ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AREA FLASH, CODE, READONLY ARM INCLUDE ADuC7026.inc ;MMR definitions EXPORT __main ;Export __main so linker can find definition ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Allocate any code space constants next ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; src DCD 0x00010203,0x04050607,0x08090A0B,0x0C0D0E0F ; main program start __main main_loop ;;;;;;;;; Part a below ;;;;;;;;;;;;;;;;;;;;;;;;;;;; LDR R6, =src ;R6 will be a pointer to source LDR R7, =dest1 ;R7 will be a pointer to dest1 ADD R5, R6, #16 ;R5 is address of last last src byte + 1 byt_mv LDRB R4, [R6], #1 ;Read byte at R6 and increment pointer to next byte CMP R4, #0x0A ;Compare to 0x0A MVNCS R4, R4 ;Complement byte if Higher or same STRB R4, [R7], #1 ;Store byte into dest1 area CMP R6, R5 ;compare current pointer to end BNE byt_mv ;if not done, keep going ;;;;;;;;; Part b below ;;;;;;;;;;;;;;;;;;;;;;;;;;; LDR R6, =src ;R6 will be a pointer to source LDR R7, =dest2 ;R7 will be a pointer to dest2 LDMIA R6, {R0,R1,R2,R3} ;Load up all 4 words in {R0,R1,R2,R3} STMIA R7, {R0,R1,R2,R3} ;Store off all 4 words at dest2 location B main_loop ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Allocate any data in the SRAM area next ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AREA SRAM, DATA, READWRITE ; use area directive with type DATA dest1 SPACE 16 ;allocate space for 4 words of dest1 dest2 SPACE 16 ;allocate space for 4 words of dest2 END