| | |
A simple problem can anyone help
![]() |
•
•
Join Date: Nov 2005
Posts: 2
Reputation:
Solved Threads: 0
I'm writing a program in assebly using x86 intel processor series and a flat model
can anyome suggest anything about this?
;;;;;;;;;;;;;;;;;;;
input string,40 ;the user enter a characher 'q' for instance
atod string ; now the value in eax as decimal
;;i need to compare the number and if is 'q' to quit
;;i've tried this senario
cmp eax,'q'
jz quit ;;;;;;not working
cmp al,'q' ;;;;;;not again
jz quit
cmp eax,113 ;;;;where 113 is the decimal ascii value of 'q'
jz quit
cmp al,113 ;;;;;nothing
jz quit
cmp al,71 ;;;i didnt not make the convertion here atod
;;and nothing again 71 is hex of 'q'
cmp eax,113 ;;;;same;;nothing
can anyone help?
Thanks in advance
;;;;;;;;;;;;;;;;;;;
can anyome suggest anything about this?
;;;;;;;;;;;;;;;;;;;
input string,40 ;the user enter a characher 'q' for instance
atod string ; now the value in eax as decimal
;;i need to compare the number and if is 'q' to quit
;;i've tried this senario
cmp eax,'q'
jz quit ;;;;;;not working
cmp al,'q' ;;;;;;not again
jz quit
cmp eax,113 ;;;;where 113 is the decimal ascii value of 'q'
jz quit
cmp al,113 ;;;;;nothing
jz quit
cmp al,71 ;;;i didnt not make the convertion here atod
;;and nothing again 71 is hex of 'q'
cmp eax,113 ;;;;same;;nothing
can anyone help?
Thanks in advance
;;;;;;;;;;;;;;;;;;;
What is the underlying operating system, or are you using BIOS calls.
In any event, EAX won't work because especially in the case of ASCII only an 8 bit value is returned and you are comparing a 32 bit value and may not know at any given time what the value of bits 31 - 8 are. Comparing cmp al,'q', should work except where caps lock may be on then you would have to compare against 'Q'. The method I usually use is to implement a case insensitive comparison where I'll convert all characters in AL to upper or lower case.
In any event, EAX won't work because especially in the case of ASCII only an 8 bit value is returned and you are comparing a 32 bit value and may not know at any given time what the value of bits 31 - 8 are. Comparing cmp al,'q', should work except where caps lock may be on then you would have to compare against 'Q'. The method I usually use is to implement a case insensitive comparison where I'll convert all characters in AL to upper or lower case.
Assembly Syntax (Toggle Plain Text)
mov al, [Character] and al, 0x5f cmp al,'Q' jz Done
•
•
Join Date: Nov 2005
Posts: 2
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by Tight_Coder_Ex
What is the underlying operating system, or are you using BIOS calls.
In any event, EAX won't work because especially in the case of ASCII only an 8 bit value is returned and you are comparing a 32 bit value and may not know at any given time what the value of bits 31 - 8 are. Comparing cmp al,'q', should work except where caps lock may be on then you would have to compare against 'Q'. The method I usually use is to implement a case insensitive comparison where I'll convert all characters in AL to upper or lower case.
Assembly Syntax (Toggle Plain Text)
mov al, [Character] and al, 0x5f cmp al,'Q' jz Done
Thanks Tight_Coder_Ex
You made it clear to me thanks.Problem solved.
![]() |
Similar Threads
- Installing Windows 98 On VMware. Floppy problem (Windows 95 / 98 / Me)
- Newbie - looping and array [very simple] problem (PHP)
- Help me with this Simple Problem plss (C)
- BUTTON DOES NOT WORK??? simple problem (C)
- Simple problem regardingform elements (ASP)
- Mac Mouse Problem! Help me out? (OS X)
Other Threads in the Assembly Forum
- Previous Thread: DIVISION algorithm
- Next Thread: hi everyone..
| Thread Tools | Search this Thread |





