For my project, i'm trying to make a program that can tell if a number is odd or even
global _start
section .data
org 100h
message dd 13, "Enter a number", 13, 10, '$'
even_msg dd 13, "Even Number! $", 13, 10, '$'
odd_msg dd 13, "Odd Number! $", 13, 10, '$'
section .text
_start:
mov ah, 09h
mov dx, message
int 21h
mov ah, 01h
int 21h
and al, 1
je even
jne odd
odd:
mov ah,09h
mov dx, odd_msg
int 21h
jmp exit
even:
mov ah,09h
mov dx, even_msg
int 21h
jmp exit
exit:
mov ah,00h
int 16h
ret
when i use this code, it only accepts numbers from 0 to 9, because ii used the funtion 01h in int 21h, but when i chang it to the function 0Ah in int 21h, even tho it accepts all numbers no matter how many digits are in it, it always says that it's an even number!
i'm fairly new to nasm, i would appreciate some help, thank you!