lOMoARcPSD| 60797905
*Bài 1: 琀椀 tle Bai 1
cua Man nhes
.model small
.stack 100h
.data msg_input db 10,13,'Nhap vao mot ky tu: $'
msg_error db 10,13,'Khong phai la ky tu so. Nhap lai.$'
msg_output db 10,13,'Ky tu vua nhap: $' char_input
db ? char_output db ?
.code
main:
mov ax, @data
mov ds, ax mov
ah, 9 lea dx,
msg_input int
21h
input_loop: mov
ah, 1 int 21h
cmp al, '0' jb
input_error cmp
al, '9' ja
input_error mov
char_input, al jmp
input_done
input_error:
mov ah, 9 lea
dx, msg_error int
lOMoARcPSD| 60797905
21h jmp
input_loop
input_done: mov
ah, 9 lea dx,
msg_output int
21h
mov dl, char_input
mov ah, 2 int 21h
mov ah, 4ch int
21h
end main
* Bài 2: 琀椀 tle Bai 2
cua Man nhes
.model small
.stack 100h
.data msg_input db 10,13,'Nhap vao mot ky tu: $'
msg_output db 10,13,'Ky tu vua nhap (in HOA): $'
char_input db ? char_output db ?
.code
main:
mov ax, @data
mov ds, ax mov
ah, 9 lea dx,
msg_input int 21h
mov ah, 1 int 21h
mov char_input, al
lOMoARcPSD| 60797905
cmp al, 'a' jb
not_lowercase
cmp al, 'z' ja
not_lowercase
sub al, 32
not_lowercase: mov
char_output, al mov
ah, 9 lea dx,
msg_output int 21h
mov dl, char_output
mov ah, 2 int 21h
mov ah, 4ch int 21h
end main
Bài 3: 琀椀 tle Bai 3 cua
Man nhes .model small
.stack 100h
.data
msg_input db 10,13,'Nhap vao hai chu so thap phan co tong nho hon 10: $'
msg_sum db 10,13,'Tong cua chung la: $' char_ques 琀椀 on db '?$'
char_space db ' $' char_newline db 10, 13, '$'
.code
main:
mov ax, @data
mov ds, ax mov ah, 9
lea dx, char_ques 琀椀
on int 21h
input_loop: mov ah,
lOMoARcPSD| 60797905
9 lea dx, msg_input
int 21h mov ah, 1
int 21h mov bl, al
int 21h mov bh, al
sub bl, 30h sub bh,
30h add bl, bh cmp
bl, 10 jge input_loop
mov ah, 9 lea dx,
msg_sum int 21h
mov dl, bl add dl, 30h
mov ah, 2 int 21h
mov ah, 9 lea dx,
char_space int 21h
lea dx, char_newline
int 21h mov ah, 4ch
int 21h
end main
Bài 4: 琀椀 tle Bai 4 cua
Man nhes
.model small
.stack 100h .data msg_input db 10,13,'Nhap vao
mot ky tu: $' msg_digit db 'Day la ky tu so.$'
msg_upper db 'Day la ky tu hoa.$' msg_lower db
'Day la ky tu thuong.$' msg_other db 'Khong phai
ky tu so/hoa/thuong.$' char_input db ? .code
main: mov ax, @data mov ds, ax mov ah, 9
lea dx, msg_input int 21h mov ah, 1 int 21h
mov char_input, al
cmp char_input, 30h
lOMoARcPSD| 60797905
jl not_digit cmp
char_input, 39h
jle is_digit
cmp char_input, 41h
jl not_upper cmp
char_input, 5Ah jle
is_upper cmp
char_input, 61h jl
not_lower cmp
char_input, 7Ah jle
is_lower not_digit:
mov ah, 9 lea dx,
msg_other int 21h
jmp end_program
is_digit: mov ah,
9 lea dx,
msg_digit int
21h
jmp end_program
not_upper:
mov ah, 9 lea
dx, msg_other int
21h
jmp end_program
is_upper: mov ah,
9 lea dx,
msg_upper int
21h
jmp end_program
not_lower: mov
lOMoARcPSD| 60797905
ah, 9 lea dx,
msg_other int
21h
jmp end_program
is_lower: mov ah,
9 lea dx,
msg_lower int
21h
jmp end_program
end_program:
mov ah, 4ch
int 21h
end main

Preview text:

lOMoAR cPSD| 60797905 *Bài 1: 琀椀 tle Bai 1 cua Man nhes .model small .stack 100h
.data msg_input db 10,13,'Nhap vao mot ky tu: $'
msg_error db 10,13,'Khong phai la ky tu so. Nhap lai.$'
msg_output db 10,13,'Ky tu vua nhap: $' char_input db ? char_output db ? .code main: mov ax, @data mov ds, ax mov ah, 9 lea dx, msg_input int 21h input_loop: mov ah, 1 int 21h cmp al, '0' jb input_error cmp al, '9' ja input_error mov char_input, al jmp input_done input_error: mov ah, 9 lea dx, msg_error int lOMoAR cPSD| 60797905 21h jmp input_loop input_done: mov ah, 9 lea dx, msg_output int 21h mov dl, char_input mov ah, 2 int 21h mov ah, 4ch int 21h end main * Bài 2: 琀椀 tle Bai 2 cua Man nhes .model small .stack 100h
.data msg_input db 10,13,'Nhap vao mot ky tu: $'
msg_output db 10,13,'Ky tu vua nhap (in HOA): $'
char_input db ? char_output db ? .code main: mov ax, @data mov ds, ax mov ah, 9 lea dx, msg_input int 21h mov ah, 1 int 21h mov char_input, al lOMoAR cPSD| 60797905 cmp al, 'a' jb not_lowercase cmp al, 'z' ja not_lowercase sub al, 32 not_lowercase: mov char_output, al mov ah, 9 lea dx, msg_output int 21h mov dl, char_output mov ah, 2 int 21h mov ah, 4ch int 21h end main Bài 3: 琀椀 tle Bai 3 cua Man nhes .model small .stack 100h .data
msg_input db 10,13,'Nhap vao hai chu so thap phan co tong nho hon 10: $'
msg_sum db 10,13,'Tong cua chung la: $' char_ques 琀椀 on db '?$'
char_space db ' $' char_newline db 10, 13, '$' .code main: mov ax, @data mov ds, ax mov ah, 9 lea dx, char_ques 琀椀 on int 21h input_loop: mov ah, lOMoAR cPSD| 60797905 9 lea dx, msg_input int 21h mov ah, 1 int 21h mov bl, al int 21h mov bh, al sub bl, 30h sub bh, 30h add bl, bh cmp bl, 10 jge input_loop mov ah, 9 lea dx, msg_sum int 21h mov dl, bl add dl, 30h mov ah, 2 int 21h mov ah, 9 lea dx, char_space int 21h lea dx, char_newline int 21h mov ah, 4ch int 21h end main Bài 4: 琀椀 tle Bai 4 cua Man nhes .model small
.stack 100h .data msg_input db 10,13,'Nhap vao
mot ky tu: $' msg_digit db 'Day la ky tu so.$'
msg_upper db 'Day la ky tu hoa.$' msg_lower db
'Day la ky tu thuong.$' msg_other db 'Khong phai
ky tu so/hoa/thuong.$' char_input db ? .code
main: mov ax, @data mov ds, ax mov ah, 9
lea dx, msg_input int 21h mov ah, 1 int 21h mov char_input, al cmp char_input, 30h lOMoAR cPSD| 60797905 jl not_digit cmp char_input, 39h jle is_digit cmp char_input, 41h jl not_upper cmp char_input, 5Ah jle is_upper cmp char_input, 61h jl not_lower cmp char_input, 7Ah jle is_lower not_digit: mov ah, 9 lea dx, msg_other int 21h jmp end_program is_digit: mov ah, 9 lea dx, msg_digit int 21h jmp end_program not_upper: mov ah, 9 lea dx, msg_other int 21h jmp end_program is_upper: mov ah, 9 lea dx, msg_upper int 21h jmp end_program not_lower: mov lOMoAR cPSD| 60797905 ah, 9 lea dx, msg_other int 21h jmp end_program is_lower: mov ah, 9 lea dx, msg_lower int 21h jmp end_program end_program: mov ah, 4ch int 21h end main