Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

812 lines
20 KiB

  1. ;***
  2. ;cruntime.inc - multi-model assembly macros for interfacing to HLLs
  3. ;
  4. ; Copyright (c) 1988-2001, Microsoft Corporation. All rights reserved.
  5. ;
  6. ;Purpose:
  7. ; This file defines the current memory model being used.
  8. ;
  9. ;Revision History:
  10. ; 08-04-88 SJM Initial version to handle all four memory models
  11. ; in 16-bit mode and small model in 32-bit mode
  12. ; 08-08-88 JCR Added CPDIST, ?WIN, PCS, ISHIFT/LSHIFT, OS2,
  13. ; DNPTR/DFPTR, DFLOAT/DDOUBLE/DLDOUBLE
  14. ; 08-16-88 PHG Added FPES, LFPES, CBI, ZXAL, ZXBL, ZXCL, ZXDL
  15. ; 08-17-88 JCR Added CAXDX, modified FPSIZE
  16. ; 08-20-88 PHG Added diagnostic messages, removed 386 16-bit support
  17. ; and 386 large code/data support, added mucho comments,
  18. ; PSS now defined as es: only if SS_NEQ_GROUP defined
  19. ; 08-24-88 JCR Added RBXSAVE and RBXONLY for use in 'proc uses'
  20. ; 08-25-88 JCR Added savereg macro, removed rbxsave/rbxonly...
  21. ; 08-26-88 GJF Added codeseg (text) macro
  22. ; 09-15-88 JCR Corrected savelist/reglist macro to go with new MASM
  23. ; 09-21-88 WAJ Added JS*, static*, global*, and label*, and lab macros
  24. ; 09-22-88 JCR Change 'plm' to 'pascal' in label macro
  25. ; 09-26-88 WAJ Added PUSH16 which will do a 16 bit push in a USE32 seg.
  26. ; 09-28-88 WAJ Added CPWORD and DPWORD
  27. ; 09-29-88 WAJ Added JMPFAR16 macro
  28. ; 10-12-88 JCR Made PCS evaluate to 'cs:' for 16/32 stub testbed
  29. ; 04-24-89 JCR Added 'assume seg:flat' for 386 to avoid masm/link bug
  30. ; 05-25-89 GJF Added APIEXT, a macro that expands to the proper extrn
  31. ; declaration for an API function
  32. ; 06-13-89 JCR Added 'flat:' to DCPTR and DDPTR
  33. ; 09-15-89 JCR Added DCPTR? and DDPTR?, always use "FLAT" not "flat"
  34. ; 10-27-92 SKS Miscellaneous minor changes for MASM 6.10 compatibility
  35. ; 09-06-94 CFW Replace MTHREAD with _MT.
  36. ; 01-11-95 SKS Remove MASM 5.X support
  37. ; 05-04-95 GJF Use .586 for Win32.
  38. ;
  39. ;*******************************************************************************
  40. ;==============================================================================
  41. ;
  42. ;Use the following defines to control processor/segment model
  43. ;
  44. ; -DI86 8086/8088 processor
  45. ; -DI286 80286 processor
  46. ; -DI386 80386 processor with 32-bit code/data segment
  47. ;
  48. ; -Dmem_S Small memory model (near code, near data)
  49. ; -Dmem_M Medium memory model (far code, near data)
  50. ; -Dmem_C Compact memory model (near code, fat data)
  51. ; -Dmem_L Large memory model (far code, far data)
  52. ;
  53. ; -DSS_NEQ_DGROUP SS and DS point to different segments
  54. ;
  55. ; default is -DI86 -Dmem_S
  56. ;
  57. ;==============================================================================
  58. ;
  59. ;The following variables are defined by this file:
  60. ; cpu 86, 286, or 386
  61. ; sizeC code distance; 1 = far code, 0 = near code
  62. ; sizeD data distance; 1 = far data, 0 = near data
  63. ; mmodel english name of the memory model, i.e. "Medium"
  64. ; ISIZE, LSIZE, NSIZE size of ints, longs, shorts
  65. ; FLTSIZE, DBLSIZE, LDBLSIZE size of float, double, long double
  66. ; NPSIZE, FPSIZE size of near/far pointers
  67. ; CPSIZE, DPSIZE size of code/data pointers
  68. ; ISHIFT, LSHIFT bits to shift to convert byte to int/long
  69. ;
  70. ;The following macros allow easy writing of combined 16/32 bit code:
  71. ;
  72. ; 16/32 bit registers:
  73. ; rax, rbx, rcx, rdx, expand to native registers (rax = eax or ax)
  74. ; rsi, rdi, rsp, rbp
  75. ; 16/32 bit register instructions:
  76. ; JRCXZ jump when rcx is zero
  77. ; CBI convert byte to int (al to rax)
  78. ; CAXDX convert rax to rax:rdx
  79. ; ZXAL, ZXBL, ZXCL, ZXDL zero extend al,bl,cl,dl to rax,rbx,rcx,rdx
  80. ; Pointer instructions:
  81. ; LPDS, LPES load data pointer with ES or DS
  82. ; PDS, PES segment overrides when pointer loaded as above
  83. ; PCS, PSS segment override to get at code/stack segment
  84. ; LFPDS, LFPES load far pointer with ES or DS
  85. ; FPDS, FPES segment overrides when pointer loaded as above
  86. ; CPTR data type of code pointer
  87. ; CPDIST distance of code (near/far)
  88. ; DNPTR, DFPTR define near/far pointer
  89. ; DCPTR, DDPTR define code/data pointer
  90. ; DCPTR?, DDPTR? define uninitialized code/data pointer
  91. ; CPWORD, DPWORD data type of code or data pointer
  92. ; Numeric type instructions:
  93. ; IWORD, LWORD, SWORD data type of int, long, short
  94. ; DINT, DLONG, DSHORT define int, long, short
  95. ; DFLOAT, DDOUBLE, DLDOUBLE define float, double, long double
  96. ; Offsets:
  97. ; codeoffset, dataoffset offsets from code and data segments
  98. ; API calls:
  99. ; APIDIST distance of API calls (near/far)
  100. ; APIEXT ApiName extrn declaration for an API function
  101. ;
  102. ;The following utility macros are provided:
  103. ; codeseg define/declare code segment
  104. ; error <msg> stop assembly with message
  105. ; display <msg> display a message, unless QUIET defined
  106. ; savelist [<reg> ...] init list of regs to be save by 'proc uses'
  107. ; _if cond <instruction> assemble instruction only if cond is TRUE
  108. ; _ife cond <instruction> assemble instruction only if cond is FALSE
  109. ; _ifd symbol <instruction> assemble instruction only if symbol defined
  110. ; _ifnd symbol <instruction> assemble instruction only if symbol not defined
  111. ;
  112. ; lab LabelName assembles to "LabelName:" If DEBUG is defined
  113. ; LabelName is made public
  114. ;
  115. ; JS* (ex. JSE,JSZ,JSB ...) assemble to "je short","jz short","jb short"
  116. ;
  117. ; Cmacro look alikes
  118. ; static* Name, InitialValue, Repeat defines a static variable of type *
  119. ; global* Name, InitialValue, Repeat defines a global variable of type *
  120. ; label* Name, {PUBLIC,PASCAL,C} defines a label of type *
  121. ;
  122. ; PUSH16 SegmentReg pushes 16 bits in a use32 segment
  123. ; JMPFAR16 label will do a far 16:16 jmp from a use32 segment
  124. ;
  125. ;==============================================================================
  126. ; error <msg> - Output message and generate error
  127. error MACRO msg
  128. if2 ;; only on pass 2 can we generate errors
  129. %out **********************************************************
  130. %out *** E r r o r -- msg
  131. %out **********************************************************
  132. .err
  133. endif
  134. ENDM
  135. ; display msg - Output message unless QUIET defined
  136. display MACRO msg
  137. ifndef QUIET ;; only when quiet flag not set
  138. if1 ;; and on pass 1, then display message
  139. %out msg
  140. endif
  141. endif
  142. ENDM
  143. ; One line conditionals:
  144. ; here we create the capability of writing code lines like
  145. ;
  146. ; _if sizeD <push ds> as opposed to if sizeD
  147. ; push ds
  148. ; endif
  149. _if MACRO cond,text
  150. if cond
  151. text
  152. endif
  153. ENDM
  154. _ife MACRO cond,text
  155. ife cond
  156. text
  157. endif
  158. ENDM
  159. _ifd MACRO cond,text
  160. ifdef cond
  161. text
  162. endif
  163. ENDM
  164. _ifnd MACRO cond,text
  165. ifndef cond
  166. text
  167. endif
  168. ENDM
  169. ; set windows flag to 0
  170. ?WIN equ 0 ; disable windows-specific code
  171. ; check for _MT, requires 286 or greater processor
  172. ifdef _MT
  173. ifndef I386
  174. ifndef I286
  175. ; _MT implies 286 processor
  176. display <Multi-thread specified - assuming 80286 processor>
  177. I286 equ <>
  178. endif
  179. endif
  180. endif
  181. ; Process memory-model arguments
  182. ifdef mem_M
  183. ; Medium model
  184. sizeC equ 1
  185. sizeD equ 0
  186. mmodel equ <Medium>
  187. elseifdef mem_C
  188. ; Compact model
  189. sizeC equ 0
  190. sizeD equ 1
  191. mmodel equ <Compact>
  192. elseifdef mem_L
  193. ; Large model
  194. sizeC equ 1
  195. sizeD equ 1
  196. mmodel equ <Large>
  197. else
  198. ; Small model - default
  199. sizeC equ 0
  200. sizeD equ 0
  201. mmodel equ <Small>
  202. endif
  203. ; Process processor arguments
  204. ifdef _WIN32
  205. display <Processor: 486/586>
  206. cpu equ 586
  207. .586
  208. elseifdef _POSIX_
  209. display <Processor: 486/586>
  210. cpu equ 586
  211. .586
  212. elseifdef I286
  213. display <Processor: 80286>
  214. cpu equ 286
  215. .286
  216. elseifdef I386
  217. display <Processor: 80386>
  218. cpu equ 386
  219. .386
  220. else
  221. display <Processor: 8086/8088>
  222. cpu equ 86
  223. .8086
  224. endif
  225. ; 386 32-bit checking. Currently we are only expecting small model
  226. ; 32 bit segments, so we make a few checks to be sure nothing is
  227. ; incorrectly being defined.
  228. ifdef I386
  229. if sizeC or sizeD
  230. error <Must use Small memory model for 386 version.>
  231. endif
  232. ifdef _LOAD_DGROUP
  233. error <No loading DGROUP in 386 version.>
  234. endif
  235. ifdef SS_NEQ_DGROUP
  236. error <SS always equals DGROUP in 386 version.>
  237. endif
  238. endif
  239. ; Set memory model
  240. % display <Memory model: mmodel>
  241. % .model mmodel, C
  242. ;
  243. ; *** Temporary Workaround ***
  244. ; Currently, MASM will not recognize the 'FLAT' keyword unless it previously
  245. ; appears in an 'assume' statement. Presumably, when the '.model FLAT' feature
  246. ; is implemented, this will go away. [Use 'gs:' since we never use that
  247. ; segment register.
  248. ;
  249. ifdef I386
  250. ; ensure that MASM recognizes 'FLAT'
  251. assume gs:FLAT
  252. endif
  253. ; Define registers:
  254. ; Instead of using the "word" registers directly, we will use a set of
  255. ; text equates. This will allow you to use the native word size instead of
  256. ; hard coded to 16 bit words. We also have some instruction equates for
  257. ; instruction with the register type hard coded in.
  258. ifdef I386
  259. rax equ <eax>
  260. rbx equ <ebx>
  261. rcx equ <ecx>
  262. rdx equ <edx>
  263. rdi equ <edi>
  264. rsi equ <esi>
  265. rbp equ <ebp>
  266. rsp equ <esp>
  267. JRCXZ equ <jecxz>
  268. CBI equ <movsx eax, al> ; convert byte to int (al to rax)
  269. CAXDX equ <cdq> ; convert rax to rdx:rax
  270. ZXAL equ <movzx eax, al> ; zero extend al
  271. ZXBL equ <movzx ebx, bl> ; zero extend bl
  272. ZXCL equ <movzx ecx, cl> ; zero extend cl
  273. ZXDL equ <movzx edx, dl> ; zero extend dl
  274. else
  275. rax equ <ax>
  276. rbx equ <bx>
  277. rcx equ <cx>
  278. rdx equ <dx>
  279. rdi equ <di>
  280. rsi equ <si>
  281. rbp equ <bp>
  282. rsp equ <sp>
  283. JRCXZ equ <jcxz>
  284. CBI equ <cbw> ; convert byte to int (al to rax)
  285. CAXDX equ <cwd> ; convert rax to rdx:rax
  286. ZXAL equ <xor ah, ah> ; zero extend al
  287. ZXBL equ <xor bh, bh> ; zero extend bl
  288. ZXCL equ <xor ch, ch> ; zero extend cl
  289. ZXDL equ <xor dh, dh> ; zero extend dl
  290. endif
  291. ; The following equates deal with the differences in near versus
  292. ; far data pointers, and segment overrides.
  293. ;
  294. ; Use LPES and PES when loading a default size pointer -- it loads
  295. ; a 16-bit pointer register in 286 Small/Medium model,
  296. ; a 16-bit pointer register and 16-bit segment register in 8086/286
  297. ; Compact/Large model, and a 32-bit pointer register in 386 mode.
  298. ;
  299. ; Use LFPES and FPES when loading an always far pointer -- it loads a
  300. ; 16-bit pointer register and 16-bit segment register in 8086/286,
  301. ; all models; a 32-bit pointer register in 386 mode.
  302. if sizeD
  303. LPES equ <les>
  304. LPDS equ <lds>
  305. PDS equ <ds:>
  306. PES equ <es:>
  307. else
  308. LPES equ <mov>
  309. LPDS equ <mov>
  310. PDS equ <>
  311. PES equ <>
  312. endif
  313. ifdef I386
  314. LFPES equ <mov>
  315. LFPDS equ <mov>
  316. FPES equ <>
  317. FPDS equ <>
  318. else
  319. LFPES equ <les>
  320. LFPDS equ <lds>
  321. FPES equ <es:>
  322. FPDS equ <ds:>
  323. endif
  324. if sizeC or @WordSize eq 2
  325. PCS equ <cs:> ; large code model or non-386
  326. else
  327. IF 1 ;*** TEMP 16/32 TESTBED ***
  328. PCS equ <cs:>
  329. ELSE
  330. PCS equ <> ; 386 small code model
  331. ENDIF ;*** END TEMP CODE
  332. endif
  333. ifdef SS_NEQ_DGROUP
  334. PSS equ <ss:> ; SS != DS
  335. else
  336. PSS equ <> ; SS == DS
  337. endif
  338. ; Define offset macros:
  339. ; The 32-bit segments will not have 'groups'
  340. ifdef I386
  341. codeoffset equ <offset FLAT:>
  342. dataoffset equ <offset FLAT:>
  343. else
  344. codeoffset equ <offset @code:>
  345. dataoffset equ <offset DGROUP:>
  346. endif
  347. ; The next set of equates deals with the size of SHORTS, INTS, LONGS, and
  348. ; pointers in the 16 and 32 bit versions.
  349. ifdef I386 ;--- 32 bit segment ---
  350. ; parameters and locals
  351. IWORD equ <dword>
  352. LWORD equ <dword>
  353. ; static storage
  354. DINT equ <dd>
  355. DLONG equ <dd>
  356. DSHORT equ <dw>
  357. ; sizes for fixing SP, stepping through tables, etc.
  358. ISIZE equ 4
  359. LSIZE equ 4
  360. SSIZE equ 2
  361. NPSIZE equ 4
  362. FPSIZE equ 4
  363. ; bit shift count to convert byte cnt/ptr to int/long cnt/ptr
  364. ISHIFT equ 2 ; byte-to-int shift count
  365. LSHIFT equ 2 ; byte-to-long shift count
  366. ; sizes dependent upon memory model. dq -vs- df is not yet clear
  367. DNPTR equ <dd> ; near pointer
  368. DFPTR equ <dd> ; far pointer
  369. DCPTR equ <dd offset FLAT:>; 32 bit offset only
  370. DCPTR? equ <dd> ; No seg override for uninitialized values
  371. CPSIZE equ 4
  372. CPDIST equ <near> ; code pointers are near
  373. CPTR equ <near ptr>
  374. DDPTR equ <dd offset FLAT:>
  375. DDPTR? equ <dd>
  376. DPSIZE equ 4
  377. CPWORD equ <dword> ; code pointers are dwords
  378. DPWORD equ <dword> ; data pointers are dwords
  379. APIDIST equ <near> ; all API calls are NEAR in the 32 bit model
  380. ; macro to declare API functions
  381. EXTAPI macro apiname
  382. extrn pascal apiname:near
  383. endm
  384. else ;--- 16-bit segment ---
  385. ; parameters and locals
  386. IWORD equ <word>
  387. LWORD equ <dword>
  388. ; static storage
  389. DINT equ <dw>
  390. DLONG equ <dd>
  391. DSHORT equ <dw>
  392. ; sizes for fixing SP, stepping through tables, etc
  393. ISIZE equ 2
  394. LSIZE equ 4
  395. SSIZE equ 2
  396. NPSIZE equ 2
  397. FPSIZE equ 4
  398. ; bit shift count to convert byte cnt/ptr to int/long cnt/ptr
  399. ISHIFT equ 1 ; byte-to-int shift count
  400. LSHIFT equ 2 ; byte-to-long shift count
  401. ; sizes dependent upon memory model
  402. DNPTR equ <dw> ; near pointer
  403. DFPTR equ <dd> ; far pointer
  404. if sizeC
  405. DCPTR equ <dd> ; 16 bit segment and 16 bit offset
  406. DCPTR? equ <dd>
  407. CPSIZE equ 4
  408. CPDIST equ <far> ; code pointers are far
  409. CPTR equ <far ptr>
  410. CPWORD equ <dword> ; code pointers are dwords
  411. else
  412. DCPTR equ <dw> ; 16 bit offset only
  413. DCPTR? equ <dw>
  414. CPSIZE equ 2
  415. CPDIST equ <near> ; code pointers are near
  416. CPTR equ <near ptr>
  417. CPWORD equ <word> ; code pointers are words
  418. endif
  419. if sizeD
  420. DDPTR equ <dd>
  421. DDPTR? equ <dd>
  422. DPSIZE equ 4
  423. DPWORD equ <dword> ; data pointers are dwords
  424. else
  425. DDPTR equ <dw>
  426. DDPTR? equ <dw>
  427. DPSIZE equ 2
  428. DPWORD equ <word> ; data pointers are words
  429. endif
  430. APIDIST equ <far> ; API calls are FAR in 16 bit model
  431. ; macro to declare API functions
  432. EXTAPI macro apiname
  433. extrn pascal apiname:far
  434. endm
  435. endif ; --- 16/32 segment ---
  436. ; Float/double definitions
  437. ; (currently the same for 16- and 32-bit segments)
  438. FLTSIZE equ 4 ; float
  439. DBLSIZE equ 8 ; double
  440. LDBLSIZE equ 10 ; long double
  441. DFLOAT equ <dd>
  442. DDOUBLE equ <dq>
  443. DLDOUBLE equ <dt>
  444. ;
  445. ; savelist - Generate a list of regs to be saved by the proc 'uses' option.
  446. ;
  447. ; Input:
  448. ; reg1, reg2, reg3, reg4 = registers to be saved across function
  449. ; Output:
  450. ; reglist = text string of registers that can be passed to the 'uses'
  451. ; option on the 'proc' command.
  452. ;
  453. savelist MACRO reg1, reg2, reg3, reg4
  454. local ws, listsize
  455. ws catstr < > ; whitespace char
  456. IFNDEF I386
  457. rbx equ <> ; 8086/286 don't save rbx
  458. ENDIF
  459. IFNB <reg4>
  460. reglist catstr reg1, ws, reg2, ws, reg3, ws, reg4
  461. ELSEIFNB <reg3>
  462. reglist catstr reg1, ws, reg2, ws, reg3, ws
  463. ELSEIFNB <reg2>
  464. reglist catstr reg1, ws, reg2, ws, ws
  465. ELSEIFNB <reg1>
  466. reglist catstr reg1, ws, ws, ws
  467. ELSE
  468. reglist catstr <>
  469. ENDIF
  470. listsize sizestr reglist ; size of register list
  471. IF listsize LE 3 ; if list is only the 3 ws chars...
  472. reglist catstr <>
  473. ENDIF
  474. IFNDEF I386
  475. rbx equ <bx> ; restore rbx
  476. ENDIF
  477. ENDM ; savelist
  478. ;
  479. ; codeseg - Define/declare the standard code segment. Maps to the proper
  480. ; form of the .code directive.
  481. ;
  482. ; Input:
  483. ;
  484. ; Output:
  485. ; .code _TEXT ; for large code models
  486. ; .code ; for small code models
  487. ; assume cs:FLAT ; for 386
  488. ; assume ds:FLAT ; for 386
  489. ; assume es:FLAT ; for 386
  490. ; assume ss:FLAT ; for 386
  491. ;
  492. codeseg MACRO
  493. if sizeC
  494. .code _TEXT
  495. else
  496. .code
  497. endif
  498. ifdef I386
  499. assume ds:FLAT
  500. assume es:FLAT
  501. assume ss:FLAT
  502. endif
  503. ENDM
  504. ;*========
  505. ;*
  506. ;* Debug lab macro
  507. ;*
  508. ;*========
  509. lab macro name
  510. ifdef DEBUG
  511. public pascal name ;; define label public for Symdeb
  512. endif
  513. name:
  514. endm
  515. ;*========
  516. ;*
  517. ;* Conditional jump short macros
  518. ;*
  519. ;*========
  520. irp x,<Z,NZ,E,NE,S,NS,C,NC,P,NP,PE,PO,A,AE,B,BE,NB,G,GE,L,LE>
  521. JS&x equ <j&x short>
  522. endm
  523. ;*========
  524. ;*
  525. ;* Global data definition macros
  526. ;*
  527. ;* Usage:
  528. ;* globalI Name, InitialValue, Repeat
  529. ;*
  530. ;*========
  531. MakeGlobal macro suffix, DataType ;; makes all of the global* macros
  532. global&suffix macro name, data, rep
  533. public name
  534. ifb <rep>
  535. _repeat = 1
  536. else
  537. _repeat = (rep)
  538. endif
  539. name &DataType _repeat dup( data )
  540. endm
  541. endm
  542. MakeGlobal T, dt ; globalT
  543. MakeGlobal Q, dq ; globalQ
  544. MakeGlobal D, dd ; globalD
  545. MakeGlobal W, dw ; globalW
  546. MakeGlobal B, db ; globalB
  547. % MakeGlobal I, <DINT> ; globalI
  548. % MakeGlobal DP, <DDPTR> ; globalDP
  549. % MakeGlobal CP, <DCPTR> ; globalCP
  550. % MakeGlobal FP, <DFPTR> ; globalFP
  551. % MakeGlobal NP, <DNPTR> ; globalNP
  552. ;*========
  553. ;*
  554. ;* Static data definition macros
  555. ;*
  556. ;* Usage:
  557. ;* staticI Name, InitialValue, Repeat
  558. ;*
  559. ;*========
  560. MakeStatic macro suffix, DataType ;; makes all of the static* macros
  561. static&suffix macro name, data, rep
  562. ifdef DEBUG
  563. public pascal name ;; make statics public if DEBUG
  564. endif
  565. ifb <rep>
  566. _repeat = 1
  567. else
  568. _repeat = (rep)
  569. endif
  570. name &DataType _repeat dup( data )
  571. endm
  572. endm
  573. MakeStatic T, dt ; staticT
  574. MakeStatic Q, dq ; staticQ
  575. MakeStatic D, dd ; staticD
  576. MakeStatic W, dw ; staticW
  577. MakeStatic B, db ; staticB
  578. % MakeStatic I, <DINT> ; staticI
  579. % MakeStatic DP, <DDPTR> ; staticDP
  580. % MakeStatic CP, <DCPTR> ; staticCP
  581. % MakeStatic FP, <DFPTR> ; staticFP
  582. % MakeStatic NP, <DNPTR> ; staticNP
  583. ;*========
  584. ;*
  585. ;* Label definition macros
  586. ;*
  587. ;*========
  588. ;*
  589. ;* Label definition macros
  590. ;*
  591. ;* Usage:
  592. ;* labelI Name, {PUBLIC, PASCAL, C}
  593. ;*
  594. ;*========
  595. __MakePublic macro name, option ;; decides if a label should be
  596. ifidni <option>, <PUBLIC> ;; made public
  597. public name
  598. elseifidni <option>, <PASCAL>
  599. public pascal name
  600. elseifidni <option>, <C>
  601. public C name
  602. elseifb <option>
  603. ifdef DEBUG
  604. public pascal name ;; make public if DEBUG
  605. endif
  606. endif
  607. endm
  608. MakeLabel macro suffix, LabelType ;; makes all of the label* macros
  609. %@CatStr(<label>,<suffix>) macro name, option
  610. __MakePublic <name>,<option>
  611. name label &LabelType
  612. endm
  613. endm
  614. MakeLabel T, tbyte ; make labelT
  615. MakeLabel Q, qword ; make labelQ
  616. MakeLabel D, dword ; make labelD
  617. MakeLabel W, word ; make labelW
  618. MakeLabel B, byte ; make labelB
  619. MakeLabel P, proc ; make labelP
  620. MakeLabel FP, far ; make labelFP
  621. MakeLabel NP, near ; make labelNP
  622. % MakeLabel I, IWORD ; make labelI
  623. labelDP macro name, option ;; labelDP
  624. __MakePublic <name>,<option>
  625. ifdef I386
  626. if sizeD
  627. name label fword
  628. else
  629. name label dword
  630. endif
  631. else ;not I386
  632. if sizeD
  633. name label dword
  634. else
  635. name label word
  636. endif
  637. endif ;not I386
  638. endm
  639. labelCP macro name, option ;; labelCP
  640. __MakePublic <name>,<option>
  641. ifdef I386
  642. if sizeC
  643. name label fword
  644. else
  645. name label dword
  646. endif
  647. else ;not I386
  648. if sizeC
  649. name label dword
  650. else
  651. name label word
  652. endif
  653. endif ;not I386
  654. endm
  655. ;*
  656. ;* PUSH16 SegReg - pushes 16 bits in a use32 segment
  657. ;*
  658. PUSH16 macro SegReg
  659. ifdef I386
  660. nop
  661. db 66h ; operand size over-ride
  662. endif ; I386
  663. push SegReg
  664. endm
  665. ;*
  666. ;* JMPFAR16 label - jmps far from a use32 to a use16 segment
  667. ;*
  668. JMPFAR16 macro label
  669. ifndef I386
  670. error <JMPFAR16 can only be used in a use32 code segment>
  671. endif ;I386
  672. nop
  673. db 66h ;; operand size over-ride
  674. db 0eah ;; jmp far immediate op code
  675. dw offset label
  676. dw seg label
  677. endm