Write a program PROG1ASM that will 1 Output a prompt chatact

 Write a program PROG1.ASM that will  1.   Output a prompt chatacter \'?\'  2.   Input a single character  3.   echo the next character in the ASCII sequence on the next 2 lines  Assemble and link your program to create PROG1.EXE.       An example of a program run is:  C>PROG1 ?A B B C>  

Solution

Answer:

MIPS Assembly Language Code :

.zero 1
.LC0:
.string \"Enter the charter\"
.LC1:
.string \"Next charter is\"
.LC2:
.string \"Ascii value is \"
main:
push rbp
mov rbp, rsp
push rbx
sub rsp, 24
mov edi, OFFSET FLAT:.LC0
mov eax, 0
call printf
lea rax, [rbp-17]
mov rsi, rax
mov edi, OFFSET FLAT:std::cin
call std::basic_istream<char, std::char_traits<char> >& std::operator>><char, std::char_traits<char> >(std::basic_istream<char, std::char_traits<char> >&, char&)
movzx eax, BYTE PTR [rbp-17]
movsx eax, al
lea ebx, [rax+1]
mov esi, OFFSET FLAT:.LC1
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)
mov esi, ebx
mov rdi, rax
call std::basic_ostream<char, std::char_traits<char> >::operator<<(int)
movzx eax, BYTE PTR [rbp-17]
movsx eax, al
lea ebx, [rax+1]
mov esi, OFFSET FLAT:.LC2
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)
mov esi, ebx
mov rdi, rax
call std::basic_ostream<char, std::char_traits<char> >::operator<<(int)
mov eax, 0
add rsp, 24
pop rbx
pop rbp
ret
__static_initialization_and_destruction_0(int, int):
push rbp
mov rbp, rsp
sub rsp, 16
mov DWORD PTR [rbp-4], edi
mov DWORD PTR [rbp-8], esi
cmp DWORD PTR [rbp-4], 1
jne .L5
cmp DWORD PTR [rbp-8], 65535
jne .L5
mov edi, OFFSET FLAT:std::__ioinit
call std::ios_base::Init::Init()
mov edx, OFFSET FLAT:__dso_handle
mov esi, OFFSET FLAT:std::__ioinit
mov edi, OFFSET FLAT:std::ios_base::Init::~Init()
call __cxa_atexit
.L5:
nop
leave
ret
push rbp
mov rbp, rsp
mov esi, 65535
mov edi, 1
call __static_initialization_and_destruction_0(int, int)
pop rbp
ret

 Write a program PROG1.ASM that will 1. Output a prompt chatacter \'?\' 2. Input a single character 3. echo the next character in the ASCII sequence on the next
 Write a program PROG1.ASM that will 1. Output a prompt chatacter \'?\' 2. Input a single character 3. echo the next character in the ASCII sequence on the next

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site