📄 guiload.inc
字号:
jne .foundend
mov esi,eax
mov edi,prevloadfnamel
; copy filename
.findnext
mov ch,[esi]
mov [edi],ch
cmp ch,0
je .foundend
inc esi
inc edi
jmp .findnext
.foundend
call GUIloadfilename
xor eax,eax
mov al,[GUIwinptr]
dec eax
mov byte[GUIwinactiv+1],0
mov byte[GUIwinorder+eax],0
dec byte[GUIwinptr]
ret
.drivefn db 'A:\temp.tmp',0
GetNormalEntries2:
cmp byte[showallext],1
je near .guishowall
GUIGetEntry2 GUIsmcfind
GUIGetEntry2 GUIsfcfind
GUIGetEntry2 GUIswcfind
GUIGetEntry2 GUIfigfind
%ifndef __MSDOS__
GUIGetEntry2 GUIfindGZIP
%endif
GUIGetEntry2 GUIfind058
GUIGetEntry2 GUIfind078
GUIGetEntry2 GUIfindUSA
GUIGetEntry2 GUIfindJAP
GUIGetEntry2 GUIfindBIN
; cmp byte[OSPort],1
; je near .noasm
GUIGetEntry2 GUIfindZIP
;.noasm
GUIGetEntry2 GUIfind1
jmp .guiNext
.guishowall
GUIGetEntry2 GUIfindall
.guiNext
ret
GetNormalEntries:
cmp byte[showallext],1
je near .guishowall
GUIGetEntry GUIsmcfind
GUIGetEntry GUIsfcfind
GUIGetEntry GUIswcfind
GUIGetEntry GUIfigfind
%ifndef __MSDOS__
GUIGetEntry GUIfindGZIP
%endif
GUIGetEntry GUIfind058
GUIGetEntry GUIfind078
GUIGetEntry GUIfindUSA
GUIGetEntry GUIfindJAP
GUIGetEntry GUIfindBIN
; cmp byte[OSPort],1
; je near .noasm
GUIGetEntry GUIfindZIP
;.noasm
GUIGetEntry GUIfind1
jmp .guiNext
.guishowall
GUIGetEntry GUIfindall
.guiNext
ret
GUIGetEntryLFNfunc:
push es
push edi
mov eax,714Eh ; Findfirst
mov cx,ds
mov es,cx
mov ch,0
mov cl,0
mov edi,LFNData
mov si,0
int 21h
mov [LFNHandle],ax
pop edi
pop es
jc near .done
.next
mov esi,LFNData+44
mov ecx,23
.loop
mov al,[esi]
cmp al,'a'
jb .nocap
cmp al,'z'
ja .nocap
sub al,'a'-'A'
.nocap
cmp al,'%'
jne .noperc
cmp byte[esi+1],'0'
jb .noperc
cmp byte[esi+1],'F'
ja .noperc
cmp byte[esi+2],'0'
jb .noperc
cmp byte[esi+2],'F'
ja .noperc
mov al,[esi+2]
sub al,'0'
cmp al,9
jbe .nodec
sub al,'A'-'0'-10
.nodec
mov ah,[esi+1]
sub ah,'0'
cmp ah,9
jbe .nodecb
sub ah,'A'-'0'-10
.nodecb
shl ah,4
or al,ah
add esi,2
.noperc
mov [edi],al
inc edi
inc esi
dec ecx
jnz near .loop
mov byte[edi],0
add edi,9
push es
push edi
mov bx,[LFNHandle]
mov eax, 714Fh ; Findnext
mov dx,ds
mov es,dx
mov edi,LFNData
mov si,0
int 21h
pop edi
pop es
jnc near .next
.done
mov eax,71A1h ;Filefind Close
mov bx,[LFNHandle]
int 21h
ret
GUIGetEntryLFNfuncdir:
mov edx,GUIfindall
push es
push edi
mov eax,714Eh ; Findfirst
mov cx,ds
mov es,cx
mov ch,10h
mov cl,10h
mov edi,LFNData
mov si,0
int 21h
mov [LFNHandle],ax
pop edi
pop es
jc near .done
.next
mov esi,LFNData+44
mov ecx,11
.loop
mov al,[esi]
cmp al,'a'
jb .nocap
cmp al,'z'
ja .nocap
sub al,'a'-'A'
.nocap
mov [edi],al
inc edi
inc esi
dec ecx
jnz .loop
mov byte[edi],0
add edi,21
push es
push edi
mov bx,[LFNHandle]
mov eax, 714Fh ; Findnext
mov dx,ds
mov es,dx
mov edi,LFNData
mov si,0
int 21h
pop edi
pop es
jnc near .next
.done
mov eax,71A1h ;Filefind Close
mov bx,[LFNHandle]
int 21h
ret
%macro GUIGetEntryLFN 1
mov edx,%1
call GUIGetEntryLFNfunc
%endmacro
GetLoadLfn:
call GetNormalEntries
push edi
mov edi,[spcBuffera]
inc edi
cmp byte[showallext],1
je near .guishowall
GUIGetEntryLFN GUIsmcfind
GUIGetEntryLFN GUIsfcfind
GUIGetEntryLFN GUIswcfind
GUIGetEntryLFN GUIfigfind
%ifndef __MSDOS__
GUIGetEntryLFN GUIfindGZIP
%endif
GUIGetEntryLFN GUIfind058
GUIGetEntryLFN GUIfind078
GUIGetEntryLFN GUIfindUSA
GUIGetEntryLFN GUIfindJAP
GUIGetEntryLFN GUIfindBIN
GUIGetEntryLFN GUIfindZIP
GUIGetEntryLFN GUIfind1
jmp .guiNext
.guishowall
GUIGetEntryLFN GUIfindall
.guiNext
pop edi
ret
LFNData times 400 db 0
LFNHandle dw 0
GetLoadNormal:
call GetNormalEntries2
ret
GetLoadHeader:
call GetNormalEntries
push edi
; Copy every 14 bytes of spcRamcmp into every 32 bytes of spcBuffer
mov ecx,[GUInumentries]
mov esi,spcRamcmp+1
mov edi,[spcBuffera]
inc edi
cmp ecx,0
je near .none
.loop
; open file at esi and store in edi
push esi
push ecx
push edi
; check if .zip file
mov eax,esi
.zipdet
cmp byte[eax],0
je near .skipcheck
cmp byte[eax],'.'
je .dotdetected
inc eax
jmp .zipdet
.dotdetected
cmp byte[eax+1],'z'
je near .yeszipa
cmp byte[eax+1],'Z'
jne near .skipcheck
.yeszipa
cmp byte[eax+2],'i'
je near .yeszipb
cmp byte[eax+2],'I'
jne near .skipcheck
.yeszipb
cmp byte[eax+3],'p'
je near .yeszipc
cmp byte[eax+3],'P'
jne near .skipcheck
.yeszipc
; move esi to edi
.ziploop
mov al,[esi]
mov [edi],al
inc esi
inc edi
or al,al
jnz .ziploop
jmp .doneall
.skipcheck
; open file
mov edx,esi
call Open_File
jc near .fileerror
mov bx,ax
; Check filesize
mov cx,0
mov dx,0
call File_Seek_End
jc near .fileerror
cmp dx,0
jne .locokay
cmp ax,32768
jae .locokay
jmp .fileerror
.locokay
; Look for 512 byte header
mov cx,0
mov dx,250
call File_Seek
jc near .fileerror
mov ecx,20
mov edx,fnameheadtemp
call Read_File
jc near .fileerror
; if 10 or more 0's, then header
mov ecx,20
mov esi,fnameheadtemp
xor eax,eax
.loop2
cmp byte[esi],0
jne .notzero2
inc eax
.notzero2
inc esi
dec ecx
jnz .loop2
cmp eax,10
ja near .yes512header
mov cx,0
mov dx,32704
call File_Seek
jc near .fileerror
mov ecx,20
mov edx,edi
call Read_File
jc near .fileerror
mov cx,0
mov dx,32704+32768
call File_Seek
jc near .fileerror
mov ecx,20
mov edx,fnameheadtemp
call Read_File
jc near .fileerror
jmp .noheaderdone
.yes512header
mov cx,0
mov dx,32704+512
call File_Seek
jc near .fileerror
mov ecx,20
mov edx,edi
call Read_File
jc near .fileerror
mov cx,1
mov dx,448
call File_Seek
jc near .fileerror
mov ecx,20
mov edx,fnameheadtemp
call Read_File
jc near .fileerror
.noheaderdone
mov ecx,20
.loops
cmp byte[edi],0
jne .notzero
mov byte[edi],32
.notzero
inc edi
dec ecx
jnz .loops
; Check which header has more alphabets, then move
sub edi,20
call .checkalpha
push eax
push edi
mov edi,fnameheadtemp
call .checkalpha
pop edi
mov ecx,eax
pop eax
cmp ecx,eax
jb .noswaps
mov ecx,20
sub edi,20
mov esi,fnameheadtemp
.loops2
mov al,[esi]
mov [edi],al
inc edi
inc esi
dec ecx
jnz .loops2
.noswaps
jmp .fileokay
.fileerror
mov eax,[.invfile]
mov [edi],eax
mov eax,[.invfile+4]
mov [edi+4],eax
mov eax,[.invfile+8]
mov [edi+8],eax
mov eax,[.invfile+12]
mov [edi+12],eax
mov eax,[.invfile+16]
mov [edi+16],eax
.fileokay
call Close_File
.doneall
pop edi
pop ecx
pop esi
mov byte[edi+20],0
push edi
push esi
push ecx
; check if first 20 bytes are all equal or not
mov al,[edi+1]
mov ecx,19
.loopchk
cmp byte[edi+1],al
jne .notequal
inc edi
dec ecx
jnz .loopchk
sub edi,19
mov ecx,14
.loopcpy
mov al,[esi]
mov [edi],al
inc esi
inc edi
dec ecx
jnz .loopcpy
.notequal
pop ecx
pop esi
pop edi
; Capitalize
push edi
push ecx
mov ecx,20
.loop4
mov al,[edi]
cmp al,'a'
jb .nocap
cmp al,'z'
ja .nocap
sub al,'a'-'A'
.nocap
mov [edi],al
loop .loop4
pop ecx
pop edi
add esi,14
add edi,32
dec ecx
jnz near .loop
.none
pop edi
ret
.checkalpha
mov ecx,20
xor eax,eax
.loop3
cmp byte[edi],32
je .alpha
cmp byte[edi],'A'
jb .noalpha
cmp byte[edi],'Z'
jbe .alpha
cmp byte[edi],'a'
jb .noalpha
cmp byte[edi],'z'
ja .noalpha
.alpha
inc eax
.noalpha
inc edi
dec ecx
jnz .loop3
ret
.invfile db ' ** INVALID FILE **',0
fnameheadtemp times 22 db 0
GetNormalDirEntries2:
GUIGetDir2
ret
GetNormalDirEntries:
GUIGetDir
ret
GetLoadDirNormal2:
call GetNormalDirEntries2
ret
GetLoadDirNormal:
call GetNormalDirEntries
push edi
; Copy every 14 bytes of spcRamcmp into every 32 bytes of spcBuffer
mov ecx,[GUIdirentries]
mov esi,[GUIdirStartLoc]
mov edi,dword[GUIfileentries]
shl edi,5
add edi,[spcBuffera]
cmp ecx,0
je .none
.loop
mov eax,[esi]
mov [edi],eax
mov eax,[esi+4]
mov [edi+4],eax
mov eax,[esi+8]
mov [edi+8],eax
xor ax,ax
mov [edi+12],ax
add esi,14
add edi,32
dec ecx
jnz .loop
.none
pop edi
ret
GetLoadDirNormallfn:
call GetNormalDirEntries
push edi
; Copy every 14 bytes of spcRamcmp into every 32 bytes of spcBuffer
mov edi,dword[GUIfileentries]
shl edi,5
add edi,[spcBuffera]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -