Replaced most of the OSPort tests with %ifdef

This commit is contained in:
teuf
2001-05-07 00:00:45 +00:00
parent a258375051
commit 28f53de9b6
8 changed files with 168 additions and 118 deletions

View File

@@ -1497,11 +1497,11 @@ NEWSYM InitSPC
mov dword [opcjmptab+03F4h],OpFD
mov dword [opcjmptab+03F8h],OpFE
mov dword [opcjmptab+03FCh],OpFF
cmp byte[soundon],0
; cmp byte[soundon],0
; je near .nosound
cmp byte[OSPort],2
jae near .nosound
; cmp byte[OSPort],2
; jae near .nosound
%ifdef __MSDOS__
mov ax,0100h ; Allocate DOS memory
mov bx,16384/16 ; Allocate 16384 bytes
int 31h
@@ -1537,12 +1537,14 @@ NEWSYM InitSPC
mov eax,0
rep stosd
pop es
%endif
.nosound
pop edx
pop ecx
pop ebx
pop eax
ret
%ifdef __MSDOS__
.error
mov edx,.nohand ;use extended
mov ah,9 ;DOS- API
@@ -1550,10 +1552,12 @@ NEWSYM InitSPC
call DosExit
.nohand db 'Unable to allocate conventional memory!',13,10,'$'
%endif
NEWSYM InitSB
%ifdef __MSDOS__
call initSB
%endif
ret
NEWSYM DeInitSPC

View File

@@ -415,10 +415,12 @@ NEWSYM ProcessRewind
ret
NEWSYM UpdateRewind
cmp byte[OSPort],3
je .yeswin32
ret
.yeswin32
; cmp byte[OSPort],3
; je .yeswin32
; ret
;.yeswin32
%ifndef __MSDOS__
push eax
cmp dword[KeyRewind],0
je .notftimer
@@ -449,6 +451,7 @@ NEWSYM UpdateRewind
.noteq
mov dword[RewindTimer],60*3
pop eax
%endif
ret
NEWSYM BackupSystemVars
@@ -812,17 +815,21 @@ NetSaveState:
%macro stim 0
cmp byte[OSPort],1
ja %%nosti
; cmp byte[OSPort],1
; ja %%nosti
%ifdef __MSDOS__
sti
%%nosti
%endif
;%%nosti
%endmacro
%macro clim 0
cmp byte[OSPort],1
ja %%nocli
; cmp byte[OSPort],1
; ja %%nocli
%ifdef __MSDOS__
cli
%%nocli
%endif
;%%nocli
%endmacro
%macro ProcessIRQStuffB 0
@@ -1050,8 +1057,9 @@ NEWSYM reexecute
jmp reexecuteb2
NEWSYM reexecuteb
cmp byte[OSPort],1
ja reexecuteb2
;cmp byte[OSPort],1
;ja reexecuteb2
%ifdef __MSDOS__
mov esi,pressed
mov ecx,256+128+64
mov al,0
@@ -1062,6 +1070,7 @@ NEWSYM reexecuteb
.notclear
inc esi
loop .loopa
%endif
reexecuteb2:
; temporary sprite displayer
; mov edx,.sdispname
@@ -2787,8 +2796,9 @@ NEWSYM cpuover
call RemoteSendChar
; ##################
; Send latency value
cmp byte[OSPort],3
jne .nolatencysend
;cmp byte[OSPort],3
;jne .nolatencysend
%ifndef __MSDOS__
cmp byte[BackState],1
jne .nolatencysend
mov ebx,[LatencySendPtr]
@@ -2799,6 +2809,7 @@ NEWSYM cpuover
mov al,[LocalLValue]
; inc al
call RemoteSendChar
%endif
.nolatencysend
mov ebx,[cnetptrhead]
mov ecx,JoyAOrig
@@ -2837,13 +2848,15 @@ NEWSYM cpuover
push esi
mov esi,chatstrR
cmp byte[OSPort],2
jae .notwin32b
;cmp byte[OSPort],2
;jae .notwin32b
%ifdef __MSDOS__
mov byte[esi],'L'
mov byte[esi+1],'>'
add esi,2
jmp .skipsendnick
.notwin32b
%else
;jmp .skipsendnick
;.notwin32b
cmp dword[chatstrL+1],'/ME '
jne .noaction
mov al,'*'
@@ -2883,13 +2896,16 @@ NEWSYM cpuover
call RemoteSendChar
pop eax
pop ebx
%endif
.skipsendnick
mov ebx,chatstrL+1
cmp byte[OSPort],2
jb .noaction3
;cmp byte[OSPort],2
;jb .noaction3
%ifndef __MSDOS__
cmp dword[chatstrL+1],'/ME '
jne .noaction3
mov ebx,chatstrL+5
%endif
.noaction3
.nextchatc
mov al,[ebx]
@@ -2937,8 +2953,9 @@ NEWSYM cpuover
push ecx
push ebx
cmp byte[OSPort],3
jne .nobackstate
; cmp byte[OSPort],3
; jne .nobackstate
%ifndef __MSDOS__
cmp byte[BackState],1
jne .nobackstate
call BackupCVFrame
@@ -2947,6 +2964,7 @@ NEWSYM cpuover
inc ebx
and ebx,0Fh
mov [CBackupPos],ebx
%endif
.nobackstate
pop ebx
pop ecx
@@ -3007,8 +3025,9 @@ NEWSYM cpuover
.notor
cmp dh,0
jne .foundchar
cmp byte[OSPort],3
jne .notwin32
;cmp byte[OSPort],3
;jne .notwin32
%ifndef __MSDOS__
push ebx
cmp byte[BackState],1
jne .nobackstate2
@@ -3049,6 +3068,7 @@ NEWSYM cpuover
jb .notwin32
cmp byte[pressed+1],1
je .netquit2
%endif
.notwin32
mov bl,1
jmp .notfoundchar
@@ -3079,8 +3099,9 @@ NEWSYM cpuover
pushad
; Receive latency value
; #####################
cmp byte[OSPort],3
jne near .nolatencyrecv2
;cmp byte[OSPort],3
;jne near .nolatencyrecv2
%ifndef __MSDOS__
cmp byte[BackState],1
jne near .nolatencyrecv2
.tryagainlatency
@@ -3114,6 +3135,7 @@ NEWSYM cpuover
jb .nolatencyrecv2
mov dword[latencytimer],0
inc byte[t1cc]
%endif
.nolatencyrecv2
popad
inc dword[NetSent2]
@@ -3155,8 +3177,9 @@ NEWSYM cpuover
test dl,02h
jz near .nocrupdate2
cmp byte[OSPort],3
jne .notwin32d
; cmp byte[OSPort],3
; jne .notwin32d
%ifndef __MSDOS__
cmp byte[BackState],1
jne .notwin32d
push edx
@@ -3182,6 +3205,7 @@ NEWSYM cpuover
and ebx,0Fh
mov [PBackupPos],ebx
pop edx
%endif
.notwin32d
mov ecx,JoyAOrig
NetHelpExecRecv 0
@@ -3260,12 +3284,14 @@ NEWSYM cpuover
jne .nextchatcr ; *********
pop edx
pushad
cmp byte[OSPort],2
jae .notwin32e
;cmp byte[OSPort],2
;jae .notwin32e
%ifdef __MSDOS__
mov dl,'R'
call NetAddChar
mov dl,'>'
call NetAddChar
%endif
.notwin32e
mov esi,chatstrR
call WritetochatBuffer

View File

@@ -25,7 +25,8 @@ EXTSYM MessageOn,Msgptr,MsgCount,sndrot,GenerateBank0Table,SnowTimer
EXTSYM inittableb,inittablec,FPUCopy,newgfx16b,cfgreinittime,EndMessage
EXTSYM Open_File,Read_File,Write_File,Close_File,Output_Text,Get_Key,CNetType
EXTSYM Delete_File,Get_First_Entry,Get_Next_Entry,Change_Dir,Get_Dir,InitDSP
EXTSYM Remove_Dir,Change_Single_Dir,Create_Dir,Get_Memfree,OSPort,Create_File
EXTSYM Remove_Dir,Change_Single_Dir,Create_Dir,Get_Memfree,Create_File
EXTSYM OSPort
EXTSYM SPCDisable,osm2dis,CurRecv,BackupSystemVars
EXTSYM SnowData,SnowVelDist
EXTSYM cvidmode, newengen, cfgnewgfx, GUI16VID
@@ -4871,8 +4872,9 @@ NEWSYM showinfo
; wait for key
cmp byte[enterpress],0
jne .noesc
cmp byte[OSPort],3
je .noesc
; cmp byte[OSPort],3
; je .noesc
%ifdef __MSDOS__
call Get_Key
cmp al,27
jne .noesc
@@ -4880,6 +4882,7 @@ NEWSYM showinfo
mov ebx,InitDir
call Change_Dir
jmp DosExit
%endif
.noesc
mov edx,.ret
call Output_Text

View File

@@ -69,9 +69,6 @@ EXTSYM RaisePitch,AdjustFrequency
EXTSYM vidbufferofsb,vidbuffer
EXTSYM clearwin
EXTSYM Stop60HZ
EXTSYM dosmakepal
EXTSYM doschangepal
EXTSYM dosinitvideo,dosinitvideo2
EXTSYM initwinvideo
EXTSYM vesa2_rpos
EXTSYM vesa2_gpos
@@ -93,15 +90,12 @@ EXTSYM scanlines,vesa2_bits
EXTSYM vesa2_x,vesa2_y
EXTSYM vesa2selec,InitVesa12,videotroub
EXTSYM genfulladdtab
EXTSYM DosDrawScreen,dosvidpastecopyscr,GUICPC
EXTSYM GUICPC
EXTSYM drawscreenwin
EXTSYM ConvertToAFormat
EXTSYM UnusedBit,HalfTrans,UnusedBitXor,UnusedBit,UnusedBitXor
EXTSYM ngrposng,nggposng,ngbposng,HalfTransB,HalfTransC
EXTSYM DOSClearScreen
EXTSYM DosUpdateDevices
EXTSYM WinUpdateDevices
EXTSYM DOSJoyRead
EXTSYM UpdateVFrame
EXTSYM GetMouseX
EXTSYM GetMouseY
@@ -985,20 +979,8 @@ NEWSYM NumVideoModes, dd 4
NEWSYM GUIVideoModeNames
db '256X224 R WIN ',0 ;2
db '256x224 R FULL',0 ;3
;db '512X448 R WIN ',0 ;4
db '512X448 DR WIN ',0 ;5
db '640x480 DR FULL',0 ;6
;db '640x480 S WIN ',0 ;6
;db '640X480 DS FULL',0 ;8
;db '640X480 S FULL',0 ;9
;db '800x600 S WIN ',0 ;10
;db '800x600 DS WIN ',0 ;11
;db '800x600 S FULL',0 ;12
;db '800x600 DS FULL',0 ;13
;db '1024X768 S WIN ',0 ;14
;db '1024X768 DS WIN ',0 ;15
;db '1024x768 S FULL',0 ;16
;db '1024x768 DS FULL',0 ;17
; Video Mode Feature Availability (1 = Available, 0 = Not Available)

View File

@@ -26,7 +26,7 @@ EXTSYM SBPort,SBInt,SBIrq,SBDMA,SBDMAPage,SBHDMAPage,getenv,vibracard
EXTSYM ram7fa,wramdataa
EXTSYM malloc,free
EXTSYM StateBackup
EXTSYM OSPort
;EXTSYM OSPort
EXTSYM ADSRGAINSwitch,FPUCopy,ScreenScale,SoundQuality
EXTSYM debugger,pl1contrl,pl2contrl,romtype,smallscreence
EXTSYM smallscreenon,spcon
@@ -518,6 +518,7 @@ SECTION .text
; Get Blaster Locates SET BLASTER environment
;*******************************************************
NEWSYM getblaster
%ifndef __LINUX__
mov edx,.string2s
push edx
call getenv
@@ -733,6 +734,7 @@ NEWSYM getblaster
mov edx,.blasterstr2b
call PrintStr
call WaitForKey
%endif
ret
SECTION .data
@@ -807,6 +809,7 @@ SECTION .text
AllocateLDTDescriptor:
%ifndef __LINUX__
;Get ZSNES Base
mov ax,ds
mov bx,ax
@@ -818,10 +821,12 @@ AllocateLDTDescriptor:
ret
.FatalError
; maybe dosexit?
%endif
ret
AllocateBlock:
%ifndef __LINUX__
mov eax,0501h
mov bx,[BlockSize+2]
mov cx,[BlockSize]
@@ -840,6 +845,7 @@ AllocateBlock:
ret
.FatalError
mov ebx,1
%endif
ret
@@ -905,24 +911,28 @@ NEWSYM allocspc7110
ret
outofmemoryb
cmp byte[OSPort],1
ja .notdos
; cmp byte[OSPort],1
; ja .notdos
%ifdef __MSDOS__
mov ax,3
int 10h
.notdos
%endif
;.notdos
jmp outofmemory
NEWSYM allocptr
mov dword[cmemallocptr],memfreearray
cmp byte[OSPort],3
jne near .nostate
; cmp byte[OSPort],3
; jne near .nostate
%ifndef __MSDOS__
AllocmemFail 4096*128*16+4096+65536*16,StateBackup,outofmemory
mov eax,[StateBackup]
add eax,4096*128*16
mov [BitConv32Ptr],eax
.nostate
%endif
;.nostate
; Memory Allocation
AllocmemFail 65536*4+4096,spcBuffera,outofmemory

View File

@@ -16,23 +16,6 @@
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
EXTSYM GUIOn,HalfTrans
EXTSYM ClearScreen
EXTSYM Mode7HiRes,mosenng,mosszng,intrlng,mode7hr ;,VESAAddr
EXTSYM GUICPC, newgfx16b
EXTSYM vesa2_clbitng,vesa2_clbitng2,vesa2_clbitng3
EXTSYM granadd
EXTSYM SpecialLine
EXTSYM vidbufferofsb
;EXTSYM Super2xSaI
EXTSYM HalfTransB,HalfTransC
%include "video/2xsaimmx.inc"
SECTION .text
@@ -60,6 +43,7 @@ NEWSYM ResetTripleBuf
mov byte[CVidStartAd],0
ret
%ifdef __MSDOS__
GUITripleBuffer:
cmp byte[TriplebufTech],0
je near .tech2
@@ -238,6 +222,7 @@ PreTripleBuffer:
.failed
mov byte[Triplebufen],0
ret
%endif
VidModeSize dd 0,0,320*240,320*240*2,640*480,640*480*2,512*384,512*384*2
dd 0,320*480,320*480*2
@@ -252,6 +237,7 @@ NEWSYM LastLineStart, dd 0
NEWSYM FlipWait, db 0
NEWSYM TriplebufTech, db 0
%ifdef __MSDOS__
NEWSYM DosDrawScreen
cmp byte[curblank],40h
je .nocopy
@@ -336,13 +322,13 @@ ScreenShowGUI:
cmp byte[cvidmode],0
je near copymodex
jmp copymodeq
%endif
;*******************************************************
; CopyModeX Copies buffer into unchained 320x240
;*******************************************************
%ifdef __MSDOS__
NEWSYM copymodex
cmp byte[curblank],40h
jne .startcopy
@@ -829,6 +815,7 @@ copyvesa2320x480x8ng:
;*******************************************************
; Copy VESA2 640x480x8b Copies buffer to 640x480x8bVBE2
;*******************************************************
%endif
ALIGN32
NEWSYM EagleHold, dd 0
@@ -839,6 +826,7 @@ vesavaland dd 0,0
mmxvalanda dd 11111111110000001111111111000000b,11111111110000001111111111000000b
mmxvalandb dd 00000000000111110000000000011111b,00000000000111110000000000011111b
%ifdef __MSDOS__
NEWSYM copyvesa2640x480x8bgui
mov byte[CurrentGUIOn],1
cmp byte[smallscreenon],1
@@ -2016,6 +2004,7 @@ NEWSYM palresvalngb, dd 0,0
%macro copyb320x240 0
mov [es:edi+2],dx
%endmacro
%endif
ALIGN32
NEWSYM rescompareng, dd 0
@@ -2026,6 +2015,8 @@ NEWSYM lineleft, dd 0
NEWSYM lineleft2, dd 0
bankpos dd 0
%ifdef __MSDOS__
;*******************************************************
; Copy VESA2 320x480x16b Copies buffer to 320x480x16bVB2
;*******************************************************
@@ -2180,7 +2171,7 @@ NEWSYM copyvesa2320x480x16bgui
jnz .loopabhq
pop es
ret
%endif
NEWSYM ConvertToAFormat
cmp byte[GUIOn],1
@@ -2264,6 +2255,7 @@ NEWSYM UnConvertToAFormat
jnz .crgbloop
ret
%ifdef __MSDOS__
NEWSYM copyvesa2320x480x16b
cmp byte[curblank],40h
jne .startcopy
@@ -5393,12 +5385,12 @@ NEWSYM copyvesa12640x480x16b
jnz near .loopac
pop es
ret
%endif
;*******************************************************
; Clear Screen
;*******************************************************
NEWSYM DOSClearScreen
%ifdef __MSDOS__
cmp byte[cvidmode],1
je near cscopymodeq
cmp byte[cvidmode],2
@@ -5421,6 +5413,7 @@ NEWSYM DOSClearScreen
je near cscopyvesa2320x480x16b
cmp byte[cvidmode],0
je near cscopymodex
%endif
ret
%macro TripleBufferClear 0
@@ -5434,6 +5427,7 @@ NEWSYM DOSClearScreen
%%noclear
%endmacro
%ifdef __MSDOS__
NEWSYM cscopymodeq
push es
mov ax,[selcA000]
@@ -5579,21 +5573,24 @@ NEWSYM cscopyvesa2512x384x16b
jnz .loopb
pop es
ret
%endif
NEWSYM GetScreen
cmp byte[OSPort],1
jbe .getscreen
ret
.getscreen
%ifdef __MSDOS__
; cmp byte[OSPort],1
; jbe .getscreen
; ret
;.getscreen
cmp byte[cvidmode],3
je near getcopyvesa2320x240x16b
cmp byte[cvidmode],5
; je near getcopyvesa2640x480x16b
cmp byte[cvidmode],7
; je near getcopyvesa2512x384x16b
%endif
ret
%ifdef __MSDOS__
NEWSYM getcopyvesa2320x240x16b
push es
mov ax,[vesa2selec]
@@ -5691,13 +5688,4 @@ NEWSYM cscopyvesa12640x480x16b
jnz near .loopa
pop es
ret
NEWSYM Clear2xSaIBuffer
mov ebx,[vidbufferofsb]
add ebx,288*2
mov ecx,144*239
.nextb
mov dword[ebx],0FFFFFFFFh
add ebx,4
loop .nextb
ret
%endif

View File

@@ -53,6 +53,17 @@ EXTSYM ClearScreenSkip,debugdisble,cmovietimeint
EXTSYM ChatNick
EXTSYM StringLength
EXTSYM chatstrLt
EXTSYM GUIOn,HalfTrans
EXTSYM ClearScreen
EXTSYM Mode7HiRes,mosenng,mosszng,intrlng,mode7hr ;,VESAAddr
EXTSYM GUICPC, newgfx16b
EXTSYM vesa2_clbitng,vesa2_clbitng2,vesa2_clbitng3
EXTSYM granadd
EXTSYM SpecialLine
EXTSYM vidbufferofsb
;EXTSYM Super2xSaI
EXTSYM HalfTransB,HalfTransC
NEWSYM ProcVidAsmStart
@@ -82,8 +93,10 @@ NEWSYM TempDebugV, dw 0 ; Temporary Debugging variable
%MACRO CopyFPU 0
%ENDMACRO
%include "video/2xsaimmx.inc"
%include "video/copyvid.inc"
SECTION .text
NEWSYM FPUZero
mov [.Zero],eax
mov [.Zero+4],eax
@@ -1551,7 +1564,9 @@ NEWSYM saveselect
jne .nong16b
cmp byte[cbitmode],0
je .nong16b
%ifdef __MSDOS__
call GetScreen
%endif
.nong16b
cmp dword[MessageOn],0
je .nochangem
@@ -1567,8 +1582,9 @@ NEWSYM saveselect
cmp byte[soundon],0
je .nosound
mov byte[csounddisable],1
cmp byte[OSPort],1
ja .nosound
;cmp byte[OSPort],1
;ja .nosound
%ifdef __MSDOS__
push es
mov es,[sbselec]
mov edi,[sbpmofs]
@@ -1579,6 +1595,7 @@ NEWSYM saveselect
dec ecx
jnz .loopa
pop es
%endif
.nosound
cmp byte[cbitmode],1
je near .16b
@@ -1771,8 +1788,9 @@ NEWSYM saveselect
.esc
mov byte[pressed+1],0
mov byte[pressed+28],0
cmp byte[OSPort],1
jbe .notpr28b
;cmp byte[OSPort],1
;jbe .notpr28b
%ifndef __MSDOS__
cmp byte[pressed+1],1
jne .notpr1b
mov byte[pressed+1],2
@@ -1780,6 +1798,7 @@ NEWSYM saveselect
cmp byte[pressed+28],1
jne .notpr28b
mov byte[pressed+28],2
%endif
.notpr28b
mov word[t1cc],0
mov byte[csounddisable],0
@@ -2086,8 +2105,9 @@ NEWSYM saveselect
mov ebx,[statefileloc]
mov byte[fnamest+ebx],al
.esc16b
cmp byte[OSPort],1
jbe .notprwin
;cmp byte[OSPort],1
;jbe .notprwin
%ifndef __MSDOS__
cmp byte[pressed+1],1
jne .notpr1
mov byte[pressed+1],2
@@ -2097,6 +2117,7 @@ NEWSYM saveselect
mov byte[pressed+28],2
.notpr28
jmp .prwin
%endif
.notprwin
mov byte[pressed+1],0
mov byte[pressed+28],0
@@ -2173,8 +2194,9 @@ NEWSYM testpressed8b
inc bl
mov byte[pressed+77],2
.noright
cmp byte[OSPort],3
jne near .nowin32
;cmp byte[OSPort],3
;jne near .nowin32
%ifndef __MSDOS__
%ifdef __LINUX__
test byte[pressed+05Ch],1
%else
@@ -2205,7 +2227,8 @@ NEWSYM testpressed8b
mov byte[pressed+0CDh],2
%endif
.noright2
.nowin32
;.nowin32
%endif
ret
;*******************************************************
@@ -3301,11 +3324,13 @@ NEWSYM ChatType
pushad
mov dl,'L'
; call NetAddChar
cmp byte[OSPort],2
jb .dos
;cmp byte[OSPort],2
;jb .dos
%ifndef __MSDOS__
cmp dword[chatstrL+1],'/ME '
je .action
.dos
%endif
;.dos
mov esi,ChatNick
call WritetochatBuffer
mov esi,chatstrL
@@ -3508,9 +3533,11 @@ NEWSYM vidpaste
jne .novsync
cmp byte[curblank],0h
jne .novsync
cmp byte[OSPort],1
ja .novsync
; cmp byte[OSPort],1
; ja .novsync
%ifdef __MSDOS__
call waitvsync
%endif
.novsync
cmp byte[cbitmode],1
je .nopal
@@ -3622,6 +3649,17 @@ NEWSYM vidpaste
.SSRedCo dw 0
NEWSYM Clear2xSaIBuffer
mov ebx,[vidbufferofsb]
add ebx,288*2
mov ecx,144*239
.nextb
mov dword[ebx],0FFFFFFFFh
add ebx,4
loop .nextb
ret
NEWSYM lastfps, db 0 ; stores the last fps encountered
NEWSYM lastfps2, db 0 ; stores the last fps encountered
NEWSYM curfps2, db 0 ; current video refresh fps

View File

@@ -94,14 +94,13 @@ EXTSYM res480
EXTSYM AddSub256,InitVesa2,cbitmode,cvidmode
EXTSYM scanlines,vesa2_bits
EXTSYM vesa2_x,vesa2_y
EXTSYM vesa2selec,InitVesa12,videotroub
EXTSYM vesa2selec,videotroub
EXTSYM genfulladdtab
EXTSYM DosDrawScreen,dosvidpastecopyscr,GUICPC
EXTSYM GUICPC
EXTSYM drawscreenwin
EXTSYM ConvertToAFormat
EXTSYM UnusedBit,HalfTrans,UnusedBitXor,UnusedBit,UnusedBitXor
EXTSYM ngrposng,nggposng,ngbposng,HalfTransB,HalfTransC
EXTSYM DOSClearScreen
EXTSYM DosUpdateDevices
EXTSYM WinUpdateDevices
EXTSYM DOSJoyRead