Source code of Windows XP (NT5)
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.

826 lines
20 KiB

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