dsz¶
dsz R¶
指令格式¶
dsz R
影响标志¶
无
伪指令¶
1 2 | R = R - 1 if R == 0 then skip end |
指令描述¶
将寄存器R减1,结果存回到寄存器R,同时判断结果,结果为0则跳过下一条指令;
范例¶
1 2 3 4 5 6 7 | //计算1 ~ A的和 cseg sum_A: clr R0 //R0 = 0 add R0, A //R0 = R0 + A dsz A //A = A - 1; if A == 0 then skip next instruction end jmp sum_A + 1 ret //return |
dsz A, R¶
指令格式¶
dsz A, R
影响标志¶
无
伪指令¶
1 2 | A = R - 1 if A == 0 then skip end |
指令描述¶
将寄存器R减1,结果存储到累加器A,同时判断结果,如果为0则跳过下一条指令;
范例¶
1 2 3 4 5 6 7 8 9 | //计算1 ~ A的和 cseg sum_R0: clr A //A = 0 inc R0 //R0 = R0 + 1 dec R0 //R0 = R0 - 1 add A, R0 //A = A + R0 dsz A, R0 //A = R0 - 1; if A == 0 then skip next instruction end jmp sum_R0 + 2 ret //return |