IDNLearn.com makes it easy to find precise answers to your specific questions. Ask your questions and receive accurate, in-depth answers from our knowledgeable community members.

your assignment is to write an assembly language program which read a string and print it in uppercase. this program asks the user to enter a string, which is subsequently displayed in uppercase. it is important to first ensure that string to be converted is in the a-z range. the program does not recognize any space, symbols or any kind of punctuation marks. any time the user enters any of this character the program is going to repeatedly ask for the valid string. an example execution of your program could be: please enter your string: 1winter invalid entry! please enter your string: summer your capitalized string:summer submit your ha8-main. s file on blackboard for this assignment.

Sagot :

The program starts by printing the prompt message, then reads the input string from the user using the read system call.

How to write assembly program?

Here is an example of an assembly language program that reads a string and prints it in uppercase:

.section .data

prompt:

   .ascii "Please enter your string: "

.section .text

.globl _start

_start:

   ; print the prompt

   movl $4, %eax         ; system call number for write

   movl $1, %ebx         ; file descriptor for stdout

   movl $prompt, %ecx    ; address of the prompt

   movl $17, %edx        ; length of the prompt

   int $0x80             ; invoke the system call

   ; read the input string

   movl $3, %eax         ; system call number for read

   movl $0, %ebx         ; file descriptor for stdin

   movl $input, %ecx     ; address of the input buffer

   movl $128, %edx       ; maximum length of the input string

   int $0x80             ; invoke the system call

   ; check the input string and convert to uppercase

   movl $input, %esi     ; point to the input string

   movl $output, %edi    ; point to the output buffer

loop:

   lodsb                  ; load the next character from the input string

   cmpb $0, %al          ; check for the end of the string

   je done                ; if end of string, jump to "done"

   cmpb

a', %al        ; check if the character is in the a-z range

   jb next                ; if not in range, jump to "next"

   cmpb

z', %al

   ja next                ; if not in range, jump to "next"

   subb

a'-'A', %al    ; convert to uppercase

   stosb                  ; store the character in the output buffer

   jmp loop               ; continue with the next character

next:

   jmp loop               ; repeat the loop

done:

   ; print the output string

   movl $4, %eax         ; system call number for write

   movl $1, %ebx         ; file descriptor for stdout

   movl $output, %ecx    ; address of the output string

   movl $128, %edx       ; length of the output string

   int $0x80             ; invoke the system call

   ; exit

   movl $1, %eax         ; system call number for exit

   xorl %ebx, %ebx       ; exit code 0

   int $0x80             ; invoke the system call

.section .bss

input:

   .space 128            ; buffer for the input string

output:

   .space 128            ; buffer for the output string

To Know More About assembly language, Check Out

https://brainly.com/question/14728681

#SPJ4