dsnz¶
dsnz R¶
指令格式¶
dsnz 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 dsnz A //A = A - 1; if A != 0 then skip next instruction end ret //return jmp sum_A + 1 |
dsnz A, R¶
指令格式¶
dsnz 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 | //计算1 ~ R0的和 cseg sum_R0: clr A //A = 0 add A, R0 //A = A + R0 dsnz A, R0 //A = R0 - 1; if A != 0 then skip next instruction end ret //return dec R0 //R0 = R0 - 1 jmp sum_R0 + 1 |