44 eBook PSP | MICROPROCESSOR FUNDAMENTAL – Assembly Language: Processing Data
04
EXERCISE &
REFERENCES
eBook PSP | MICROPROCESSOR FUNDAMENTAL – Assembly Language: Processing Data 45
Exercise 1
Based on the instructions below, determine the results
• START ; 0x0150A234
•LDRR1, =0x2375A2B4 ; 0xCFFAF7B7
•LDR R2, =0xC9D8E735 ; 0x01A20082
•LDRR3, =0x87A21083
•LDR R4, =0xFE459001 ; 0x01BA6FFE
•ANDS R1, R1, R2 ; 0x00F2A2B6
•ORRS R2, R2, R3
•BICS R3, R3, R4
•MVNS R4, R4
•EORS R1, R1, R3
• BSTART
• END
Exercise 2
Obtain the answer for each instruction. Calculate using theory and compare the
answers with Kiel µ5.
• START
•LDR R0, =0xAAAAAAAA
•LDR R1, =0xAAAAAAAA
•LDR R2, =0xAAAAAAAA
•LDR R3, =0xBBBBBBBB
•LDR R4, =0xBBBBBBBB
•LDR R5, =0xBBBBBBBB
•LSLSR0, R0, #1 ; 0x55555554, C=1
•LSLSR1, R1, #2 ; 0xAAAAAAA8, N=1
•LSLSR2, R2, #3 ; 0x55555550, C=1
•LSRSR3, R3, #1 ; 0x5DDDDDDD, C=1
•LSRSR4, R4, #2 ; 0x2EEEEEEE, C=1
•LSRSR5, R5, #3 ; 0x17777777
• BSTART
• END
46 eBook PSP | MICROPROCESSOR FUNDAMENTAL – Assembly Language: Processing Data
Exercise 3
Obtain the answer for each instruction. Calculate using theory and compare the
answers with Kiel µ5.
• START ; 0xE6666666, N=1
• LDR R0, =0xCCCCCCCC ; 0xF3333333, N=1
• LDR R1, =0xCCCCCCCC ; 0xF9999999, N=1, C=1
• LDR R2, =0xCCCCCCCC ; 0xEEEEEEEE, N=1, C=1
• LDR R3, =0xDDDDDDDD ; 0x77777777
• LDR R4, =0xDDDDDDDD
•MOVS R5, #1
•MOVS R6, #2
•ASRSR0, R0, #1
•ASRSR1, R1, #2
•ASRSR2, R2, #3
•RORSR3, R3, R5
•RORSR4, R4, R6
• BSTART
• END
eBook PSP | MICROPROCESSOR FUNDAMENTAL – Assembly Language: Processing Data 47
REFERENCE
ARM Cortex-A Series Programmer’s Guide for ARMv7-
https://developer.arm.com/documentation/den0013/d/ARM-Thumb-Unified-
Assembly-Language-Instructions/Data-processing-operations
ECE353: Introduction to Microprocessor System
https://ece353.engr.wisc.edu/
Farahmand (2019). Microprocessor and system Design-Using PIC Microcontroller.
https://www.sonoma.edu/users/f/farahman/sonoma/courses/es310/lectures/chapter
10_interrupt.pdf
Joseph Yiu (2014). The Definitive Guide to ARM Cortex-M3 dan Cortex-M4 Processor 3rd
Edition. Oxford:Elsevier
Martin, T.(2016). The Designer’s Guide to the Cortex-M Processor Family 2nd Edition.
Place of publication not identified : Elsevier
Valvano, J. W. (2017). Embedded System: Introduction to arm Cortex-M Microcontrollers.
Nielsen Bookdata
Zhu, Y. (2015). Embedded system with ARM@ Cortex-M3 Microcontrollers in assembly
language and C. Ballston Spa : E-Man Press LLC
E ISBN 978-967-2774-20-4
POLITEKNIK SEBERANG PERAI
JALAN PERMATANG PAUH
13500 PERMATANG PAUH
PULAU PINANG
http://www.psp.edu.my