Question: Can you please make this to work in assembly section . data name db 'Julius Ceasar Marquez', 0 Ah , 0 Dh nameLen equ $

Can you please make this to work in assembly
section .data
name db 'Julius Ceasar Marquez', 0Ah,0Dh
nameLen equ $-name
section .bss
var1 resb 3
var2 resb 1
result resb 3
section .text
global _start
_start:
; print name
mov eax, 4
mov ebx, 1
mov ecx, name
mov edx, nameLen
int 0x80
mov eax, 3
mov ebx, 0
mov ecx, var1
mov edx, 3
int 0x80
mov eax, 3
mov ebx, 0
mov ecx, var2
mov edx, 1
int 0x80
; convert input to integers
mov eax, 0
mov al, byte [var1+0]
sub eax, 0x30
mov ebx, 100
mul ebx
mov ebx, 0
mov bl, byte [var1+1]
sub ebx, 0x30
mov ecx, 10
mul ecx
add eax, ebx
mov ebx, 0
mov bl, byte [var1+2]
sub ebx, 0x30
add eax, ebx
mov ebx, 0
mov bl, byte [var2+0]
sub ebx, 0x30
; subtract num2 from num1
sub eax, ebx
; convert result to string
mov ecx, result
mov ebx, 10
mov edx, 0
div al
add edx, 0x30
mov [ecx +2], dl
mov ebx, 10
div al
add edx, 0x30
mov [ecx +1], dl
add eax, 0x30
mov [ecx], al
; print result
mov eax, 4
mov ebx, 1
mov ecx, result
mov edx, 3
int 0x80
; exit program
mov eax, 1
xor ebx, ebx
int 0x80

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 Databases Questions!