Hey guys. This is my first post here.
I'm learning assembly and I'm trying to develop is one program that counts the number of lower and upper case characters that are located in STRING1, and store the result in memory. The string, STRING1, consists of lower and upper case characters. I have to read 20 bytes of the the character date stored in STRING1, and count the number of lower and upper case characters, then store them in UPPER and LOWER.
Can anybody help me out here? I have a faint idea of how to go about creating the loop, but I have no idea of how to determine if the character is lower case or upper case.
I'm programming for 80x86 Intel.
Thanks a lot.
Help - Assembly: counting lower/upper case chars from string
Started by Treymac, Mar 05 2008 09:52 PM
1 reply to this topic
#1
Posted 05 March 2008 - 09:52 PM
|
|
|
#2
Posted 06 March 2008 - 05:38 AM
You can compare two values using the cmp-instruction, and then use the different jump-instructions.
# AT&T syntax cmp $0x41, character jl not_uppercase cmp $0x5A, character jg not_uppercase # 'character' is lowercase...
; Intel syntax cmp character, 0x41 jl not_uppercase cmp character, 0x5A jg not_uppercase ; 'character' is lowercase...41 and 5A are the hexadecimal-values for 'A' and 'Z' respectively.


Sign In
Create Account

Back to top









