📄 gui.asm
字号:
NEWSYM pl2Rtk, dd 0 ; Turbo R
NEWSYM pl3Ltk, dd 0 ; Turbo L
NEWSYM pl3Rtk, dd 0 ; Turbo R
NEWSYM pl4Ltk, dd 0 ; Turbo L
NEWSYM pl4Rtk, dd 0 ; Turbo R
NEWSYM pl5Ltk, dd 0 ; Turbo L
NEWSYM pl5Rtk, dd 0 ; Turbo R
NEWSYM GUITRAdd, db 0
NEWSYM GUITGAdd, db 10
NEWSYM GUITBAdd, db 31
NEWSYM GUIWRAdd, db 8
NEWSYM GUIWGAdd, db 8
NEWSYM GUIWBAdd, db 25
NEWSYM GrayscaleMode, db 0
NEWSYM MouseWheel, db 1
NEWSYM AlternateTimer, db 0
NEWSYM AllowMultipleInst, db 0
NEWSYM FilteredGUI, db 0
NEWSYM BilinearFilter, db 0
NEWSYM TripleBufferWin, db 0
NEWSYM ExclusiveSound, db 0
NEWSYM DisableScreenSaver, db 0
GUIsave equ $-GUIRAdd
NEWSYM CombinDataGlob, times 3300 db 0 ; 20-name, 42-combo, 2-key#, 1-P#, 1-ff
NEWSYM CombinDataLocl, times 3300 db 0
GUIwinorder db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
GUIwinpos db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
GUIwinactiv db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DialNumber times 40 db 0
ViewBuffer times 50*32 db 0
NEWSYM ModemInitStat, db 0
ModemProcess db 0 ; Shows current dial/answer process
ModemPTimer dd 0 ; Timer for modem process
ModemOKStat db 0 ; OK is detected on modem status
; LOAD STAT INPT OPT VID SND CHT NET GMKEY GUIOP ABT RSET SRC STCN MOVE CMBO ADDO
GUIwinposxo dd 0,5 ,60 ,30 ,55 ,50 ,65 ,5 ,30 ,20 ,10 ,80 ,65 ,20 ,70 ,50 ,3 ,50
GUIwinposyo dd 0,20 ,70 ,30 ,20 ,20 ,20 ,20 ,30 ,20 ,20 ,50 ,60 ,30 ,65 ,50 ,22 ,60
GUIwinsizex dd 0,244 ,126 ,189 ,167 ,170 ,148 ,244 ,8*16,13*16,240 ,7*16,9*16,8*16,9*16,140 ,250 ,160
GUIwinsizey dd 0,190 ,3*16,166 ,190 ,192 ,184 ,191 ,40 ,189 ,192 ,98 ,42 ,40 ,42 ,70 ,190 ,60
GUIwinptr db 0
GUItextcolor db 0,0,0,0,0
GUIcmenupos db 0
GUIescpress db 0
GUIcwinpress db 0
GUIpmenupos db 0
GUIcrowpos dd 0
GUIpclicked db 0
GUImouseposx dd 0
GUImouseposy dd 0
GUICYLocPtr dd 0
GUIMenuL dd 0
GUIMenuR dd 0
GUIMenuD dd 0
GUIOnMenuItm db 0
NEWSYM GUIQuit, db 0
GUIHold db 0
GUIHoldx dd 0
GUIHoldy dd 0
GUIHoldxm dd 0
GUIHoldym dd 0
GUIcolscaleval dd 0
cwindrawn db 0
GUIWincol dd 0
GUIWincoladd dd 0
GUITemp dd 0
GUIHoldXlimL dd 0
GUIHoldXlimR dd 0
GUIHoldYlim dd 0
GUIHoldYlimR dd 0
cloadnpos dd 0
cloadnposb dd 0
cloadmaxlen dd 0
cloadnleft dd 0
cplayernum db 0
vbuflimtop dd 0
vbuflimbot dd 0
GUIScrolTim1 dd 0
GUIScrolTim2 dd 0
GUICHold dd 0
GUICBHold dd 0
GUICBHold2 dd 0
GUIDClickTL dd 0
GUIDClCWin dd 0
GUIDClCEntry dd 0
GUICResetPos dd 0
GUICStatePos dd 0
GUICCFlash db 0
GUILDFlash db 0
GUIPalConv dd 0
PrevResoln dw 0
SnowMover dd 0
keycontrolval dd 0
NEWSYM CheatBDoor, db 0
NEWSYM ShowTimer, db 0
NEWSYM MousePRClick, db 0
NEWSYM MouseDis, db 0
NEWSYM NetPlayNoMore, db 0
RestoreValues db 0
NEWSYM NetChatFirst, db 0
NEWSYM NetServer, db 0
NEWSYM NetQuitAfter, db 0
NEWSYM NetNewNick, times 16 db 0
NEWSYM NetFilename, times 512 db 0
NEWSYM CheatOn, dd 0
NEWSYM NumCheats, dd 0
NEWSYM cheatdataprev, times 28 db 0 ; leave contents blank
NEWSYM cheatdata, times 28*255+56 db 0 ; toggle, value, address, pvalue, name(22)
NEWSYM GUIcurrentdir, times 131 db 0
numdrives dd 26
gotoroot db '\',0
curgsval db 0
SubPalTable times 256 db 1 ; Corresponding Gray Scale Color
WhichRemote dd 0 ; Modem = 1, IPX = 2, TCP/IP = 4
Connected dd 0
IDCheckPos dd 0
NEWSYM pl1neten, db 0
NEWSYM pl2neten, db 0
NEWSYM pl3neten, db 0
NEWSYM pl4neten, db 0
NEWSYM pl5neten, db 0
NEWSYM cnetplaybuf, times 512 db 0
NEWSYM cnetptrhead, dd 0
NEWSYM cnetptrtail, dd 0
NEWSYM prevp1net, dd 0
NEWSYM prevp2net, dd 0
NEWSYM prevp3net, dd 0
NEWSYM prevp4net, dd 0
NEWSYM prevp5net, dd 0
NEWSYM netdelayed, db 0
NEWSYM ChatProgress,dd 0
NEWSYM RecvProgress,dd 0
NEWSYM IPXInfoStr, dw 0
NEWSYM IPXInfoStrR, dw 0
NEWSYM GUICMessage, dd 0
NEWSYM GUICTimer, dd 0
NEWSYM GUIOn, db 0
NEWSYM GUIOn2, db 0
;GOSPort db 0
NEWSYM CurPalSelect, db 0
NEWSYM StartLL, dd 0
NEWSYM StartLR, dd 0
NEWSYM LatencyVal, times 32 db 0
NEWSYM NetLoadState, db 0
NEWSYM TRVal, dw 0
NEWSYM TGVal, dw 0
NEWSYM TBVal, dw 0
NEWSYM TRVali, dw 0
NEWSYM TGVali, dw 0
NEWSYM TBVali, dw 0
NEWSYM TRVal2, dw 0
NEWSYM TGVal2, dw 0
NEWSYM TBVal2, dw 0
;ModemProcess db 0 ; Shows current dial/answer process
;ModemPTimer db 0 ; Timer for modem process
%macro stim 0
; cmp byte[OSPort],1
; ja %%nosti
%ifdef __MSDOS__
sti
%endif
;%%nosti
%endmacro
%macro clim 0
; cmp byte[OSPort],1
; ja %%nocli
%ifdef __MSDOS__
cli
%endif
;%%nocli
%endmacro
clearsram:
push eax
push ecx
mov eax,srama
mov ecx,65536
.loop
mov byte[eax],0FFh
inc eax
loop .loop
cmp byte[SFXSRAM],0
je .nosfxsram
mov eax,[sfxramdata]
mov ecx,65536
.loop2
mov byte[eax],0FFh
inc eax
loop .loop2
.nosfxsram
cmp byte[SA1Enable],1
jne .nosa1
mov eax,[SA1RAMArea]
mov ecx,65536*2
.loop3
mov byte[eax],0FFh
inc eax
loop .loop3
.nosa1
pop ecx
pop eax
ret
GUIQuickLoadUpdate:
cmp byte[prevlfreeze],0
je .off
mov byte[GUIPrevMenuData.onoff+15],'O'
mov byte[GUIPrevMenuData.onoff+16],'N'
mov byte[GUIPrevMenuData.onoff+17],' '
jmp .on
.off
mov byte[GUIPrevMenuData.onoff+15],'O'
mov byte[GUIPrevMenuData.onoff+16],'F'
mov byte[GUIPrevMenuData.onoff+17],'F'
.on
mov esi,prevloadfnamel
; cmp byte[OSPort],2
; jae .notdos
%ifdef __MSDOS__
mov esi,prevloadnames
%endif
;.notdos
mov edi,GUIPrevMenuData+3
mov edx,10
.mainloop
mov ecx,25
; cmp byte[OSPort],2
; jae .notdos3
%ifdef __MSDOS__
mov ecx,16
%endif
;.notdos3
push edi
push esi
cmp byte[esi],32
je near .fin2
.loop
mov al,[esi]
cmp al,0
je .zero
mov [edi],al
inc esi
inc edi
dec ecx
jnz .loop
cmp byte[esi],0
je .zero
mov byte[edi],'.'
mov byte[edi+1],'.'
mov byte[edi+2],'.'
jmp .fin
.zero
add ecx,3
.loop2
mov byte[edi],32
inc edi
dec ecx
jnz .loop2
jmp .fin
.fin2
mov ecx,18
.loop3
mov byte[edi],32
inc edi
dec ecx
jnz .loop3
.fin
pop esi
pop edi
add esi,512 ;16
; cmp byte[OSPort],2
; jae .notdos2
%ifdef __MSDOS__
sub esi,512-16
%endif
;.notdos2
add edi,32
dec edx
jnz near .mainloop
ret
CalcChecksum:
mov eax,GUIRAdd
mov ecx,100
xor edx,edx
xor ebx,ebx
.loop
mov bl,[eax]
add edx,ebx
inc eax
loop .loop
mov ebx,edx
xor bx,1011001011101101b
xor eax,eax
test bh,08h
jz .nb
mov al,1
.nb
and bh,0F7h
test bl,10h
jz .nb2
or bh,08h
.nb2
and bl,0EFh
test al,1
jz .nb3
or bl,10h
.nb3
xor bl,bh
or bl,80h
ret
NEWSYM GUIRestoreVars
mov edx,GUIFName
call Open_File
jc .fail
mov bx,ax
mov edx,GUIRAdd
mov ecx,GUIsave
call Read_File
call Close_File
.fail
mov al,[GUIsmallscreenon]
mov [smallscreenon],al
mov al,[GUIScreenScale]
mov [ScreenScale],al
mov al,[FPSAtStart]
mov [FPSOn],al
call CalcChecksum
cmp byte[TimeChecker],bl
jne .nottimer
mov byte[ShowTimer],1
mov dword[NumSnow],200
mov dword[SnowTimer],0
.nottimer
cmp byte[ReCalib],0
je .nocal
mov byte[ReCalib],0
mov dword[CalibXmin],0
mov dword[CalibXmax],0
mov dword[CalibYmin],0
mov dword[CalibYmax],0
mov dword[CalibXmin209],0
mov dword[CalibXmax209],0
mov dword[CalibYmin209],0
mov dword[CalibYmax209],0
.nocal
mov dword[NumComboGlob],0
mov edx,GUICName
call Open_File
jc .failb
mov bx,ax
mov edx,ComboBlHeader
mov ecx,23
call Read_File
mov al,byte[ComboBlHeader+22]
or al,al
jz .done
mov [NumComboGlob],al
mov ecx,[NumComboGlob]
mov edx,ecx
shl ecx,6
add ecx,edx
add ecx,edx
mov edx,CombinDataGlob
call Read_File
.done
call Close_File
.failb
ret
SECTION .data
NEWSYM ComboHeader, db 'Key Combination File',26,1,0
NEWSYM ComboBlHeader, times 23 db 0
SECTION .text
NEWSYM ExecGUISaveVars
cmp byte[ShowTimer],1
jne .nottimer
call CalcChecksum
mov byte[TimeChecker],bl
.nottimer
cmp byte[cfgdontsave],1
je .failed
mov edx,GUIFName
call Create_File
jc .failed
mov bx,ax
mov edx,GUIRAdd
mov ecx,GUIsave
call Write_File
call Close_File
.failed
mov al,[NumComboGlob]
or al,al
jz .failb
mov [ComboHeader+22],al
mov edx,GUICName
call Create_File
jc .failb
mov bx,ax
mov edx,ComboHeader
mov ecx,23
call Write_File
mov ecx,[NumComboGlob]
mov edx,ecx
shl ecx,6
add ecx,edx
add ecx,edx
mov edx,CombinDataGlob
call Write_File
call Close_File
.failb
ret
%macro GUIInitIRQs 0
call GUIInit
mov esi,pressed
mov ecx,256
mov al,0
.loopa
mov [esi],al
inc esi
loop .loopa
%endmacro
%macro GUIDeInitIRQs 0
call GUIDeInit
%endmacro
SECTION .data
NEWSYM GUIoldhand9o, dd 0
NEWSYM GUIoldhand9s, dw 0
NEWSYM GUIoldhand8o, dd 0
NEWSYM GUIoldhand8s, dw 0
GUIt1cc dd 0
GUIt1ccSwap db 0
GUIskipnextkey42 db 0
SECTION .text
NEWSYM GUIinit18_2hz
mov al,00110110b
out 43H,al
mov ax,0
out 40H,al
mov al,ah
out 40H,al
ret
NEWSYM GUIinit36_4hz
mov al,00110110b
out 43H,al
mov ax,32768
out 40H,al
mov al,ah
out 40H,al
ret
NEWSYM GUI36hzcall
inc dword[GUIt1cc]
inc dword[SnowMover]
cmp dword[ModemPTimer],0
je .nodec5
dec dword[ModemPTimer]
.nodec5
cmp dword[GUIEditStringLTxt],0
je .nodec
dec dword[GUIEditStringLTxt]
.nodec
cmp dword[GUIScrolTim1],0
je .nodec4
dec dword[GUIScrolTim1]
.nodec4
cmp dword[GUIDClickTL],0
je .nodec2
dec dword[GUIDClickTL]
.nodec2
cmp dword[GUIkeydelay],0
je .nodec3
dec dword[GUIkeydelay]
.nodec3
cmp dword[GUIkeydelay2],0
je .nodec3b
dec dword[GUIkeydelay2]
.nodec3b
cmp dword[GUICTimer],0
je .nodec6
dec dword[GUICTimer]
.nodec6
inc byte[GUICCFlash]
and byte[GUICCFlash],0Fh
inc byte[GUILDFlash]
and byte[GUILDFlash],0Fh
inc byte[GUINetTextm2+2]
and byte[GUINetTextm2+2],0Fh
ret
NEWSYM GUIhandler8h
cli
push ds
push eax
mov ax,[cs:dssel]
mov ds,ax
call GUI36hzcall
xor byte[GUIt1ccSwap],1
cmp byte[GUIt1ccSwap],0
je .nocall
pushf
call far [GUIoldhand8o]
.nocall
mov al,20h
out 20h,al
pop eax
pop ds
sti
iretd
NEWSYM GUIhandler9h
cli
push ds
push eax
push ebx
mov ax,[cs:dssel]
mov ds,ax
xor ebx,ebx
in al,60H ; get keyboard scan code
cmp al,42
jne .no42
cmp byte[GUIskipnextkey42],0
je .no42
mov byte[GUIskipnextkey42],0
jmp .skipkeyrel
.no42
cmp al,0E0h
jne .noE0
mov byte[GUIskipnextkey42],1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -