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

📄 gui.asm

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 ASM
📖 第 1 页 / 共 5 页
字号:
    je near .mousedone
    mov byte[MouseInitOkay],1
    cmp byte[MouseDis],1
    je .mousedone
    call Init_Mouse
    cmp ax,0
    jne .mousedone
    mov byte[MouseDis],1
.mousedone
    popad

    mov eax,[KeyQuickLoad]
    test byte[pressed+eax],1
    jz near .noquickload
    mov byte[GUIcmenupos],2
    loadmenuopen 1
.noquickload
    mov esi,pressed
    mov ecx,64+32+8
.pclear
    mov dword[esi],0
    add esi,4
    loop .pclear
    mov byte[pressed+1],2
    mov byte[GUIescpress],1

    ; set Video cursor location
    xor eax,eax
    mov al,[cvidmode]
    mov [GUIcurrentvideocursloc],eax
    mov ebx,[NumVideoModes]
    sub ebx,5
    cmp eax,ebx
    jbe .noof
    mov eax,ebx
.noof
    mov [GUIcurrentvideoviewloc],eax

    ; change to sram dir
    mov dl,[SRAMDrive]
    mov ebx,SRAMDir
    call Change_Dir

    call SaveSramData

    cmp byte[SFXSRAM],0
    je .nosfxsram
    clim
    mov edx,fnames+1
    call Create_File
    jc .nosfxramwrite
    mov bx,ax
    mov ecx,65536
    mov edx,[sfxramdata]
    call Write_File
    call Close_File
.nosfxramwrite
    stim
.nosfxsram
    call GUIQuickLoadUpdate
    call LoadDetermine
    ; change dir to LoadDrive/LoadDir
    mov dl,[LoadDrive]
    mov ebx,LoadDir
    call Change_Dir

    cmp byte[NetFilename],0
    je near .nofilenamenet
    cmp byte[NetChatFirst],0
    je near .filenamenetb
    mov ebx,NetFilename
    xor ecx,ecx
.fnetloop
    cmp byte[ebx],'\'
    jne .fnetloopb
    mov ecx,ebx
.fnetloopb
    inc ebx
    cmp byte[ebx],0
    jne .fnetloop
    or ecx,ecx
    jz near .nofilenamenet
    mov byte[ecx],0
    push ecx
    mov dl,[LoadDrive]
    cmp byte[NetFilename+1],':'
    jne .nodrivenetb
    mov dl,[NetFilename]
    sub dl,'A'
.nodrivenetb
    mov ebx,NetFilename
    call Change_Dir
    pop ecx
    mov ebx,NetFilename
    inc ecx
.nextnetl
    mov al,[ecx]
    mov [ebx],al
    inc ecx
    inc ebx
    or al,al
    jnz .nextnetl
    jmp .nofilenamenet
.filenamenetb
    mov dl,[LoadDrive]
    cmp byte[NetFilename+1],':'
    jne .nodrivenet
    mov dl,[NetFilename]
    sub dl,'A'
.nodrivenet
    mov ebx,NetFilename
    call Change_Dir
    mov byte[NetFilename],0
.nofilenamenet
    cmp byte[NetServer],0
    je .noserverclient
    mov byte[CNetType],15
    mov byte[ModemProcess],40
    cmp byte[NetServer],2
    jne .noclient
    mov byte[ModemProcess],41
.noclient
    mov byte[NetServer],0
    mov byte[WhichRemote],4
    mov byte[GUIcmenupos],0
    mov byte[GUIcrowpos],0
    call loadnetopen
.noserverclient
    cmp byte[NetNewNick],0
    je .nonewnick
    mov ebx,NetNewNick
    mov ecx,ChatNick
.nickloop
    mov al,[ebx]
    mov [ecx],al
    inc ebx
    inc ecx
    or al,al
    jnz .nickloop
    mov byte[NetNewNick],0
.nonewnick

;NEWSYM NetChatFirst, db 0
;NEWSYM NetServer, db 0
;NEWSYM NetQuitAfter, db 0
;NEWSYM NetNewNick, times 16 db 0
;NEWSYM NetFilename, times 512 db 0

    cmp byte[CNetType],20
    je near .noautostate
    cmp byte[AutoState],0
    je .noautostate
    cmp byte[romloadskip],0
    jne .noautostate
    call SaveSecondState
.noautostate

    GUIInitIRQs

    cmp byte[CNetType],20
    jne near .nostat20
    test byte[NetQuit],80h
    jnz near .nostat20
    mov byte[GUIcmenupos],0
    mov byte[GUIcrowpos],0
    call loadnetopen
    cmp byte[WhichRemote],1
    jne .yesdcd
    call ModemCheckDCD
    cmp al,1
    jne near .nostat20
.yesdcd

    mov byte[RestoreValues],1
    pushad
    mov dword[CBackupPos],0
    call BackupCVFrame
    popad

    call DisableSUDPPacket
    call Wait1SecWin
    ; sync
    call PreparePacket
    mov al,254
    call RemoteSendChar
    call SendPacket
    call PreparePacket
    mov al,254
    call RemoteSendChar
    call SendPacket
    call PreparePacket
    mov al,254
    call RemoteSendChar
    call SendPacket
    call PreparePacket
    mov al,254
    call RemoteSendChar
    call SendPacket
    mov dword[ModemPTimer],4*32
.nochar
    pushad
    call JoyRead
    popad
    call RemoteGetChar
    cmp dword[ModemPTimer],0
    je near .nostat20
    cmp dh,0
    je .nochar
    cmp dl,254
    jne .nochar
    call PreparePacket
    mov al,253
    call RemoteSendChar
    call SendPacket
.nocharc
    pushad
    call JoyRead
    popad
    call RemoteGetChar
    cmp dword[ModemPTimer],0
    je near .nostat20
    cmp dh,0
    je .nocharc
    cmp dl,253
    jne .nocharc
    call PreparePacket
    mov al,1
    call RemoteSendChar
    call SendPacket
    call ClearUDPStuff

    mov byte[RemoteCommand],1
    mov byte[HoldCommand],1
    cmp byte[NetLoadState],1
    jne .notreceive
    mov byte[CNetType],22
.noreceivestate
    pushad
    call JoyRead
    popad
    call RemoteGetChar
    cmp dh,0
    je .noreceivestate
    cmp dl,14
    jne .noreceivestate
    call loadstaterecvinit
.notreceive
    cmp byte[NetLoadState],2
    jne .notsend
    call NetLoadStuff
.notsend
.nostat20

    cmp byte[GUIwinptr],0
    jne .nomenuopen
    cmp byte[lastcursres],1
    je .nomenuchange
    mov byte[GUIcmenupos],2
    mov byte[GUIcrowpos],0
    mov dword[GUICYLocPtr],MenuDat2
    cmp byte[lastcursres],0
    je .nomenuchange
.nomenuopen
    mov byte[GUIcmenupos],0
.nomenuchange
    cmp byte[GUIwinactiv+1],0
    je .noloadrefresh
    call GetLoadData
.noloadrefresh
    mov byte[GUIHold],0
    ; clear 256 bytes from hirestiledat
    mov esi,hirestiledat
    mov ecx,256
.loophires
    mov byte[esi],0
    inc esi
    dec ecx
    jnz .loophires
    mov byte[curblank],00h
    call InitGUI

    cmp byte[CheatWinMode],0
    je near .csskip
    ; change to sram dir
    mov dl,[SRAMDrive]
    mov ebx,SRAMDir
    call Change_Dir

    ; Load Cheat Search File
    mov edx,cstempfname
    call Open_File
    jc .csskipb
    mov bx,ax
    mov edx,[vidbuffer]
    add edx,129600
    mov ecx,65536*2+32768
    call Read_File
    call Close_File

.csskipb
    ; change dir to LoadDrive/LoadDir
    mov dl,[LoadDrive]
    mov ebx,LoadDir
    call Change_Dir
.csskip

    mov byte[GUIQuit],0
.nokey
    cmp byte[CNetType],21
    je .noquit
    cmp byte[CNetType],22
    jne .yesquit
.noquit
    mov byte[GUIQuit],0
.yesquit
    cmp byte[GUIQuit],2
    je near .exit
    cmp byte[GUIQuit],1
    je near .exitgui
    mov byte[GUIQuit],0
    cmp byte[MouseDis],1
    je .mousedis2
    call ProcessMouse
    cmp byte[videotroub],1
    jne .notrouble
    ret
.notrouble
.mousedis2
    call GUIUnBuffer
    cmp byte[CNetType],20
    je .nowater
    cmp byte[CNetType],21
    je .nowater
    cmp byte[CNetType],22
    je .nowater
    cmp byte[GUIEffect],1
    jne .nosnow
    call DrawSnow
.nosnow
    cmp byte[GUIEffect],2
    jne .nowater
    call DrawWater
.nowater
;    call TestSent
    cmp byte[CNetType],20
    jne .noreceive

    cmp byte[NetChatFirst],0
    je .noloadbeforechat
    mov eax,NetFilename
    call GUIloadfilename.nocnettype
    mov byte[sramsavedis],1
    call transfersram
    mov byte[NetChatFirst],0
.noloadbeforechat

    cmp byte[GUIcmenupos],0
    jne .nomenuout2
    cmp byte[GUIwinptr],0
    jne .nomenuout2
    cmp byte[netlastloaded],1
    je .openmenu
    mov byte[GUIcmenupos],2
    mov byte[GUIcrowpos],0
    jmp .nomenuout2
.openmenu
    mov byte[netlastloaded],0
    call loadnetopen
.nomenuout2
    call RemoteGetChar
    cmp dh,0
    jne .received
    mov dl,1
.received
    call ProcessRemoteCommand
    jmp .noreceive2
.noreceive
    mov byte[HoldCommand],0
.noreceive2

    cmp byte[CNetType],21
    jne .noloadstatesend
    call loadstatesend
.noloadstatesend
    cmp byte[CNetType],22
    jne .noloadstaterecv
    call loadstaterecv
.noloadstaterecv

    cmp byte[CNetType],15
    je .modem
    cmp byte[CNetType],12
    je .modem
    cmp byte[CNetType],11
    je .modem
    cmp byte[CNetType],10
    jne near .nomodem
.modem
    call ProcessModem
    cmp byte[Connected],1
    je near .nomodem
    call ModemGetChar
    cmp dh,0
    je .nomodem
    cmp byte[ModemOKStat],0
    jne .foundokay
    mov byte[ModemOKStat],1
    jmp .skipstat
.foundokay
    cmp byte[ModemOKStat],1
    jne .nostat0
    cmp dl,13
    jne .nostat0
    inc byte[ModemOKStat]
    jmp .skipstat
.nostat0
    cmp byte[ModemOKStat],2
    jne .nostat1
    cmp dl,'O'
    jne .nostat1
    inc byte[ModemOKStat]
    jmp .skipstat
.nostat1
    cmp byte[ModemOKStat],3
    jne .nostat2
    cmp dl,'K'
    jne .nostat2
    inc byte[ModemOKStat]
    jmp .skipstat
.nostat2
.skipstat
    mov dh,0
    call NetAddChar
.nomodem

    cmp dword[GUIEditStringcWin],0
    je .noblink
    cmp dword[GUIEditStringcLen],0
    je .noblink
    mov eax,[GUIEditStringcLen]
    cmp dword[GUIEditStringLTxt],8
    jb .noblinka
    mov byte[eax],'_'
    mov byte[eax+1],0
    mov dword[GUIEditStringLstb],1
.noblinka
    cmp dword[GUIEditStringLTxt],0
    jne .noblink
    mov dword[GUIEditStringLTxt],16
.noblink

    call DisplayBoxes

    cmp dword[GUIEditStringLstb],1
    jne .notblinked
    mov dword[GUIEditStringLstb],0
    mov eax,[GUIEditStringcLen]
    mov byte[eax],0
.notblinked

    call DisplayMenu
    cmp byte[MouseDis],1
    je .mousedis3
    call DrawMouse
.mousedis3
    cmp byte[FirstTimeData],0
    jne .nofirsttime
    call guifirsttimemsg
    mov byte[FirstTimeData],1
.nofirsttime
    cmp dword[GUICTimer],0
    je .notimer
    GUIOuttext 21,211,[GUICMessage],50
    GUIOuttext 20,210,[GUICMessage],63
.notimer
    call vidpastecopyscr
    call GUIgetcurrentinput
    jmp .nokey

.exitgui
    cmp byte[CNetType],20
    jne near .nostat20b2
    call PreparePacket
    mov al,255
    call RemoteSendChar
    call SendPacket
    call PreparePacket
    mov al,255
    call RemoteSendChar
    call SendPacket
    call PreparePacket
    mov al,255
    call RemoteSendChar
    call SendPacket
.nostat20b2

    GUIDeInitIRQs

    mov ax,[PrevResoln]
    mov [resolutn],ax
    jmp endprog
.exit
    mov edi,[spcBuffera]
    mov ecx,65536
    xor eax,eax
    rep stosd
    mov edi,spcRamcmp
    mov ecx,65536/4
    xor eax,eax
    rep stosd
    GUIDeInitIRQs
    call ClearScreen
    cmp byte[cbitmode],0
    jne .nomakepal
    call makepal
.nomakepal
    mov word[t1cc],1

    mov byte[chaton],0
    mov dword[chatstrL],0
    mov dword[chatLpos],0
    mov dword[chatstrR],0
    mov dword[chatRTL],0

    cmp byte[CNetType],20
    jne near .nostat20b

    mov al,10
    sub al,[Latency]
    cmp byte[Latency],4
    jb .nolatency
    mov al,7
.nolatency
    mov [BackStateSize],al

    call ResetExecStuff

    mov byte[MultiTap],1
    cmp byte[pl3neten],0
    jne .mtap
    cmp byte[pl4neten],0
    jne .mtap
    cmp byte[pl5neten],0
    jne .mtap
.nomtap
    mov byte[MultiTap],0
.mtap

    cmp byte[RestoreValues],1
    jne .norestoreval
    pushad
    mov dword[PBackupPos],0
    call RestoreCVFrame
    popad
.norestoreval

    mov dword[nmiprevaddrl],0
    mov dword[nmiprevaddrh],0
    mov dword[nmirept],0
    mov dword[nmiprevline],224
    mov dword[nmistatus],0
    mov byte[spcnumread],0

⌨️ 快捷键说明

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