本帖最后由 meeagle 于 2022-10-4 20:16 编辑
MIPS汇编的学习资料网上特别少,特别是汇编的,以下是PIC32MX上测试过的简单范例,适合初学者入门(当初我就到处找这样的范例找不到)/*LED闪烁,RB5=0.8S频率*/
.EQU ANSELBCLR,0X6104
.EQU TRISBCLR,0X6114
.EQU PORTBINV,0X612C
.section fffd,code,address(0xBFC02FF0)
.word 0x0007FFFF
.word 0xFFFFFFFF
.word 0xFF7FFF58
.word 0x7FFFFFEB
.text
.global main
.ent main
main:
LUI $6,0XBF88
ORI $9,$0,0x20/*RB5*/
SW $9,ANSELBCLR($6)/*ANSEL*/
SW $9,TRISBCLR($6)/*TRIS*/
IOSD1: SW $9,PORTBINV($6)/*PORT*/
LUI $6,0x4
ORI $6,0x11AA
IOSD2: ADDI $6,-1
BNE $6,$0,IOSD2
NOP
SW $9,PORTBINV($6)/*PORT*/
LUI $6,0x4
ORI $6,0x11AA
IOSD3: ADDI $6,-1
BNE $6,$0,IOSD3
NOP
B IOSD1
NOP
.end main
以上文件,建一个.S文件复制进去就可以成功编译了(不需要头文件)。
|