Question: But this is the output that I got: I don't know what I am doing wrong. Help. This is my code: section .data name: db


Read a 3 digit number from one row, then a 3 digit

But this is the output that I got:

number from the second row. Multiply the two numbers and display the

I don't know what I am doing wrong. Help.

This is my code:

section .data
name: db 'Name lastname'
nameLen: equ $-name

newline db 10

section .bss
num1: resb 1
num2: resb 1
num3: resb 1
num4: resb 1
p1: resb 1;
p2: resb 1;
f: resb 1;
s: resb 1;
s1: resb 1
s2: resb 2


section .text
global _start

_start:

MOV ax, 0x7B ;; decimal: 123
MOV bx, 0x1BC ;; decimal: 444
mul ebx ;;; 123 * 444 = 54612
;;; 7B - 1BC = D554
;;; 54: 84
;;; A4: 213


mov [num1], al
mov [num2], ah

;clean numbers

mov al,0
mov ah,0

;data/ operation
mov ah , 0
mov ax , 4
mov bl , 2
div bl
add al,'0'
add ah,'0'
mov [f],al
mov [s], ah

;print name

mov eax,4
mov ebx,1
mov ecx,name
mov edx,nameLen
int 80h

;Write in th next line
mov eax,4
mov ebx,1
mov ecx,newline
mov edx,1
int 80h

;print the value of f
mov eax,4
mov ebx,1
mov ecx,f
mov edx,1
int 80h

;print the value of s
mov eax,4
mov ebx,1
mov ecx,s
mov edx,1
int 80h



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;clean numbers

mov al,0
mov ah,0
mov bl,0
mov bh,0

;data to get the thousands
mov ah , 0
mov ax , 10
mov bl , 2
div bl
add al,'0'
mov [f], al
mov [s1], ah

;clean data

mov al,0
mov ah,0
mov bl,0
mov bh,0

;print the remaiders

mov ah , 0
mov ax , 4
mov bl , 2
div bl
add al,'0'
add ah, '0'
mov [s1], al
mov [s2], ah

;print value of f

mov eax,4
mov ebx,1
mov ecx,f
mov edx,1
int 80h

;print value of s1

mov eax,4
mov ebx,1
mov ecx,s1
mov edx,1
int 80h

;print value of s2

mov eax,4
mov ebx,1
mov ecx,s2
mov edx,1
int 80h

;exit

mov eax,1
mov ebx,0
int 80h;
 

Read a 3 digit number from one row, then a 3 digit number from the second row. Multiply the two numbers and display the final result. Make sure you print your name and below it the result. Sample Input 123 444 Output Loay Alnaji 54612

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!