📄 fontnew.asm
字号:
ERRORCODE = 100
code segment
org 100h
assume cs:code,ds:code,es:code
begin:
jmp real
filename db 'c:\hzk16f',0
buffer db 8000h dup (?)
globalx dw 0
globaly dw 0
startx dw 0
starty dw 0
count dw 0
buffertest dw 0
OpenError db 'Open file error',0
handle dw ?
font db 32 dup (0)
fontbufferl dw 0
fontbufferh db 0
parbuffer dw 0b0a1h,0b4deh,0beb0h,0b1f3h
head db 8 dup(0)
db 8 dup (0)
srclen dw 8000h
srcaddl dw offset buffer
srcaddh db 0
srcattr db 93h
srcb db 0,0
tarlen dw 8000h
taraddl dw 0
taraddh db 10h
tarattr db 93h
tartb db 0,0
tail db 8 dup(0)
db 8 dup(0)
real: mov ah,3dh
mov dx,offset filename
mov bl,01
int 21h
jnc good
jmp erro1
good: mov handle,ax
mov ax,cs
mov cx,16
mul cx
push ax
push dx
add ax ,offset buffer
adc dx,0
mov srcaddl,ax
mov srcaddh,dl
pop dx
pop ax
add ax,offset font
adc dx,0
mov fontbufferl,ax
mov fontbufferh,dl
mov ah,88h
int 15h
cmp ax,260
jnb readloop
jmp erro1
readloop:
mov ah,3fh
mov dx,offset buffer
mov bx,handle
mov cx,8000h
int 21h
jnc kk
jmp erro1
kk: cmp ax,0;should cmpare whith 8000h below then close, better!
jz close
mov ah,87h
mov si,offset head
mov cx,4000h
int 15h
ADD taraddl,8000H
ADC taraddh,0
jmp readloop
close:
mov bx,handle
mov ah,3eh
int 21h
mov ah,0
mov al,12h
int 10h
lea si,parbuffer
mov cx,0
mov startx,16
moreword:
lodsw
mov dx,ax
xor ax,ax
mov count,cx
push si
push cx
push dx
mov ax,16
mul count
mov startx,ax
xor ax,ax
;mov cx,0b0a1h ;(b0-a1)*94+xx-a1)*32
xor bx,bx
pop dx
;mov dx,0b0a1h
mov al,dh
sub al,0a1h
mov cl,94
mul cl
mov bl, dl
sub bl,0a1h
add ax,bx
mov cx,32
mul cx
mov srcaddl,ax
add dl,10h
mov srcaddh,dl
mov srclen,32
mov tarlen,32
mov ax,fontbufferl
mov taraddl,ax
mov al,fontbufferh
mov taraddh,al
mov ah,87h
mov si,offset head
mov cx,16
int 15h
;display chinese word
lea si,font
mov cx,16
mov ax,startx
mov globalx,ax
mov globaly,0
drawloop:
push cx
lodsb
call draw8dots
lodsb
call draw8dots
inc globaly
push bx
mov bx,startx
mov globalx,bx
pop bx
pop cx
loop drawloop
;call exit
jmp nextword
draw8dots:
push si
mov cx,8
drawdot:
rol al,1
jnc drawnext
push cx
push ax
mov ah,0ch
mov cx,globalx
mov dx,globaly
mov al,0ffh
int 10h
pop ax
pop cx
drawnext:
inc globalx
loop drawdot
pop si
ret
nextword:
pop cx
pop si
inc cx
cmp cx,4
jz exit
jmp moreword
exit:
mov ah,4ch
int 21h
finish:
mov ax,4c00h
int 21h
erro1 :
mov ah,4ch
int 21h
code ends
end begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -