I made a program that can create and call a function that determines if the sum of all three values is odd and then sets DL to one if the sum is odd; otherwise, set DL to zero, but it doesnt work. Could anyone help? It alwyas truns out "sumIsOdd returned true!" Highly appreciate any and all help!
program Odd_Number;
#include( "stdlib.hhf" );
static
value1 : int8;
value2 : int8;
value3 : int8;
procedure oddtest( var value1 : int8; var value2 : int8; var value3 : int8 ); @nodisplay; @noframe;
static
dReturnAddress : dword;
begin oddtest;
pop( dReturnAddress );
pop( AX );
pop( BX );
pop( CX );
push( dReturnAddress );
mov(0,DX);
add(DX, AX);
add(DX, BX);
add(DX, CX);
sub_repeat:
dec(DX);
dec(DX);
cmp(DX, 0);
jg sub_repeat;
je even_result;
stdout.put("sumIsOdd returned true!");
jmp done;
even_result:
stdout.put("sumIsOdd returned false!");
done:
ret( );
end oddtest;
begin Odd_Number;
stdout.put( "Provide value1:" );
stdin.get(value1);
stdout.put( "Provide value2:" );
stdin.get(value2);
stdout.put( "Provide value3:" );
stdin.get(value3);
mov(value1,AL);
mov(value2,BL);
mov(value3,CL);
push(CX);
push(BX);
push(AX);
call oddtest;
end Odd_Number;