⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 core.lib

📁 仿TC界面用汇编写的一个信息管理器
💻 LIB
📖 第 1 页 / 共 2 页
字号:
endm

;---------------------------------
;功能:SEE过程
;入口参数:INDATA:数据,
;          NUM1:要显示的数据的个数
;          NUM2:每页显示的数据个数
;出口参数:无
;---------------------------------
SeeProcess macro
pushx
push si
cmp datanum,0
je seeExit

mov bh,displaynum
add bh,3
mov dh,4    ;当前的行数
mov dl,0    ;当前页
mov cx,1    ;存储已显示的个数
lea si,grade

changemenu dh,3,10,70h

preSee:
cmp datanum,0
je seeExit
mov ah,0
int 16h
cmp ah,01h
jne cons1 
jmp seeExit

cons1:
cmp ah,50h
jne cons2
jmp seeDown

cons2:
cmp ah,48h
jne cons3
jmp seeUp

cons3:
cmp ah,1ch
jne cons4
jmp seeEnter

cons4:
jmp preSee

seeDown:;按向下箭头
cmp cl,datanum
jnl downEnd
cmp dh,bh
jl downSelect
inc dl
dec dh
add si,82
DataDisplay [si],datanum,displaynum

downSelect:
changemenu dh,3,10,1eh
inc cx
inc dh
changemenu dh,3,10,70h

downEnd:
jmp preSee

seeUp:;按向上箭头
cmp cl,1
jng upEnd
cmp dh,4
jg upSelect
inc dh
dec dl
sub si,82
DataDisplay [si],datanum,displaynum

upSelect:
changemenu dh,3,10,1eh
dec cx
dec dh
changemenu dh,3,10,70h

upEnd:
jmp preSee

seeEnter:;按ENTER键
;由DELETE修改CL的值
dec cl
ManageProcess grade,cl
inc cl
DataDisplay [si],datanum,displaynum
cmp cl,datanum   ;看是不是删除最后一个数据
jng sENoLast
changemenu dh,3,10,1eh
cmp dh,4         ;看是不否还有数据
je sENoData
dec dh
sENoData:
dec cl
sENoLast:
setpos dh,3
changemenu dh,3,10,70h
sEEnd:
jmp preSee

seeExit:
changemenu dh,3,10,1eh
pop si
popx
endm
;-------------------------------------
;功能:计算总成绩
;入口参数:INDATA:数据
;出口参数:无
;-------------------------------------
CountMark macro indata
push bx
mov wtemVar,0
mov bx,0
mov bl,indata[72]
AscllToNum indata+20,wtemVar
mov bl,indata[73]
AscllToNum indata+30,wtemVar
mov bl,indata[74]
AscllToNum indata+40,wtemVar
NumToAscll indata+50,wtemVar
mov bx,wtemVar
mov word ptr indata[80],bx
pop bx
endm

;-------------------------------------
;功能:排序
;入口参数:INDATA:数据
;          NUM:已经存储的数据个数
;出口参数:无
;-------------------------------------
TaxisMark macro
local continue,end,changePos,nextStep
pushx
push si
push di
initOrder
lea si,grade
lea di,grade
mov ax,wdatanum
mov wtemVar,1             ;存储名次
mov bx,word ptr [di+80]   ;冒泡法,存储一轮比较中的最大值
mov cx,1                  ;当前数的下标
mov dx,0                  ;存储当前值

continue:;本轮的比较
cmp cx,ax
jnl nextStep
add si,82
mov dx,word ptr [si+80]
cmp bx,dx
jl changePos
inc cx
jmp continue

changePos:;交换位置
ChangeData [di],[si],82
mov bx,dx
inc cx
jmp continue

nextStep:;进入下一轮
NumToAscll [di+60],wtemVar
cmp wtemVar,ax
jnl end
lea si,grade
add di,82
mov bx,word ptr [di+80]
mov si,di
inc wtemVar
mov cx,wtemVar
jmp continue

end:
pop di
pop si
popx
endm

;-------------------------------------
;功能:打开文件操作
;入口参数:无
;出口参数:无
;-------------------------------------
OpenFileProcess macro
local format,exitloop,lastone
pushx
push si
OpenFileDialog

initPos FILENAME,0,100
lea si,grade

oPreFile:
mov ah,0
int 16h
cmp ah,01h
jne conof1 
jmp oFileExit

conof1:
cmp ah,4bh
jne conof2
PressLeftProcess FL
jmp oPreFile

conof2:
cmp ah,4dh
jne conof3
PressRightProcess FL,FR,FILENAME
jmp oPreFile

conof3:
cmp ah,0eh
jne conof4
PressDeleteData FL,FILENAME,14
jmp oPreFile

conof4:
cmp ah,1ch
jne conof5
jmp oFileOpen

conof5:
SaveName FL,FR,FILENAME
jmp oPreFile

oFileOpen:
OpenFile FILENAME
cmp al,1
jne oFileError
ReadFile 1,datanum
mov bx,0
mov bl,datanum
mov wdatanum,bx
mov cx,wdatanum

oFORead:
ReadFile 82,[si]
add si,82
loop oFORead
OperateFileResultDialog text73
mov ah,0
int 16h
writebscr 8,22,12,52,bscrmm
jmp oFileExit

oFileError:
OperateFileResultDialog text71
mov ah,0
int 16h
writebscr 8,22,12,52,bscrmm
setpos MT,ML

oFileExit:
writebscr 4,8,6,28,bscrmm
setpos MT,ML
CloseFile
pop si
popx
endm
;-------------------------------------
;功能:保存文件操作
;入口参数:无
;出口参数:无
;-------------------------------------
SaveFileProcess macro
local format,exitloop,lastone
pushx
push si
SaveFileDialog

lea si,grade
outputstr filename,14,FT,FL,70h
setpos FT,FL

sPreFile:
mov ah,0
int 16h
cmp ah,01h
jne consf1 
jmp sFileExit

consf1:
cmp ah,4bh
jne consf2
PressLeftProcess FL
jmp sPreFile

consf2:
cmp ah,4dh
jne consf3
PressRightProcess FL,FR,FILENAME
jmp sPreFile

consf3:
cmp ah,0eh
jne consf4
PressDeleteData FL,FILENAME,14
jmp sPreFile

consf4:
cmp ah,1ch
jne consf5
jmp sFileSave

consf5:
SaveName FL,FR,FILENAME
jmp sPreFile

sFileSave:
OpenFile filename
cmp al,1
je sFWrite
CreateFile filename
cmp al,1
jne sFileError
OpenFile filename
cmp al,1
jne sFileError

sFWrite:
WriteFile 1,datanum
mov cx,wdatanum
sFWContinue:
WriteFile 82,[si]
add si,82
loop sFWContinue
OperateFileResultDialog text74
mov ah,0
int 16h
writebscr 8,22,12,52,bscrmm
jmp sFileExit

sFileError:
OperateFileResultDialog text72
mov ah,0
int 16h
writebscr 8,22,12,52,bscrmm

sFileExit:;退出文件保存
writebscr 4,8,6,28,bscrmm
setpos MT,ML
CloseFile
pop si
popx
endm

;-------------------------------------
;功能:按左键响应
;入口参数:left:左边界
;出口参数:无
;-------------------------------------
PressLeftProcess macro left
local posStay,end
push dx
getpos
cmp dl,left
je posStay
dec dl
asetpos
jmp end
posStay:
asetpos
end:
pop dx
endm
;-------------------------------------
;功能:保存文件路径
;入口参数:left:左边界
;出口参数:无
;-------------------------------------
SaveName macro left,right,indata
local end
push bx
push dx
mov bx,0
getpos
cmp dl,right
jnl end
mov bl,dl
sub bl,left
mov indata[bx],al
outputchar al,70h,1
inc dl
asetpos
end:
pop dx
pop bx
endm
;-------------------------------------
;功能:按右键响应
;入口参数:left:左边界
;         right:右边界
;         indata:数据
;出口参数:无
;-------------------------------------
PressRightProcess macro left,right,indata
local posStay,end
pushx
getpos
cmp dl,right
je posStay
mov bx,0
mov ax,0
mov bl,dl
sub bl,left
mov al,indata[bx];当前字符
cmp al,0
je posStay
inc dl
asetpos
jmp end
posStay: 
asetpos
end:
popx
endm

;-------------------------------------
;功能:回格键响应
;入口参数:left:左边界
;         indata:数据
;出口参数:无
;-------------------------------------
PressDeleteData macro left,indata,num
local posStay,end,format,lastone,exitloop
pushx
getpos
cmp dl,left
je end
dec dl
mov bx,0

;找到要删除的字符
mov bl,dl
sub bl,left

;删除字符
mov cx,num
sub cx,bx
format:
cmp bl,num
je lastone
inc bl
mov al,indata[bx]
dec bl
mov indata[bx],al
inc bl
jmp exitloop
lastone:
mov al,0
mov indata[bx],al
exitloop:
loop format

;显示已删除后的字符串
outputstr indata,num,dh,left,70h
asetpos
end:
popx
endm

;-------------------------------------
;功能:查找提供的数据
;入口参数:indata:数据
;出口参数:al=1:找到数据,al=0:没找到
;         dl:返回找到的数据的
;-------------------------------------
FindData macro
local preFind,conf1,conf2,conf3,conf4,conf5
local continue1,continue2,FindExist,FindExit
push di
push si

lea si,grade
lea di,FINDBUF
mov dx,0
mov ax,0
add si,10

preFind:
mov ah,0
int 16h
cmp ah,01h
jne conf1
jmp FindExit 

conf1:
cmp ah,4bh
jne conf2
PressLeftProcess FINDL
jmp PreFind

conf2:
cmp ah,4dh
jne conf3
PressRightProcess FINDL,FINDR,FINDBUF
jmp PreFind

conf3:
cmp ah,0eh
jne conf4
PressDeleteData FINDL,FINDBUF,10
jmp PreFind

conf4:
cmp ah,1ch
jne conf5
jmp FindExist

conf5:
SaveName FINDL,FINDR,FINDBUF
jmp PreFind

FindExist:
cmp dl,datanum
jl continue1
mov al,0
jmp FindExit
continue1:
mov cx,6
repe cmpsb
jne continue2
mov al,1
jmp FindExit
continue2:
inc dl
add si,76
add si,cx
lea di,FINDBUF
jmp FindExist

FindExit:
pop si
pop di
endm

;-------------------------------------
;功能:查找操作
;入口参数:无
;出口参数:无
;-------------------------------------
FindProcess macro 
pushx
push di
push si
FindDialog text80,4

initPos FINDBUF,0,15
setpos FINDT,FINDL

FindPre:
FindData
cmp ah,01h
je FindPreExit  

cmp al,1
je finded
FindResultDialog
mov ah,0
int 16h
writebscr 8,22,12,52,bscrmm
setpos FINDT,FINDL
jmp FindPre
finded:
ManageProcess grade,dl

FindPreExit:
writebscr 8,27,12,47,bscrmm
pop si
pop di
popx
endm

;-------------------------------------
;功能:删除操作
;入口参数:无
;出口参数:无
;-------------------------------------
DeleteProcess macro 
local finded
pushx
push di
push si
FindDialog text100,6

initPos FINDBUF,0,15
setpos FINDT,FINDL

DeletePre:
FindData
cmp ah,01h
je DeletePreExit 

cmp al,1
je finded
FindResultDialog
mov ah,0
int 16h
writebscr 8,22,12,52,bscrmm
setpos FINDT,FINDL
jmp DeletePre
;---------------------------------------
finded:
ConfirmDialog
changemenu 13,32,3,0fh

mov bl,1   ;控制确认状态

DeleteConfirm:
mov ah,0
int 16h
cmp ah,1ch
jne conDC1 
cmp bl,1
jne DCNo
DeleteData grade,dl
writebscr 10,28,14,48,bscrmm
jmp DeletePreExit
DCNo:
writebscr 10,28,14,48,bscrmm

conDC1:
cmp ah,4bh
jne conDC2
cmp bl,1
je DeleteConfirm
changemenu 13,42,3,70h
changemenu 13,32,3,0fh
dec bl
jmp DeleteConfirm

conDC2:
cmp ah,4dh
jne DeleteConfirm
cmp bl,0
je DeleteConfirm
changemenu 13,32,3,70h
changemenu 13,42,3,0fh
inc bl
jmp DeleteConfirm
;--------------------------------------
DeletePreExit:
writebscr 8,27,12,47,bscrmm
setpos MT,13
pop si
pop di
popx
endm

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -