本帖最后由 jiangzhengwenjz 于 2023-9-21 03:43 编辑
- .nds
- .arm
- READFILE:
- stmfd r13!,{r0-r5,lr}
- ldr r2,=0x04100010
- ldr r5,=0x040001A4
- bl Set_B7
- ldr r3,=0xA1416657
- str r3,[r5]
- mov r3,0
- Read:
- ldr r0,[r5]
- ands r4,r0,0x800000
- beq End
- ldr r4,[r2]
- cmp r3,0x80 // 这里,想读多少字节数据,改成对应的就好了
- strcc r4,[r1, r3, lsl 2]
- addcc r3,r3,1
- ands r4,r0,0x80000000
- bne Read
- End:
- mov r0, 0
- bl Set_B7
- ldmfd r13!,{r0-r5,pc}
- Set_B7:
- stmfd r13!,{r1-r2}
- ldr r2, =0x040001A4
- Wait:
- ldr r1, [r2]
- ands r1, r1, 0x80000000
- bne Wait
- mov r1,0xC0
- strb r1,[r2, -0x03]
- ldr r1, =0x040001A8
- cmp r0, 0
- movne r2, 0xB7
- moveq r2, 0xB8
- strb r2, [r1], 1
- mov r2, r0, lsr 0x18
- strb r2, [r1], 1
- mov r2, r0, lsr 0x10
- strb r2, [r1], 1
- mov r2, r0, lsr 0x8
- strb r2, [r1], 1
- strb r0, [r1], 1
- mov r2, 0
- strb r2, [r1], 1
- strb r2, [r1], 1
- strb r2, [r1], 1
- ldmfd r13!,{r1-r2}
- bx lr
- .pool
复制代码
其中,READFILE接受两个参数,r0是rom的偏移,r1是main ram指针
这个是从塞尔达里抄过来的,如果侵权了之类的麻烦说一声,楼主给它删掉
读一读这个程序就知道rom的io接口该怎么设置了~ |