Comparing two number - Complement and natural

Hi!

I would like two compare two number, that is, to see if A is equal,

greater or lower than B. I need an algorithm natural binary code and

other in complement code.

I have no idea how to do it in natural code. In binary code I'm stuck

in the case that A and B are both negatives and, after the operation,

I have overflow.

Could you say me how to do that (pseudo code or something like that)?

that what i have been doing:

; == Assembler 85 ==

; Cmp_Words

; complement

;

; 1st Argument: BC

; 2nd Argument; HL

; return: A

; -1 se BC < HL; 1 se BC > HL; 0 se BC=HL

Cmp_Words:

MOV A,B

SUB H ; compares H

JZ zero

JM LowerA ; the number is lower

JP GreatorA ; the number is greater

zero:

MOV A,C ; compares L

SUB L

JZ igual

JM menorA ; the number is lower

JP maiorA ; the number is greater

igual:

MVI A,00H ; the number is equal

RET

LowerA:

MVI A,0FFH

RET

GreaterA:

MVI A,01H

RET

thanks in advance,

Paulo Abreu