MENU MACRO
call clear
mov ah,13h
mov dx,seg str1
mov es,dx
mov dx,offset str1
mov bp,dx
mov cx,count1
mov dh,5
mov dl,20
mov bh,0
mov al,0
mov bl,1
int 10h
mov ah,2
mov bh,0
mov dh,10
mov dl,20
int 10h
ENDM
CLEAR MACRO
push ax
push bx
push cx
push dx
mov ah,6
mov al,0
mov ch,0
mov cl,0
mov dh,24
mov dl,79
mov bh,0
int 10h
pop dx
pop cx
pop bx
pop ax
ret
ENDM
get_input MACRO
mov ah,2
mov bh,0
mov dh,10
mov dl,20
int 10h
mov ah,1
int 21h
ENDM
input_str MACRO OPR1,OPR2
mov ah,13h
mov dx,seg OPR1
mov es,dx
mov dx,offset OPR1
mov bp,dx
mov cx,OPR2
mov dh,5
mov dl,20
mov bh,0
mov al,0
mov bl,1
int 10h
ENDM
exit MACRO
mov ah,4ch
int 21h
ENDM
DATA SEGMENT
str1 db '1 Upper and lower case letters conversion',0dh,0ah
db ' 2 Binary and hex conversion',0dh,0ah
db ' 3 Exit', 0dh,0ah,0ah
db ' Please enter 1 or 2 or 3:'
count1 equ $-str1
str11 db '1 Big to small conversion',0dh,0ah
db ' 2 Small to big conversion',0dh,0ah
db ' 3 Return to the main menu',0dh,0ah,0ah
db ' Please enter 1 or 2 or 3:'
count2 equ $-str11
str21 db '1 Binary to hex',0dh,0ah
db ' 2 Hex to binary',0dh,0ah
db ' 3 Return to the main menu',0dh,0ah,0ah
db ' Please enter 1 or 2 or 3:'
count3 equ $-str21
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
mov ax,data
mov ds,ax
wait_input:
mov ah,1
int 21h
cmp al,'1' ;first panduan
je pro1
cmp al,'2'
je pro1
cmp al,'3'
je exit1
jmp wait_input
exit1:
; mov ah,4ch
; int 21h
ret
pro1:
clear
input_str MACRO str11,count2
get_input
cmp al,'1' ;jin ru er ji cai dan
je L_S ;kai shi zhuan huan cheng xu
cmp al,'2'
je S_L
cmp al,'3'
menu
jmp pro1
L_S:
get_input
cmp al,1bh
je exit1
sub al,20h
mov ah,9h
mov bh,0
mov bl,41h
int 10h
jmp pro1
S_L:
get_input
cmp al,1bh
je exit1
add al,20h
mov ah,9h
mov bh,0
mov bl,41h
int 10h
jmp pro1