PROGRAM 5: Big Number! Write an HLA Assembly language program that prompts for a specific int8 value named n and then di
Posted: Tue Jul 12, 2022 8:03 am
PROGRAM 5: Big Number!Write an HLA Assembly language program that prompts for a specificint8 value named n and then displays a repeated digit patternstarting with that number. The repeated digit pattern should showall the odd numbers from 1 up to that number followed by all theeven numbers from 2 up to that number. Shown below is asample program dialogue.
(Hint: I would recommend you write it first in C or Visual Basicand then translate your lines of code, one-by-one, into a assemblystatements, just like our good friend mr. compiler does.)(Hint: Since we don't really know how to do much math at thispoint, start your first loop at 1 and the second loop at 2 and thenincrement by 2 in each loop until you reach n...)
MOV ADD SUB SHL SHR SAR ROL ROR Instruction Syntax NOT AND OR XOR LAHP INC DEC CMP JMP SETCC Joc |C NC 8:47 Back 7 NZ S NS referenceguideiii.htm Programmer's Reference to HLA Assembly Language Typical Program Structure program progID; #include( "stdlib.hhf" ); static p variable declarations begin progID; statements end progID; Assembly Language Instructions novt source, dest); add source, dest); sub source, dest); sh1 count, dest); shr count, dest); sar count, dest); rol count, deat); ror count, dest); not dast 1/ and source, dest); or source, dest); xor source, dest); laht(); inc operand ); dec operand 17 emp lhs, the ); jmp label; imp( 32bit_register); jmp dward); Abbreviation setec (8bit_operand); 1cc label: Dashboard Meaning Set if Carry - 1 Set if Carry 0 Set if Zero 1 Set if Zero 0 Set if Sign 1 Set if Sign = 0 Set if Overflow 1 Description DOD 000 Calendar deat source; dest source; source; dast shuffles left a total of count bits in dest operand; sets carry when count-1 shuffles right a total of count bita 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 oits in dest operand; seta carry when count-1 rotates right a total of count bits in dest operand sets carry when count-1 transfers control to label when condition is met. Mnemonics listed below. Mnemonics For SETcc and Jcc Instructions inverts the bits of the dest operand bitwise logical AND; result placed in dest operand bitwise inclusive CR; result placed in dest operand bitwise exclusive OR; result placed in dest operand pushes the lewer 8 bits of EFLAGS register into AH operand operand + 1 operand operand 17 sets EFLAGS as if lhs-rha waa performed; does not change the value of either operand unconditional transfer of control. Note the inconsistent use of parentheses. reads an EFLAG bit into a byte operand. Mnemonics listed below. To Do 5 Example SETC SETNC SETZ SETNZ SETS SETNS SETO a Notifications A Available Datatypes int8 int16 int32 boolean Available 1/0 Routines atdout.put stdout.puti stdout.putil6 atdout.puti32 stdout.putb atdout.put stdout.put d stdout.newin stdin.get atdin.geti8 stdin.geti16 atdin.geti32 stdin.geth atdi n.getw stdin.getd M Inbox
(Hint: I would recommend you write it first in C or Visual Basicand then translate your lines of code, one-by-one, into a assemblystatements, just like our good friend mr. compiler does.)(Hint: Since we don't really know how to do much math at thispoint, start your first loop at 1 and the second loop at 2 and thenincrement by 2 in each loop until you reach n...)
MOV ADD SUB SHL SHR SAR ROL ROR Instruction Syntax NOT AND OR XOR LAHP INC DEC CMP JMP SETCC Joc |C NC 8:47 Back 7 NZ S NS referenceguideiii.htm Programmer's Reference to HLA Assembly Language Typical Program Structure program progID; #include( "stdlib.hhf" ); static p variable declarations begin progID; statements end progID; Assembly Language Instructions novt source, dest); add source, dest); sub source, dest); sh1 count, dest); shr count, dest); sar count, dest); rol count, deat); ror count, dest); not dast 1/ and source, dest); or source, dest); xor source, dest); laht(); inc operand ); dec operand 17 emp lhs, the ); jmp label; imp( 32bit_register); jmp dward); Abbreviation setec (8bit_operand); 1cc label: Dashboard Meaning Set if Carry - 1 Set if Carry 0 Set if Zero 1 Set if Zero 0 Set if Sign 1 Set if Sign = 0 Set if Overflow 1 Description DOD 000 Calendar deat source; dest source; source; dast shuffles left a total of count bits in dest operand; sets carry when count-1 shuffles right a total of count bita 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 oits in dest operand; seta carry when count-1 rotates right a total of count bits in dest operand sets carry when count-1 transfers control to label when condition is met. Mnemonics listed below. Mnemonics For SETcc and Jcc Instructions inverts the bits of the dest operand bitwise logical AND; result placed in dest operand bitwise inclusive CR; result placed in dest operand bitwise exclusive OR; result placed in dest operand pushes the lewer 8 bits of EFLAGS register into AH operand operand + 1 operand operand 17 sets EFLAGS as if lhs-rha waa performed; does not change the value of either operand unconditional transfer of control. Note the inconsistent use of parentheses. reads an EFLAG bit into a byte operand. Mnemonics listed below. To Do 5 Example SETC SETNC SETZ SETNZ SETS SETNS SETO a Notifications A Available Datatypes int8 int16 int32 boolean Available 1/0 Routines atdout.put stdout.puti stdout.putil6 atdout.puti32 stdout.putb atdout.put stdout.put d stdout.newin stdin.get atdin.geti8 stdin.geti16 atdin.geti32 stdin.geth atdi n.getw stdin.getd M Inbox