输出中文
程序运行:
代码:
daones segmentfull_name db 0,1,2,3,4,5
full_name_length dw $-full_name
start_char db 0
change_char_count dw 6color db 1
x dw 40
y dw 10
direction dw 2 sceen_start_width dw 0
sceen_width dw 80 sceen_start_height dw 0
sceen_height dw 25;------以下为孙悟空 16X16 字模点阵数据 db字母开头补充0-----------
buffer db 00H,7EH,02H,04H,08H,0AH,0CH,39H ;孙db 0C9H,0AH,0CH,08H,08H,08H,28H,10Hdb 20H,20H,20H,20H,20H,0B0H,0A8H,24Hdb 26H,22H,20H,20H,20H,20H,0A0H,40Hdb 10H,13H,10H,10H,59H,54H,51H,91H ;悟db 17H,10H,11H,11H,11H,11H,11H,11Hdb 08H,0FCH,80H,88H,0FCH,88H,08H,08Hdb 0FEH,08H,0FCH,08H,08H,08H,0F8H,08Hdb 02H,01H,7FH,40H,84H,0CH,10H,20H ;空db 00H,3FH,01H,01H,01H,01H,0FFH,00Hdb 00H,00H,0FEH,02H,44H,30H,18H,08Hdb 00H,0F8H,00H,00H,00H,04H,0FEH,00Hdaones ends codes segmentassume cs:codes, ds:daones
main proc farpush ds mov ax,0 push ax mov ax,daonesmov ds, axmov es, axmov ax,12hint 10H ;置图形模式mov ax, 3int 10H ;置文本模式;-----从显示字库start_char处替换为“雷正宇”字模-----lea bp, buffer ;取字模首址mov dl, start_char ;从显示字库start_char处替换mov dh, 0mov cx, change_char_count ;换change_char_count个字mov bx, 1000hmov ax, 1100h ;装入用户字体int 10hcall dealret
main endp deal proc near mov ax,0b800hmov es,ax next:call print_namemov ah,1int 16h ;有按键按下吗?jz no_check_key call press_keycmp cx,1234h jz exitno_check_key:call sleepmov dx,xadd dx,direction ;移一个位置mov x,dxcmp dx,sceen_start_width ;已到最左边了吗?jz change_direction mov ax,sceen_widthsub ax,full_name_lengthcmp dx,ax ;已到最右边了吗?jz change_directionjmp undochange_direction:neg direction undo:jmp next ;在新位置重新显示exit:ret deal endpprint_name proc near uses ax cx si di cld ;正序显示mov ax,y ;找到字符串所在显存的地址mul sceen_widthadd ax,xadd ax,axmov di,ax mov ah,color ;设置前景色cmp ah,7jz resetinc ahjmp continuereset: mov ah,1 continue:mov color,ahlea si,full_name ;指向串首mov cx,full_name_length ;full_name_length个字符call clear_screen ;清屏show:lodsb ;取一字stosw ;存入显存loop show ;显示下一字ret
print_name endp press_key proc near uses ax bx mov cx,0 mov ah,0int 16h ;取其键值cmp al,0dh ;是回车吗?jnz has_keymov cx,1234hjmp exithas_key: cmp ah,80jnz no_VK_DOWNmov bx,sceen_heightdec bxcmp y,bxjae no_VK_DOWNinc yjmp exitno_VK_DOWN: cmp ah,72jnz exitmov bx,sceen_start_heightcmp y,bx jz exitdec yexit:ret
press_key endp clear_screen proc near uses ax bx cx dx mov ah,6 ;清屏mov al,0 mov bh,7 mov ch,0 mov cl,0 mov dh,24 mov dl,79 int 10h ret clear_screen endp sleep proc uses ax cx dx mov cx,10delay:mov dx,3dahone:in al,dxtest al,8jnz onetwo:in al,dxtest al,8jz twoloop delayret
sleep endpcodes endsend main
左边框里面竖着读一个字节长度数据作为存储子模,读两列。由于汉字是由两个字母位置组成的
注:16点阵字库的字模提取软件