flat assembler
Message board for the users of flat assembler.

Index > Main > isupper

Author
Thread Post new topic Reply to topic
jInuQ



Joined: 26 Jun 2003
Posts: 48
Location: USA - NV
jInuQ 09 Feb 2004, 21:19
will this do what I think it should?

Code:
proc isupper, char
enter
        mov al, byte [char]
        cmp al, 0x41 ; this is 'A' 8^)
        jl NOTUPPER
        cmp al, 0x5A ; this is 'Z' 8^)
        jg NOTUPPER

        mov eax, 1
        jmp @f

        NOTUPPER:
        xor eax, eax

        @@:
        return
leave
    

_________________
jInuQ

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away."
- Antoine de Saint Exupery
Post 09 Feb 2004, 21:19
View user's profile Send private message Visit poster's website AIM Address Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 09 Feb 2004, 23:13
It seems yes, but some optimization whould be good. And probably unsigned jcc is more apropriate in this situation: ja/jb instead of jg/jl

Regards.
Post 09 Feb 2004, 23:13
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
ronware



Joined: 08 Jan 2004
Posts: 179
Location: Israel
ronware 09 Feb 2004, 23:18
It's ok only for ASCII (English). You will need a table if you want to properly uppercase/lowercase for other languages.
Post 09 Feb 2004, 23:18
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger Reply with quote
jInuQ



Joined: 26 Jun 2003
Posts: 48
Location: USA - NV
jInuQ 10 Feb 2004, 00:05
JohnFond,
Thanks for the info I will change it to ja. Make more sense that way any how.

ronware,
Yeah, right now english is the only langue I need. At some point it might be interesting to do something in unicode.

_________________
jInuQ

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away."
- Antoine de Saint Exupery
Post 10 Feb 2004, 00:05
View user's profile Send private message Visit poster's website AIM Address Reply with quote
Bitdog



Joined: 18 Jan 2004
Posts: 97
Bitdog 10 Feb 2004, 03:15
TEST AL,00100000b ;english
JZ isUPPER ;JMP if bit-5 is clear

---new edit below-----
In the english CPU alphebet 0-255
the value of 'a' is exactly 00100000b greater than 'A'
toggling bit-5 swaps case from 'A' to 'a' & back. A-Z & a-z
There are afew other characters that use the same bit-5
so under some circumstances you could alter the value of a non A-Z alph
but for the purposes of checking, or a quickie check,
TEST AL,0010000b
JNZ BITisSET ;seems to work ok.

AND AL,11011111b ; to upper case
OR AL,00100000b ; to lower case


Last edited by Bitdog on 11 Feb 2004, 08:31; edited 1 time in total
Post 10 Feb 2004, 03:15
View user's profile Send private message Reply with quote
jInuQ



Joined: 26 Jun 2003
Posts: 48
Location: USA - NV
jInuQ 11 Feb 2004, 01:46
Okay, you going to need to break down you logic. I grok what the AND does ,but don't see why your doing it? A little help? 8^)

_________________
jInuQ

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away."
- Antoine de Saint Exupery
Post 11 Feb 2004, 01:46
View user's profile Send private message Visit poster's website AIM Address Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.