NVM, got it, thanks for the help.
Posted on 2009-11-10 16:46:17 by dre
How about and al, ah? :)
Posted on 2009-11-10 16:47:25 by Scali
Is that all I'm missing, I don't get where to put that and why I'd need it, can you briefly explain?
Posted on 2009-11-10 16:52:48 by dre
actually, this is ALL you need. "AND" performs a bitwise multiplication, i.e.:
0 * 0 = 0
0 * 1 = 0
1 * 0 = 0
1 * 1 = 1

so single and al, ah instruction does what you want.

The code would be:

mov AL, byte1
mov AH, byte2
call similar

similar PROC

and AL, AH

.EXIT
similar ENDP


You have pretty much reinvented the wheel with your code.
Posted on 2009-11-10 17:51:58 by ti_mo_n
Awesome, but would my code do it as well?
Posted on 2009-11-10 17:58:14 by dre
Short answer: no.

mov al, 0 sets entire al register to 0, not only it's least significant bit. Moreover, shr al, 1 places shifted-out bit into CF, which, in turn, is reset by check: test ah, 1 and lost forever.

You may apply these modifications: replace shr al, 1 with ror al, 1 and mov al, 0 with and al, not 1.
I suppose incomplete mov cx instruction was mov cx, 0?

The .EXIT directive generates code that terminates the program and returns control to the operating system or calling program. Use of the <expression> parameter returns a numeric exit code to the operating system or calling program.
Posted on 2009-11-10 19:09:51 by baldr

NVM, got it, thanks for the help.


dre, in the future, please do not edit your posts and remove the original content... by doing so, you limit the ability of others to learn from this thread.
Posted on 2009-11-10 23:32:46 by SpooK