📄 winintrf.asm
字号:
mov ax,4202h
int 21h
ret
NEWSYM Get_Time
pushad
call GetTime
mov [TempVarSeek],eax
popad
mov eax,[TempVarSeek]
ret
NEWSYM Get_TimeDate
pushad
call GetDate
mov [TempVarSeek],eax
popad
mov eax,[TempVarSeek]
ret
NEWSYM Get_Date
; dl = day, dh = month, cx = year
mov dx,0
mov cx,0
; mov ah,2Ah
; int 21h
ret
NEWSYM Get_File_Date
mov [ZFFTimeFName],edx
pushad
call ZFileGetFTime
popad
mov edx,[ZFDate]
mov ecx,[ZFTime]
ret
; return packed date in dx:cx
mov ah,57h
mov al,00h
int 21h
ret
RefreshKeybBuffer:
call JoyRead
mov ebx,[HoldKey]
cmp byte[pressed+ebx],0
jne .holding
mov dword[HoldKey],0
.holding
xor eax,eax
xor ebx,ebx
.loop
cmp byte[PKeyBuf+eax],0
jne .not1
cmp byte[pressed+eax],0
je .not1
mov byte[PKeyBuf+eax],1
mov ebx,eax
.not1
cmp byte[pressed+eax],0
jne .not0
mov byte[PKeyBuf+eax],0
.not0
inc eax
cmp eax,100h
jne .loop
or ebx,ebx
jz .notpressed
mov [HoldKey],ebx
mov byte[GUIkeydelay2],14
call .processkey
.notpressed
; Execute the following at 36hz
cmp dword[HoldKey],0
je .noholder
cmp byte[GUIkeydelay2],0
jne .noholder
mov byte[GUIkeydelay2],3
call .processkey
.noholder
ret
.processkey
mov ebx,[HoldKey]
cmp ebx,0A8h
jb .skipdecval
sub ebx,80h
.skipdecval
cmp ebx,58h
jae .none
xor eax,eax
mov al,[Keybtail]
inc al
and al,0Fh
cmp al,[Keybhead]
je .none
mov al,[Keybtail]
mov cl,[KeyConvTable+ebx]
cmp byte[pressed+2Ah],0
jne .shift
cmp byte[pressed+36h],0
je .noshift
.shift
mov cl,[KeyConvTableS+ebx]
.noshift
mov [HoldKeyBuf+eax],cl
inc al
and al,0Fh
mov [Keybtail],al
.none
ret
Keybhead db 0
Keybtail db 0
HoldKey dd 0
HoldKeyBuf times 16 db 0
PKeyBuf times 100h db 0
NEWSYM CurKeyPos, dd 0
NEWSYM CurKeyReadPos, dd 0
NEWSYM KeyBuffer, times 16 dd 0
NEWSYM Check_Key
mov al,[CurKeyPos]
cmp al,[CurKeyReadPos]
jne .yeskey
xor al,al
ret
.yeskey
mov al,0FFh
ret
; returns 0 if there are no keys in the keyboard buffer, 0xFF otherwise
; mov al,byte [keyboardhit]
; push eax
; xor eax,eax
; mov byte [keyboardhit],al
; pop eax
pushad
; call kbhit
call RefreshKeybBuffer
mov byte[wfkey],0
mov al,[Keybhead]
cmp al,[Keybtail]
je .nokeys
mov byte[wfkey],0FFh
.nokeys
popad
mov al,[wfkey]
; mov ah,0Bh
; int 21h
ret
NEWSYM Get_Key
; wait if there are no keys in buffer, then return key in al
; for extended keys, return a 0, then the extended key afterwards
xor eax,eax
.nokey
pushad
call JoyRead
popad
mov al,[CurKeyReadPos]
cmp al,[CurKeyPos]
je .nokey
test word[KeyBuffer+eax*4],100h
jnz .upper
mov al,[KeyBuffer+eax*4]
inc dword[CurKeyReadPos]
and dword[CurKeyReadPos],0Fh
ret
.upper
sub word[KeyBuffer+eax*4],100h
xor al,al
ret
pushad
.nonewkey
call RefreshKeybBuffer
xor eax,eax
mov al,[Keybhead]
cmp al,[Keybtail]
je .nonewkey
mov bl,[HoldKeyBuf+eax]
test bl,80h
jz .notupperkey
xor bl,bl
sub byte[HoldKeyBuf+eax],80h
jmp .yesupperkey
.notupperkey
inc al
and al,0Fh
mov [Keybhead],al
.yesupperkey
; call getch
mov [wfkey],bl
popad
mov al,[wfkey]
;mov ah,7
;int 21h
; return key in al
ret
KeyConvTable
db 255,27 ,'1','2','3','4','5','6' ; 00h
db '7','8','9','0','-','=',8 ,9
db 'Q','W','E','R','T','Y','U','I' ; 10h
db 'O','P','[',']',13 ,255,'A','S'
db 'D','F','G','H','J','K','L',';' ; 20h
db 39 ,'`',255,'\','Z','X','C','V'
db 'B','N','M',',','.','/',255,'*' ; 30h
db 255,32 ,255,255,255,255,255,255
db 255,255,255,255,255,255,255,255 ; 40h
db 200,201,202,203,204,205,206,207
db 208,209,210,211,255,255,255,255 ; 50h
KeyConvTableS
db 255,27 ,'!','@','#','$','%','^' ; 00h
db '&','*','(',')','_','+',8 ,9
db 'Q','W','E','R','T','Y','U','I' ; 10h
db 'O','P','{','}',13 ,255,'A','S'
db 'D','F','G','H','J','K','L',':' ; 20h
db '"','~',255,'|','Z','X','C','V'
db 'B','N','M','<','>','?',255,'*' ; 30h
db 255,32 ,255,255,255,255,255,255
db 255,255,255,255,255,255,255,255 ; 40h
db 200,201,202,203,204,205,206,207
db 208,209,210,211,255,255,255,255 ; 50h
; mov dl,[SRAMDrive]
; mov ebx,SRAMDir
; call Change_Dir
NEWSYM Change_Drive
; change to drive in dl (0 = A, 1 = B, etc.)
and edx,0FFh
add edx,1
push edx
call _chdrive
pop edx
; mov ah,0Eh
; int 21h
ret
NEWSYM Change_Single_Dir
mov [CHPath],edx
pushad
call ZFileCHDir
or eax,eax
jnz .notokay
popad
clc
ret
.notokay
popad
stc
ret
; Dir in edx, return error in carry flag
mov ah,3Bh
int 21h
ret
NEWSYM Create_Dir
; change to dir in edx
mov [MKPath],edx
pushad
call ZFileMKDir
or eax,eax
jnz .notokay
popad
clc
ret
.notokay
popad
stc
ret
mov ah,39h
int 21h
ret
NEWSYM Remove_Dir
; remove dir in edx
mov [RMPath],edx
pushad
call ZFileRMDir
or eax,eax
jnz .notokay
popad
clc
ret
.notokay
popad
stc
ret
mov ah,3Ah
int 21h
ret
; mov dl,[LoadDrive]
; mov ebx,LoadDir
; call Change_Dir
NEWSYM Change_Dir
pushad
and edx,0FFh
add edx,1
push edx
call _chdrive
pop edx
; mov ah,0Eh
; int 21h
; jc .fail
mov dword[CHPath],gotoroot
call ZFileCHDir
or eax,eax
jnz .fail
popad
mov [CHPath],ebx
cmp byte[ebx],0
je .nocdir
pushad
call ZFileCHDir
or eax,eax
jnz .fail
popad
.nocdir
clc
ret
.fail
popad
stc
ret
; dl = drive, ebx = dir
push ebx
mov ah,0Eh
int 21h
mov ah,3Bh
mov edx,gotoroot
int 21h
pop ebx
mov edx,ebx
cmp byte[edx],0
je .nodir
mov ah,3Bh
int 21h
.nodir
ret
; mov ebx,LoadDir
; mov edx,LoadDrive
; call Get_Dir
NEWSYM Get_Dir
mov [DirName],ebx
pushad
call ZFileGetDir
mov eax,[DirName]
mov ebx,eax
mov ecx,125
.loop
mov dl,[eax+3]
cmp dl,'/'
jne .noslash
mov dl,'\'
.noslash
mov [eax],dl
inc eax
loop .loop
popad
push edx
call _getdrive
; mov ah,19h
; int 21h
sub al,1
pop edx
mov [edx],al
ret
push edx
mov ah,47h
mov dl,0
mov esi,ebx
int 21h
mov ah,19h
int 21h
pop edx
mov [edx],al
ret
NEWSYM Get_First_Entry
; cx = attributes, edx = pointer to wildcard
; returns : DTALoc+15h, bit 4 = Dir (1) or File (0)
; DTALoc+1Eh = filename, carry flag set = no more entry
mov [ZFileFindPATH],edx
mov dword[ZFileFindATTRIB],0
mov [ZFileFindATTRIB],cx
mov dword[DTALocPos],DTALoc
pushad
call ZFileFindFirst
or eax,eax
jnz .end
popad
clc
ret
.end
popad
stc
ret
mov ah,4Eh
mov al,0
int 21h
ret
NEWSYM Get_Next_Entry
mov dword[DTALocPos],DTALoc
pushad
call ZFileFindNext
or eax,eax
jnz .end
popad
clc
ret
.end
popad
stc
ret
mov ah,04Fh
int 21h
ret
NEWSYM Set_DTA_Address
; Only needed for dos stuff
; mov edx,DTALoc
; mov ah,1Ah
; int 21h
ret
NEWSYM Get_Memfree
mov eax,02000000h
; mov ax,0500h
; mov edi,edx
; int 31h
ret
NEWSYM Output_Text ; Output character (ah=02h) or string (ah=09h)
pushad
; This function usually displays an error message on-screen
cmp ah,02h
je .char
cmp ah,09h
je .string
ret
.char
push edx
call putchar
pop edx
; int 21h ; print dl
popad
ret
.string
pushad
call PrintStr ; print edx
popad
popad
ret
NEWSYM TempBlah, dd 0
NEWSYM InitPreGame ; Executes before starting/continuing a game
mov byte[pressed+1],2
pushad
call Start60HZ
popad
pushad
call initwinvideo
popad
mov byte[RaisePitch],1
pushad
call AdjustFrequency
popad
pushad
xor eax,eax
mov edi,[vidbufferofsb]
mov ecx,228*120
rep stosd
popad
pushad
call clearwin
popad
ret
; set up interrupt handler
; get old handler pmode mode address
; Process stuff such as sound init, interrupt initialization
ret
NEWSYM SetupPreGame ; Executes after pre-game init, can execute multiple
; times after a single InitPreGame
mov byte[pressed+1],2
ret
NEWSYM DeInitPostGame ; Called after game is ended
pushad
call Stop60HZ
popad
ret
; ****************************
; Video Stuff
; ****************************
; ** Palette Functions **
NEWSYM makepal ; 8-bit palette set
ret
; jmp dosmakepal
NEWSYM changepal ; 8-bit palette set (changes only)
ret
; jmp doschangepal
NEWSYM displayfpspal
ret
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -