|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
assume cs:code
code segment
start:mov al,113
call showsin
mov ax,4c00h
int 21h
showsin:jmp short show
jiong db 'Input error, please re-enter',0
baise db 0,30,60,90,120,150,180
table dw ag0,ag30,ag60,ag90,ag120,ag150,ag180 ;字符串偏移地址表
ag0 db '0',0 ;sin(0)对应的字符串'0'
ag30 db '0.5',0 ;sin(30)对应的字符串'0.5'
ag60 db '0.866',0 ;sin(60)对应的字符串'0.866'
ag90 db '1',0 ;sin(90)对应的字符串'1'
ag120 db '0.866',0 ;sin(120)对应的字符串'0.866'
ag150 db '0.5',0 ;sin(150)对应的字符串'0.5'
ag180 db '0',0 ;sin(180)对应的字符串'0'
show:push bx
push es
push si
push ax
push cx
mov bx,0b800h
mov es,bx
mov si,52+12*160
mov bx,0
mov cx,7
b:cmp al,baise[bx] ;进行判断看看角度值是否在集合中
je f
inc bx
loop b
mov bx,0
h:mov al,jiong[bx]
cmp al,0
je ok
mov es:[si],al
inc bx
add si,2
jmp short h
;一下用角度/30作为相对于table的偏移,取得对应的字符串的偏移地址,放在bx中
f:mov bl,30
div bl
mov bl,al
mov bh,0
add bx,bx
mov bx,table[bx]
;以下显示字符
mov si,12*160+40*2
d:mov al,cs:[bx]
cmp al,0 ;比较是不是0
je ok
mov es:[si],al
inc bx
add si,2
jmp short d
ok:pop cx
pop ax
pop si
pop es
pop bx
ret
code ends
end start
|
|