We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
iam trying to convert the char i received to uppercase if it is lowercase if not leave it asit is . igot this code from net. but unable to understand why they added #224 at the end.
org 0000h mov acc,#'z' clr c subb a, #97 jc upper2 subb a, #26 jnc upper2 add a, #224 upper2: mov r0,a end
First of all, do you have an ASCII chart showing the full range of ASCII codes (from 0x00 to 0x7F)? This is absolutely fundamental to understanding what's going on.
Look at your ASCII table: what would you need to do to convert a lowercase character to uppercase? Think of a simple bitwise operation...
Before you can apply this conversion, you have to test that your ASCII code actually is a lowercase character...
"unable to understand why they added #224 at the end"
Try thinking in Hex...
hello Andy Neil
I am getting 0xdf in r0 after debugging and finally I don t have any value corresponding 0xdf in my ASCII chart
"I don t have any value corresponding 0xdf in my ASCII chart"
Correct - it is not a valid ASCII code!
Valid ASCII values are 0x00 to 0x7F, as I mentioned before.
"I am getting 0xdf in r0 after debugging"
Since 0xDF is not a valid ASCII code, your code is not de-bugged - it contains a bug that gives invalid results!
"Debugging" is the process of removing bugs so that your code does work correctly!
Have you actually thought about the things I suggested?
As you step through the code, have you thought about what each step is trying to do, and checked that it's doing it correctly.
It's impossible to debug code if you don't first understand what it's supposed to be doing!