Skip to content

Commit

Permalink
causeway: cleanup code (open-watcom#1379)
Browse files Browse the repository at this point in the history
use symbolic constant to do code more transparent
  • Loading branch information
jmalak authored Jan 18, 2025
1 parent 98f4dd2 commit b080ad0
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 31 deletions.
10 changes: 5 additions & 5 deletions bld/causeway/asm/api.asm
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ api15_0:
assume ds:nothing
mov ds,cs:apiDSeg
assume ds:_cwMain
cmp ProtectedType,2
cmp ProtectedType,PT_DPMI
assume ds:_apiCode
jnz api15_NoStack0
assume ds:nothing
Expand Down Expand Up @@ -866,7 +866,7 @@ api15_DoneStack0:
assume ds:nothing
mov ds,cs:apiDSeg
assume ds:_cwMain
cmp ProtectedType,2
cmp ProtectedType,PT_DPMI
assume ds:_apiCode
jnz api15_DoneStack1
assume ds:nothing
Expand Down Expand Up @@ -915,7 +915,7 @@ api16_0:
assume ds:nothing
mov ds,cs:apiDSeg
assume ds:_cwMain
cmp ProtectedType,2
cmp ProtectedType,PT_DPMI
assume ds:_apiCode
jnz api16_NoStack1
assume ds:nothing
Expand All @@ -941,7 +941,7 @@ api16_DoneStack2:
assume ds:nothing
mov ds,cs:apiDSeg
assume ds:_cwMain
cmp ProtectedType,2
cmp ProtectedType,PT_DPMI
assume ds:_apiCode
jnz api16_DoneStack3
assume ds:nothing
Expand Down Expand Up @@ -4201,7 +4201,7 @@ COMMENT ! MED 02/15/96
push ds
mov ds,apiDSeg
assume ds:_cwMain
cmp ProtectedType,2
cmp ProtectedType,PT_DPMI
assume ds:_apiCode
pop ds
jz api74_normal
Expand Down
43 changes: 25 additions & 18 deletions bld/causeway/asm/cw32.asm
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,15 @@ VersionMinor db '05'
;
RealPSPSegment dw ? ;Real mode PSP segment.
RealEnvSegment dw ? ;Real mode environment segment.
ProtectedFlags dw 0 ;Bit significant, 0-DPMI,1-VCPI,2-RAW.
ProtectedType dw 0 ;0-RAW,1-VCPI,2-DPMI.
PF_NONE equ 0
PF_DPMI equ 1
PF_VCPI equ 2
PF_RAW equ 4
ProtectedFlags dw PF_NONE ;Bit significant, 0-DPMI,1-VCPI,2-RAW.
PT_RAW equ 0
PT_VCPI equ 1
PT_DPMI equ 2
ProtectedType dw PT_RAW ;0-RAW,1-VCPI,2-DPMI.
ProtectedForce db 0
DOSVersion dw 0
SystemFlags dd 0
Expand Down Expand Up @@ -270,7 +277,7 @@ cwOpen proc near
mov ax,RealPSPSegment
mov es:RealRegsStruc.Real_ES[edi],ax
mov bx,_cwDPMIEMU
cmp ProtectedType,2
cmp ProtectedType,PT_DPMI
jnz cw1_KeepRaw
mov bx,_cwRaw
cw1_KeepRaw:
Expand Down Expand Up @@ -533,7 +540,7 @@ cw2_Use0:
assume es:nothing
;
cw2_noAPI:
cmp ProtectedType,2 ;DPMI?
cmp ProtectedType,PT_DPMI
jz cw2_DPMI

;
Expand Down Expand Up @@ -762,7 +769,7 @@ dpmiSelBuffer db 8 dup (0)
;
apiDataSegi dw 0
IProtectedMode db 0
IProtectedType dw 0
IProtectedType dw PT_RAW
DPMISwitch dw ?,?
dpmiSelBase dd 0
dpmiCodeSel dw ?
Expand Down Expand Up @@ -952,7 +959,7 @@ chk386:
;
call GetProtectedType
mov cs:IErrorNumber,3
cmp ProtectedFlags,0 ;Any types available?
cmp ProtectedFlags,PF_NONE
jz InitError
;
;Get CAUSEWAY environment variable settings.
Expand All @@ -971,7 +978,7 @@ chk386:
;
;now see about type specific initialisations.
;
cmp ProtectedType,2 ;DPMI initialiseation?
cmp ProtectedType,PT_DPMI
jz cw5_InitDPMI
;
;Useing either RAW or VCPI so do the stuff that's common to both for now.
Expand Down Expand Up @@ -1712,7 +1719,7 @@ END COMMENT !
mov ax,_cwMain
mov ds,ax
assume ds:_cwMain
cmp ProtectedType,1 ;VCPI?
cmp ProtectedType,PT_VCPI
assume ds:_cwRaw
pop ds
jz cw5_VCPI
Expand Down Expand Up @@ -3726,7 +3733,7 @@ cw6_Use0:
;
cw6_noAPI:
assume ds:nothing
cmp cs:IProtectedType,2 ;DPMI?
cmp cs:IProtectedType,PT_DPMI
assume ds:_cwInit
jz cw6_DPMI
;
Expand Down Expand Up @@ -4681,13 +4688,13 @@ GetProtectedType proc near
;
call ChkDPMI ;32 bit DPMI server present?
jc cw13_0
or ProtectedFlags,1
or ProtectedFlags,PF_DPMI
cw13_0: call ChkVCPI ;VCPI >= v1.0 present?
jc cw13_1
or ProtectedFlags,2
or ProtectedFlags,PF_VCPI
cw13_1: call ChkRAW ;Running in real mode?
jc cw13_2
or ProtectedFlags,4
or ProtectedFlags,PF_RAW
cw13_2: ret
GetProtectedType endp

Expand All @@ -4696,19 +4703,19 @@ GetProtectedType endp
SetProtectedType proc near
cmp ProtectedForce,0
jz cw14_NoDPMIForce
test BYTE PTR ProtectedFlags,1
test BYTE PTR ProtectedFlags,PF_DPMI
jnz cw14_2
;
cw14_NoDPMIForce:
test BYTE PTR ProtectedFlags,4
test BYTE PTR ProtectedFlags,PF_RAW
jz cw14_1
mov ProtectedType,0 ;Use real mode.
mov ProtectedType,PT_RAW ;Use real mode.
jmp cw14_3
cw14_1: test BYTE PTR ProtectedFlags,2
cw14_1: test BYTE PTR ProtectedFlags,PF_VCPI
jz cw14_2
mov ProtectedType,1 ;Use VCPI.
mov ProtectedType,PT_VCPI ;Use VCPI.
jmp cw14_3
cw14_2: mov ProtectedType,2 ;Use DPMI.
cw14_2: mov ProtectedType,PT_DPMI ;Use DPMI.
cw14_3: push es
mov ax,_cwInit
mov es,ax
Expand Down
16 changes: 8 additions & 8 deletions bld/causeway/asm/raw_vcpi.asm
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ rv1_pl0:
mov ax,MainDS
mov ds,ax
assume ds:_cwMain
cmp ProtectedType,1 ;VCPI?
cmp ProtectedType,PT_VCPI
mov ax,KernalDS
mov ds,ax
assume ds:_cwRaw
Expand Down Expand Up @@ -778,7 +778,7 @@ VCPIRelExtended proc far
mov ax,MainCS
mov ds,ax
assume ds:_cwMain
cmp ProtectedType,1
cmp ProtectedType,PT_VCPI
assume ds:_cwRaw
pop ds
jnz rv12_9
Expand Down Expand Up @@ -1037,7 +1037,7 @@ Int15Rel proc far
mov ax,MainDS
mov ds,ax
assume ds:_cwMain
cmp ProtectedType,1 ;VCPI?
cmp ProtectedType,PT_VCPI
assume ds:_cwRaw
pop ds
jnc rv15_9
Expand Down Expand Up @@ -2477,7 +2477,7 @@ A20Handler proc far
mov ax,MainDS
mov ds,ax
assume ds:_cwMain
cmp ProtectedType,0
cmp ProtectedType,PT_RAW
assume ds:_cwRaw
pop ax
pop ds
Expand Down Expand Up @@ -4512,7 +4512,7 @@ GetVCPIPage proc near
mov ax,MainDS
mov ds,ax
assume ds:_cwMain
cmp ProtectedType,1 ;VCPI?
cmp ProtectedType,PT_VCPI
assume ds:_cwDPMIEMU
jnz rv52_9

Expand Down Expand Up @@ -4578,7 +4578,7 @@ GetVCPIPages proc near
mov ax,MainDS
mov ds,ax
assume ds:_cwMain
cmp ProtectedType,1 ;VCPI?
cmp ProtectedType,PT_VCPI
assume ds:_cwDPMIEMU
jnz rv53_9
;
Expand Down Expand Up @@ -4827,7 +4827,7 @@ GetXMSPages proc near
assume ds:_cwMain

; MED, 11/11/99
; cmp ProtectedType,1 ;VCPI?
; cmp ProtectedType,PT_VCPI
cmp VCPIHasNoMem,0 ; see if VCPI provided no memory, bail if it did

assume ds:_cwRaw
Expand Down Expand Up @@ -5319,7 +5319,7 @@ GetInt15Pages proc near
mov ax,MainDS
mov ds,ax
assume ds:_cwMain
cmp ProtectedType,1 ;VCPI?
cmp ProtectedType,PT_VCPI
assume ds:_cwRaw
pop ds
jnc rv57_9
Expand Down

0 comments on commit b080ad0

Please sign in to comment.