This commit is contained in:
2023-11-08 14:27:21 +00:00
commit f39b67e87d
32 changed files with 238 additions and 0 deletions

25
twos_complement.hla Normal file
View File

@@ -0,0 +1,25 @@
program twosComplement;
#include("stdlib.hhf")
static
pos_value: int8;
neg_value: int8;
begin twosComplement;
stdout.put( "Enter an integer between 0 and 127: " );
stdin.get( pos_value );
stdout.put( nl, "Value in hex: $" );
stdout.puth8( pos_value );
mov( pos_value, al );
// not ( al );
// stdout.put( nl, "Invert all the bits: $", al, nl);
// add( 1, al );
neg( al );
// stdout.put( "Add one: $", al, nl );
mov( al, neg_value );
stdout.put( nl, "Result in decimal: ", neg_value, nl);
end twosComplement;