📄 keti4.asm
字号:
.model small
.stack
.data
row db ?
col db ?
dat1 dw ?
dat2 dw ?
meg1 db ' Data1 :','$'
meg2 db ' Data2 :','$'
meg3 db ' Result :','$'
meg4 db '[q]=OUT,[h]=HELP. Press any other key continue.','$'
meg5 db 10,13,'[h]=help','$'
meg6 db 10,13,' 1. (+) num.(0~30000); 2.(-)num.(data1>data2)',10,13
db ' 3. (*) result <60000 ; 4.(/)(data1>data2).','$'
meg7 db 10,13,' Choice[+,-,*,/]:','$'
.code
main proc far
mov ax,@data
mov ds,ax
;
main_loop:
mov ax,0600h
call scrn
;清屏
call jiemian ;界面
call in_dat1;数据一
call in_dat2;数据二
call in_out ;结果显示
;
mov row,15
mov col,00
call curs
lea dx,meg4
mov ah,09h
int 21h
call getch
cmp al,'q'
je main_exit
cmp al,'h'
jne main_loop
lea dx,meg6
mov ah,09h
int 21h
call getch
jmp main_loop
main_exit:
mov ax,4c00h
int 21h
main endp
in_dat1 proc near
mov col,18
mov row,05
call curs
call scanf
mov dat1,ax
ret ;第一数据输入完成
in_dat1 endp
;
in_dat2 proc near
mov row,06
mov col,18
call curs
call scanf
mov dat2,ax
ret ;第二数据输入完成
in_dat2 endp
;
jiemian proc near
;
mov row,05
mov col,03
call curs
lea dx,meg1
mov ah,09h
int 21h
;data1界面
mov row,06
mov col,3
call curs
lea dx,meg2
mov ah,09h
int 21h
;data2界面
mov row,07
mov col,03
call curs
lea dx,meg3
mov ah,09h
int 21h
;result界面
;mov col,02
;mov row,08
;call curs
lea dx,meg7
mov ah,09h
int 21h
;加 减 乘 除 选择界面
ret
jiemian endp
;
in_out proc near
inout_loop:
mov col,18
mov row,8
call curs
call getch
;
cmp al,'+'
jne next111
mov col,18
mov row,07h
call curs
mov ax,dat1
add ax,dat2
mov bx,0001
call printf
ret
;
next111:
cmp al,'-'
jne next222
mov col,18
mov row,07h
call curs
mov ax,dat1
cmp ax,dat2
jb inout_exit
sub ax,dat2
mov bx,0001
call printf
ret
;
inout_loop1:
jmp inout_loop
next222:
cmp al,'*'
jne next333
mov col,18
mov row,07h
call curs
mov dx,0
mov cx,dat1
mov ax,dat2
mul cx
mov bx,0001
call printf
;mov ax,dx
;mov bx,0001
;call printf
ret
next333:
cmp al,'/'
jne inout_loop1
mov col,18
mov row,07h
call curs
mov dx,0
mov cx,dat2
cmp cx,0
je inout_exit
mov ax,dat1
cmp dat1,cx
jb inout_exit
div cx
mov bx,0001
call printf
inout_exit:
ret
in_out endp
include asm.sub
end main
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -