test3.txt

来自「ARM综合板子分时电度器计算电价」· 文本 代码 · 共 45 行

TXT
45
字号
.global _start.text.equ	time1, 6              	/* Number of entries in jump table */.equ    time2, 22_start:        MOV     r0, #0  		/*  set up the three parameters */        MOV     r1, #10			/*R1中是由时钟传来的时刻(小时,不计分钟),*/        MOV     r2, #20			/*R2中为6时至22时用电度数20(整数,动态增加)*/        MOV     R3,#30       /*R3中为22时至次日6时用电度数30(整数,动态增加),*/        MOV     R4,#4		    /*R4中为每度电的价格(4元),*/        MOV     R8,#4        MOV     R9,#2        MOV     R10,#0x00000003        BL      arithfunc   /*  call the function   BL:Branch with link */stop:        B		stoparithfunc:                       /*  label the function */        MLA R7,R2,R8,R0        MLA R6,R3,R9,R7        STMIA r10,{R6}        CMP     r1, #time1        /*  Treat function code as unsigned integer */        BLS     DoHalf           /*  If code is <=6 then do operation 0. */        CMP     R1,#time2        BHS     DoHalf        BL			DoFull				        ADR     r3, JumpTable   /*  Load address of jump table */        LDR     pc, [r3,r0,LSL#2]	/*  Jump to the appropriate routine */JumpTable:        .long     DoFull        .long     DoHalfDoFull:        MOV     R5,#4        MOV     pc,lrDoHalf:	MOV     R5,#2    MOV     pc,lr .end							/*  mark the end of this file */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?