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

📄 guinetpl.inc

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 INC
📖 第 1 页 / 共 3 页
字号:
    jne .invversion
    mov byte[IDCheckPos],9
    ret
.nocheck7
    cmp byte[IDCheckPos],9
    jne .nocheck10
    cmp dl,[soundon]
    jne .invsound
    mov byte[IDCheckPos],7
    ret
.nocheck10
    cmp byte[IDCheckPos],7
    jne .nocheck8
    mov [RemCNetType],dl
    mov byte[IDCheckPos],0
    mov byte[ModemProcess],80
    cmp byte[WhichRemote],4
    jne .nocheck8
    mov byte[ModemProcess],81
.nocheck8
    ret
.invversion
    mov esi,.invver
    call .writestr
    mov byte[IDCheckPos],8
    ret
.invsound
    mov esi,.invsnd
    call .writestr
    mov byte[IDCheckPos],8
    ret
.doneprocess
    ret
.noprocess67
    cmp byte[ModemProcess],81
    je near .nonetpl
    cmp byte[ModemProcess],80
    jne near .noprocess80
    mov dword[pl1neten],0
    mov byte[pl5neten],0
    mov byte[UseRemoteSRAMData],0
    cmp byte[CNetType],10
    jne .noans
    mov byte[pl2neten],2
    mov byte[pl1neten],1
.noans
    cmp byte[RemCNetType],10
    jne .noans2
    mov byte[pl2neten],1
    mov byte[pl1neten],2
.noans2
    cmp byte[CNetType],11
    jne .noans3
    mov byte[pl2neten],1
    mov byte[pl1neten],2
.noans3
    cmp byte[RemCNetType],11
    jne .noans4
    mov byte[pl2neten],2
    mov byte[pl1neten],1
.noans4
    cmp byte[CNetType],15
    jne near .nonetpl
    mov bx,[IPXInfoStr]
    mov ax,[IPXInfoStrR]
.nextpldet
    push eax
    push ebx
    xor ax,bx
    test ax,1
    jz .nochipx
    test bx,1
    jz .pl2
    mov byte[pl2neten],2
    mov byte[pl1neten],1
    jmp .skipipxpl
.pl2
    mov byte[pl2neten],1
    mov byte[pl1neten],2
    jmp .skipipxpl
.nochipx
    pop ebx
    pop eax
    shr eax,1
    shr ebx,1
    jmp .nextpldet
.skipipxpl
    pop ebx
    pop eax
    mov byte[UseRemoteSRAMData],0
.nonetpl
    mov eax,ViewBuffer
    mov ecx,50*32
.cloop2
    mov byte[eax],0
    inc eax
    loop .cloop2
    mov dword[CCursLoc],0
    mov dword[CViewLoc],0
    mov dword[NViewLoc],0
    mov byte[CNetType],20
    mov dword[ChatString],0
    mov byte[RemoteCommand],1
    mov byte[romloadskip],1
    call LoadDetermine
    call PreparePacket
    mov al,1
    call RemoteSendChar
    call SendPacket
.noprocess80
    ret
.writestr
    mov dh,1
.loop
    mov dl,[esi]
    or dl,dl
    jz .nomore
    call NetAddChar
    inc esi
    jmp .loop
.nomore
    ret
.writehex
    mov dx,ax
    shr dx,12
    and edx,0Fh
    mov dl,[.hexval+edx]
    push eax
    call NetAddChar
    pop eax
    mov dx,ax
    shr dx,8
    and edx,0Fh
    mov dl,[.hexval+edx]
    push eax
    call NetAddChar
    pop eax
    mov dx,ax
    shr dx,4
    and edx,0Fh
    mov dl,[.hexval+edx]
    push eax
    call NetAddChar
    pop eax
    mov dx,ax
    and edx,0Fh
    mov dl,[.hexval+edx]
    call NetAddChar
    ret
.hexval db '0123456789ABCDEF'
.unableinit db 'CANNOT INIT DRIVER!',13,10,0
.init db 'ZSNES MODEM TERMINAL',13,10,0
.initb db 13,10,'INITIALIZING MODEM :',13,10,13,10,0
.initc db 'ZSNES IPX TERMINAL',13,10,13,10,0
.uart0 db 'USING 8250 UART',13,10,0
.uart1 db 'USING 16550A UART',13,10,0
.uart2 db 'USING FOSSIL DRIVER',13,10,0
.tout db 'MODEM RESPONSE TIMEOUT',13,10,0
.ata db 'ATA',13,0
.cdet db 'CARRIER DETECTED',13,10,0
.invver db 13,10,'INCOMPATIBLE VERSION!',13,10,0
.rdet db 'WAITING FOR RING...',13,10,0
.invsnd db 'INVALID SOUND SETTING!',13,10,0
.noipx db 13,10,13,10,'UNABLE TO INIT IPX!',13,10,0
.yesipx db 13,10,13,10,'IPX INITIALIZED.',13,10,13,10,'WAITING FOR REMOTE',13,10,0
.localid db 'LOCAL ID  : ',0
.remoteid db 'REMOTE ID : ',0
.connectest db 'CONNECTION ESTABLISHED',13,10,0
.tcpipinit db 'ZSNES NET INTERFACE',13,10,13,10,0
.tcpipserv db 'INIT SERVER ... ',0
.tcpipclie db 'INIT CLIENT ... ',0
InitStr1Done db 0

NEWSYM PreparePacket
    call PreparePacketIPX
    cmp byte[WhichRemote],4
    jne .nottcpip
    call TCPIPPreparePacket
.nottcpip
    ret

NEWSYM SendPacket
    call SendPacketIPX
    cmp byte[WhichRemote],4
    jne .nottcpip
    call TCPIPSendPacket
.nottcpip
    ret

NEWSYM SendPacketUDP
    call SendPacketIPX
    cmp byte[WhichRemote],4
    jne .nottcpip
    call TCPIPSendPacketUDP
.nottcpip
    ret

NEWSYM WritetochatBuffer
    ; 28 characters
    mov dh,1
.loop
    mov dl,[esi]
    or dl,dl
    jz .nomore
    call NetAddChar
    inc esi
    jmp .loop
.nomore
    ret

NEWSYM RemoteCommand, db 0
HoldCommand db 0

RemoteDeInit:
    cmp byte[ModemInitStat],0
    je .nodeinitmodem
    call DeInitModemC
    mov byte[ModemInitStat],0
.nodeinitmodem
    mov byte[CNetType],1
    cmp byte[WhichRemote],2
    jne .noipx
    mov byte[CNetType],0
.noipx
    cmp byte[WhichRemote],4
    jne .notcpip
    cmp byte[TCPIPStatus],0
    je .nottcpipinit
    call TCPIPDisconnect
    mov byte[TCPIPStatus],0
.nottcpipinit
    mov byte[CNetType],4
.notcpip
    ret

Checkfileexist:
    mov edx,FileNameMod
    call Open_File
    jc .failed
    mov bx,ax
    mov ecx,1
    mov edx,.temp
    call Read_File
    jc .failed2
    call Close_File
    jc .failed
    xor eax,eax
    ret
.failed2
    call Close_File
.failed
    mov eax,1
    ret
.temp db 0

ProcessRemoteCommand:
    cmp byte[WhichRemote],1
    jne .notmodem
    push edx
    call ModemCheckDCD
    pop edx
    cmp al,1
    jne near .nomulti
.notmodem
    cmp byte[RemoteDisconnect],1
    je near .nomulti
    call ProcRewind
    ; 1 = Idle, 2 = Chat String, 3..7 = Player Select
    ; 10 = Load Game, 11 = Proceed Load, 12 = Load failed, 13 = File not Found
    ; 20 = Send Controls
    cmp dl,1
    je near .finish
    cmp dl,2
    je near .chatstr
    cmp dl,10
    je near .loadstr
    cmp dl,11
    je near .startloading
    cmp dl,12
    je near .loadfail  ; ***************************
    cmp dl,13
    je near .loadfnf
    cmp dl,14
    je near .loadstate
    cmp dl,15
    je near .skipstate
    cmp dl,20
    je near .latencychange
    cmp dl,30
    je near .quitgui
    cmp dl,40
    je near .guireset
    cmp dl,8
    ja near .nomulti
    cmp [HoldCommand],dl
    je near .forgetcommand
    cmp dl,3
    jne .nopl1
    cmp byte[pl1neten],1
    je .nopl1
    xor byte[pl1neten],2
.nopl1
    cmp dl,4
    jne .nopl2
    cmp byte[pl2neten],1
    je .nopl2
    xor byte[pl2neten],2
.nopl2
    cmp dl,5
    jne .nopl3
    cmp byte[pl3neten],1
    je .nopl3
    xor byte[pl3neten],2
.nopl3
    cmp dl,6
    jne .nopl4
    cmp byte[pl4neten],1
    je .nopl4
    xor byte[pl4neten],2
.nopl4
    cmp dl,7
    jne .nopl5
    cmp byte[pl5neten],1
    je .nopl5
    xor byte[pl5neten],2
.nopl5
    cmp dl,8
    jne .nobackstate
    xor byte[BackState],1
    cmp byte[BackState],0
    jne .notbstate0
    mov byte[Latency],10
    mov byte[Latencytochange],10
.notbstate0
    cmp byte[BackState],1
    jne .notbstate1
    mov byte[Latency],3
    mov byte[Latencytochange],3
.notbstate1
.nobackstate
    jmp .finish
.forgetcommand
    mov byte[HoldCommand],1
    jmp .finish
.nomulti
    cmp dl,50
    jne .nosramnone
    cmp byte[HoldCommand],41
    je .forgetcommand
    cmp byte[HoldCommand],42
    je .forgetcommand
    mov byte[UseRemoteSRAMData],0
    jmp .finish
.nosramnone
    cmp dl,41
    jne .nosramlocal
    cmp byte[HoldCommand],40
    je .forgetcommand
    cmp byte[HoldCommand],41
    je .forgetcommand
    mov byte[UseRemoteSRAMData],2
    jmp .finish
.nosramlocal
    cmp dl,42
    jne .nosramremote
    cmp byte[HoldCommand],40
    je .forgetcommand
    cmp byte[HoldCommand],42
    je .forgetcommand
    mov byte[UseRemoteSRAMData],1
    jmp .finish
.nosramremote
    cmp byte[NetQuitAfter],0
    je .noguiquit
    mov byte[GUIQuit],1
.noguiquit
    ; error
    call RemoteDeInit
    ret
.loadfail
    cmp dword[GUINetTextk2],'127.'
    jne .nonum
    cmp dword[GUINetTextk2+4],'0.0.'
    jne .nonum
    cmp byte[GUINetTextk2+8],'1'
    je near .startloadingb
.nonum
    mov esi,.filenotu
    call ProcessModem.writestr
    jmp .finish
.startloadingb
    mov byte[UseRemoteSRAMData],0
    jmp .startloading
.loadfnf
    mov esi,.filenotfr
    call ProcessModem.writestr
    jmp .finish
.loadstate
    mov byte[CNetType],22
    call loadstaterecvinit
.skipstate
    jmp .finish
.latencychange
    cmp [HoldCommand],dl
    je near .invlatencych
.keepgoinglc
    call RemoteGetChar
    cmp dh,0
    je .keepgoinglc
    mov [Latency],dl
    mov [Latencytochange],dl
    jmp .finish
.quitgui
    mov byte[GUIQuit],2
    jmp .finsend
.guireset
    call GUIDoReset
    jmp .finsend
.invlatencych
    mov al,[Latency]
    mov [Latencytochange],al
    jmp .finsend
.loadstr
    push edx
    mov esi,.loading
    call ProcessModem.writestr
    xor ebx,ebx
.keepgoing2
    push ebx
    call RemoteGetChar
    pop ebx
    cmp dh,0
    je .keepgoing2
    mov [FileNameMod+ebx],dl
    inc ebx
    or dl,dl
    je .doneload
    jmp .keepgoing2
.doneload
    mov esi,FileNameMod
    call ProcessModem.writestr
    mov dl,13
    call NetAddChar
    mov dl,10
    call NetAddChar
    pop edx
    cmp byte[HoldCommand],11
    je .loadfailed
    cmp [HoldCommand],dl
    jne .okayload
    ; ***** - Add comment
;    jmp .okayload               ; ************
.loadfailed
    ; load failed
    mov esi,.filenotu
    call ProcessModem.writestr
    mov byte[RemoteCommand],12
    jmp .finish
.loadfailednf
    ; File Not Found
    mov esi,.filenotf
    call ProcessModem.writestr
    mov byte[RemoteCommand],13
    jmp .finish
.okayload
    call Checkfileexist
    cmp eax,0
    jne .loadfailednf
    mov byte[RemoteCommand],11
.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
    jmp .finish
.chatstr
    ; Keep receiving and printing characters until 0 is found
;    mov dl,'R'
;    call NetAddChar
;    mov dl,'>'
;    call NetAddChar
.keepgoing
    call RemoteGetChar
    cmp dh,0
    je .keepgoing
    or dl,dl
    je .finishst
    call NetAddChar
    jmp .keepgoing
.finishst
    mov dl,13
    call NetAddChar
    mov dl,10
    call NetAddChar
.finish
    mov al,[HoldCommand]
    cmp al,2
    jne .noprintst
    mov dl,'L'
;    call NetAddChar
    mov dl,'>'
;    call NetAddChar
    xor ebx,ebx
.next
    mov dl,[ChatString+ebx]
    cmp dl,0
    je .donenac
    push ebx
;    call NetAddChar
    pop ebx
    inc ebx
    jmp .next
.donenac
    mov dl,13
;    call NetAddChar
    mov dl,10
;    call NetAddChar
    mov dword[ChatString],0
    jmp .skipcommand
.noprintst
    cmp al,20
    jne .nolatencyc
    mov al,[Latencytochange]
    mov [Latency],al
    jmp .skipcommand
.nolatencyc
    cmp al,3
    jne .nopl1b
    cmp byte[pl1neten],2
    je .nopl1b
    xor byte[pl1neten],1
.nopl1b
    cmp al,4
    jne .nopl2b
    cmp byte[pl2neten],2
    je .nopl2b
    xor byte[pl2neten],1
.nopl2b
    cmp al,5
    jne .nopl3b
    cmp byte[pl3neten],2
    je .nopl3b
    xor byte[pl3neten],1
.nopl3b
    cmp al,6
    jne .nopl4b
    cmp byte[pl4neten],2
    je .nopl4b
    xor byte[pl4neten],1
.nopl4b
    cmp al,7
    jne .nopl5b
    cmp byte[pl5neten],2
    je .nopl5b
    xor byte[pl5neten],1
.nopl5b
    cmp al,8
    jne .nobackstateb
    xor byte[BackState],1
    cmp byte[BackState],0
    jne .notbstate0b
    mov byte[Latency],10
    mov byte[Latencytochange],10
.notbstate0b
    cmp byte[BackState],1
    jne .notbstate1b
    mov byte[Latency],3
    mov byte[Latencytochange],3
.notbstate1b
.nobackstateb
    cmp al,50
    jne .nosramnoneb
    mov byte[UseRemoteSRAMData],0
.nosramnoneb
    cmp al,41
    jne .nosramlocalb
    mov byte[UseRemoteSRAMData],1
.nosramlocalb
    cmp al,42
    jne .nosramremoteb
    mov byte[UseRemoteSRAMData],2

⌨️ 快捷键说明

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