用arm写,谢谢
发布网友
发布时间:2024-10-09 04:37
我来回答
共1个回答
热心网友
时间:2024-11-16 13:54
.global
.text
.equ num,20
_start:
ADR r0, src /*将str地址送给R0*/
ADR r3, src1
ADR r4, src2
ADR r5, src3
ADR r6, src4
MOV r2, #num
change:
LDRB r7, [r0], #1
CMPS r7,#0x30 /*比0小?*/
BLT l3
CMPS r7,#0x39 /*比9大?*/
BGT l1
STRB r7, [r3], #1
B pe
l1: CMPS r7,#0x41 /*比A小?*/
BLT l3
CMPS r7,#0x5a /*比Z大?*/
BGT l2
STRB r7, [r4], #1
B pe
l2: CMPS r7,#0x61 /*比a小?*/
BLT l3
CMPS r7,#0x7a /*比z大?*/
BGT l3
STRB r7, [r5], #1
B pe
l3: STRB r7, [r6], #1
pe: SUBS r2, r2, #1
CMPS r2,#0
BNE change
stop:
B stop
.ltorg
src:
.string "7Wdhd@y3#jfsdaGJd7Bh\n"
src1:
.string "00000000000000000000\n"
src2:
.string "00000000000000000000\n"
src3:
.string "00000000000000000000\n"
src4:
.string "00000000000000000000\n"
.end