Click here to Skip to main content
15,035,866 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've been struggling with the following prompt for hours:
In MS DOS, Write an assembly language program that will accept a single character from the keyboard, and then output the next character in the ASCII sequence. For example, if the character 'A' is entered, the character 'B' will be typed out.

What I have tried:

I don't really know how to add to the input value. Any advice would be greatly appreciated!
INCLUDE Irvine32.inc
.data
msg1 db "Enter a key ",0
msg2 db "You typed in ",0
.code
main PROC

mov edx, OFFSET msg1
call WriteString
call ReadChar


mov edx, OFFSET msg2
call WriteString
call WriteChar 

exit
main ENDP
END main
Posted
Updated 10-May-21 23:33pm
v2
Comments
Patrice T 18-Feb-18 13:02pm
   
What have you done so far?
Member 13684076 18-Feb-18 13:10pm
   
I have a program that accepts one input value and outputs that same value.
Patrice T 18-Feb-18 13:18pm
   
Show your code.
Member 13684076 18-Feb-18 13:29pm
   
INCLUDE Irvine32.inc
.data
msg1 db "Enter a key ",0
msg2 db "You typed in ",0
.code
main PROC

mov edx, OFFSET msg1
call WriteString
call ReadChar


mov edx, OFFSET msg2
call WriteString
call WriteChar

exit
main ENDP
END main
Patrice T 18-Feb-18 13:39pm
   
Use Improve question to update your question.
So that everyone can pay attention to this information.
Member 13684076 18-Feb-18 14:04pm
   
Thanks!!!
Richard MacCutchan 18-Feb-18 14:17pm
   
After you call ReadChar you need to save the character so that you can write out the updated value.
Member 13684076 21-Feb-18 21:46pm
   
That does help. Thank you! :)
Member 13684076 21-Feb-18 21:45pm
   
Thank you for the great advice!
CHill60 18-Feb-18 16:04pm
   
You also need to understand that MS-DOS is an (old) operating system and "assembler" is any one of several "programming languages" that target an operating system. You can't write anything "in" MS-DOS

1 solution

In any computer language adding 1 to 'A' will produce 'B'. If you do not understand that basic concept then you need to get hold of an introductory book on computers.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900