#2
Valenciax2016-12-01 20:52
|
程序代码:
data segment
LINE_CHAR EQU 210 ;在屏幕上第几行显示
COL_CHAR EQU 230 ;在屏幕上第几列显示
COLOR_CHAR EQU 0EH ;显示颜色
CHARS EQU (offset disp_data_end-offset disp_data)/2
CC_FILE DB 'D:\HZK16',0 ;字库文件名,用 UCDOS 的16点阵汉字库
HANDLE DW ? ;file handle
DISP_DATA DB '罗云彬' ;要显示的汉字
DISP_DATA_END EQU THIS BYTE
D_OPEN_ERROR DB 'File D:\HZK16 not found !',0dh,0ah,24h
data ends
;
;
code segment
main proc far
assume cs:code,ds:data
start:
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov ax,3d00h ;打开汉字库
mov dx,offset cc_file
int 21h
jnb open_ok
mov ah,9
mov dx,offset d_open_error
int 21h
open_ok:
mov handle,ax
mov si,offset disp_data
mov di,offset zi_buffer
mov cx,chars
cld
ins2:
lodsb
mov ah,al
lodsb
call get_dots ;读出汉字点针
loop ins2
call disp_cc ;显示到屏幕
MOV AX,4C00H
INT 21H
GET_DOTS PROC
push ax
sub ax,0a1a1h ;汉字的内码从 A1区开始
cwd
mov dl,al ;所以绝对开始区是内码-A1
mov al,ah ;点阵在字库中的位置为
cbw
mov bl,94 ;((汉字码1-A1)* 94 + 汉字码2 - A1)* 32
mul bl
add ax,dx
mov bx,32
mul bx
mov cx,dx
mov dx,ax
mov ax,4200h ;移动读写指针到点阵数据位置
mov bx,handle
int 21h
mov ah,3fh
mov cx,32
mov dx,di
int 21h
pop ax
add di,32
ret
GET_DOTS ENDP
DISP_CC PROC
mov ax,12h ;640*480 mode
int 10h ;设置640*480/16色显示模式
mov cx,chars
mov si,offset zi_buffer
mov bx,col_char-20 ;BX = column
dh_lop0:
add bx,20 ;every char column+20
push cx
mov cx,16 ;l6 lines/char
mov dx,line_char ;DX = start line
dh_lop1:
push bx
push cx
lodsb ;16 dots/line
mov ah,al
lodsb
mov cx,16
dh_lop2:
shl ax,1
push ax
push bx
push cx
jc db_color
xor al,al ;back color is 0
jmp short db_draw
db_color:
mov al,color_char
db_draw:
mov ah,0ch
mov cx,bx
xor bh,bh
int 10h
pop cx
pop bx
pop ax
inc bx ;inc column
loop dh_lop2
inc dx ;next line
pop cx
pop bx
loop dh_lop1
pop cx
loop dh_lop0
xor ah,ah
int 16h
mov ax,3
int 10h
ret
DISP_CC ENDP
ZI_BUFFER EQU THIS BYTE
main endp
code ends
end start
LINE_CHAR EQU 210 ;在屏幕上第几行显示
COL_CHAR EQU 230 ;在屏幕上第几列显示
COLOR_CHAR EQU 0EH ;显示颜色
CHARS EQU (offset disp_data_end-offset disp_data)/2
CC_FILE DB 'D:\HZK16',0 ;字库文件名,用 UCDOS 的16点阵汉字库
HANDLE DW ? ;file handle
DISP_DATA DB '罗云彬' ;要显示的汉字
DISP_DATA_END EQU THIS BYTE
D_OPEN_ERROR DB 'File D:\HZK16 not found !',0dh,0ah,24h
data ends
;
;
code segment
main proc far
assume cs:code,ds:data
start:
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov ax,3d00h ;打开汉字库
mov dx,offset cc_file
int 21h
jnb open_ok
mov ah,9
mov dx,offset d_open_error
int 21h
open_ok:
mov handle,ax
mov si,offset disp_data
mov di,offset zi_buffer
mov cx,chars
cld
ins2:
lodsb
mov ah,al
lodsb
call get_dots ;读出汉字点针
loop ins2
call disp_cc ;显示到屏幕
MOV AX,4C00H
INT 21H
GET_DOTS PROC
push ax
sub ax,0a1a1h ;汉字的内码从 A1区开始
cwd
mov dl,al ;所以绝对开始区是内码-A1
mov al,ah ;点阵在字库中的位置为
cbw
mov bl,94 ;((汉字码1-A1)* 94 + 汉字码2 - A1)* 32
mul bl
add ax,dx
mov bx,32
mul bx
mov cx,dx
mov dx,ax
mov ax,4200h ;移动读写指针到点阵数据位置
mov bx,handle
int 21h
mov ah,3fh
mov cx,32
mov dx,di
int 21h
pop ax
add di,32
ret
GET_DOTS ENDP
DISP_CC PROC
mov ax,12h ;640*480 mode
int 10h ;设置640*480/16色显示模式
mov cx,chars
mov si,offset zi_buffer
mov bx,col_char-20 ;BX = column
dh_lop0:
add bx,20 ;every char column+20
push cx
mov cx,16 ;l6 lines/char
mov dx,line_char ;DX = start line
dh_lop1:
push bx
push cx
lodsb ;16 dots/line
mov ah,al
lodsb
mov cx,16
dh_lop2:
shl ax,1
push ax
push bx
push cx
jc db_color
xor al,al ;back color is 0
jmp short db_draw
db_color:
mov al,color_char
db_draw:
mov ah,0ch
mov cx,bx
xor bh,bh
int 10h
pop cx
pop bx
pop ax
inc bx ;inc column
loop dh_lop2
inc dx ;next line
pop cx
pop bx
loop dh_lop1
pop cx
loop dh_lop0
xor ah,ah
int 16h
mov ax,3
int 10h
ret
DISP_CC ENDP
ZI_BUFFER EQU THIS BYTE
main endp
code ends
end start
我这个程序,HZK16在,为什么一直提示File D:\HZK16 not found !