.global _start _start: ldr r7, =SW ldr r1, =LED ldr r2, =SSLED ldr r3, [r7] str r3, [r1] mov r9, #0 mov r10, #0 mov r11, #0 mov r12, #0 _cv1: cmp r3, #1000 bge _sub1000 _cv2: cmp r3, #100 bge _sub100 _cv3: cmp r3, #10 bge _sub10 _cv4: cmp r3, #1 bge _sub1 _LED1: mov r4, r9 bl _comparator mov r6, r0 lsl r6, #8 _LED2: mov r4, r10 bl _comparator add r6, r0 lsl r6, #8 _LED3: mov r4, r11 bl _comparator add r6, r0 lsl r6, #8 _LED4: mov r4, r12 bl _comparator add r6, r0 str r6, [r2] b _start _sub1000: sub r3, #1000 add r9, #1 b _cv1 _sub100: sub r3, #100 add r10, #1 b _cv2 _sub10: sub r3, #10 add r11, #1 b _cv3 _sub1: sub r3, #1 add r12, #1 b _cv4 _comparator: _c0: cmp r4, #0 bne _c1 mov r0,#0x3F bx lr _c1: cmp r4, #1 bne _c2 mov r0,#0x06 bx lr _c2: cmp r4, #2 bne _c3 mov r0,#0x5B bx lr _c3: cmp r4, #3 bne _c4 mov r0,#0x4F bx lr _c4: cmp r4, #4 bne _c5 mov r0,#0x66 bx lr _c5: cmp r4, #5 bne _c6 mov r0,#0x6D bx lr _c6: cmp r4, #6 bne _c7 mov r0,#0x7D bx lr _c7: cmp r4, #7 bne _c8 mov r0,#0x07 bx lr _c8: cmp r4, #8 bne _c9 mov r0,#0x7F bx lr _c9: mov r0,#0x67 bx lr .data .equ SW, 0xff200040 .equ LED, 0xff200000 .equ SSLED, 0xff200020