Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

question: Display the final counts on your screen using software interrupts as s

ID: 2268573 • Letter: Q

Question

question:

Display the final counts on your screen using software interrupts as shown in the example. (Hint: How to

convert from hex number to ASCII number?)

ENTER A STRING : T h i s Pentium 4 computer i s t o o f a s t t o run a DOS program . :

(

I n p u t S t r i n g : T h i s Pentium 4 computer i s t o o f a s t t o run a DOS program . :

(

C o n t a i n s :

5 c a p i t a l l e t t e r ( s ) .

39 s m a l l l e t t e r ( s ) .

1 number ( s ) .

4 symbol ( s )

can anyone help me to finsh the last part of the code thanks!

.data

//Declare your variables here

   COUNT_CAP: .word 0
   COUNT_SMALL: .word 0
   COUNT_DIGIT: .word 0
   COUNT_OTHER: .word 0
   input_string:   .ascii   "                                        "
   length=       .-   input_string
   @output_string:   .ascii   "ENTER A STRING "
   @output_string2:   .ascii   "   capital letter(s) "           @R10
   @output_string3:   .ascii   "   small letter(s) "               @R11  
   @output_string4:   .ascii   "   nmber(s) "                       @R9
   @output_string5:   .ascii   "   symbol(s) "                   @R12
.text
.global main

main:
  
   MOV R7,#4
   MOV R0,#1
   MOV R2,#15
   LDR R1,=output_string
   SWI 0
   //Code here for steps 1-7
   MOV R7, #3
   MOV R0, #0
   LDR R2, =length
   LDR R1, =input_string
   SWI 0
  
   MOV R7, #4
   MOV R0, #1
   SWi 0
  
  
   MOV R9, #0 @digit
   MOV R10, #0 @cap
   MOV R11, #0 @small
   MOV R12, #0 @others
  
start:  
       LDRB R8,[R1]
       CMP R8, #0x0A @end
       BEQ end
  
       CMP R8, #0x2F   @other
       BLE inc_other
          
       CMP R8, #0x39   @digit
       BLE inc_dig
   
       CMP R8, #0x40   @other
       BLE inc_other
   
       CMP R8, #0x5A   @cap
       BLE inc_cap
   
       CMP R8, #0x60   @other
       BLE inc_other
   
       CMP R8, #0x7A   @small
       BLE inc_small
   
       CMP R8, #0x7F   @other
       BLE inc_other  
   
inc_dig:
           add R9,R9,#1
           add R1,R1,#1
           BAL start
          
inc_cap:
           add R10,R10,#1
           add R1,R1,#1
           BAL start
          
          
inc_small:  
           add R11,R11,#1
           add R1,R1,#1
           BAL start
          
inc_other:
           add R12,R12,#1
           add R1,R1,#1
           BAL start
          
end:
           ldr R2, =COUNT_DIGIT
           strb R9, [R2]
           ldr R3, =COUNT_CAP
           strb R10, [R3]
           ldr R4, =COUNT_SMALL
           strb R11, [R4]
           ldr R5, =COUNT_OTHER
           strb r12, [R5]
          
          
          
  
    @ exit syscall
    mov r7, #1
    swi 0

          
          
  
    @ exit syscall
    mov r7, #1
    swi 0

Explanation / Answer

.data

//Declare your variables here

COUNT_CAP: .word 0
COUNT_SMALL: .word 0
COUNT_DIGIT: .word 0
COUNT_OTHER: .word 0
input_string: .ascii " "
length= .- input_string
@output_string: .ascii "ENTER A STRING "
@output_string2: .ascii " capital letter(s) " @R10
@output_string3: .ascii " small letter(s) " @R11   
@output_string4: .ascii " nmber(s) " @R9
@output_string5: .ascii " symbol(s) " @R12
.text
.global main

main:
  
MOV R7,#4
MOV R0,#1
MOV R2,#15
LDR R1,=output_string
SWI 0
//Code here for steps 1-7
MOV R7, #3
MOV R0, #0
LDR R2, =length
LDR R1, =input_string
SWI 0
  
MOV R7, #4
MOV R0, #1
SWi 0
  
  
MOV R9, #0 @digit
MOV R10, #0 @cap
MOV R11, #0 @small
MOV R12, #0 @others
  
start:   
LDRB R8,[R1]
CMP R8, #0x0A @end
BEQ end
  
CMP R8, #0x2F @other
BLE inc_other
  
CMP R8, #0x39 @digit
BLE inc_dig

CMP R8, #0x40 @other
BLE inc_other

CMP R8, #0x5A @cap
BLE inc_cap

CMP R8, #0x60 @other
BLE inc_other

CMP R8, #0x7A @small
BLE inc_small

CMP R8, #0x7F @other
BLE inc_other   

inc_dig:
add R9,R9,#1
add R1,R1,#1
BAL start
  
inc_cap:
add R10,R10,#1
add R1,R1,#1
BAL start
  
  
inc_small:   
add R11,R11,#1
add R1,R1,#1
BAL start
  
inc_other:
add R12,R12,#1
add R1,R1,#1
BAL start
  
end:
ldr R2, =COUNT_DIGIT
strb R9, [R2]
ldr R3, =COUNT_CAP
strb R10, [R3]
ldr R4, =COUNT_SMALL
strb R11, [R4]
ldr R5, =COUNT_OTHER
strb r12, [R5]
  
  
  
  
@ exit syscall
mov r7, #1
swi 0

  
  
  
@ exit syscall
mov r7, #1
swi 0