求助一个用汇编语言编写的汉字显示研究程序(急用!最好附解释!)
现在急需这个程序,会的人帮帮忙哦!谢啦!
谢谢拉!我这也有一个拉!拿出来分享一下.
code segment
assume cs:code,ds:code
org 100h
main proc far
start:jmp begin
;汉字:仁
ren dw 300h,0,3c0h,0c0h,33fh,0fff0h,0f00h,0,0c00h,0,3c00h,0,0cc00h,0,0c00h,0,0c00h,0,0c00h,0,0c00h,0,0c00h,0h,0cffh,0fffch,0c00h,0,0c00h,0,0,0
;要显示的位置
row dw 50
col dw 50
off dw 36 ;每次要增加的距离
lp1num db 0
lp2num db 2
lp3num db 0 ;第3层循环的次数,最大为16
lp4num db 0
lp5num db 0
cmpnum dw 8000h
n db 1 ;设置字体大小,默认一个象素画一个点
begin:push ds
xor ax,ax
push ax
mov ax,code
mov ds,ax
;设置屏幕显示方式320*200彩色方式
MOV AH,0H
MOV AL,04H
INT 10H
MOV AH,0BH
MOV BH,0H
MOV BL,1
INT 10H
MOV AH,0BH
MOV BH,01H
MOV BL,0
INT 10H
;程序主体部分,3重循环
xianshi: ;清除屏幕
call clears
mov si,offset ren
;调用显示子程序,入口参数:si=要显示的汉字(用32个word存储的32*32的点阵)
;入口参数:col=要显示汉字的行,row=要显示汉字的列
;显示汉字:仁
call show
;call show
;循环接收键盘响应,看是否输入'+'字符
keyacc: mov ah,0
int 16h
cmp al,'q'
je exit
cmp al,'_'
je ensmall
cmp al,'+'
je enlarge
jmp keyacc
enlarge:inc n
cmp n,8
jbe gons
dec n
gons: jmp xianshi
ensmall:dec n
cmp n,1
jae goonx
inc n
goonx : jmp xianshi
;程序退出
exit:
; mov ah,01h
;int 21h
mov ah,0;恢复屏幕原来的显示方式
mov al,2;黑白方式80*25
int 10h
ret
main endp
;显示汉字子程序,入口参数:si=要显示的汉字存储区首地址(用32个word存储的16*32的点阵)
;入口参数:col=要显示汉字的行,row=要显示汉字的列
show proc near
push ax
push bx
push cx
push dx
push si
push word ptr row
push word ptr col
;mov cx,16
mov ah,0ch
mov dx,row
mov cx,col
mov lp1num,0
lp1:mov lp2num,0
mov cx,col
lp2:mov bx,[si]
mov lp3num,0
mov cmpnum,8000h
lp3:test bx,cmpnum
jz wr2
mov al,2
push dx ;保护列值以便恢复
mov lp4num,0
lp4:push cx
mov lp5num,0
lp5:int 10h
inc lp5num
inc cx
push ax
mov al,n
cmp lp5num,al
pop ax
jb lp5
ag4:inc dx
inc lp4num
pop cx
push ax
mov al,n
cmp lp4num,al
pop ax
jb lp4
jmp ag3
wr2:mov al,0
push dx ;保护列值以便恢复
lp42:push cx
mov lp5num,0
lp52:
int 10h
inc lp5num
inc cx
push ax
mov al,n
cmp lp5num,al
pop ax
jb lp52
ag42: inc dx
inc lp4num
pop cx
push ax
mov al,n
cmp lp4num,al
pop ax
jb lp42
ag3:pop dx
shr cmpnum,1
push ax
mov al,n
mov ah,0
add cx,ax
pop ax
; inc cx
inc lp3num
cmp lp3num,16
jb lp3
ag2: add si,2
inc lp2num
cmp lp2num,2
jb lp2ee
jmp ag1
lp2ee:jmp lp2
ag1:
; add dx,n
;inc dx
push ax
mov al,n
mov ah,0
add dx,ax
pop ax
inc lp1num
cmp lp1num,16
jb lp1ee
jmp exitshow
lp1ee:jmp lp1
exitshow:
mov lp2num,0
mov lp3num,0
mov lp1num,0
mov cmpnum,8000h
pop word ptr col
pop word ptr row
pop si
pop dx
pop cx
pop bx
pop ax
ret
show endp
;清除屏幕子程序
clears proc near
push ax
push bx
mov ah,0fh
int 10h
mov ah,0
int 10h
pop bx
pop ax
ret
clears endp
code ends
end start