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

📄 guiload.inc

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 INC
📖 第 1 页 / 共 3 页
字号:
    inc edi
    call GUIGetEntryLFNfuncdir
    pop edi
    ret

Win95Failed db 0

NEWSYM GetCurDir
    ; get Drive/Dir
%ifndef __LINUX__
    mov ebx,GUIcurrentdir+3
%else
    mov ebx,GUIcurrentdir
%endif
    mov edx,GUIcurrentdir
    call Get_Dir

%ifndef __LINUX__
    add byte[GUIcurrentdir],65

    mov byte[GUIcurrentdir+1],':'
    mov byte[GUIcurrentdir+2],'\'
%endif

    cmp byte[GUIcurrentdir+35],0
    je .nodotend
    mov byte[GUIcurrentdir+35],'.'
    mov byte[GUIcurrentdir+36],'.'
    mov byte[GUIcurrentdir+37],'.'
    mov byte[GUIcurrentdir+38],0
.nodotend
    ; Set DTA address
    call Set_DTA_Address
    ret

GetLoadData:
    mov dword[GUIcurrentfilewin],0
.a
    call GetCurDir
    mov dword[GUInumentries],0
    mov dword[GUIcurrentviewloc],0
    mov dword[GUIcurrentcursloc],0
    mov dword[GUIcurrentdirviewloc],0
    mov dword[GUIcurrentdircursloc],0
    mov edi,spcRamcmp
    mov byte[Win95Failed],0
;    cmp byte[OSPort],1
;    ja .notdos
%ifdef __MSDOS__
    cmp byte[GUIloadfntype],2
    jne .nowin95lfn
    clc
    mov ax,7100h
    int 21h
    jc .nowin95lfn
%endif
;.notdos
    mov byte[GUIloadfntype],0
.nowin95lfn
    cmp byte[GUIloadfntype],2
    je .win95lfn
    cmp byte[GUIloadfntype],1
    je .snesheader
    mov edi,[spcBuffera]
    call GetLoadNormal
    jmp .doneheader
.snesheader
    mov byte[showallext],0
    call GetLoadHeader
    jmp .doneheader
.win95lfn
    call GetLoadLfn
.doneheader
    cmp byte[Win95Failed],1
    jne .notfailed
    mov byte[GUIloadfntype],0
    jmp GetLoadData
.notfailed
    mov eax,dword[GUInumentries]
    mov dword[GUIfileentries],eax
    cmp dword[GUIfileentries],0
    jne .nonoentry
    mov dword[GUIcurrentfilewin],1
.nonoentry

    ; Sort List
    push edi
    ; compares string at esi to edi and returns 1 to al if esi is >, else 0
.sortagain
    mov byte[BubbleSorted],0
    mov esi,[spcBuffera]
    inc esi
    mov edi,spcRamcmp+1
    cmp dword[GUInumentries],1
    jbe near .nosort
    cmp byte[GUIloadfntype],0
    je near .sort2
    mov ecx,[GUInumentries]
    dec ecx
.nextentry
    push ecx
    ; check if esi > esi+32
    call GUIStringGreater
    ; if it is, swap!
    cmp al,0
    je near .noswap
    mov ecx,31
.nextswap
    mov al,[esi]
    mov bl,[esi+32]
    mov [esi],bl
    mov [esi+32],al
    inc esi
    dec ecx
    jnz .nextswap
    mov ecx,13
.nextswap2
    mov al,[edi]
    mov bl,[edi+14]
    mov [edi],bl
    mov [edi+14],al
    inc edi
    dec ecx
    jnz .nextswap2
    mov byte[BubbleSorted],1
    sub esi,31
    sub edi,13
.noswap
    add esi,32
    add edi,14
    pop ecx
    dec ecx
    jnz near .nextentry
.nosort
    cmp byte[BubbleSorted],1
    je near .sortagain
    jmp .donesort

.sort2
    mov esi,spcRamcmp
    mov ecx,[GUInumentries]
    dec ecx
.nextentryb
    push ecx
    mov ebx,[esi]
    mov edx,[esi+4]
    inc ebx
    inc edx
    ; check if ebx > edx
    call GUIStringGreater2
    ; if it is, swap!
    cmp al,0
    je near .noswapb
    mov eax,[esi]
    mov ebx,[esi+4]
    mov [esi],ebx
    mov [esi+4],eax
    mov byte[BubbleSorted],1
.noswapb
    add esi,4
    pop ecx
    dec ecx
    jnz near .nextentryb
.nosortb
    cmp byte[BubbleSorted],1
    je near .sortagain
.donesort
    pop edi
GUIGetDirs:
    mov dword[GUIdirentries],0
    mov [GUIdirStartLoc],edi
    cmp byte[GUIloadfntype],0
    jne near .loadtype0
    mov eax,[GUInumentries]
    mov [GUIdirStartLoc],eax
.loadtype0

    cmp byte[GUIloadfntype],2
    je .win95lfn
    cmp byte[GUIloadfntype],0
    je .normaldir
    call GetLoadDirNormal
    jmp .nowin95
.normaldir
    call GetLoadDirNormal2
    jmp .nowin95
.win95lfn
    call GetLoadDirNormallfn
.nowin95
    cmp dword[GUInumentries],0
    je near .nodirs
    cmp dword[GUIdirentries],0
    je near .nodirs

    ; Sort List
    ; copy from GUIdirStartLoc to spcBuffer+GUIdirentries*32
    ; compares string at esi to edi and returns 1 to al if esi is >, else 0

    push edi
    ; compares string at esi to edi and returns 1 to al if esi is >, else 0
.sortagain
    mov byte[BubbleSorted],0
    mov esi,dword[GUIfileentries]
    shl esi,5
    add esi,[spcBuffera]
    mov edi,[GUIdirStartLoc]
    inc esi
    inc edi

    cmp dword[GUIdirentries],1
    jbe near .nosort
    mov ecx,[GUIdirentries]
    dec ecx
    cmp byte[GUIloadfntype],0
    je near .sort2
.nextentry
    push ecx
    ; check if esi > esi+32
    call GUIStringGreater
    ; if it is, swap!
    cmp al,0
    je near .noswap
    mov ecx,31
.nextswap
    mov al,[esi]
    mov bl,[esi+32]
    mov [esi],bl
    mov [esi+32],al
    inc esi
    dec ecx
    jnz .nextswap
    mov ecx,13
.nextswap2
    mov al,[edi]
    mov bl,[edi+14]
    mov [edi],bl
    mov [edi+14],al
    inc edi
    dec ecx
    jnz .nextswap2
    mov byte[BubbleSorted],1
    sub esi,31
    sub edi,13
.noswap
    add esi,32
    add edi,14
    pop ecx
    dec ecx
    jnz near .nextentry
.nosort
    cmp byte[BubbleSorted],1
    je near .sortagain
    pop edi
    jmp .nodirs
.sort2
    mov esi,dword[GUIfileentries]
    shl esi,2
    add esi,spcRamcmp
.nextentryb
    push ecx
    mov ebx,[esi]
    mov edx,[esi+4]
    inc ebx
    inc edx
    ; check if ebx > edx
    call GUIStringGreater2
    ; if it is, swap!
    cmp al,0
    je near .noswapb
    mov eax,[esi]
    mov ebx,[esi+4]
    mov [esi],ebx
    mov [esi+4],eax
    mov byte[BubbleSorted],1
.noswapb
    add esi,4
    pop ecx
    dec ecx
    jnz near .nextentryb
.nosortb
    cmp byte[BubbleSorted],1
    je near .sortagain
    pop edi
.nodirs
%ifndef __LINUX__
    cmp byte[GUIloadfntype],0
    je near .drive2
    mov esi,[GUInumentries]
    shl esi,5
    add esi,[spcBuffera]
    mov al,65
    mov ecx,[numdrives]
.nextdrive
    GUIPutDrive
    inc al
    dec ecx
    jnz .nextdrive
    jmp .nodrive
.drive2
    mov esi,[GUInumentries]
    shl esi,2
    add esi,spcRamcmp
    mov al,65
    mov ecx,[numdrives]
.nextdriveb
    mov [esi],edi
    GUIPutDrive2
    add esi,4
    inc al
    dec ecx
    jnz .nextdriveb
.nodrive
%endif
    ret

BubbleSorted      db 0
GUIcurrentfilewin dd 0
GUIcurrentviewloc dd 0
GUIcurrentcursloc dd 0
GUIcurrentdirviewloc dd 0
GUIcurrentdircursloc dd 0
GUIdirStartLoc    dd 0
GUInumentries dd 0
GUIdirentries dd 0
GUIfileentries dd 0
%ifdef __LINUX__
NEWSYM GUIsmcfind,    db '*.[sS][mM][cC]',0
NEWSYM GUIsfcfind,    db '*.[sS][fF][cC]',0
NEWSYM GUIswcfind,    db '*.[sS][wW][cC]',0
NEWSYM GUIfigfind,    db '*.[fF][iI][gG]',0
%else
NEWSYM GUIsmcfind,    db '*.SMC',0
NEWSYM GUIsfcfind,    db '*.SFC',0
NEWSYM GUIswcfind,    db '*.SWC',0
NEWSYM GUIfigfind,    db '*.FIG',0
%endif
NEWSYM GUIfind058,    db '*.058',0
NEWSYM GUIfind078,    db '*.078',0
%ifdef __LINUX__
NEWSYM GUIfindUSA,    db '*.[uU][sS][aA]',0
NEWSYM GUIfindJAP,    db '*.[jJ][aA][pP]',0
NEWSYM GUIfindBIN,    db '*.[bB][iI][nN]',0
NEWSYM GUIfindZIP,    db '*.[zZ][iI][pP]',0
NEWSYM GUIfindGZIP,    db '*.[gG][zZ]',0
%else
NEWSYM GUIfindUSA,    db '*.USA',0
NEWSYM GUIfindJAP,    db '*.JAP',0
NEWSYM GUIfindBIN,    db '*.BIN',0
NEWSYM GUIfindZIP,    db '*.ZIP',0
NEWSYM GUIfindGZIP,    db '*.GZ',0
%endif
NEWSYM GUIfind1,      db '*.1',0
%ifdef __LINUX__
GUIfindDIR    db '*',0
NEWSYM GUIfindall,    db '*',0
%else
GUIfindDIR    db '*.*',0
NEWSYM GUIfindall,    db '*.*',0
%endif
NEWSYM DTALoc, times 2048+32 db 0

; Routines to load from the Quick Menu
loadquickfname:
    pushad
.trynext
    cmp byte[GUIwinptr],0
    je near .noclose
    xor eax,eax
    mov al,[GUIwinptr]
    dec eax
    xor ebx,ebx
    mov bl,[GUIwinorder+eax]
    ; close window
    mov byte[GUIwinorder+eax],0
    mov byte[GUIwinactiv+ebx],0
    dec byte[GUIwinptr]
    cmp byte[GUIwinptr],0
    jne .noclose
    mov al,[GUIpmenupos]
    mov [GUIcmenupos],al
    jmp .trynext
.noclose
    popad

    ; move menuitem to top
    cmp ecx,0
    je near .nomove
    cmp byte[prevlfreeze],0
    jne near .nomove

    ; copy 16 bytes of ebx to pressed
    mov eax,[ebx]
    mov [pressed],eax
    mov eax,[ebx+4]
    mov [pressed+4],eax
    mov eax,[ebx+8]
    mov [pressed+8],eax
    mov eax,[ebx+12]
    mov [pressed+12],eax
    ; move each entry above ebx down
.next2
    mov eax,[ebx-16]
    mov [ebx],eax
    mov eax,[ebx+4-16]
    mov [ebx+4],eax
    mov eax,[ebx+8-16]
    mov [ebx+8],eax
    mov eax,[ebx+12-16]
    mov [ebx+12],eax
    sub ebx,16
    cmp ebx,prevloadnames
    jne .next2
    ; copy 16 bytes of pressed to top
    mov eax,[pressed]
    mov [ebx],eax
    mov eax,[pressed+4]
    mov [ebx+4],eax
    mov eax,[pressed+8]
    mov [ebx+8],eax
    mov eax,[pressed+12]
    mov [ebx+12],eax

    ; copy 512 bytes of edi to pressed
    mov ecx,128
    xor ebx,ebx
.loopb
    mov eax,[edi+ebx*4]
    mov [pressed+ebx*4],eax
    inc ebx
    dec ecx
    jnz .loopb
    ; move each entry above ebx down
.next3b
    mov ecx,128
    xor ebx,ebx
.loop2b
    mov eax,[edi-512+ebx*4]
    mov [edi+ebx*4],eax
    inc ebx
    dec ecx
    jnz .loop2b
    sub edi,512
    cmp edi,prevloadfnamel
    jne .next3b
    ; copy 512 bytes of pressed to top
    mov ecx,128
    xor ebx,ebx
.loop3b
    mov eax,[pressed+ebx*4]
    mov [edi+ebx*4],eax
    inc ebx
    dec ecx
    jnz .loop3b

    ; copy 512 bytes of esi to pressed
    mov ecx,128
    xor ebx,ebx
.loop
    mov eax,[esi+ebx*4]
    mov [pressed+ebx*4],eax
    inc ebx
    dec ecx
    jnz .loop
    ; move each entry above ebx down
.next3
    mov ecx,128
    xor ebx,ebx
.loop2
    mov eax,[esi-512+ebx*4]
    mov [esi+ebx*4],eax
    inc ebx
    dec ecx
    jnz .loop2
    sub esi,512
    cmp esi,prevloaddnamel
    jne .next3
    ; copy 512 bytes of pressed to top
    mov ecx,128
    xor ebx,ebx
.loop3
    mov eax,[pressed+ebx*4]
    mov [esi+ebx*4],eax
    inc ebx
    dec ecx
    jnz .loop3

;    pushad
;    mov ax,03h
;    int 10h
;    popad
;    push edi
;    mov edx,esi+1
;    call PrintStr
;    pop edi
;    mov edx,edi+1
;    call PrintStr
;    jmp DosExit

    ; clear pressed
    mov eax,pressed
    mov ecx,128
.loop4
    mov dword[eax],0
    add eax,4
    dec ecx
    jnz .loop4
.nomove
    ; change dir
    mov dl,[esi]
    mov ebx,esi
    inc ebx
    call Change_Dir
    call GetCurDir
    mov eax,edi
    push eax
    mov edx,edi
    call Open_File
    jc near .failed
    mov bx,ax
    mov edx,.temp
    mov ecx,1
    call Read_File
    jc near .failed2
    call Close_File
    jc near .failed
    pop eax
    pushad
    call GUIQuickLoadUpdate
    popad

    call GUIloadfilename
    ret
.failed2
    call Close_File
.failed
    pop eax
    ret
.temp times 256 dd 0

⌨️ 快捷键说明

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