Question: Computer science. Microcomputer assembly language ( ASCII data ) Code Templet: section . bss input resb 2 5 ; reserve 2 5 bytes for input

Computer science.
Microcomputer assembly language (ASCII data)
Code Templet:
section .bss
input resb 25 ; reserve 25 bytes for input
sum resb 2
section .data
len0 dd 0
msg db "Hello ",
len equ $ - msg
msg2 db "! How are you?", 0xA
len2 equ $ - msg2
msg3 db "Your name has ",
len3 equ $ - msg3
msg4 db " characters in it.",0xA
len4 equ $ - msg4
section .text
global _start
_start:
mov ecx, msg
mov edx, len
call print
; Read from input
mov eax, 3
mov ebx, 0
mov ecx, input
mov edx, 25
int 0x80
mov [len0], eax
mov dx,0
mov bx,10 ; divide by 10 for tens column value
div bx ; ax = ax / bx
add ax,'0' ; convert digit to ASCII
mov [sum], byte ax ; move quotient into place
add dx,'0' ; convert digit to ASCII
mov [sum+1], byte dx ; move remainder into place
mov ecx, input
mov edx, [len0]
call print
mov ecx, msg2
mov edx, len2
call print
mov ecx, msg3
mov edx, len3
call print
mov ecx, sum
mov edx, 2
call print
mov ecx, msg4
mov edx, len4
call print
call exit
print:
mov eax, 4 ;sys_write
mov ebx, 1 ;stdout
int 0x80 ;System call
ret ;Return to caller
exit:
mov eax, 1 ;Sys_exit
mov ebx, 0 ;Stdin
int 0x80 ;System call
Computer science. Microcomputer assembly language

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!