D/A转换

data segment
ioport equ 0ff00h-0280h
io0832a equ ioport+290h
ts1 db '锯齿 1' ,0dh,0ah
db '三角 2',0dh,0ah
db '方 3',0dh,0ah
db '正弦 4',0dh,0ah
db '退出 5',0dh,0ah,'$'
ts2 db '按下键无效,继续选择',0dh,0ah,'$'
ts3 db '俺任意键退回主菜单',0dh,0ah,'$'
sinbuf db 80h,8ch,98h,0a5h,0b0h,0bch,0c7h,0d1h;
db 0dah,0e2h,0eah,0f0h,0f6h,0fah,0fdh,0ffh
db 0ffh,0fdh,0fah,0f6h,0f0h,0eah,0e2h,0dah
db 0d1h,0c7h,0bch,0b0h,0a5h,98h,8ch,80h
db 7fh,73h,67h,5ah, 4fh, 43h, 38h, 2eh
db 25h, 1dh, 15h, 0fh, 09h, 05h, 02h, 00h
db 00h, 02h, 05h, 09h, 0fh, 15h, 1dh, 25h
db 2eh, 38h, 43h, 4fh, 5ah, 67h, 73h, 7fh
data ends 
stack segment
sta db 20 dup(?)
top equ length sta
stack ends
code segment
assume cs: code,ds:data,ss:stack
begin: mov ax,data
mov ds,ax
mov ax,stack
mov ss,ax
mov sp,top
zcd: lea dx,ts1
mov ah,9
int 21h
mov ah,8
int 21h
push ax
lea dx,ts3
mov ah,9
int 21h
pop ax
mov ah,al
cmp al,'1'
jz jcb
mov al,ah
cmp al,'2'
jz sjb
mov al,ah
cmp al,'3'
jz fb
mov al,ah
cmp al,'4'
jz zxb
mov al,ah
cmp al,'5'
jnz wx
jmp exit
zxb:jmp zxb1
wx: lea dx,ts2
mov ah,9
int 21h
jmp zcd
jcb: mov dx,io0832a
mov al,0
bbb: mov cx,200h
bb: out dx,al
inc dx
out dx,al
dec dx
add al,1
cmp al,0
jnz bb
loop bb
push ax
push dx
mov dl,0ffh
mov ah,6
int 21h
jnz zcd
pop dx
pop ax
jmp bbb
sjb: mov dx,io0832a
mov al,0
eee: mov cx,200h
ee: out dx,al
inc dx
out dx,al
dec dx
add al,1
cmp al,0ffh
jne ee
ff: out dx,al
inc dx
out dx,al
dec dx
sub al,1
cmp al,0
jne ff
loop ee
push ax
push dx
mov dl,0ffh
mov ah,6
int 21h
jnz bg
pop dx
pop ax
jmp eee
bg: jmp zcd
fb: mov dx,io0832a
mov ax,0
hh: out dx,al
inc dx
out dx,al
dec dx
add ah,1
cmp ah,0
jne hh
mov al,0ffh
zz:out dx,al
inc dx
out dx,al
dec dx
add ah,1
cmp ah,0
jne zz
push ax
push dx
mov dl,0ffh
mov ah,6
int 21h
jnz bg1
pop dx
pop ax
mov al,0
jmp hh
bg1:jmp zcd
zxb1: mov dx,io0832a
jjj:mov cx,50h
jj:lea si,sinbuf
mov bl,64
kk:mov al,[si]
out dx,al
inc dx
out dx,al
dec dx
inc si
dec bl
jnz kk
loop jj
push ax
push dx
mov dl,0ffh
mov ah,6
int 21h
jnz bg1
pop dx
pop ax
jmp jjj
exit:mov ah,4ch
int 21h
code ends
end begin

你可能感兴趣的:(接口)