📄 execute.asm
字号:
dec esi
cmp byte[HIRQNextExe],0
je .nohirq
mov dh,[HIRQCycNext]
mov byte[HIRQCycNext],0
jmp .hirq
.nohirq
cmp byte[SA1Enable],0
je near .nosa1b
test byte[exiter],01h
jnz near .nosa1
mov byte[cycpl],150
test byte[SA1Control],60h
jnz near .nosa1
call SA1Swap
cmp byte[CurrentExecSA1],15
ja .nocontinueexec
xor ebx,ebx
mov bl,[esi]
inc esi
jmp execloop.startagain
.nocontinueexec
; check for sa-1 speed hacks
mov byte[SA1SHb],0
cmp word[IRAM+0A0h],80BFh
jne .noshb2
cmp word[IRAM+020h],0
jne .noshb2
mov ecx,[SA1Ptr] ; small speed hack
sub ecx,[romdata]
cmp ecx,83h
jb .skipsh
cmp ecx,97h
ja .skipsh
mov byte[SA1SHb],1
.skipsh
.noshb2
mov ecx,[SA1Ptr] ; small speed hack
cmp dword[ecx],0FCF04BA5h
je .shm
cmp dword[ecx-2],0FCF04BA5h
jne .skipshm
.shm
cmp byte[IRAM+4Bh],0
jne .skipshm
mov byte[SA1SHb],1
.skipshm
cmp dword[ecx],80602EEEh
jne .skipshc
sub ecx,[romdata]
cmp ecx,4E5h
jb .skipshc
cmp ecx,4E8h
ja .skipshc
mov byte[SA1SHb],1
mov ecx,[SA1BWPtr]
add word[ecx+602Eh],4
.skipshc
test word[IRAM+0Ah],8000h
jnz .noshb2b
test word[IRAM+0Eh],8000h
jz .noshb2b
mov ecx,[SA1Ptr] ; small speed hack
sub ecx,[romdata]
cmp ecx,0C93h
jb .skipshb
cmp ecx,0C9Bh
ja .skipshb
mov byte[SA1SHb],1
.skipshb
cmp ecx,0CB8h
jb .skipshb3
cmp ecx,0CC0h
ja .skipshb3
mov byte[SA1SHb],1
.skipshb3
.noshb2b
sub esi,[wramdata]
cmp esi,224h
jb .nosh
cmp esi,22Eh
ja .nosh
mov ecx,[wramdata]
mov dword[SA1LBound],224h
mov dword[SA1UBound],22Eh
add dword[SA1LBound],ecx
add dword[SA1UBound],ecx
mov byte[SA1SH],1
.nosh
cmp esi,1F7C6h
jb .noshb
cmp esi,1F7CCh
ja .noshb
mov ecx,[wramdata]
mov dword[SA1LBound],1F7C6h
mov dword[SA1UBound],1F7CCh
add dword[SA1LBound],ecx
add dword[SA1UBound],ecx
mov byte[SA1SH],1
.noshb
cmp esi,14h
jb .noshc
cmp esi,1Ch
ja .noshc
mov ecx,[wramdata]
cmp dword[ecx+14h],0F023002Ch
jne .noshc
mov dword[SA1LBound],14h
mov dword[SA1UBound],1Ch
add dword[SA1LBound],ecx
add dword[SA1UBound],ecx
mov byte[SA1SH],1
.noshc
add esi,[wramdata]
sub esi,[romdata]
cmp esi,0A56h
jb .noshbc
cmp esi,0A59h
ja .noshbc
mov ecx,[romdata]
mov dword[SA1LBound],0A56h
mov dword[SA1UBound],0A59h
add dword[SA1LBound],ecx
add dword[SA1UBound],ecx
mov byte[SA1SH],1
.noshbc
xor ecx,ecx
add esi,[romdata]
xor dh,dh
mov byte[cycpl],10
cmp byte[CurrentExecSA1],255
jne .notsa1255
mov byte[cycpl],160
.notsa1255
mov byte[CurrentExecSA1],0
test dl,04h
jnz .nosa1
test byte[SA1IRQEnable],80h
jz .nosa1
test byte[SA1DoIRQ],4
jz .nosa1
and byte[SA1DoIRQ],0FBh
mov al,byte[SA1Message+1]
mov byte[SA1Message+3],al
or byte[SA1IRQExec],1
; Start IRQ
add dh,10
jmp .virq
.nosa1
test byte[SA1IRQEnable],20h
jz .nosa1chirq
test byte[SA1DoIRQ],8
jz .nosa1chirq
; jmp .nosa1chirq
and byte[SA1DoIRQ],0F7h
mov al,byte[SA1Message+1]
mov byte[SA1Message+3],al
or byte[SA1IRQExec],2
; Start IRQ
add dh,10
jmp .virq
.nosa1chirq
.nosa1b
FlipCheck
cmp byte[NextLineCache],0
je .nosprcache
call Donextlinecache
.nosprcache
cmp byte[KeyOnStB],0
je .nokeyon
mov al,[KeyOnStB]
call ProcessKeyOn
.nokeyon
mov al,[KeyOnStA]
mov [KeyOnStB],al
mov byte[KeyOnStA],0
test byte[exiter],01h
jnz near exitloop2
test byte[SfxSFR],20h
jnz near StartSFX
.returnfromsfx
; inc dword[numinst] ;Temporary
inc word[curypos]
add dh,[cycpl]
mov ax,[totlines]
cmp word[curypos],ax
ja near .overy
cmp byte[spcon],0
je .nosound
call updatetimer
.nosound
mov ax,[resolutn]
inc ax
cmp [curypos],ax
je near .nmi
mov ax,[resolutn]
cmp [curypos],ax
je near .hdma
; add ax,2
; cmp [curypos],ax
; je near .hdma
.hdmacont
cmp byte[curypos],100
jne .noline100
mov ax,[scrnon]
mov [TempVidInfo],ax
mov ax,[scaddset]
mov [TempVidInfo+2],ax
.noline100
; check for VIRQ/HIRQ/NMI
ProcessIRQStuff
mov ax,[resolutn]
dec ax
cmp [curypos],ax
jb .drawline
; mov ax,[resolutn]
; cmp [curypos],ax
; jb .drawline
C4Paused
xor ebx,ebx
mov bl,[esi]
inc esi
jmp execloop.startagain
.hdma
call exechdma
jmp .hdmacont
.drawline
mov al,[nmiprevline]
cmp [curypos],al
jb near .noskip
cmp byte[nmirept],10
jb near .noskip
; if between correct address, decrease by 2, set nmistatus as 2
; if not, set nmistatus as 1, increase by 2
cmp byte[curexecstate],0
jne .nn
xor dh,dh
.nn
cmp byte[nmistatus],2
jae near .noskip
cmp esi,[nmiprevaddrl]
jb .failcheck2
cmp esi,[nmiprevaddrh]
ja .failcheck2
cmp byte[nmiprevline],20
jb .nodec
sub byte[nmiprevline],10
.nodec
xor eax,eax
mov al,[esi]
cmp byte[disable65816sh],1
je .ohno
cmp byte[SpeedHackSafeTable+eax],1
jne .okay
.ohno
mov byte[nmirept],0
mov dword[nmiprevaddrl],0FFFFFFFFh
mov dword[nmiprevaddrh],0
jmp .noskip
.okay
mov byte[nmistatus],2
and byte[curexecstate],0FEh
.nodis65816
jmp .noskip
.failcheck2
add byte[nmiprevline],1
mov byte[nmistatus],1
.noskip
cmp byte[hdmadelay],0
je .dohdma
dec byte[hdmadelay]
jmp .nodohdma
.dohdma
cmp word[curypos],1
jne .nooffby1line
test byte[INTEnab],20h
jz .nooffby1line
cmp word[VIRQLoc],0
je .nodohdma
.nooffby1line
call exechdma
.nodohdma
cmp word[curypos],1
jne .nocache
call cachevideo
.nocache
cmp byte[curblank],0
jne .nodrawlineb2
call drawline
.nodrawlineb2
cmp byte[curexecstate],2
je near pexecs
cmp byte[curexecstate],0
jne .yesexec
xor dh,dh
.yesexec
C4Paused
xor ebx,ebx
mov bl,[esi]
inc esi
jmp execloop.startagain
.nmi
mov byte[irqon],80h
mov byte[doirqnext],0
inc dword[NetSent]
cmp byte[yesoutofmemory],1
jne .noout
call outofmemfix
.noout
; pushad
; call GenLatencyDisplay
; popad
; NetCommand : bit 0 = Okay (should be 1), bit 1 = control update,
; bit 2 = print update, bit 3 = quit, bit 4 = reset
dec word[curypos]
mov [tempdh],dh
xor dh,dh
mov byte[doirqnext],0
call exechdma
call exechdma
; push es
; cmp byte[cbitmode],1
; jne .nodisptest
; mov es,[vesa2selec]
; mov word[es:10+640],1111111111111111b
;.nodisptest
; pop es
mov byte[NetCommand],0
mov byte[NextNGDisplay],1
cmp byte[newengen],0
je .nonewgfx
cmp byte[curblank],0h
jne .nonewgfx
cmp byte[ForceNewGfxOff],0
jne .nonewgfx
; cmp byte[NextNGDisplay],0
; je .nonewgfx
call StartDrawNewGfx
.nonewgfx
cmp byte[chaton],1
je near .nonet
cmp byte[CNetType],20
je near .net
cmp byte[GUIQuit],1
je near endprog
mov eax,dword[KeyQuickSnapShot]
or eax,eax
jz .nosskey
test byte[pressed+eax],1
jz .nosskey
mov byte[SSKeyPressed],1
mov byte[pressed+eax],2
jmp exitloop
.nosskey
test byte[pressed+1],01h
jnz near exitloop
test byte[pressed+59],01h
jnz near exitloop
cmp byte[nextmenupopup],1
je near exitloop
cmp byte[nextmenupopup],2
jb .skipmenupop
dec byte[nextmenupopup]
.skipmenupop
mov eax,[KeySaveState]
test byte[pressed+eax],01h
jnz near exitloop
mov eax,[KeyLoadState]
test byte[pressed+eax],01h
jnz near exitloop
mov eax,[KeyQuickRst]
test byte[pressed+eax],01h
jnz near exitloop
mov eax,[KeyQuickExit]
test byte[pressed+eax],01h
jnz near exitloop
mov eax,[KeyQuickLoad]
test byte[pressed+eax],01h
jnz near exitloop
cmp byte[ExecExitOkay],0
je .returntoloop
dec byte[ExecExitOkay]
.returntoloop
jmp .nonet
.net
test byte[pressed+1],01h
jz .nonetexit
or byte[NetCommand],08h
.nonetexit
mov eax,[KeySaveState]
test byte[pressed+eax],01h
jz .notnetsave
mov byte[pressed+eax],2
call NetSaveState
.notnetsave
mov eax,[KeyLoadState]
test byte[pressed+eax],01h
jz .notnetload
or byte[NetCommand],88h
.notnetload
.nonet
mov dh,[tempdh]
inc word[curypos]
cmp byte[CurRecv],1
je .noinputread
cmp byte[NoInputRead],1
je .noinputread
call ReadInputDevice
.noinputread
call UpdateRewind
mov byte[NetQuit],0
cmp byte[CNetType],20
jne near .nozerons
test byte[NetSwap],1
jnz near .noonens
cmp byte[CurRecv],1
je near .noreceiveb2
mov eax,[JoyAOrig]
cmp eax,[prevp1net]
je .nochange1
or byte[NetCommand],02h
mov [prevp1net],eax
.nochange1
mov eax,[JoyBOrig]
cmp eax,[prevp2net]
je .nochange2
or byte[NetCommand],02h
mov [prevp2net],eax
.nochange2
mov eax,[JoyCOrig]
cmp eax,[prevp3net]
je .nochange3
or byte[NetCommand],02h
mov [prevp3net],eax
.nochange3
mov eax,[JoyDOrig]
cmp eax,[prevp4net]
je .nochange4
or byte[NetCommand],02h
mov [prevp4net],eax
.nochange4
test byte[NetCommand],02h
jz .nochangeatall
mov dword[ResendTimer],60
jmp .yeschanged
.nochangeatall
dec dword[ResendTimer]
jnz .yeschanged
or byte[NetCommand],02h
mov dword[ResendTimer],60
.yeschanged
; Send command & store command
call PreparePacket
push ebx
push ecx
mov al,[NetCommand]
mov ebx,[cnetptrhead]
mov [cnetplaybuf+ebx],al
call RemoteSendChar
; ##################
; Send latency value
;cmp byte[OSPort],3
;jne .nolatencysend
%ifndef __MSDOS__
cmp byte[BackState],1
jne .nolatencysend
mov ebx,[LatencySendPtr]
and ebx,0FFh
inc dword[LatencySendPtr]
mov byte[LatencyV+ebx],0
mov ebx,[PBackupPos]
mov al,[LocalLValue]
; inc al
call RemoteSendChar
%endif
.nolatencysend
mov ebx,[cnetptrhead]
mov ecx,JoyAOrig
inc ebx
and ebx,1FFh
test byte[NetCommand],02h
jz near .nosendextra
NetHelpExecSend 0
NetHelpExecSend 1
NetHelpExecSend 2
NetHelpExecSend 3
NetHelpExecSend 4
.nosendextra
mov [cnetptrhead],ebx
call SendPacketUDP
cmp byte[chaton],0
jne .nosendchats
cmp byte[chatstrL],0
je .nosendchats
cmp dword[chatTL],0
jne .nosendchats
mov byte[NetCommand],04h
.nosendchats
; send chat string
test byte[NetCommand],04h
jz near .nosendchatsend
call PreparePacket
mov al,04h
call RemoteSendChar
call MoveStringChat
push esi
mov esi,chatstrR
;cmp byte[OSPort],2
;jae .notwin32b
%ifdef __MSDOS__
mov byte[esi],'L'
mov byte[esi+1],'>'
add esi,2
%else
;jmp .skipsendnick
;.notwin32b
cmp dword[chatstrL+1],'/ME '
jne .noaction
mov al,'*'
push ebx
push eax
mov [esi],al
inc esi
call RemoteSendChar
pop eax
pop ebx
.noaction
mov ebx,ChatNick
.nextchatc2
mov al,[ebx]
cmp al,0
je .nonextchat
push ebx
push eax
mov [esi],al
inc esi
call RemoteSendChar
pop eax
pop ebx
inc ebx
cmp byte[ebx-1],0
jne .nextchatc2
.nonextchat
mov al,'>'
cmp dword[chatstrL+1],'/ME '
jne .noaction2
mov al,' '
.noaction2
push ebx
push eax
mov [esi],al
inc esi
call RemoteSendChar
pop eax
pop eb
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -