[ARM] 입력받은 숫자의 합을 2진수로 출력하기
.text _start: .global _start mov r0, #0 mov r2, #1 mov r7, #3 ldr r1, #3 mov r6, #0 mov r8, #128 mov r9, #7 swi 0 ldrb r5, [r1] LOOP: CMP r5, #10 BEQ cal CMP r5, #49 BLT LOOP2 CMP r5, #56 BGT LOOP2 SUB r5, r5, #48 ADD r6, r6, r5 LOOP2: mov r0, #0 mov r2, #1 mov r7, #3 ldr r1, =buf swi 0 ldrb r5, [r1] B LOOP cal: AND r5, r6, r8 lsr r5, r9 lsr r8, #1 mov r0, #1 mov r2, #1 mov r7, #4 ADD r5, r5, #4..
2014. 1. 23.
[ARM] 입력받은 문자열중 숫자만 출력하기
.text_start: .global _startmov r0, #0ldr r1, =bufmov r2, #1mov r7, #3swi 0ldrb r5, [r1]LOOP:CMP r5, #10BEQ exitCMP r5, #49BLT LOOP2CMP r5, #57BGT LOOP2mov r0, #1mov r2. #1mov r7, #4swi 0LOOP2:mov r0, #0ldr r1, =bufmov r2, #1mov r7, #3swi 0ldrb r5, [r1]B LOOPexit:mov r0, #0mov r7, #1swi 0.data.alignbuf: .skip 4.end
2014. 1. 23.