📄 98_hzk_gb2312_v1.1_2004.11.12.asm
字号:
changerow:
cmp liney,616
jae reset_y ;大于等于跳至换行
add liney,16
mov dx,buffer_read
cmp dl,0a0h ;由于输出为非汉字,只占用8个象素,所以要-8
jb needsub8
jmp next
needsub8:
sub liney,8
jmp next
reset_y:
mov liney,0h
add linex,16
;;************************************************************ ;开始读第二个字
next: jmp getword_file ;loop getword_file ;为什么用LOOP提示超出NEAR的范围,如何解决?
;;******************************************************** ;附加的一些处理程序段
print_ansi_char: ;用来显示一些非汉字字符,即ASCII字符
mov dx,buffer_read
cmp dl,10 ;手动输出换行符
jz needchangeline
jmp gogogo
needchangeline:
mov liney,624 ;置Y轴的坐标大于边界,跳至上边会自动换行。 不用在此强制换行mov liney,0并且不会产生换行多两个字符的BUG
jmp change
gogogo:
mov bl,16 ;计算行列值,非象素值
mov ax,linex
cmp ax,0
jz cannotdiv_x
div bl
mov dh,al
jmp get_y
cannotdiv_x:
mov dh,0
get_y:
mov ax,liney
cmp ax,0
jz cannotdiv_y
mov bl,8
div bl
mov dl,al
jmp positionisok
cannotdiv_y:
mov dl,0
positionisok:
mov ah,2h
INT 10h
mov dx,buffer_read
mov ah,2h
INT 21h
jmp change
;;**************************************************************** ;错误处理程序
open_cclib_error: lea dx,msg_open_cclib_error
jmp msgshow
open_read_error: lea dx,msg_open_read_error
jmp msgshow
read_cclib_error: lea dx,msg_read_cclib_error
jmp msgshow
read_read_error: lea dx,msg_read_read_error
msgshow:
mov ah,9h
INT 21h
jmp donewithoutclose
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
done:
mov ax,3e00h
mov bx,handle_cclib
int 21h
mov ax,3e00h
mov bx,handle_read
int 21h
mov ah,00h
int 16h
mov ax,0003h ;在WINDOWS下不用此结束后会产生花屏
int 10h
donewithoutclose:
mov ah,4ch
INT 21h
main ENDP
;;**************************************************************** ;正常显示汉字子程序
print_normal proc near
mov dx,linex ;设置X轴的坐标
mov cx,16 ;每个汉字显示为16行
lea si,buffer_cclib
writex:
push cx
mov bx,liney ;设置Y轴的坐标
;;;;;;;;;;
mov cx,16 ;一个汉字为16列,此为第一个字节显示
mov ah,[si]
mov al,[si+1]
writey:
shl ax,1
push ax
jc iszero ;在1.0版中,由于push的位置不对,误认为
xor al,al ;shl只能用于字节的移位,对SHL的理解不够,使子程序长了近一倍。
jmp goon
iszero:
mov al,7h
goon:
mov ah,0ch
xchg cx,bx
push bx
xor bx,bx
INT 10h
pop bx
xchg cx,bx
pop ax
inc bx ;bx代替CX来计算列地址,右移一列
loop writey
;;;;;;;;;;;;;;;;
pop cx
inc dx ;DX为行地址,下移一行
inc si
inc si
loop writex ;开始行循环
RET
print_normal ENDP
;;**************************************************************** ;左转90度显示汉字子程序
print_left proc near
mov bx,liney ;设置X轴的坐标
;ADD bx,16
mov cx,16 ;每个汉字显示为16行
lea si,buffer_cclib
writex:
push cx
mov dx,linex ;设置Y轴的坐标
ADD dx,16
;;;;;;;;;;
mov cx,16 ;一个汉字为16列,此为第一个字节显示
mov ah,[si]
mov al,[si+1]
writey:
shl ax,1
push ax
jc iszero ;在1.0版中,由于push的位置不对,误认为
xor al,al ;shl只能用于字节的移位,对SHL的理解不够,使子程序长了近一倍。
jmp goon
iszero:
mov al,7h
goon:
mov ah,0ch
xchg cx,bx
push bx
xor bx,bx
INT 10h
pop bx
xchg cx,bx
pop ax
dec dx ;bx代替CX来计算列地址,右移一列
loop writey
;;;;;;;;;;;;;;;;
pop cx
inc bx ;DX为行地址,下移一行
inc si
inc si
loop writex ;开始行循环
RET
print_left ENDP
;;**************************************************************** ;右转90度显示汉字子程序
print_right proc near
mov bx,liney ;设置X轴的坐标
ADD bx,16
mov cx,16 ;每个汉字显示为16行
lea si,buffer_cclib
writex:
push cx
mov dx,linex ;设置Y轴的坐标
;ADD dx,16
;;;;;;;;;;
mov cx,16 ;一个汉字为16列,此为第一个字节显示
mov ah,[si]
mov al,[si+1]
writey:
shl ax,1
push ax
jc iszero ;在1.0版中,由于push的位置不对,误认为
xor al,al ;shl只能用于字节的移位,对SHL的理解不够,使子程序长了近一倍。
jmp goon
iszero:
mov al,7h
goon:
mov ah,0ch
xchg cx,bx
push bx
xor bx,bx
INT 10h
pop bx
xchg cx,bx
pop ax
inc dx ;bx代替CX来计算列地址,右移一列
loop writey
;;;;;;;;;;;;;;;;
pop cx
dec bx ;DX为行地址,下移一行
inc si
inc si
loop writex ;开始行循环
RET
print_right ENDP
;;**************************************************************** ;倒转显示汉字子程序
print_reverse proc near
mov dx,linex ;设置X轴的坐标
ADD dx,16
mov cx,16 ;每个汉字显示为16行
lea si,buffer_cclib
writex:
push cx
mov bx,liney ;设置Y轴的坐标
add bx,16
;;;;;;;;;;
mov cx,16 ;一个汉字为16列,此为第一个字节显示
mov ah,[si]
mov al,[si+1]
writey:
shl ax,1
push ax
jc iszero ;在1.0版中,由于push的位置不对,误认为
xor al,al ;shl只能用于字节的移位,对SHL的理解不够,使子程序长了近一倍。
jmp goon
iszero:
mov al,7h
goon:
mov ah,0ch
xchg cx,bx
push bx
xor bx,bx
INT 10h
pop bx
xchg cx,bx
pop ax
dec bx ;bx代替CX来计算列地址,右移一列
loop writey
;;;;;;;;;;;;;;;;
pop cx
dec dx ;DX为行地址,下移一行
inc si
inc si
loop writex ;开始行循环
RET
print_reverse ENDP
;;********************************************************************************************
END main
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -