Question 1: (back)
Write an HLA program that reads a single precision floating point number from the user and prints the internal representation of that value using hexadecimal notation.
program Question1; #include( "stdlib.hhf" ); static r: real32; r2: real32; cnt: int8; cnt2: int8; begin Question1; mov( 0, eax ); stdout.put( "Please enter a real number: " ); stdin.get( r ); mov( (type dword r), eax ); stdout.newln(); stdout.put( "Hex: ", eax, nl ); stdout.put( "Binary: "); mov( 0, cnt ); mov( 0, cnt2 ); while( cnt < 32 ) do if( cnt2 = 4 ) then stdout.put( "_" ); mov( 0, cnt2 ); endif; shl( 1, eax ); if( @c ) then stdout.put( "1" ); else stdout.put( "0" ); endif; inc( cnt ); inc( cnt2 ); endwhile; end Question1;