Alisa Allaire
/
4180L1_P1ASM
s
my_asm.s
- Committer:
- aallaire3
- Date:
- 2018-01-18
- Revision:
- 0:208fc50f22f9
File content as of revision 0:208fc50f22f9:
AREA asm_func, CODE, READONLY EXPORT my_asm my_asm LDR R1, =0x2009C000 // pushbutton at p8 LDR R2, =0x2009C040 // led at p21 MOV.W R3, #0x000020 ; 0x000020 = 1<<5 all "0"s with a "1" in bit 5 ; value passed from C compiler code is in R0 - compare to a "0" CMP R1, #0 ; value == 0 ? ; (If-Then-Else) on next two instructions using equal cond from the zero flag ITE EQ ; STORE if EQ - clear led 1 port bit using GPIO FIOCLR register and mask STREQ R3, [R2,#0x5C] ; if==0, clear LED1 bit ; STORE if NE - set led 1 port bit using GPIO FIOSET register and mask STRNE R3, [R1,#0x58] ; if==1, set LED1 bit ; Return to C using link register (Branch indirect using LR - a return) BX LR END