📄 core.lib
字号:
;--------------------------------
;功能:初始化窗口
;入口参数:无
;出口参数:无
;--------------------------------
INITWIN MACRO
local initclear
pushx
mov dl,02h
mov dh,02h
asetpos
initclear:
mov ah,0ah
mov al,0
mov bx,0
mov cx,77
int 10h
inc dh
asetpos
cmp dh,22
jne initclear
popx
ENDM
;--------------------------------
;功能:绘制窗口
;入口参数:无
;出口参数:无
;--------------------------------
DRAWWIN MACRO
local draw
;******************* 初始化屏幕开始
mov ah,0
mov al,03h
int 10h
;******************* 初始化屏幕结束
showcur 1 ;隐藏光标
;************************************* 开始主窗口的绘制
drawwindow 1eh,0,0,24,79
outputstr msgtitle,25,9,27,1fh
outputstr msg0,15,17,49,17h
outputstr msg1,23,18,45,17h
outputstr msg6,28,20,40,1eh
mov ah,0h
int 16h
drawwindow 1eh,0,0,24,79
drawwindow 70h,0,0,0,79
drawwindow 70h,24,0,24,79
setpos 1,0
windowtandb 0d5h,0cdh,0b8h,1,0,80,1eh
mov al,2
draw:
windowlandr 0b3h,al,0,80,1eh
inc al
cmp al,17h
jne draw
windowtandb 0c0h,0c4h,0d9h,23,0,80,1eh
outputstr buttonMsg1,10,24,3,70h
changemenu 24,3,5,74h
outputstr buttonMsg2,10,24,15,70h
changemenu 24,15,5,74h
outputstr buttonMsg3,10,24,27,70h
changemenu 24,27,3,74h
outputstr buttonMsg4,7,24,39,70h
changemenu 24,39,2,74h
outputstr buttonMsg5,7,24,48,70h
changemenu 24,48,2,74h
outputstr text,63,3,3,1ah
;***************************************开始主菜单的绘制
setpos 0,3
outputstr mainmenu1,4,0,3,0fh
outputstr mainmenu2,4,0,13,70h
changemenu 0,13,1,74h
outputstr mainmenu3,3,0,23,70h
changemenu 0,23,1,74h
outputstr mainmenu4,4,0,33,70h
changemenu 0,33,1,74h
setpos 0,3
;*********************************** 结束主窗口和主菜单的绘制
ENDM
;--------------------------------
;功能:插入数据
;入口参数:INDATA:数据,
; NUM:数据在数组中的位置
;出口参数:无
;--------------------------------
INSERT MACRO insNum
local preIns,insExit,insSctrl
local coni1,coni2,coni3,coni4,coni5,coni6,coni7,coni8,coni9
pushx
push si
push di
lea si,grade
mov bl,82
mov al,insNum
mul bl
add si,ax
mov dx,ax
mov di,si
preIns:
mov ah,0
int 16h
cmp ah,01h
jne coni1
jmp insExit
coni1:
cmp ah,4bh
jne coni2
PressLeftProcess IL
jmp preIns
coni2:
cmp ah,50h
jne coni3
InsPressDown
jmp preIns
coni3:
cmp ah,48h
jne coni4
InsPressUp
jmp preIns
coni4:
cmp ah,4dh
jne coni5
InsPressRight
jmp preIns
coni5:
cmp ah,01h
js coni6
cmp ah,0ch
jns coni6
InsPressNum
jmp preIns
coni6:
cmp al,61h
js coni7
cmp al,7bh
jns coni7
InsPressLetter
jmp preIns
coni7:
cmp ah,0eh
jne coni8
InsPressDel
jmp preIns
coni8:
cmp ah,1fh
jne coni9
mov ah,02h
int 16h
and al,0fh
cmp al,08h
jne coni9
jmp insSctrl
coni9:
jmp preIns
insSctrl:;按ALT+S
CountMark [si]
mov isInsData,1
insExit:
pop di
pop si
popx
ENDM
;-------------------------------------
;功能:按右键响应(INSERT)
;入口参数:DI:插入数据的首地址
;出口参数:无
;-------------------------------------
InsPressRight macro
local posStay,end,moveRight,callInsDown
pushx
push di
getpos
cmp dl,IR
je posStay
push dx
mov ax,0
mov bx,0
sub dh,IT
mov al,dh
mov bl,10
mul bl
add di,ax
sub dl,IL
mov bl,dl
add di,bx
mov bl,[di];当前字符
inc di
mov bh,[di];下一个字符
pop dx
cmp bl,0
jne moveRight
cmp bh,0
je callInsDown
jmp end
moveRight:
inc dl
asetpos
jmp end
callInsDown:
InsPressDown
jmp end
posStay:
asetpos
end:
pop di
popx
endm
;-------------------------------------
;功能:按向下键响应(INSERT)
;入口参数:DI:插入数据的首地址
;出口参数:无
;-------------------------------------
InsPressDown macro
local posStay,end
push bx
push dx
getpos
mov bx,0
mov bl,dh
sub bl,IT
cmp dh,IB
jne posStay
mov dl,nowpos[bx]
asetpos
jmp end
posStay:
inc bx
mov dl,nowpos[bx]
inc dh
asetpos
end:
pop dx
pop bx
endm
;-------------------------------------
;功能:按上键响应(INSERT)
;入口参数:DI:插入数据的首地址
;出口参数:无
;-------------------------------------
InsPressUp macro
local posStay,end
push bx
push dx
getpos
mov bx,0
mov bl,dh
sub bl,IT
cmp dh,IT
jne posStay
mov dl,nowpos[bx]
asetpos
jmp end
posStay:
dec bx
mov dl,nowpos[bx]
dec dh
asetpos
end:
pop dx
pop bx
endm
;-------------------------------------
;功能:按数字键响应(INSERT)
;入口参数:DI:插入数据的首地址
;出口参数:无
;-------------------------------------
InsPressNum macro
local inputName,inputSubject,saveNum
local end,save,mul
push dx
push bx
push di
getpos
cmp dh,IT
jne inputName
cmp dl,IR
jl saveNum
jmp end
inputName:
cmp dh,11
jne inputSubject
cmp dl,39
jl saveNum
jmp end
inputSubject:
cmp dl,37
jl saveNum
jmp end
saveNum:;存储数字
push dx
sub dh,IT
mul:
cmp dh,0
je save
add di,10
dec dh
jmp mul
save:
push bx
mov bx,0
sub dl,33
mov bl,dl
mov [di+bx],al
pop bx
pop dx
outputchar al,70h,1
inc dl
asetpos
end:
mov bx,0
mov bl,dh
sub bl,10
mov nowpos[bx],dl;存储当前位置
mov di,si
sub dl,34
add di,70
mov [di+bx],dl ;存储位数
pop di
pop bx
pop dx
endm
;-------------------------------------
;功能:按字母键响应(INSERT)
;入口参数:DI:插入数据的首地址
;出口参数:无
;-------------------------------------
InsPressLetter macro
local end
push dx
push bx
push di
getpos
cmp dl,39
jnl end
cmp dh,11
jne end
;存储字符
push dx
push ax
mov ax,0
mov bx,0
sub dh,IT
mov al,dh
mov bl,10
mul bl
add di,ax
sub dl,IL
mov bl,dl
pop ax
mov [di+bx],al
pop dx
outputchar al,70h,1
inc dl
asetpos
end:
mov bx,0
mov bl,dh
sub bl,10
mov nowpos[bx],dl;存储当前位置
pop di
pop bx
pop dx
endm
;-------------------------------------
;功能:按退格键响应(INSERT)
;入口参数:DI:插入数据的首地址
;出口参数:无
;-------------------------------------
InsPressDel macro
local end,preDel,format,exitloop,lastone
push bx
push dx
push di
getpos
cmp dl,IL
jne preDel
jmp end
preDel:
dec dl
;取得当前位置
mov nowrow,dh
sub nowrow,IT
mov bx,0
mov bl,nowrow
mov nowpos[bx],dl ;保存删除后的位置
asetpos
;找到要删除的字符
push dx
push ax
mov ax,0
mov al,nowrow
mov bl,10
mul bl
add di,ax
sub dl,IL
mov bl,dl
pop ax
pop dx
;删除字符
mov cx,9
sub cx,bx
format:
cmp bl,10
je lastone
inc bl
mov al,[di+bx]
dec bl
mov [di+bx],al
inc bl
jmp exitloop
lastone:
mov al,0
mov [di+bx],al
exitloop:
loop format
;显示已删除后的字符串
mov dl,33
outputstr [di],10,dh,dl,70h
mov bl,nowrow
mov dl,nowpos[bx]
asetpos
end:
mov di,si
sub dl,34
add di,70
mov [di+bx],dl ;存储位数
pop di
pop dx
pop bx
endm
;---------------------------------
;功能:删除过程
;入口参数:INDATA:数据,
; delNum:要删除的数据的位置
;出口参数:无
;---------------------------------
DeleteData macro indata,delNum
local moveb,delEnd,copy,init
pushx
push si
push di
lea di,indata
mov bl,82
mov al,delNum
mul bl
add di,ax
mov si,di
add si,82
mov bl,delNum
inc bl
moveb:
cmp bl,datanum
jg delEnd
mov cx,82
copy:
movsb
loop copy
inc bl
jmp moveb
delEnd:
mov cx,82
init:
movsb
loop init
dec datanum
dec wdatanum
pop di
pop si
popx
endm
;----------------------------------------
;功能:管理过程
;入口参数:INDATA:数据
; NUM:进行管理的数据项
;出口参数:无
;----------------------------------------
ManageProcess macro indata,magNum
local preManage,conM1,conM2,conM3,manageLeft,manageRight,manageEnter,mEDNo
local mLeftEnd,mRightEnd,mEDelete,conMED1,conMED2,mEModify,mEExit,manageExit
pushx
push si
ManageDialog
lea si,indata
mov bl,82
mov al,magNum
mul bl
add si,ax
outputstr [si],10,10,33,70h
add si,10
outputstr [si],6,11,33,70h
add si,10
outputstr [si],4,12,33,70h
add si,10
outputstr [si],4,13,33,70h
add si,10
outputstr [si],4,14,33,70h
changemenu 16,22,6,0fh
mov temVar,22 ;作为位置记录
preManage:
mov ah,0
int 16h
cmp ah,1ch
jne conM1
jmp manageEnter
conM1:
cmp ah,4bh
jne conM2
jmp manageLeft
conM2:
cmp ah,4dh
jne conM3
jmp manageRight
conM3:
jmp preManage
manageLeft:
cmp temVar,22
jng mLeftEnd
changemenu 16,temVar,6,70h
changemenu 16,temVar,1,74h
sub temVar,12
changemenu 16,temVar,6,0fh
mLeftEnd:
jmp preManage
manageRight:
cmp temVar,46
jnl mRightEnd
changemenu 16,temVar,6,70h
changemenu 16,temVar,1,74h
add temVar,12
changemenu 16,temVar,6,0fh
mRightEnd:
jmp preManage
manageEnter:
cmp temVar,22
jne mEModify
ConfirmDialog
changemenu 13,32,3,0fh
mov bl,1 ;控制确认状态
mEDelete:
mov ah,0
int 16h
cmp ah,1ch
jne conMED1
cmp bl,1
jne mEDNo
DeleteData indata,magNum
writebscr 10,28,14,48,bscrmm
jmp manageExit
mEDNo:
writebscr 10,28,14,48,bscrmm
setpos 16,22
jmp preManage
conMED1:
cmp ah,4bh
jne conMED2
cmp bl,1
je mEDelete
changemenu 13,42,3,70h
changemenu 13,32,3,0fh
dec bl
jmp mEDelete
conMED2:
cmp ah,4dh
jne mEDelete
cmp bl,0
je mEDelete
changemenu 13,32,3,70h
changemenu 13,42,3,0fh
inc bl
jmp mEDelete
mEModify:
cmp temVar,34
jne mEExit
setpos 10,33
initPos nowpos,33,5
insert magNum
changemenu 16,temVar,6,70h
changemenu 16,temVar,1,74h
changemenu 16,22,6,0fh
mov temVar,22
jmp preManage
mEExit:
cmp temVar,46
jne preManage
manageExit:
writebscr 8,20,18,55,bscrmm
pop si
popx
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -