好久没更新这个系列了,更新一下吧。
直接上代码。
main.asm
org 0x7c00
jmp main
%include "font.asm"
enter:
mov bp,0
mov al,0x00
int 10h
mov al,0x0d
int 10h
mov al,0x0a
int 10h
jmp keyboard
back:
mov ah,03h ;获取光标所在行
int 10h
mov ah,0eh
cmp dh,2
je backmain
cmp dl,0
je backmain2
jmp backmain
backmain:
mov al,0x00
int 10h
mov al,0x08
int 10h
mov al,0x08
int 10h
mov al,0x00
int 10h
mov al,0x08
int 10h
sub bp,1
jmp keyboard
backmain2:
mov al,0x00
int 10h
mov al,0x08
int 10h
mov ah,02h
mov dl,78
sub dh,1
int 10h
mov bp,78
jmp keyboard
keyenter:
int 10h
mov al,0x0d
int 10h
mov al,0x0a
int 10h
mov bp,0
jmp keyboard
main:
call font_init
mov bp,0
mov si,0
call 记
mov bp,16
mov si,0
call 事
mov bp,32
mov si,0
call 本
mov ah,01h
mov cx,0607h
int 10h
mov ah,02h ;设置光标到0行2列
mov dh,2
mov dl,0
int 10h
mov bp,0
keyboard:
mov ah,0eh
mov al,'_'
int 10h
mov al,0x08
int 10h
mov ah,0
int 16h
mov ah,0eh
cmp al,0x0d
je enter
cmp al,0x08
je back
cmp bp,78
je keyenter
int 10h
add bp,1
jmp keyboard
times 0xCFE-($-$$) db 0
db 0x55,0xaa
font.asm
记:
call dz
mov cx,bp
add cx,3
inc cx
mov dx,si
add dx,2
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,2
inc dx
call dz
mov cx,bp
add cx,4
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,6
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,7
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,9
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,10
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,11
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,12
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,14
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,4
inc cx
mov dx,si
add dx,4
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,4
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,6
inc dx
call dz
mov cx,bp
add cx,1
inc cx
mov dx,si
add dx,7
inc dx
call dz
mov cx,bp
add cx,2
inc cx
mov dx,si
add dx,7
inc dx
call dz
mov cx,bp
add cx,3
inc cx
mov dx,si
add dx,7
inc dx
call dz
mov cx,bp
add cx,4
inc cx
mov dx,si
add dx,7
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,7
inc dx
call dz
mov cx,bp
add cx,4
inc cx
mov dx,si
add dx,8
inc dx
call dz
mov cx,bp
add cx,7
inc cx
mov dx,si
add dx,8
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,8
inc dx
call dz
mov cx,bp
add cx,9
inc cx
mov dx,si
add dx,8
inc dx
call dz
mov cx,bp
add cx,10
inc cx
mov dx,si
add dx,8
inc dx
call dz
mov cx,bp
add cx,11
inc cx
mov dx,si
add dx,8
inc dx
call dz
mov cx,bp
add cx,12
inc cx
mov dx,si
add dx,8
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,8
inc dx
call dz
mov cx,bp
add cx,4
inc cx
mov dx,si
add dx,9
inc dx
call dz
mov cx,bp
add cx,7
inc cx
mov dx,si
add dx,9
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,9
inc dx
call dz
mov cx,bp
add cx,4
inc cx
mov dx,si
add dx,10
inc dx
call dz
mov cx,bp
add cx,7
inc cx
mov dx,si
add dx,10
inc dx
call dz
mov cx,bp
add cx,4
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,7
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,4
inc cx
mov dx,si
add dx,12
inc dx
call dz
mov cx,bp
add cx,7
inc cx
mov dx,si
add dx,12
inc dx
call dz
mov cx,bp
add cx,15
inc cx
mov dx,si
add dx,12
inc dx
call dz
mov cx,bp
add cx,4
inc cx
mov dx,si
add dx,13
inc dx
call dz
mov cx,bp
add cx,6
inc cx
mov dx,si
add dx,13
inc dx
call dz
mov cx,bp
add cx,7
inc cx
mov dx,si
add dx,13
inc dx
call dz
mov cx,bp
add cx,15
inc cx
mov dx,si
add dx,13
inc dx
call dz
mov cx,bp
add cx,4
inc cx
mov dx,si
add dx,14
inc dx
call dz
mov cx,bp
add cx,5
inc cx
mov dx,si
add dx,14
inc dx
call dz
mov cx,bp
add cx,7
inc cx
mov dx,si
add dx,14
inc dx
call dz
mov cx,bp
add cx,15
inc cx
mov dx,si
add dx,14
inc dx
call dz
mov cx,bp
add cx,4
inc cx
mov dx,si
add dx,15
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,15
inc dx
call dz
mov cx,bp
add cx,9
inc cx
mov dx,si
add dx,15
inc dx
call dz
mov cx,bp
add cx,10
inc cx
mov dx,si
add dx,15
inc dx
call dz
mov cx,bp
add cx,11
inc cx
mov dx,si
add dx,15
inc dx
call dz
mov cx,bp
add cx,12
inc cx
mov dx,si
add dx,15
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,15
inc dx
call dz
mov cx,bp
add cx,14
inc cx
mov dx,si
add dx,15
inc dx
call dz
mov cx,bp
add cx,15
inc cx
mov dx,si
add dx,15
inc dx
call dz
ret
事:
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,1
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,2
inc dx
call dz
mov cx,bp
add cx,14
inc cx
mov dx,si
add dx,2
inc dx
call dz
mov cx,bp
add cx,1
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,2
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,3
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,4
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,5
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,6
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,7
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,9
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,10
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,11
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,12
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,14
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,15
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,4
inc dx
call dz
mov cx,bp
add cx,3
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,4
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,5
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,6
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,7
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,9
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,10
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,11
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,12
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,3
inc cx
mov dx,si
add dx,6
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,6
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,6
inc dx
call dz
mov cx,bp
add cx,3
inc cx
mov dx,si
add dx,7
inc dx
call dz
mov cx,bp
add cx,4
inc cx
mov dx,si
add dx,7
inc dx
call dz
mov cx,bp
add cx,5
inc cx
mov dx,si
add dx,7
inc dx
call dz
mov cx,bp
add cx,6
inc cx
mov dx,si
add dx,7
inc dx
call dz
mov cx,bp
add cx,7
inc cx
mov dx,si
add dx,7
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,7
inc dx
call dz
mov cx,bp
add cx,9
inc cx
mov dx,si
add dx,7
inc dx
call dz
mov cx,bp
add cx,10
inc cx
mov dx,si
add dx,7
inc dx
call dz
mov cx,bp
add cx,11
inc cx
mov dx,si
add dx,7
inc dx
call dz
mov cx,bp
add cx,12
inc cx
mov dx,si
add dx,7
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,7
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,8
inc dx
call dz
mov cx,bp
add cx,3
inc cx
mov dx,si
add dx,9
inc dx
call dz
mov cx,bp
add cx,4
inc cx
mov dx,si
add dx,9
inc dx
call dz
mov cx,bp
add cx,5
inc cx
mov dx,si
add dx,9
inc dx
call dz
mov cx,bp
add cx,6
inc cx
mov dx,si
add dx,9
inc dx
call dz
mov cx,bp
add cx,7
inc cx
mov dx,si
add dx,9
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,9
inc dx
call dz
mov cx,bp
add cx,9
inc cx
mov dx,si
add dx,9
inc dx
call dz
mov cx,bp
add cx,10
inc cx
mov dx,si
add dx,9
inc dx
call dz
mov cx,bp
add cx,11
inc cx
mov dx,si
add dx,9
inc dx
call dz
mov cx,bp
add cx,12
inc cx
mov dx,si
add dx,9
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,9
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,10
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,10
inc dx
call dz
mov cx,bp
add cx,1
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,2
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,3
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,4
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,5
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,6
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,7
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,9
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,10
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,11
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,12
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,14
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,15
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,12
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,12
inc dx
call dz
mov cx,bp
add cx,3
inc cx
mov dx,si
add dx,13
inc dx
call dz
mov cx,bp
add cx,4
inc cx
mov dx,si
add dx,13
inc dx
call dz
mov cx,bp
add cx,5
inc cx
mov dx,si
add dx,13
inc dx
call dz
mov cx,bp
add cx,6
inc cx
mov dx,si
add dx,13
inc dx
call dz
mov cx,bp
add cx,7
inc cx
mov dx,si
add dx,13
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,13
inc dx
call dz
mov cx,bp
add cx,9
inc cx
mov dx,si
add dx,13
inc dx
call dz
mov cx,bp
add cx,10
inc cx
mov dx,si
add dx,13
inc dx
call dz
mov cx,bp
add cx,11
inc cx
mov dx,si
add dx,13
inc dx
call dz
mov cx,bp
add cx,12
inc cx
mov dx,si
add dx,13
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,13
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,14
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,14
inc dx
call dz
mov cx,bp
add cx,6
inc cx
mov dx,si
add dx,15
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,15
inc dx
call dz
mov cx,bp
add cx,7
inc cx
mov dx,si
add dx,16
inc dx
call dz
ret
本:
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,1
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,2
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,3
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,4
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,4
inc dx
call dz
mov cx,bp
add cx,2
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,3
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,4
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,5
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,6
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,7
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,9
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,10
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,11
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,12
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,14
inc cx
mov dx,si
add dx,5
inc dx
call dz
mov cx,bp
add cx,6
inc cx
mov dx,si
add dx,6
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,6
inc dx
call dz
mov cx,bp
add cx,10
inc cx
mov dx,si
add dx,6
inc dx
call dz
mov cx,bp
add cx,6
inc cx
mov dx,si
add dx,7
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,7
inc dx
call dz
mov cx,bp
add cx,10
inc cx
mov dx,si
add dx,7
inc dx
call dz
mov cx,bp
add cx,6
inc cx
mov dx,si
add dx,8
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,8
inc dx
call dz
mov cx,bp
add cx,10
inc cx
mov dx,si
add dx,8
inc dx
call dz
mov cx,bp
add cx,5
inc cx
mov dx,si
add dx,9
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,9
inc dx
call dz
mov cx,bp
add cx,11
inc cx
mov dx,si
add dx,9
inc dx
call dz
mov cx,bp
add cx,5
inc cx
mov dx,si
add dx,10
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,10
inc dx
call dz
mov cx,bp
add cx,11
inc cx
mov dx,si
add dx,10
inc dx
call dz
mov cx,bp
add cx,4
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,12
inc cx
mov dx,si
add dx,11
inc dx
call dz
mov cx,bp
add cx,3
inc cx
mov dx,si
add dx,12
inc dx
call dz
mov cx,bp
add cx,5
inc cx
mov dx,si
add dx,12
inc dx
call dz
mov cx,bp
add cx,6
inc cx
mov dx,si
add dx,12
inc dx
call dz
mov cx,bp
add cx,7
inc cx
mov dx,si
add dx,12
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,12
inc dx
call dz
mov cx,bp
add cx,9
inc cx
mov dx,si
add dx,12
inc dx
call dz
mov cx,bp
add cx,10
inc cx
mov dx,si
add dx,12
inc dx
call dz
mov cx,bp
add cx,11
inc cx
mov dx,si
add dx,12
inc dx
call dz
mov cx,bp
add cx,13
inc cx
mov dx,si
add dx,12
inc dx
call dz
mov cx,bp
add cx,14
inc cx
mov dx,si
add dx,12
inc dx
call dz
mov cx,bp
add cx,15
inc cx
mov dx,si
add dx,12
inc dx
call dz
mov cx,bp
add cx,1
inc cx
mov dx,si
add dx,13
inc dx
call dz
mov cx,bp
add cx,2
inc cx
mov dx,si
add dx,13
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,13
inc dx
call dz
mov cx,bp
add cx,14
inc cx
mov dx,si
add dx,13
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,14
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,15
inc dx
call dz
mov cx,bp
add cx,8
inc cx
mov dx,si
add dx,16
inc dx
call dz
ret
font_init:
mov ah,0
mov al,11h
int 10h
ret
dz:
mov al,11h
mov bx,cx
add bx,1
int 10h
mov ah,0ch
inc cx
ret
font.asm只是显示开始的记事本三个汉字可以选择不调用。
效果图
注意!如果要在真机或者虚拟机上运行,要把org 0x7c00去掉。
这是虚拟机运行的图片