Testing for zeroAssembler/8086

If a routine gives back the result in a register and its value is 0 on error and 1 on success, the ordinary

        or      ax,ax
	je      error
There are two things to note. First, use TEST instead of OR. This does not write the result back to the register. There is however a better solution that is smaller:
        dec     ax
	jne     error
For example, the XMS driver reports the errors this way. Is it fair that testing a register=0 is longer than testing if it is 1 or -1?
Gem writer: Ervin Toth
last updated: 1998-03-16