| ??? 10/01/09 10:45 Read: times |
#169329 - OR this way also Responding to: ???'s previous message |
Dear Jr,
It was not wrong to write this way Jr Requiroso said:
So for example, should I redo the code for AHUNDS as follows (not sure if I'm right):
AHUNDS:
MOV A, R0
FZERO:
CJNE A, #0, FONE
MOV R3, #ZERO
RET
FONE:
CJNE A, #1, FTWO
MOV R3, #ONE
RET
FTWO:
MOV R3, #TWO
RET
thanks for the heads up! regards, JR But you can do this way too (so that one function has 1 return) (this might be important if you need to push-pop some registors) AHUNDS:
MOV A, R0
FZERO:
CJNE A, #0, FONE
MOV R3, #ZERO
sjmp F_RET
FONE:
CJNE A, #1, FTWO
MOV R3, #ONE
sjmp F_RET
FTWO:
MOV R3, #TWO
F_RET:
RET
Regards, Mahesh. |



