cmacros.inc

来自「用于查询PC机上的USB端口是否有设备挂接上」· INC 代码 · 共 1,635 行 · 第 1/2 页

INC
1,635
字号
defD <n>
endm
else
defDP macro n
defW <n>
endm
endif
endif
?ad macro n,s
irp x,<n>
.xcref
.xcref ??CM_Paste(?t_,x)
.cref
??CM_Paste(?t_,x)=s
endm
endm
ifndef ?NOPTR
.xcref
.xcref regPtr,farPtr
.cref
regPtr macro n,s,o
farPtr n,s,o
endm
farPtr macro n,s,o
.xcref
.xcref ?t_&n
.cref
n macro
if ?pgen32
irp sn,<cs,ds,es,fs,gs,ss>
ifidni <s>,<sn>
        db 66h
endif
endm
endif
	push	s
if ?pgen32
irp sn,<cs,ds,es,fs,gs,ss>
ifidni <o>,<sn>
        db 66h
endif
endm
endif
	push	o
endm
?t_&n=80h
endm
endif
arg macro a
irp x,<a>
?argc=?argc+1
?atal <x>,%?argc
endm
endm
?atal macro n,i
.xcref
.xcref ?ali&i
.cref
?ali&i macro
?ap <n>
endm
endm
?ap macro n
?argl=?argl+2
ifdef ?t_&n
ife ?t_&n-1
	push	word ptr (n)
exitm
endif
ife ?t_&n-2
	push	n
exitm
endif
ife ?t_&n-4
if @Cpu AND 1000b
	pushd	n
else
	push	word ptr (n)[2]
	push	word ptr (n)
endif
?argl=?argl+2
exitm
endif
ife ?t_&n-8
	push	word ptr (n)[6]
	push	word ptr (n)[4]
	push	word ptr (n)[2]
	push	word ptr (n)
?argl=?argl+6
exitm
endif
if ?t_&n and 80h
n
?argl=?argl+2
exitm
endif
ife ?t_&n
	push	word ptr (n)
exitm
endif
endif
if ((OPATTR n) AND 00000100b)
if (?pconst32 OR (?pgen32 EQ 0))
        push    n
else
        push    word ptr (n)
endif
else
if ?pgen32
irp s,<cs,ds,es,fs,gs,ss>
ifidni <n>,<s>
        db 66h
endif
endm
endif
	push	n
endif
endm
cCallN32 macro n,a,c
?pconst32=1
cCall <NEAR16 PTR (n)>,<a>,c
?pconst32=0
        endm
cCallF32 macro n,a,c
?pconst32=1
?pgen66=1
cCall (n),<a>,c
?pgen66=0
?pconst32=0
        endm
cCall macro n,a,c
ifnb <a>
arg <a>
endif
mpush %?rsl
ifdef ?CC&n
?cCall1=?CC&n
else
?cCall1=?PLM
endif
ifnb <c>
?gcc ?cCall1,%?cCall1,<c>
endif
?argl=0
ife ?cCall1
?acb=?argc
else
?acb=1
endif
rept ?argc
uconcat <?ali>,%?acb
uconcat <purge>,,<?ali>,%?acb
ife ?cCall1
?acb=?acb-1
else
?acb=?acb+1
endif
endm
if ?pgen66
db 66h,9Ah
dw OFFSET (n), SEG (n)
else
        call    n
endif
if ((?cCall1 eq 0) and (?argl ne 0))
	add	sp,?argl
endif
mpop %?rsl
?rsl=0
?argc= 0
?argl= 0
endm
cProc macro n,cf,a
if ?cpd
?utpe
endif
?cpd=1
???=0
?argc=0
?ba=0
?po=0
?pu=0
?ia=0
?adj=4
?rp=0
?uf=0
?wfp=?WIN
?ff=0
?pas=0
?pcc=?PLM
?lds=0
?exp=0
?entser=0
?extser=0
ifnb <a>
?ri ?pas,<a>
endif
?pc=sizec
?nd=?nodata1
?nx=0
irp x,<cf>
ifidn <x>,<FAR>
?pc=1
endif
ifidn <x>,<NEAR>
?pc=0
endif
ifidn <x>,<PUBLIC>
?pu=1
endif
ifidn <x>,<SMALL>
?uf=1
endif
ifidn <x>,<DATA>
?nd=0
endif
ifidn <x>,<NODATA>
?nd=1
endif
ifidn <x>,<ATOMIC>
?nx=1
endif
ifidn <x>,<C>
?pcc=0
endif
ifidn <x>,<PLM>
?pcc=1
endif
ifidn <x>,<PASCAL>
?pcc=1
endif
ifidn <x>,<WIN>
?wfp=1
endif
ifidn <x>,<NONWIN>
?wfp=0
endif
ifidn <x>,<LOADDS>
?lds=1
endif
ifidn <x>,<EXPORTED>
?exp=1
endif
ifidn <x>,<SERIAL>
?entser=1
?extser=1
endif
endm
if ?pcc
?PLMPrevParm=0
.xcref
.xcref ?PLMParm0
.cref
?PLMParm0 macro arg
purge ?PLMParm0
endm
endif
.xcref
.xcref ?CC&n
.cref
?CC&n=?pcc
if (?nx eq 1) and (?nd eq 0)
?nx = 0
??error <ATOMIC specified without NODATA - ATOMIC ignored>
endif
if ?pc
if ?wfp+?exp+?lds 
ife ?nx
ife ?pmd 	  
?ia=2		  
endif
?pas = ?pas and (not ?ds)
endif
endif
?adj=?adj+2
else
?wfp=0
if ?pgen32
?adj = ?adj+2
endif
endif
ife ?386regs
?pas = ?pas and (not (?sp+?cs+?ss))
endif
if ?uf
if ?386regs
?pas = ?pas and (not (?si+?di))
else
?pas = ?pas and (not (?bp+?si+?di))
endif
endif
ife ?pcc
?pg <_&n>,%?pu,%?pc,%?pas,%?wfp,<n>,%?pcc
else
?pg <n>,%?pu,%?pc,%?pas,%?wfp,<n>,%?pcc
endif
endm
?pg macro n,p,c,a,w,nnu,cc
.xcref
if ?uf
if ?nd
??error <NODATA encountered in &n - user frame ignored>
?uf=0
endif
endif
.xcref cBegin
cBegin macro g
.xcref
if cc
uconcat <?PLMParm>,%?PLMPrevParm,%?po
endif
if ?uf
if ?rp
??error <parmR encountered in &n - user frame ignored>
?uf=0
endif
endif
?pg1 <n>,c,a,%?po,w,%?uf,%?nd,%?rp,cc
?cpd=0
?argc=0
?ba=1
???=(???+1) and 0fffeh
if p
public n
endif
ife c
n proc near
else
n proc far
endif
ife cc
nnu equ n
endif
ifidn <g>,<nogen>
if ???+?po+a+?rp
??_out <cBegin - possible invalid use of nogen>
endif
else
if ?uf
?mf c,%???,%?po
mpush a
else
if w+?exp+?lds	
if ?pmd		
ife ?nd		
if ?lds		
mov ax,_DATA	
else		
if ?exp
mov ax,ds 	
nop		
endif
endif
endif
ife ?nx		
if ???+?po	
  if ?chkstk1 	
    push bp
    ife ?pgen32
      movzx ebp,sp
    else
      mov  bp,sp
    endif
  else
    if ???		
      if ?pgen32
        push bp
        movzx ebp,sp
        sub sp,???
      else
        enter ???,0
      endif
    else
      push bp
      if ?pgen32
        movzx ebp,sp
      else
        mov bp,sp	
      endif
    endif
  endif
endif

push ds		

if ?lds+?exp 	
 mov ds,ax	
endif
else		
if ?ff+???+?po+?rp
push bp
if ?pgen32
movzx ebp,sp
else
mov bp,sp	  
endif
endif
endif
else 
ife ?nd
	mov	ax,ds
	nop
endif
ife ?nx
ife ?DOS5
	inc	bp
endif
	push	bp
if ?pgen32
        movzx   ebp,sp
else
	mov	bp,sp
endif
	push	ds
else
if ?ff+???+?po+?rp
	push	bp
if ?pgen32
        movzx   ebp,sp
else
	mov	bp,sp
endif
endif
endif
ife ?nd
	mov	ds,ax
endif
endif
else
if ?pmd		     
if ?exp
mov ax,ds	     
nop 		     
else
if ?lds		     
mov ax,_DATA
endif
endif
if ?ff+???+?po+?rp   
if ?chkstk1	     
push bp
if ?pgen32
movzx ebp,sp
else
mov  bp,sp
endif
else
if ???
    if ?pgen32
      push bp
      movzx ebp,sp
      sub sp,???
    else
      enter ???,0
    endif
else
push bp
if ?pgen32
movzx ebp,sp
else
mov bp,sp 	     
endif
endif
endif
endif
if ?exp+?lds	     
push ds		     
mov ds,ax	     
endif
else 
if ?ff+???+?po+?rp
	push	bp
if ?pgen32
        movzx   ebp,sp
else
	mov	bp,sp
endif
endif
endif
endif
if ?rp
?uf=0
rept ?rp
uconcat mpush,,?rp,%?uf
?uf=?uf+1
endm
endif
if ???
if ?chkstk1
ifdef ?CHKSTKPROC
?CHKSTKPROC %???
else
	mov	ax,???
ife cc
	call	_chkstk
else
	call	chkstk
endif
endif
else
	ife ?pmd  
	sub sp,???
	endif
endif
endif
mpush a
endif
if ?entser
EnterSerialize
?entser=0
endif
ifdef ?PROFILE
if c
	call	StartNMeas
endif
endif
endif
.cref
purge cBegin
endm
.xcref ?utpe
?utpe macro
??error <unterminated procedure definition: "&n">
endm
.cref
endm
?pg1 macro n,c,a,o,w,f,d,r,cc
.xcref
.xcref cEnd
cEnd macro g
.xcref
?ba=0
ifidn <g>,<nogen>
if o+a+r
??_out <cEnd - possible invalid use of nogen>
endif
else
ifdef ?PROFILE
if c
call StopNMeas
endif
endif
if ?extser
ExitSerialize
?extser=0
endif
mpop a
if f
if (?pgen32 and ?pc)
	db	66h     ; override the ret!
endif
	db	0c3h
else
if w+?exp+?lds	      
if ?pmd
ife ?nx
pop ds		      
endif
ife ?nx		      
if ?chkstk1+???+?po
if ?pgen32
mov sp,bp
pop bp
else
leave
endif
endif
else		      
if ?ff+???+?po+?rp    
if ?pgen32
mov sp,bp
pop bp
else
leave
endif
endif
endif
else	    
ife ?nx
if (?TF eq 0) or (???+?rp)
if ?pgen32
	lea	sp,(-4)[bp]
else
	lea	sp,(-2)[bp]
endif
endif
	pop	ds
	pop	bp
ife ?DOS5
	dec	bp
endif
else
if (?TF eq 0) or (???+?rp)
	mov	sp,bp
endif
if ???+?po+?rp
	pop	bp
endif
endif
endif
else
if ?pmd
if ?ff+???+?po+?rp 
if ?pgen32
mov sp,bp
pop bp
else
leave
endif
endif
else
if ?ff+???+?po+?rp
if (?TF eq 0) or (???+?rp)
	mov	sp,bp
endif
	pop	bp
endif
endif
endif
if (?pgen32 and ?pc)
        db      66h     ; override the ret!
endif
ife cc
	ret
else
	ret	o
endif
endif
endif
n endp
.cref
purge cEnd
endm
.cref
endm
assumes macro s,ln
ifdef MS_STARTUP
ifidn <code>,<ln>
assume s&:_TEXT
exitm
elseifidn <CODE>,<ln>
assume s&:_TEXT
exitm
elseifidn <data>,<ln>
assume s&:dgroup
exitm
elseifidn <DATA>,<ln>
assume s&:dgroup
exitm
endif
endif
ifndef ln&_assumes
assume s:ln
else
ln&_assumes s
endif
endm
createSeg macro n,ln,a,co,cl,grp,u
ifnb <cl>
ifnb <u>
ifidn <u>,<USE32>
.386p
endif
n segment a co '&cl'
else
.286p
n segment a co '&cl'
endif
else
ifnb <u>
n segment a co u
else
n segment a co
endif
endif
n ends
?cs1 <ln>,<n>,<u>
ifnb <grp>
grp group n
?cs3 <ln>,<grp>
ln&OFFSET equ <offset grp:>
ln&BASE equ <grp>
else
?cs3 <ln>,<n>
ln&OFFSET equ <offset>
ln&BASE equ <n>
endif
endm
addseg macro grp,seg
.xcref
.xcref grp&_add
.cref
grp&_add macro s
grp&_in <seg>,s
endm
.xcref
.xcref grp&_in
.cref
grp&_in macro sl,s
ifb <s>
grp group sl
else
grp&_add macro ns
grp&_in <sl,s>,ns
endm
endif
endm
endm
defgrp macro grp,ln
endm
?cs1 macro ln,n,u
.xcref
.xcref ln&_sbegin
.cref
ln&_sbegin macro
?cs2 <ln>,<n>
n segment
.xcref
.xcref ?mf
.cref
?mf macro c,l,p
if c
	extrn	n&_FARFRAME:near
	call	n&_FARFRAME
else
	extrn	n&_NEARFRAME:near
	call	n&_NEARFRAME
endif
	db	l shr 1
	db	p shr 1
endm
?pgen32=0
ifnb <u>
ifidn <u>,<USE32>
?pgen32=1
endif
endif
endm
endm
?cs2 macro ln,n
.xcref
.xcref sEnd
.cref
sEnd macro arg
n ends
?pgen32=0
purge ?mf
purge sEnd
endm
endm
?cs3 macro ln,n
.xcref
.xcref ln&_assumes
.cref
ln&_assumes macro s
assume s:&n
endm
endm
retn32 macro
db 66h
retn
endm
retf32 macro
db 66h
retf
endm
.xcref
.xcref sBegin
.cref
sBegin macro ln
ln&_sbegin
endm
ife ?DF
createSeg _TEXT,Code,word,public,CODE
ife ?nodata1
createSeg _DATA,Data,word,public,DATA,DGROUP
defgrp DGROUP,Data
endif
if ?chkstk1
ifndef ?CHKSTKPROC
externp <chkstk>
endif
endif
endif
errnz macro x
ifnb <x>
.errnz (x),<x>
endif
endm
errnz1 macro x1,x2
= *errnz* x1 = x2
.err
endm
errn$ macro l,x
errnz <offset $ - offset l x>
endm
EnterSerialize  macro
endm
ExitSerialize   macro
endm
ifdef ?PROFILE
externFP <StartNMeas,StopNMeas>
endif
callcrt MACRO funcname
ifdef _QC2
call funcname
else
if sizeC
push cs
call near ptr (funcname)
else
call funcname
endif
endif
ENDM
.cref

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?