stick in eld broadcast
org 100h
mov ah, 9
mov dx, str1
int 21h
mov ah, 1
int 21h
mov ah, 9
cmp al, 37h
jz age_ selfsame(prenominal)
jg age_ sure-enough(a)
jl age_younger
jmp after
age_same:
mov dx, str2
int 21h
jmp after
age_older:
mov dx, str3
int 21h
jmp after
age_younger:
mov dx, str4
int 21h
jmp after
after:
mov ah, 4Ch
int 21h
str1 db ENTER YOUR AGE: $
str2 db 0Ah, Wow. You and I are the same age.$
str3 db 0Ah, You are older than me, pal. Cool!$
str4 db 0Ah, I am older than you, haha!$s
NASM - The Netwide Assembler
February 18, 2012, 10:32:47 pm
Welcome, Guest
Please login or register.
Login with username, give-and-take and session length
News:
We are back up and running!
Home
Help
Search
Calendar
Login
memorialize
NASM - The Netwide Assembler >
NASM Forum >
Example Code >
Enter your age program
« previous next »
Pages: [1]
Print
Author Topic: Enter your age program (Read 848 times)
sledge
Jr.
Member
Offline
Posts: 19
Enter your age program
« on: August 23, 2011, 02:56:11 am »
________________________________________
Code: [Select]
org 100h
mov ah, 9
mov dx, str1
int 21h
mov ah, 1
int 21h
mov ah, 9
cmp al, 37h
jz age_same
jg age_older
jl age_younger
jmp after
age_same:
mov dx, str2
int 21h
jmp after
age_older:
mov dx, str3
int 21h
jmp after
age_younger:
mov dx, str4
int 21h
jmp after
after:
mov ah, 4Ch
int 21h
str1 db ENTER YOUR AGE: $
str2 db 0Ah, Wow. You and I are the same age.$
str3 db 0Ah, You are older than me, pal. Cool!$
str4 db 0Ah, I am older than you, haha!$s
This wonderful program asks for your age, compare and then outputs a message based on how old you claimed to be.
Problem is I cant type more than one character... so in this program you cant be older than 9 years old.
Logged
blustering Kotler
NASM Developer
Hero Member
Country:
...If you want to get a safe essay, order it on our website: Ordercustompaper.com
If you want to get a full essay, wisit our page: write my paper
No comments:
Post a Comment