//sum of 1 ~ A
cseg
sum_A: mov R0, A //R0 = A
clr A //A = 0
add A, R0 //A = A + R0
dec R0 //R0 = R0 - 1
snz R0 //if R0 != 0 then skip next instruction end
ret
jmp sum_A + 2
//sum of 1 ~ A
cseg
sum_A: clr R0 //R0 = 0
add R0, A //R0 = R0 + A
dec R0 //R0 = R0 - 1
snz A, R0 //A = R0; if R0 == 0 then skip next instruction end
ret
jmp sum_A + 1