.data 段的内存引用实例
十进制数不要以0开头,否则会被认为是8进制数
一个数前面可以加-负号或者~取反符号;
申请一个内存块;
重复!
转义字符!
内存对齐
The offset from the PC has 19 bits in the instruction, which gives a range of +/-1MB. The offset address is in words “ldr X1, #8” means 8 words from the current instruction. Any data that you want to modify should go in a .data section.
updates X1 with the value calculated
一个程序:把字符串转成大写
.global _start _start: ldr x0,=instr ldr x1,=outstr mov x2,0 loop: ldrb w3,[x0,x2] cmp w3,0 b.eq cout //reach the end of instr cmp w3,'a' b.cc write cmp w3,'z' b.hi write sub w3,w3,'a'-'A' write: strb w3,[x1,x2] add x2,x2,1 //next loop b loop cout: mov x0,1 //stdout mov x8,64 //linux write system call svc 0 mov x0,0 mov x8,93 svc 0 .data instr: .asciz "a test string , convert To UPPER case.\n" outstr: .fill 255,1,0
ldp,stp,加载或保存128bits数据,使用2个64位寄存器;
标签:CHAPTER,Memories,mov,write,w3,Thanks,x2,x0,内存 From: https://www.cnblogs.com/yangdinshan/p/17641453.html