orgcaptainnemo
Limp Gawd
- Joined
- Jan 9, 2003
- Messages
- 242
Alright,
I'm writing a little assembly program that takes someone's score (0-100) and then tells you what letter grade they will get. So, 90-100 = A, 80-89 = B, and so on.
I'm writing it in NASM on the 8086, and right now I can get it to read my input correctly. Its stored in:
Now I need to find a way to compare what they've inputted into 'input' with 90, 80, etc... I know how to use the cmp and jmp commands (ja, jna, jb, jnb, etc...) BUT I'm not sure how to create a piece of data that I can directly compare with my input.
Since the input is a string in ASCII and the jmp commands are looking at the hex value. So simply saying:
If I could just get some suggestions or ideas on how to compare this it would be really great.
Thanks
I'm writing a little assembly program that takes someone's score (0-100) and then tells you what letter grade they will get. So, 90-100 = A, 80-89 = B, and so on.
I'm writing it in NASM on the 8086, and right now I can get it to read my input correctly. Its stored in:
Code:
buf:
max db 4
count db 0
input db 0,0,0,0
Now I need to find a way to compare what they've inputted into 'input' with 90, 80, etc... I know how to use the cmp and jmp commands (ja, jna, jb, jnb, etc...) BUT I'm not sure how to create a piece of data that I can directly compare with my input.
Since the input is a string in ASCII and the jmp commands are looking at the hex value. So simply saying:
Code:
mov bx, input
mov ax, ninety ; assume ninety was declared as '90'
cmp bx, ax
jb else ; if bx is lower than 90 than go to the else
mov ah, 9
mov dx, msga ; msg says the user gets an A
int 0x21
else: <IMAGINE MORE CODE>
If I could just get some suggestions or ideas on how to compare this it would be really great.
Thanks