I have a assembly program to write. I need to check the AX register, if the AX register is greater than 0 move +1 in BX, if the AX register has a value less than 0 then move -1 in BX else if AX =0 then move 0 in BX. I have the following code that does it but I am looking for an alternate solution. Please help out. Thanks
CMP AX, 0
JG GREATER
JL LESS
MOV BX, 0
GREATER:
MOV BX, 1
LESS:
MOV BX, -1
The code you gave always returns -1. Try this: