sbnz¶
sbnz B¶
指令格式¶
sbnz B
影响标志¶
无
伪指令¶
1 | if B != 0 then skip end |
指令描述¶
如果比特B不为0则跳过下一条指令;
范例¶
1 2 3 4 5 6 7 8 | export FLAG dseg bit FLAG //其他程序改变其值 cseg sbnz FLAG //if FLAG != 0 then skip next instruction end ... //do something ... |
sbnz R, p¶
指令格式¶
sbnz R, p
影响标志¶
无
伪指令¶
1 | if R[p] != 0 then skip end |
指令描述¶
如果寄存器R的第p位不为0则跳过下一条指令;
范例¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /** * 测试A中为1的bit的数量是否为偶数: * 偶数return 1 * 奇数return 0 */ cseg f_is_bits_even_A: bset R0, 0 //R0[0] = 1 snz A //if A != 0 then skip next instruction end jmp end sbz A, 0 //if A[0] == 0 then skip next instruction end bcpl R0, 0 //R0[0] = ~R0[0] rsh A //A = A >> 1 jmp f_is_bits_even_A + 1 end: sbnz R0, 0 //if R0[0] != 0 then skip next instruction end ret #0 //return 0 ret #1 //return 1 |