有没有办法增加8051架构的内存?
例如:
内存插槽:
mov 0x71, #0x01
mov 0x72, #0x02
mov 0x73, #0x03
有没有办法在for循环中说
mov 0x71, A
do something;
mov 0x72, A
do something;
在for循环中?
在java中你只是做了简单的for(int i = 0; i < variable; i++)
,但我不知道如何在8051架构中做到这一点。
答案 0 :(得分:2)
当然,有很多方法可以做到这一点。我可能会使用DJNZ或CJNE指令,具体取决于周围的代码。
;Load your control variable into B. From a table, GPIO, etc.
MOV B,#3H
;Build your loop. This is basically a Do While loop.
;int i=0, (really a byte since 8 is 8-bit)
CLR A
;Start of the loop, notice this is AFTER the CLR op
FN_LOOP:
;Do something...
;i++
INC A
;i < variable. Stops when A == B
CJNE A,B,FN_LOOP
;Rest of your code
我建议您阅读装配中的寻址模式。这些知识对于阅读汇编指令集文档至关重要。