Using the ROL instruction to perform doubling, write a program to produce a quad table. This table should be built from
Posted: Mon Jul 11, 2022 9:54 am
Using the ROL instruction to perform doubling, write a programto produce a quad table. This table should be built from asingle int32 value provided by the user and print three rows fromthe starting value, each offset by one from the starting value. Inthat column, the pattern of quad numbers should be calculated bydoing ROL instructions twice on each value. For example, thefollowing output should be produced when the user inputs thestarting value 4:Gimme a starting value: 4Quad Table4: 16 645: 20 806: 24 96
For example, the following output should be producedwhen the user inputs the starting value 7:
Gimme a starting value: 7Quad Table7: 28 1128: 32 1289: 36 144
It should be the case that the only instructions you need tocomplete the programs assigned here are the ones described in thepictures
Programmer's Reference to HLA Assembly Language Typical Program Structure program progID; #include( "stdlib.hhf" ); static end progID; Assembly Language Instructions Description MOV Instruction Syntax mov( ADD SUB SHL SHR variable declarations SAR begin progID; statements ROL source, dest); add( source, dest); sub( source, dest); shl( count, dest); shr ( count, dest); sar ( count, est ); rol( count, dest); dest= source; dest += source; dest -= source; shuffles left a total of count bits in dest operand; sets carry when count=1 shuffles right a total of count bits in dest operand; sets carry when count=1 shuffles right a total of count bits in dest operand; sets carry when count=1; leaves H.O. bit unchanged rotates left a total of count bits Available Datatypes int8 int16 int32 boolean Available 1/0 Routines stdout.put stdout.puti8 stdout.puti16 stdout.puti32 stdout.putb stdout.putw stdout.putd stdout.newln stdin.get stdin.geti8 stdin.geti16 stdin.geti32 stdin.getb stdin.getw stdin.getd
ROR NOT AND OR XOR LAHF ror ( count, dest); and ( source, dest); or ( source, dest); xor ( source, dest); in dest operand; sets carry when count=1 inverts the not( dest bits of the )); dest lahf(); count=1 rotates right a total of count bits in dest operand; sets carry when operand bitwise logical AND; result placed in dest operand bitwise inclusive OR; result placed in dest operand bitwise exclusive OR; result placed in dest operand pushes the lower 8 bits of EFLAGS register into AH
For example, the following output should be producedwhen the user inputs the starting value 7:
Gimme a starting value: 7Quad Table7: 28 1128: 32 1289: 36 144
It should be the case that the only instructions you need tocomplete the programs assigned here are the ones described in thepictures
Programmer's Reference to HLA Assembly Language Typical Program Structure program progID; #include( "stdlib.hhf" ); static end progID; Assembly Language Instructions Description MOV Instruction Syntax mov( ADD SUB SHL SHR variable declarations SAR begin progID; statements ROL source, dest); add( source, dest); sub( source, dest); shl( count, dest); shr ( count, dest); sar ( count, est ); rol( count, dest); dest= source; dest += source; dest -= source; shuffles left a total of count bits in dest operand; sets carry when count=1 shuffles right a total of count bits in dest operand; sets carry when count=1 shuffles right a total of count bits in dest operand; sets carry when count=1; leaves H.O. bit unchanged rotates left a total of count bits Available Datatypes int8 int16 int32 boolean Available 1/0 Routines stdout.put stdout.puti8 stdout.puti16 stdout.puti32 stdout.putb stdout.putw stdout.putd stdout.newln stdin.get stdin.geti8 stdin.geti16 stdin.geti32 stdin.getb stdin.getw stdin.getd
ROR NOT AND OR XOR LAHF ror ( count, dest); and ( source, dest); or ( source, dest); xor ( source, dest); in dest operand; sets carry when count=1 inverts the not( dest bits of the )); dest lahf(); count=1 rotates right a total of count bits in dest operand; sets carry when operand bitwise logical AND; result placed in dest operand bitwise inclusive OR; result placed in dest operand bitwise exclusive OR; result placed in dest operand pushes the lower 8 bits of EFLAGS register into AH