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

📄 guinetpl.inc

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 INC
📖 第 1 页 / 共 3 页
字号:
.nosramremoteb
    cmp al,11
    jne .noload
.startloading
    mov byte[HoldCommand],1
    mov byte[RemoteCommand],1
    mov eax,FileNameMod
    call GUIloadfilename.nocnettype
    mov byte[sramsavedis],1
    call transfersram
    ret
.noload
.skipcommand
    mov al,[RemoteCommand]
    mov [HoldCommand],al
    cmp al,2
    jne near .nosendstcheck
    cmp byte[ChatString],0
    jne .nosendstcheck
    mov byte[RemoteCommand],1
    mov byte[HoldCommand],1
    mov al,1
.nosendstcheck
    cmp al,1
    je near .finsend
    call PreparePacket
    call RemoteSendChar
.nosend
    mov al,[RemoteCommand]
    cmp al,2
    jne near .nosendst

    push eax
    ; Capitalize ChatString
    mov eax,ChatString
.nextletter
    cmp byte[eax],0
    je .doneletter
    cmp byte[eax],'a'
    jb .noletter
    cmp byte[eax],'z'
    jb .noletter
    sub byte[eax],'a'-'A'
.noletter
    inc eax
    jmp .nextletter
.doneletter
    cmp dword[ChatString],'/ME '
    je .action
    cmp dword[ChatString],'/NIC'
    jne .notaction
    cmp word[ChatString+4],'K '
    je near .nickchange
.notaction
    mov eax,.chatinitial
    mov ebx,ChatString
    call ConcatString
    mov eax,ChatNick
    mov ebx,ChatString
    call ConcatString
    jmp .noaction
.action
    mov eax,ChatString
    mov ebx,4
    call ClipString
    mov eax,.actinitial2
    mov ebx,ChatString
    call ConcatString
    mov eax,ChatNick
    mov ebx,ChatString
    call ConcatString
    mov eax,.actinitial
    mov ebx,ChatString
    call ConcatString
    jmp .noaction
.nickchange
    mov eax,ChatString
    mov ebx,6
    call ClipString
    ; Valid String?
    mov eax,ChatString
    xor ebx,ebx
.loopnickcheck
    cmp byte[eax],0
    je .donestcheck
    cmp byte[eax],'-'
    je .okaystring
    cmp byte[eax],'_'
    je .okaystring
    cmp byte[eax],'^'
    je .okaystring
    cmp byte[eax],'='
    je .okaystring
    cmp byte[eax],'+'
    je .okaystring
    cmp byte[eax],'['
    je .okaystring
    cmp byte[eax],']'
    je .okaystring
    cmp byte[eax],'0'
    jb .notokaystring
    cmp byte[eax],'9'
    jbe .okaystring
    cmp byte[eax],'A'
    jb .notokaystring
    cmp byte[eax],'Z'
    jbe .okaystring
    jmp .notokaystring
.okaystring
    inc eax
    inc ebx
    jmp .loopnickcheck
.donestcheck
    cmp ebx,9
    ja .notokaystringb
    mov eax,ChatString
    mov ebx,.tempnick
    call CopyString
    mov eax,.nickchangeb
    mov ebx,ChatString
    call ConcatString
    mov eax,ChatNick
    mov ebx,ChatString
    call ConcatString
    mov eax,.tempnick
    mov ebx,ChatNick
    call CopyString
    jmp .noaction
.notokaystring
    mov esi,.strinvalid
    call WritetochatBuffer
    pop eax
    jmp .finsend
.notokaystringb
    mov esi,.strtoolong
    call WritetochatBuffer
    pop eax
    jmp .finsend
.noaction
    pop eax

    xor ebx,ebx
.next2
    mov al,[ChatString+ebx]
    push ebx
    push eax
    call RemoteSendChar
    pop eax
    pop ebx
    inc ebx
    cmp al,0
    jne .next2
    mov esi,ChatString
    call WritetochatBuffer
    mov dl,13
    call NetAddChar
    mov dl,10
    call NetAddChar
    jmp .finsend2
.nosendst
    cmp al,20
    jne .nolatencych
    mov al,[Latencytochange]
    call RemoteSendChar
    jmp .finsend2
.nolatencych
; FileNameMod times 29 db 0
    cmp al,10
    jne .nosendfn
    xor ebx,ebx
.next3
    mov al,[FileNameMod+ebx]
    push ebx
    push eax
    call RemoteSendChar
    pop eax
    pop ebx
    inc ebx
    cmp al,0
    jne .next3
    jmp .finsend2
.nosendfn
.finsend2
    call SendPacket
.finsend
    mov byte[RemoteCommand],1
    ret

.chatinitial db '>',0
.actinitial db '*',0
.actinitial2 db ' ',0
.loading db 'LOADING ',0
.filenotf db 'FILE NOT FOUND!',13,10,0
.filenotfr db 'FILE NOT FOUND AT REMOTE!',13,10,0
.filenotu db 'UNABLE TO LOAD!',13,10,0
.tempnick times 16 db 0
.strinvalid db '** INVALID NICK **',13,10,0
.strtoolong db '** NICK IS TOO LONG **',13,10,0
.nickchangeb db ' IS NOW KNOWN AS ',0

transfersram:
    cmp byte[SFXSRAM],0
    jne .nosram
    cmp byte[SA1Enable],1
    je .nosram
    cmp dword[ramsize],0
    je .nosram
    cmp byte[UseRemoteSRAMData],1
    je .uselocal
    cmp byte[UseRemoteSRAMData],2
    je near .useremote
.nosram
    call clearsram
    ret

.uselocal
    call PreparePacket
    mov al,233
    call RemoteSendChar
    call SendPacket
.notimer
    pushad
    call JoyRead
    popad
    call RemoteGetChar
    cmp dh,0
    je .notimer
    cmp dl,234
    jne .notimer

    ; send sram
    mov ecx,[ramsize]
    mov ebx,[sram]
    xor esi,esi
.loop
    push ebx
    push ecx
    mov ebx,esi
    and ebx,0FFh
    cmp ebx,0
    jne .notzero
    call PreparePacket
.notzero
    pop ecx
    pop ebx
    mov al,[ebx]
    push ebx
    push ecx
    call RemoteSendChar
    pop ecx
    mov ebx,esi
    and ebx,0FFh
    cmp ebx,0FFh
    jne .notsend
    call SendPacket
.notsend
    pop ebx
    inc esi
    inc ebx
    loop .loop
    mov byte[sramsavedis],0
    ret

.useremote
    call PreparePacket
    mov al,234
    call RemoteSendChar
    call SendPacket
.notimerb
    pushad
    call JoyRead
    popad
    call RemoteGetChar
    cmp dh,0
    je .notimerb
    cmp dl,233
    jne .notimerb

    ; receive sram
    mov ecx,[ramsize]
    mov ebx,[sram]
.loopb
.getnext
    pushad
    call JoyRead
    popad
    call RemoteGetChar
    cmp dh,0
    je .getnext
    mov [ebx],dl
    inc ebx
    loop .loopb
    ret

NEWSYM RemoteSendEAX
;    call RemoteSendChar
    shr eax,8
    call RemoteSendChar
    shr eax,8
    call RemoteSendChar
    shr eax,8
    call RemoteSendChar
    ret

NEWSYM RemoteGetEAX
;.getnext
;    call RemoteGetChar
;    cmp dh,0
;    je .getnext
;    mov bl,dl
    xor ebx,ebx
;    shl ebx,8
.getnext2
    call RemoteGetChar
    cmp dh,0
    je .getnext2
    mov bl,dl
    shl ebx,8
.getnext3
    call RemoteGetChar
    cmp dh,0
    je .getnext3
    mov bl,dl
    shl ebx,8
.getnext4
    call RemoteGetChar
    cmp dh,0
    je .getnext4
    mov bl,dl
    bswap ebx
    mov eax,ebx
    ret


NEWSYM RemoteSendChar
    cmp byte[WhichRemote],1
    jne .nomodem
    call ModemSendChar
.nomodem
    cmp byte[WhichRemote],2
    jne .noipx
    call ipxsendchar
.noipx
    cmp byte[WhichRemote],4
    jne .notcpip
    call TCPIPStoreByte
.notcpip
    ret

NEWSYM RemoteGetChar
    cmp byte[WhichRemote],1
    jne .nomodem
    call ModemGetChar
.nomodem
    cmp byte[WhichRemote],2
    jne .noipx
    call ipxgetchar
.noipx
    cmp byte[WhichRemote],4
    jne .notcpip
    call TCPIPGetByte
.notcpip
    ret

ModemSendStr:
.loop
    mov al,[esi]
    or al,al
    jz .nomore
    call ModemSendChar
    inc esi
    jmp .loop
.nomore
    ret

NetLoadHandle dw 0
NetStateSize dd 0
NetStateTotal dd 0
NetStateQuit db 0
NetStateBuffer times 2048 db 0
Netfname db 'nettemp.zst',0

NetLoadStuff:
    call loadnetopen
    mov byte[NetStateQuit],0
    mov edx,fnamest+1
    call Open_File
    jc .nostate
    mov bx,ax
    mov cx,0
    mov dx,0
    call File_Seek_End
    shl edx,16
    mov dx,ax
    mov [NetStateSize],edx
    mov [NetStateTotal],edx
    call Close_File
    mov byte[CNetType],21
    call PreparePacket
    mov al,14
    call RemoteSendChar
    mov al,[NetStateSize]
    call RemoteSendChar
    mov al,[NetStateSize+1]
    call RemoteSendChar
    mov al,[NetStateSize+2]
    call RemoteSendChar
    call SendPacket
    call ChangetoSRAMdir
    mov edx,fnamest+1
    call Open_File
    mov [NetLoadHandle],ax
    call ChangetoLOADdir
.nostate
    ret

loadstaterecvinit:
    mov byte[NetStateQuit],0
    mov dword[NetStateSize],0
.noreceive
    pushad
    call JoyRead
    popad
    call RemoteGetChar
    cmp dh,0
    je .noreceive
    mov [NetStateSize],dl
.noreceive1
    call RemoteGetChar
    cmp dh,0
    je .noreceive1
    mov [NetStateSize+1],dl
.noreceive2
    call RemoteGetChar
    cmp dh,0
    je .noreceive2
    mov [NetStateSize+2],dl
    call ChangetoSRAMdir
    mov edx,Netfname
    call Create_File
    mov edx,[NetStateSize]
    mov [NetStateTotal],edx
    mov [NetLoadHandle],ax
    call ChangetoLOADdir
    ret

loadstatesend:
    call RemoteGetChar
    cmp dh,0
    je .noreceived
    cmp dl,15
    je .finished
    call ProcessRemoteCommand
.noreceived
    cmp byte[NetStateQuit],0
    je .noquit
.finished
    call PreparePacket
    mov al,15
    call RemoteSendChar
    call SendPacket
    mov byte[CNetType],20
    mov esi,StateLoadedFail
    call ProcessModem.writestr
    mov bx,[NetLoadHandle]
    call Close_File
    cmp byte[NetLoadState],0
    je .norun
    mov byte[GUIQuit],2
.norun
    ret
.noquit
    call PreparePacket
    mov al,1
    call RemoteSendChar
    mov ecx,[NetStateSize]
    cmp ecx,2047
    jbe .notsmaller
    mov ecx,2047
.notsmaller
    sub [NetStateSize],ecx
    mov bx,[NetLoadHandle]
    mov edx,NetStateBuffer
    push ecx
    call Read_File
    pop ecx
    mov edx,NetStateBuffer
.loop
    mov al,[edx]
    push edx
    push ecx
    call RemoteSendChar
    pop ecx
    pop edx
    inc edx
    loop .loop
    call SendPacket
    cmp dword[NetStateSize],0
    jne .notzero
    pushad
    call loadstate2
    mov byte[RestoreValues],0
    mov bx,[NetLoadHandle]
    call Close_File
    mov byte[CNetType],20
    mov esi,StateLoadedOk
    call ProcessModem.writestr
    cmp byte[NetLoadState],0
    je .norun2
    mov byte[GUIQuit],2
.norun2
    popad
.notzero
    ret

loadstaterecv:
    cmp byte[NetStateQuit],0
    je .noquit2
    mov byte[NetStateQuit],0
    call PreparePacket
    mov al,15
    call RemoteSendChar
    call SendPacket
.noquit2
    call RemoteGetChar
    cmp dh,0
    jne .received
    ret
.received
    cmp dl,1
    je .noquit
    mov byte[CNetType],20
    mov esi,StateLoadedFail
    call ProcessModem.writestr
    cmp byte[NetLoadState],0
    je .norun
    mov byte[GUIQuit],2
.norun
    mov bx,[NetLoadHandle]
    call Close_File
    ret
.noquit
    mov ecx,[NetStateSize]
    cmp ecx,2047
    jbe .notsmaller
    mov ecx,2047
.notsmaller
    sub [NetStateSize],ecx
    mov edx,NetStateBuffer
    push ecx
.loop
    push edx
    push ecx
.notrecv
    call RemoteGetChar
    cmp dh,0
    je .notrecv
    mov al,dl
    pop ecx
    pop edx
    mov [edx],al
    inc edx
    loop .loop
    pop ecx
    mov bx,[NetLoadHandle]
    mov edx,NetStateBuffer
    call Write_File
    cmp dword[NetStateSize],0
    jne .notzero
    pushad
    mov bx,[NetLoadHandle]
    call Close_File
    call ChangetoSRAMdir
    mov edx,Netfname
    mov byte[RestoreValues],0
    call loadstate3
    call ChangetoLOADdir
    cmp byte[NetLoadState],0
    je .norun2
    mov byte[GUIQuit],2
.norun2
    mov byte[CNetType],20
    mov esi,StateLoadedOk
    call ProcessModem.writestr
    popad
.notzero
    ret

StateLoadedOk db 10,13,'STATE LOADED.',10,13,10,13,0
StateLoadedFail db 10,13,'LOAD FAILED.',10,13,10,13,0

⌨️ 快捷键说明

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