Professional Documents
Culture Documents
CPE 310 - ACT LAB2celeste
CPE 310 - ACT LAB2celeste
1. By using Compare and Jump commands, have 0-9 be TRUE while any other character
is FALSE.
.model small
.stack
.data
msg1 db "Enter a number (0-9): $"
msg2 db "Correct Input. $"
msg3 db "Wrong input. $"
.code
start:
input_loop:
mov ah, 1
int 21h
mov ah, 02
mov dl, 10
int 21h
int 21h
jmp exit
Wrong_input:
mov ah, 02
mov dl, 10
int 21h
exit:
end start
2. By Using Compare and Jump commands, have A,B,C,D,E,F,G be TRUE, while any other
character is FALSE.
● Among the TRUE characters, when the user types 'G', the program will close.
● If the character is TRUE, print "The character is correct!", should go back to initial
message.
● Among the FALSE characters, when the user types 'L' the program will close.
● If the character is FALSE, print "The character is wrong!", should go back to initial
message.
.model small
.stack
.data
.code
start:
mov ax, @data
mov ds, ax
mov ah, 02h
mov dl, 10
int 21h
mov ah, 09h
mov dx, offset msg
int 21h
mov ah, 01h
int 21h
cmp al, 'A'
JE tama
cmp al, 'B'
JE tama
cmp al, 'C'
JE tama
cmp al, 'D'
JE tama
cmp al, 'E'
JE tama
cmp al, 'F'
JE tama
cmp al, 'G'
JE tamang_tama
cmp al, 'L'
JE maling_mali
JMP mali
tama:
mov ah, 02h
mov dl, 10
int 21h
mov ah, 09h
mov dx, offset success
int 21h
mov ah, 02h
mov dl, 10
int 21h
jmp start
mali:
mov dl, 10
int 21h
mov ah, 09h
int 21h
jmp start
maling_mali:
mov dl, 10
int 21h
int 21h
jmp exit
tamang_tama:
mov dl, 10
int 21h
int 21h
jmp exit
exit:
int 21h
end start
Submit the PDF and ASM file.