Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an HLA Assembly Program using the ROL instruction to perform multiplicatio

ID: 3804021 • Letter: W

Question


Write an HLA Assembly Program using the ROL instruction to perform multiplication, write a program to produce a double table. This table should be built from a single int8 value provided by the user and print 4 rows from the starting value, each offset by one from the starting value. In that column, the pattern of doubled numbers should be calculated by ROL instructions. For example, the following output should be produced when the user inputs the starting value 4:

Gimme a starting value: 4
Double Table
4: 8 16 32
5: 10 20 40
6: 12 24 48
7: 14 28 56

For example, the following output should be produced when the user inputs the starting value 7:

Gimme a starting value: 7
Double Table
7: 14 28 56
8: 16 32 64
9: 18 36 72
10: 20 30 40

(Note: you must use ROL to solve this problem.)
(Hint: Again, please don't worry too much about the spacing in the table. As with the prior week's assignment, the goal is to practice working with HLA...

Explanation / Answer

I would like to give an overview about the purpose of using ROL Instruction to calculate the Multiplication and producing a double table. The major reason is ROL Operation will shift each bit to the left of the mnemonics, Where the biggest value is cloned with the help of the Carry flag and the smallest value path.

The HLA assembly program is a robust programming language to make the users convienient in more user friendly way and most powerful assembly programming language.

I have attached the Code for the above criteria:

program doubleMultiply;

#include("console.hhf");
#include("stdlib.hhf");

begin doubleMultiply;

mainlp:

DATA SEGMENT
Number1 DB ?
Number2 DB ?
RESULT DB ?
stdout.puts(Message1 DB 20,27,"Please enter the first number to check the multiplication: " nl);
stdout.puts(Message2 DB 20,27,"Please enter the second number to check the multiplication:" nl);
stdout.puts(Message3 DB 20,27,"The final result of double multiplication is:" nl);
ENDS

CODE SEGMENT
ASSUME DA:DATA CS:CODE
START:
MOV AX,DATA
MOV DA,AX

LEA DX,Message1
MOV AH,9
INT 21H

MOV AH,1
INT 21H
SUB AL,30H
MOV Number1,AL

LEA DX,Message2
MOV AH,9
INT 21H

MOV AH,1
INT 21H
SUB AL,30H
MOV Number2,AL

MUL Number1
  
MOV RESULT,AL
AAM

ADD AH,30H
ADD AL,30H

MOV BX,AX

LEA DX,Message3
MOV AH,9
INT 21H

MOV AH,2
MOV DL,BH
INT 21H

MOV AH,2
MOV DL,BL
INT 21H

MOV AH,4CH
INT 21H   
ENDS
END START

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote