Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8922793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:56:13+00:00 2026-06-15T06:56:13+00:00

Having a bit of difficulty getting my input to print once a white space

  • 0

Having a bit of difficulty getting my input to print once a white space character is inputted. So far, i have it to display the uppercase/lowercase of the input but once i enter a string it doesnt read whats after the white space character. any suggestions?

EDIT: intel x86 processor and im using EMU8086

org 100h

include 'emu8086.inc'
printn "Enter string to convert" 
mov dx,20
call get_string

printn
mov bx,di
mov ah,0eh

mov al,[ds+bx]
cmp al, 41h

cmp al, 5Ah
jle ToLower1
cmp al, 61h
cmp al, 7ah
jle ToUpper1

ToLower1:
add al, 20h
int 10h
jmp stop1
ToUpper1:
sub al, 20h
int 10h
stop1:

inc bx
mov al,[ds+bx]
cmp al, 41h

cmp al, 5Ah
jle ToLower2
cmp al, 61h

cmp al, 7ah
jle ToUpper2

ToLower2:
add al, 20h
int 10h
jmp stop2
ToUpper2:
sub al, 20h
int 10h
stop2:

inc bx
mov al,[ds+bx]
cmp al, 41h

cmp al, 5Ah
jle ToLower3
cmp al, 61h

cmp al, 7ah
jle ToUpper3

ToLower3:
add al, 20h
int 10h
jmp stop3
ToUpper3:
sub al, 20h
int 10h
stop3:

inc bx
mov al,[ds+bx]
cmp al, 41h

cmp al, 5Ah
jle ToLower4
cmp al, 61h

cmp al, 7ah
jle ToUpper4

ToLower4:
add al, 20h
int 10h
jmp stop4
ToUpper4:
sub al, 20h
int 10h
stop4:

inc bx
mov al,[ds+bx]
cmp al, 41h

cmp al, 5Ah
jle ToLower5
cmp al, 61h
cmp al, 7ah
jle ToUpper5

ToLower5:
add al, 20h
int 10h
jmp stop5
ToUpper5:
sub al, 20h
int 10h
stop5:



printn
hlt
define_get_string
define_print_string
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:56:15+00:00Added an answer on June 15, 2026 at 6:56 am

    @Oded, those registers are x86 and emu8086 would imply an emulator for the 8086 CPU.

    @OP:
    Well your adding 32 to a character code to make it lower right? The ASCII code for space is 32 and the ASCII code for the @ symbol is 64 right? That should tell you your compares are wrong somewhere.

    cmp al, 41h ;A
    ; WHAT ARE YOU MISSING HERE?
    cmp al, 5Ah ;Z
    jle ToLower1
    
    cmp al, 61h ;a
    ; WHAT ARE YOU MISSING HERE?
    cmp al, 7ah ;z
    jle ToUpper1
    

    Do you see the error? This is basically telling the CPU if the current character is equal to or less than Z to make lower. Also, if the character is equal to or less than z to make upper.

    So what you have is:

    You need a conditional jump after cmp al, 41H and a conditional jump after cmp al, 61H

    But that still won’t work, this should work:

    cmp     al, 41H
    jb      CheckForLower
    cmp     al, 5AH
    ja     CheckForLower
    ; convert to lowercase here
    ; Process next char
    
    cmp     al, 61H
    jb      NotValid
    cmp     al, 7AH
    ja      NotValid
    ; convert to uppercase here
    ; Process next char
    

    * Edit *
    We can condense all that code into 1 loop:

    org 100h
    
    include 'emu8086.inc'
    printn "Enter string to convert" 
        mov     dx,20
        call    get_string
    
    printn
        mov     bx, di
        mov     ah,0eh 
    
        jmp     Start  
    
    NextChar:
        inc     bx 
    
    Start:
        mov     al, [ds+bx]   
        test    al, al
        jz      stop5      
    
        cmp     al, 20H    
        je      PrintChar   
    
        cmp     al, 41H    
        jb      CheckLower  
        cmp     al, 5AH
        ja      CheckLower
        add     al, 20H   
        int     10H
        jmp     NextChar
    
    CheckLower:
        cmp     al, 61H
        jb      NextChar
        cmp     al, 7AH
        ja      NextChar
        sub     al, 20H           
    
    PrintChar:
        int     10H
        jmp     NextChar 
    
    stop5:
        printn  
        hlt
        define_get_string
        define_print_string
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a bit of difficulty getting a JavaScript function to execute once and
I am having a bit of difficulty with this current code I have set
I am having a bit of difficulty getting Env.js working with my Python application.
I have had a bit of a look around and am having some difficulty
I am having a bit of difficulty getting mod_rewrite to do what I need
I'm having a bit of difficulty getting an understand of key length requirements in
I’m having a bit of difficulty getting this to work – and to be
I am having a bit of difficulty working something out. I have the follow
I'm having difficulty getting MySQLdb working for: OSX 10.7.3 Python 2.7.1 (64-bit) MySQL 5.1.62-osx10.6-x86_64
I'm having a bit of difficulty figuring out how to use this Regular Expression

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.