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.

1192 lines
39 KiB

  1. //*****************************************************************************
  2. //
  3. // (C) Copyright MICROSOFT Corp., 1988-1993
  4. //
  5. // Title: minivdd.inc - VDD definitions for other VxD's and multiple VDD's
  6. //
  7. // Version: 4.00
  8. //
  9. // Date:
  10. //
  11. // Author: FredE for the Mini-VDD interface. Adapted from VDD.INC in
  12. // the general include area. Added services are ONLY for the
  13. // use of the Mini-VDD and should therefore not be documented.
  14. //
  15. //-----------------------------------------------------------------------------
  16. //=============================================================================
  17. #ifndef _MINIVDD_H_
  18. #define _MINIVDD_H_
  19. #ifndef Not_VxD
  20. /*XLATOFF*/
  21. #define VDD_Service Declare_Service
  22. #pragma warning (disable:4003) // turn off not enough params warning
  23. /*XLATON*/
  24. #ifdef MINIVDD
  25. #ifdef NEC_98
  26. /*MACROS*/
  27. //
  28. // VDD protect mode services for other devices and VMM (Get_Version must be first).
  29. // Only define these if we're assembling either the "main" VDD or one of the
  30. // mini-VDD's. Don't define this if we're assembling a display driver or other
  31. // caller of the MiniVDD stuff:
  32. //
  33. Begin_Service_Table(VDD)
  34. VDD_Service( VDD_Get_Version ) // Get version number and ID string ptr
  35. VDD_Service( VDD_PIF_State ) // Pass video PIF bits to VDD
  36. VDD_Service( VDD_Get_GrabRtn ) // Get routine addr for video grab
  37. VDD_Service( VDD_Hide_Cursor ) // Hide cursor when display is windowed
  38. VDD_Service( VDD_Set_VMType ) // Set VM type(windowed, bckgrnd, excl)
  39. VDD_Service( VDD_Get_ModTime ) // Return system time of last mod
  40. VDD_Service( VDD_Set_HCurTrk ) // Track horiz cursor movement in window
  41. VDD_Service( VDD_Msg_ClrScrn ) // Clear screen for sysmodal message
  42. VDD_Service( VDD_Msg_ForColor ) // Set Msg_TextOut forground color
  43. VDD_Service( VDD_Msg_BakColor ) // Set Msg_TextOut background color
  44. VDD_Service( VDD_Msg_TextOut ) // Output a string
  45. VDD_Service( VDD_Msg_SetCursPos ) // Set cursor position
  46. VDD_Service( VDD_Query_Access ) // Is it OK to access video now?
  47. VDD_Service( VDD_Check_Update_Soon ) // User action may update screen
  48. VDD_Service( VDD_Get_Mini_Dispatch_Table) // Get addr of dispatch table to mini-VDD
  49. VDD_Service( VDD_Register_Virtual_Port ) // Mini-VDD asks us to setup I/O trap
  50. VDD_Service( VDD_Get_VM_Info ) // Returns CRTC owner and MemC owners
  51. // and other special VM handles
  52. VDD_Service( VDD_Get_Special_VM_IDs ) // returns planar & msg mode IDs
  53. VDD_Service( VDD_Register_Extra_Screen_Selector )
  54. // allows display driver to use second
  55. // screen selector for block moves
  56. VDD_Service( VDD_Takeover_VGA_Port ) // allows MiniVDD to takeover a port
  57. // in range 3C0H through 3DFH
  58. VDD_Service( VDD_Get_DISPLAYINFO ) // get DISPLAYINFO data structure
  59. VDD_Service( VDD_Do_Physical_IO ) // perform physical I/O for trapped port
  60. VDD_Service( VDD_Register_Mini_VDD )
  61. VDD_Service( VDD_Install_IO_Handler )
  62. VDD_Service( VDD_Install_Mult_IO_Handlers )
  63. VDD_Service( VDD_Enable_Local_Trapping )
  64. VDD_Service( VDD_Disable_Local_Trapping )
  65. VDD_Service( VDD_Trap_Suspend )
  66. VDD_Service( Test_Vid_VM_Handle )
  67. VDD_Service( VDD_Set_Core_Graphics )
  68. VDD_Service( VDD_Load_AccBIOS )
  69. VDD_Service( VDD_Map_AccBIOS )
  70. VDD_Service( VDD_Map_VRAM )
  71. VDD_Service( VDD_EnableDevice )
  72. End_Service_Table(VDD)
  73. /*ENDMACROS*/
  74. #else /*NEC_98*/
  75. /*MACROS*/
  76. //
  77. // VDD protect mode services for other devices and VMM (Get_Version must be first).
  78. // Only define these if we're assembling either the "main" VDD or one of the
  79. // mini-VDD's. Don't define this if we're assembling a display driver or other
  80. // caller of the MiniVDD stuff:
  81. //
  82. Begin_Service_Table(VDD)
  83. VDD_Service( VDD_Get_Version )// Get version number and ID string ptr
  84. VDD_Service( VDD_PIF_State )// Pass video PIF bits to VDD
  85. VDD_Service( VDD_Get_GrabRtn )// Get routine addr for video grab
  86. VDD_Service( VDD_Hide_Cursor )// Hide cursor when display is windowed
  87. VDD_Service( VDD_Set_VMType )// Set VM type(windowed, bckgrnd, excl)
  88. VDD_Service( VDD_Get_ModTime )// Return system time of last mod
  89. VDD_Service( VDD_Set_HCurTrk )// Track horiz cursor movement in window
  90. VDD_Service( VDD_Msg_ClrScrn )// Clear screen for sysmodal message
  91. VDD_Service( VDD_Msg_ForColor )// Set Msg_TextOut forground color
  92. VDD_Service( VDD_Msg_BakColor )// Set Msg_TextOut background color
  93. VDD_Service( VDD_Msg_TextOut )// Output a string
  94. VDD_Service( VDD_Msg_SetCursPos )// Set cursor position
  95. VDD_Service( VDD_Query_Access )// Is it OK to access video now?
  96. VDD_Service( VDD_Check_Update_Soon )// User action may update screen
  97. VDD_Service( VDD_Get_Mini_Dispatch_Table )// Get addr of dispatch table to mini-VDD
  98. VDD_Service( VDD_Register_Virtual_Port )// Mini-VDD asks us to setup I/O trap
  99. VDD_Service( VDD_Get_VM_Info )// Returns CRTC owner and MemC owners
  100. // and other special VM handles
  101. VDD_Service( VDD_Get_Special_VM_IDs )// returns planar & msg mode IDs
  102. VDD_Service( VDD_Register_Extra_Screen_Selector )
  103. // allows display driver to use second
  104. // screen selector for block moves
  105. VDD_Service( VDD_Takeover_VGA_Port ) // allows MiniVDD to takeover a port
  106. // in range 3C0H through 3DFH
  107. VDD_Service( VDD_Get_DISPLAYINFO ) // get DISPLAYINFO data structure
  108. VDD_Service( VDD_Do_Physical_IO ) // perform physical I/O for trapped port
  109. VDD_Service( VDD_Set_Sleep_Flag_Addr ) // when display driver can't be interrupted
  110. VDD_Service( VDD_EnableDevice )
  111. End_Service_Table(VDD)
  112. /*ENDMACROS*/
  113. #endif /*NEC_98*/
  114. #endif /*MINIVDD*/
  115. /*XLATOFF*/
  116. #pragma warning (default:4003) // turn off not enough params warning
  117. /*XLATON*/
  118. #define VDD_VerNum 0x0400 // version 4.00
  119. #define VDD_MinVerNum 0x030A // supports down to 3.10
  120. //***************
  121. // PIF_State service definitions
  122. //
  123. // These definitions cannot change without changing the PIF editor!!!
  124. //
  125. #ifdef NEC_98
  126. #define bVidTextMd 4 ; Allocate text mode mem
  127. #define fVidTextMd (1 << 4)
  128. #define bVidNTModeFF 0 ; NoTrap: Mode F/F
  129. #define fVidNTModeFF (1 << 0)
  130. #define bVidNTModeFFC16 1 ; Default is 16 color mode
  131. #define fVidNTModeFFC16 (1 << 1)
  132. #define bVidNTDispRW 2 ; NoTrap: Bank Register
  133. #define fVidNTDispRW (1 << 2)
  134. #define bVidNTPal 3 ; NoTrap: Palette
  135. #define fVidNTPal (1 << 3)
  136. #define bVidNTGDC 5 ; NoTrap: GDC
  137. #define fVidNTGDC (1 << 5)
  138. #define bVidNTGDCTON 6 ; Default Text on
  139. #define fVidNTGDCTON (1 << 6)
  140. #define bVidNTGDCGON 7 ; Default Grph on
  141. #define fVidNTGDCGON (1 << 7)
  142. #define bVidNTFont 8 ; NoTrap: KCG
  143. #define fVidNTFont (1 << 8)
  144. #define bVidCRTC 9 ; Use CRTC Tracer
  145. #define fVidCRTC (1 << 9)
  146. #define bVidDispDataXfer 10 ; Transrate mode (0:Text, 1:Text/Grph)
  147. #define fVidDispDataXfer (1 << 10)
  148. #define bVidXFERPlane0 11 ; Transrate plane Blue
  149. #define fVidXFERPlane0 (1 << 11)
  150. #define bVidXFERPlane1 12 ; Red
  151. #define fVidXFERPlane1 (1 << 12)
  152. #define bVidXFERPlane2 13 ; Green
  153. #define fVidXFERPlane2 (1 << 13)
  154. #define bVidXFERPlane3 14 ; Intensity
  155. #define fVidXFERPlane3 (1 << 14)
  156. #define mVidXFERPlane (fVidXFERPlane0+fVidXFERPlane1+fVidXFERPlane2+fVidXFERPlane3)
  157. #define mVidNTH98 (fVidNTModeFF+fVidNTModeFFC16+fVidNTDispRW+fVidNTPal+fVidNTGDC+fVidNTGDCTON+fVidNTGDCGON)
  158. #else //NEC_98
  159. #define fVidTxtEmulate 0x0001 // Do INT 10h TTY and cursor emulation
  160. #define fVidNoTrpTxt 0x0002 // Do not trap text mode apps
  161. #define fVidNoTrpLRGrfx 0x0004 // Do not trap lo res graphics mode apps
  162. #define fVidNoTrpHRGrfx 0x0008 // Do not trap hi res graphics mode apps
  163. #define fVidTextMd 0x0010 // Allocate text mode mem
  164. #define fVidLowRsGrfxMd 0x0020 // Allocate lo res graphics mode mem
  165. #define fVidHghRsGrfxMd 0x0040 // Allocate hi res graphics mode mem
  166. #define fVidRetainAllo 0x0080 // Never deallocate once allocated
  167. #endif //NEC_98
  168. //
  169. // The following stuff was added for mini-VDD support:
  170. //
  171. // Functions that we can call in the hardware-dependent mini-VDD. Note that
  172. // these equates are used to create the dispatch table for calling functions
  173. // in the mini-VDD:
  174. //
  175. #ifdef NEC_98
  176. #define REGISTER_DISPLAY_DRIVER 0
  177. #define PRE_HIRES_TO_VGA 1
  178. #define SAVE_REGISTERS 2
  179. #define RESTORE_REGISTERS 3
  180. #define ENABLE_TRAPS 4
  181. #define DISABLE_TRAPS 5
  182. #define DISPLAY_DRIVER_DISABLING 6
  183. #define ENABLE_ACCELERATER 7
  184. #define DISABLE_ACCELERATER 8
  185. #define CHECK_UPDATE 9
  186. #define CHECK_WINDOWED 10
  187. #define ACC_VBE_PM 11
  188. #define ACC_VBE_DDC 12
  189. #define ACC_INT_10 13
  190. #define ACC_GET_CAPABILITIES 14
  191. #define ACC_GET_EXT_MODE_INFO 15
  192. #define ACC_GET_FLAT_SELECTOR 16
  193. #define ACC_ENABLE_BIOS 17
  194. #define ACC_DISABLE_BIOS 18
  195. #define ACC_SET_PALETTE 19
  196. #define ACC_GET_PALETTE 20
  197. #define ACC_SET_CURSOR 21
  198. #define ACC_SHOW_CURSOR 22
  199. #define ACC_HIDE_CURSOR 23
  200. #define ACC_SET_CURSOR_POS 24
  201. #define ACC_GET_CURSOR_POS 25
  202. ;
  203. // 970204 //#define NBR_MINI_VDD_FUNCTIONS 26 //REMEMBER TO RESET THIS!!!!!!
  204. #define NBR_MINI_VDD_FUNCTIONS_40 26 //
  205. #define GET_NUM_UNITS 26 // 970220 rev.1
  206. #define SET_ADAPTER_POWER_STATE 27 // SetAdapterPowerState(DEVNODE, DWORD)
  207. #define GET_ADAPTER_POWER_STATE_CAPS 28 // GetAdapterPowerStateCap(DEVNODE)
  208. #define SET_MONITOR_POWER_STATE 29 // SetMonitorPowerState(DEVNODE, DWORD)
  209. #define GET_MONITOR_POWER_STATE_CAPS 30 // GetMonitorPowerStateCaps(DEVNODE)
  210. #define GET_MONITOR_INFO 31 // GetMonitorInfo(DEVNODE, UINT, EDID *)
  211. #define I2C_OPEN 32 // OpenI2CPort(PDO, BOOL, I2CControl *)
  212. #define I2C_ACCESS 33 // AccessI2CPort(PDO, I2CControl *);
  213. #define GPIO_OPEN 34 // OpenGPIOPort(PDO, BOOL, GPIOControl *)
  214. #define GPIO_ACCESS 35 // AccessGPIOPort(PDO, GPIOControl *)
  215. #define COPYPROTECTION_ACCESS 36 // AccessCopyProtection(PDO,CPControl * )
  216. #define NBR_MINI_VDD_FUNCTIONS_41 37
  217. #ifdef MAINVDD
  218. #define NBR_MINI_VDD_FUNCTIONS NBR_MINI_VDD_FUNCTIONS_41
  219. #else
  220. #define NBR_MINI_VDD_FUNCTIONS NBR_MINI_VDD_FUNCTIONS_40
  221. #endif
  222. #else //NEC_98
  223. #define REGISTER_DISPLAY_DRIVER 0
  224. #define GET_VDD_BANK 1
  225. #define SET_VDD_BANK 2
  226. #define RESET_BANK 3
  227. #define PRE_HIRES_TO_VGA 4
  228. #define POST_HIRES_TO_VGA 5
  229. #define PRE_VGA_TO_HIRES 6
  230. #define POST_VGA_TO_HIRES 7
  231. #define SAVE_REGISTERS 8
  232. #define RESTORE_REGISTERS 9
  233. #define MODIFY_REGISTER_STATE 10
  234. #define ACCESS_VGA_MEMORY_MODE 11
  235. #define ACCESS_LINEAR_MEMORY_MODE 12
  236. #define ENABLE_TRAPS 13
  237. #define DISABLE_TRAPS 14
  238. #define MAKE_HARDWARE_NOT_BUSY 15
  239. #define VIRTUALIZE_CRTC_IN 16
  240. #define VIRTUALIZE_CRTC_OUT 17
  241. #define VIRTUALIZE_SEQUENCER_IN 18
  242. #define VIRTUALIZE_SEQUENCER_OUT 19
  243. #define VIRTUALIZE_GCR_IN 20
  244. #define VIRTUALIZE_GCR_OUT 21
  245. #define SET_LATCH_BANK 22
  246. #define RESET_LATCH_BANK 23
  247. #define SAVE_LATCHES 24
  248. #define RESTORE_LATCHES 25
  249. #define DISPLAY_DRIVER_DISABLING 26
  250. #define SELECT_PLANE 27
  251. #define PRE_CRTC_MODE_CHANGE 28
  252. #define POST_CRTC_MODE_CHANGE 29
  253. #define VIRTUALIZE_DAC_OUT 30
  254. #define VIRTUALIZE_DAC_IN 31
  255. #define GET_CURRENT_BANK_WRITE 32
  256. #define GET_CURRENT_BANK_READ 33
  257. #define SET_BANK 34
  258. #define CHECK_HIRES_MODE 35
  259. #define GET_TOTAL_VRAM_SIZE 36
  260. #define GET_BANK_SIZE 37
  261. #define SET_HIRES_MODE 38
  262. #define PRE_HIRES_SAVE_RESTORE 39
  263. #define POST_HIRES_SAVE_RESTORE 40
  264. #define VESA_SUPPORT 41
  265. #define GET_CHIP_ID 42
  266. #define CHECK_SCREEN_SWITCH_OK 43
  267. #define VIRTUALIZE_BLTER_IO 44
  268. #define SAVE_MESSAGE_MODE_STATE 45
  269. #define SAVE_FORCED_PLANAR_STATE 46
  270. #define VESA_CALL_POST_PROCESSING 47
  271. #define PRE_INT_10_MODE_SET 48
  272. #define NBR_MINI_VDD_FUNCTIONS_40 49 //REMEMBER TO RESET THIS!!!!!!
  273. //
  274. // new miniVDD functions that a 4.1 miniVDD should implement
  275. //
  276. #define GET_NUM_UNITS 49 // GetNumUnits(DEVNODE)
  277. #define TURN_VGA_OFF 50 // TurnOffVGA(DEVNODE)
  278. #define TURN_VGA_ON 51 // TurnOnVGA(DEVNODE)
  279. #define SET_ADAPTER_POWER_STATE 52 // SetAdapterPowerState(DEVNODE, DWORD)
  280. #define GET_ADAPTER_POWER_STATE_CAPS 53 // GetAdapterPowerStateCap(DEVNODE)
  281. #define SET_MONITOR_POWER_STATE 54 // SetMonitorPowerState(DEVNODE, DWORD)
  282. #define GET_MONITOR_POWER_STATE_CAPS 55 // GetMonitorPowerStateCaps(DEVNODE)
  283. #define GET_MONITOR_INFO 56 // GetMonitorInfo(DEVNODE, UINT, EDID *)
  284. #define I2C_OPEN 57 // OpenI2CPort(PDO, BOOL, I2CControl *)
  285. #define I2C_ACCESS 58 // AccessI2CPort(PDO, I2CControl *);
  286. #define GPIO_OPEN 59 // OpenGPIOPort(PDO, BOOL, GPIOControl *)
  287. #define GPIO_ACCESS 60 // AccessGPIOPort(PDO, GPIOControl *)
  288. #define COPYPROTECTION_ACCESS 61 // AccessCopyProtection(PDO,CPControl * )
  289. #define NBR_MINI_VDD_FUNCTIONS_41 62
  290. #ifdef MAINVDD
  291. #define NBR_MINI_VDD_FUNCTIONS NBR_MINI_VDD_FUNCTIONS_41
  292. #else
  293. #define NBR_MINI_VDD_FUNCTIONS NBR_MINI_VDD_FUNCTIONS_40
  294. #endif
  295. #endif //NEC_98
  296. #endif /*NotVxD*/
  297. //
  298. // Following are function codes that can be called via the VDD's
  299. // API entry point. These are mainly for display driver --> VDD communication.
  300. // Since Windows 3.0 and 3.1 VDD's may have used the sequential numbers
  301. // (after the Grabber functions) for other VDD API services, we start our
  302. // numbering at 80H so as to avoid ugly conflicts with old 3.1 stuff:
  303. //
  304. // all these entry points take as input:
  305. //
  306. // Entry:
  307. // Client_EAX - function code.
  308. // Client_EBX - device handle, or device id (1-N)
  309. //
  310. #define VDD_QUERY_VERSION 0
  311. #define MINIVDD_SVC_BASE_OFFSET 0x80
  312. #define VDD_DRIVER_REGISTER (0 + MINIVDD_SVC_BASE_OFFSET)
  313. #define VDD_DRIVER_UNREGISTER (1 + MINIVDD_SVC_BASE_OFFSET)
  314. #define VDD_SAVE_DRIVER_STATE (2 + MINIVDD_SVC_BASE_OFFSET)
  315. #define VDD_REGISTER_DISPLAY_DRIVER_INFO (3 + MINIVDD_SVC_BASE_OFFSET)
  316. #define VDD_REGISTER_SSB_FLAGS (4 + MINIVDD_SVC_BASE_OFFSET)
  317. #define VDD_GET_DISPLAY_CONFIG (5 + MINIVDD_SVC_BASE_OFFSET)
  318. #define VDD_PRE_MODE_CHANGE (6 + MINIVDD_SVC_BASE_OFFSET)
  319. #define VDD_POST_MODE_CHANGE (7 + MINIVDD_SVC_BASE_OFFSET)
  320. #define VDD_SET_USER_FLAGS (8 + MINIVDD_SVC_BASE_OFFSET)
  321. #define VDD_SET_BUSY_FLAG_ADDR (9 + MINIVDD_SVC_BASE_OFFSET)
  322. #define VDD_PC98_RESERVED (10 + MINIVDD_SVC_BASE_OFFSET)
  323. #define VDD_VBE_PM (10 + MINIVDD_SVC_BASE_OFFSET)
  324. //
  325. // all functions >= VDD_ENABLE also take the following params:
  326. //
  327. // Client_ES:DI - buffer
  328. // Client_ECX - buffer size
  329. // Client_EDX - flags
  330. //
  331. // Exit:
  332. // Client_EAX = function code if the function is not supported.
  333. // = 0 if the function succeded.
  334. // = -1 if the function failed.
  335. //
  336. #define VDD_ENABLE (11 + MINIVDD_SVC_BASE_OFFSET)
  337. #define VDD_GETMEMBASE (12 + MINIVDD_SVC_BASE_OFFSET)
  338. #define VDD_OPEN (13 + MINIVDD_SVC_BASE_OFFSET)
  339. #define VDD_CLOSE (14 + MINIVDD_SVC_BASE_OFFSET)
  340. #define VDD_OPEN_KEY (15 + MINIVDD_SVC_BASE_OFFSET)
  341. #define VDD_SET_POWER_STATE (16 + MINIVDD_SVC_BASE_OFFSET)
  342. #define VDD_GET_POWER_STATE_CAPS (17 + MINIVDD_SVC_BASE_OFFSET)
  343. //
  344. // special verion of VDD_GET_DISPLAY_CONFIG that always get the
  345. // monitor data, even if the user has disabled using a refresh rate.
  346. //
  347. #define VDD_GET_DISPLAY_CONFIG2 0x8085
  348. //
  349. // VDD_DRIVER_REGISTER
  350. //
  351. // The display driver sends us some information needed to handle various
  352. // context changes.
  353. //
  354. // Entry:
  355. // Client_ES:DI Selector:Offset of callback routine used
  356. // to reset to Windows HiRes mode upon return
  357. // from a full screen DOS VM to the Windows VM.
  358. // Client_ES Main code segment of display driver.
  359. // Client_ECX contains the total nbr of bytes on-screen (excluding
  360. // off-screen memory).
  361. // Client_EDX contain 0 if we are to attempt to allow 4 plane VGA
  362. // virtualization.
  363. // Client_EDX contains -1 if we are to not allow 4 plane VGA
  364. // virtualization.
  365. // Client_EBX device handle, or device id (1-N)
  366. // Exit:
  367. // Client_EAX contains total bytes of memory used by visible screen
  368. // AND the VDD virtualization area (ie: the start of
  369. // off-screen memory available for use by the display
  370. // driver as "scratch" memory).
  371. //
  372. //
  373. // VDD_DRIVER_UNREGISTER
  374. //
  375. // Entry:
  376. // Client_EBX device handle, or device id (1-N)
  377. // Exit:
  378. //
  379. //
  380. // VDD_ENABLE
  381. //
  382. // entry:
  383. // Client_EAX - VDD_ENABLE (0x008B)
  384. // Client_EBX - device handle
  385. // Client_EDX - enable flags (see below)
  386. //
  387. // exit:
  388. // Client_EAX - previous enable state.
  389. //
  390. // only one device at a time can have VGAMEM, VGAIO, or ROM access
  391. // at a time.
  392. //
  393. #define ENABLE_IO 0x00000001 // enable IO.
  394. #define ENABLE_MEM 0x00000002 // enable memory.
  395. #define ENABLE_VGA 0x00000030 // enable VGA
  396. #define ENABLE_ROM 0x00000080 // enable ROM at C000.
  397. #define ENABLE_ALL 0x000000FF // enable all access to this device
  398. #define ENABLE_NONE 0x00000000 // disable device.
  399. #define ENABLE_VALID 0x000000FF // valid flags.
  400. #define ENABLE_ERROR 0xFFFFFFFF // enable fail code
  401. //
  402. // VDD_OPEN
  403. //
  404. // open a device given a name
  405. //
  406. // Entry:
  407. // Client_ES:EDI - device name
  408. // Client_EDX - flags
  409. // Client_EBX - device id (only for VDD_OPEN_ENUM)
  410. // Exit:
  411. // Client_EAX - device handle
  412. //
  413. #define VDD_OPEN_EXIST 0x00000001 // check if the device name is valid
  414. #define VDD_OPEN_ENUM 0x00000002 // return the Nth device
  415. #define VDD_OPEN_LOCK 0x00000000 // lock the device (default)
  416. #define VDD_OPEN_TEST VDD_OPEN_EXIST
  417. //
  418. // VDD_OPEN_KEY
  419. //
  420. // opens the setting key in the registry for the given device
  421. // the caller must close the key when done.
  422. //
  423. // Entry:
  424. // Client_ES:EDI - points to place to store the opened registry key
  425. // Client_ECX - must be 4, ie sizeof(HKEY)
  426. // Client_EDX - flags
  427. // Client_EBX - device handle
  428. // Exit:
  429. // Client_EAX - 0 for success, or Win32 error code
  430. //
  431. #define VDD_OPEN_KEY_WRITE 0x00000001 // will be writing settings
  432. #define VDD_OPEN_KEY_READ 0x00000002 // only gonig to read settings
  433. #define VDD_OPEN_KEY_USER 0x00000010 // open the per user settings
  434. #define VDD_OPEN_KEY_GLOBAL 0x00000020 // open the global (not per user) settings
  435. //
  436. // WIN32 IOCTLS
  437. //
  438. // The following defines are used with the Win32 function DeviceIOControl
  439. //
  440. #define VDD_IOCTL_SET_NOTIFY 0x10000001 // set mode change notify
  441. #define VDD_IOCTL_GET_DDHAL 0x10000002 // get DDHAL functions from miniVDD
  442. #define VDD_IOCTL_COPY_PROTECTION 0x10000003 // copy protection enable/disable
  443. #define VDD_IOCTL_I2C_OPEN 0x10000004 // open i2c port for access
  444. #define VDD_IOCTL_I2C_ACCESS 0x10000005 // read/write interface
  445. //
  446. // VDD_IOCTL_SET_NOTIFY
  447. //
  448. // sets a notification function that will be called when events
  449. // happen on the device.
  450. //
  451. // input:
  452. // NotifyMask - bitfield of events
  453. //
  454. // VDD_NOTIFY_START_MODE_CHANGE - start of mode change in sysVM
  455. // VDD_NOTIFY_END_MODE_CHANGE - end of mode change in sysVM
  456. // VDD_NOTIFY_ENABLE - sysVM is gaining display focus
  457. // VDD_NOTIFY_DISABLE - sysVM is losing display focus
  458. //
  459. // NotifyType - type of notify
  460. //
  461. // VDD_NOTIFY_TYPE_CALLBACK - NotifyProc is a Ring0 callback
  462. //
  463. // NotifyProc - notify procedure
  464. // NotifyData - client data
  465. //
  466. // output:
  467. // none
  468. //
  469. // return:
  470. // ERROR_SUCCES if callback is set successfuly
  471. //
  472. // notes:
  473. // currenly only one callback, per device can be active.
  474. //
  475. // to unregister a callback do a SET_NOTIFY with a NotifyMask == 0
  476. //
  477. // your callback better be in pagelocked code.
  478. //
  479. // NotifyProc has the following form:
  480. //
  481. // void __cdecl NotifyProc(DWORD NotifyDevice, DWORD NotifyEvent, DWORD NotifyData)
  482. //
  483. // NotifyDevice internal VDD device handle
  484. // NotifyEvent event code (VDD_NOTIFY_*)
  485. // NotifyData your client data
  486. //
  487. //
  488. // VDD_IOCTL_SET_NOTIFY_INPUT
  489. //
  490. typedef struct tagVDD_IOCTL_SET_NOTIFY_INPUT {
  491. DWORD NotifyMask;
  492. DWORD NotifyType;
  493. DWORD NotifyProc;
  494. DWORD NotifyData;
  495. } VDD_IOCTL_SET_NOTIFY_INPUT;
  496. //
  497. // VDD_IOCTL_SET_NOTIFY_INPUT.NotifyMask
  498. //
  499. #define VDD_NOTIFY_START_MODE_CHANGE 0x00000001
  500. #define VDD_NOTIFY_END_MODE_CHANGE 0x00000002
  501. #define VDD_NOTIFY_ENABLE 0x00000004
  502. #define VDD_NOTIFY_DISABLE 0x00000008
  503. //
  504. // VDD_IOCTL_SET_NOTIFY_INPUT.NotifyType
  505. //
  506. #define VDD_NOTIFY_TYPE_CALLBACK 1
  507. //
  508. // Port size equates:
  509. //
  510. #define BYTE_LENGTHED 1
  511. #define WORD_LENGTHED 2
  512. //
  513. // Flag equates:
  514. //
  515. #define GOING_TO_WINDOWS_MODE 1
  516. #define GOING_TO_VGA_MODE 2
  517. #define DISPLAY_DRIVER_DISABLED 4
  518. #define IN_WINDOWS_HIRES_MODE 8
  519. //
  520. // DISPLAYINFO structure
  521. //
  522. typedef struct DISPLAYINFO {
  523. WORD diHdrSize;
  524. WORD diInfoFlags;
  525. //
  526. // display mode specific data
  527. //
  528. DWORD diDevNodeHandle;
  529. char diDriverName[16];
  530. WORD diXRes;
  531. WORD diYRes;
  532. WORD diDPI;
  533. BYTE diPlanes;
  534. BYTE diBpp;
  535. //
  536. // monitor specific data
  537. //
  538. WORD diRefreshRateMax;
  539. WORD diRefreshRateMin;
  540. WORD diLowHorz;
  541. WORD diHighHorz;
  542. WORD diLowVert;
  543. WORD diHighVert;
  544. DWORD diMonitorDevNodeHandle;
  545. BYTE diHorzSyncPolarity;
  546. BYTE diVertSyncPolarity;
  547. //
  548. // new 4.1 stuff
  549. //
  550. DWORD diUnitNumber; // device unit number
  551. DWORD diDisplayFlags; // mode specific flags
  552. DWORD diXDesktopPos; // position of desktop
  553. DWORD diYDesktopPos; // ...
  554. DWORD diXDesktopSize; // size of desktop (for panning)
  555. DWORD diYDesktopSize; // ...
  556. } DISPLAYINFO;
  557. /*ASM
  558. DISPLAYINFO_SIZE equ diRefreshRateMax+2-diHdrSize
  559. DISPLAYINFO_SIZE1 equ diBpp+1-diHdrSize
  560. DISPLAYINFO_SIZE2 equ diVertSyncPolarity+1-diHdrSize
  561. DISPLAYINFO_SIZE3 equ diMemorySize+4-diHdrSize
  562. */
  563. //
  564. // Following are values for the diInfoFlags word in DISPLAYINFO:
  565. //
  566. #define RETURNED_DATA_IS_STALE 0x0001
  567. #define MINIVDD_FAILED_TO_LOAD 0x0002
  568. #define MINIVDD_CHIP_ID_DIDNT_MATCH 0x0004
  569. #define REGISTRY_BPP_NOT_VALID 0x0008
  570. #define REGISTRY_RESOLUTION_NOT_VALID 0x0010
  571. #define REGISTRY_DPI_NOT_VALID 0x0020
  572. #define MONITOR_DEVNODE_NOT_ACTIVE 0x0040
  573. #define MONITOR_INFO_NOT_VALID 0x0080
  574. #define MONITOR_INFO_DISABLED_BY_USER 0x0100
  575. #define REFRESH_RATE_MAX_ONLY 0x0200
  576. #define CARD_VDD_LOADED_OK 0x0400
  577. #define DEVICE_IS_NOT_VGA 0x0800
  578. //
  579. // Following are explanations for the diInfoFlags word in DISPLAYINFO:
  580. //
  581. // RETURNED_DATA_IS_STALE, if set, means that this call to VDD_GET_DISPLAY_CONFIG
  582. // or VDD_GetDisplayInfo (which are the Ring 3 and Ring 0 methods by which a
  583. // program would get the DISPLAYINFO structure returned to him) caused the VDD
  584. // to return data that was read in a previous call to VDD_GET_DISPLAY_CONFIG
  585. // insted of actually going out and reading "fresh" data from the Registry.
  586. //
  587. // This flag brings to light the fact that there are some circumstances when the
  588. // VDD cannot go out and read the registry in response to the call to
  589. // VDD_GET_DISPLAY_CONFIG or VDD_GetDisplayInfo (due to system multi-tasking
  590. // considerations). In this case, this flag will be set to a 1 to indicate that
  591. // the information being returned isn't "fresh" -- that is -- it may be
  592. // incorrect and obsolete. The caller should respond accordingly if this flag
  593. // is set.
  594. //
  595. //
  596. // MINIVDD_FAILED_TO_LOAD if set, indicates that for some reason (typically
  597. // that the MiniVDD didn't match the chipset installed in the machine), the
  598. // MiniVDD didn't load. Callers can examine this flag and act accordingly.
  599. //
  600. //
  601. // MINIVDD_CHIP_ID_DIDNT_MATCH means that although the MiniVDD did load
  602. // successfully, when the ChipID that the MiniVDD calculated was compared
  603. // against the value saved in the registry, they didn't match. An example of
  604. // when this would happen is when the user is happily using an S3-911 card
  605. // and then decides to upgrade his display card to an S3-864. Since both
  606. // cards use S3.VXD, the MiniVDD will load, however, since the card model
  607. // is different, the VDD will return a defect to configuration manager and
  608. // set this flag. Callers of the GET_DISPLAY_CONFIG functions can use this
  609. // flag to take appropriate actions to make sure that the user gets his
  610. // configuration correct.
  611. //
  612. //
  613. // REGISTRY_BPP_NOT_VALID if set, means that we failed to obtain the BPP value
  614. // from the registry when the VDD tried to read it.
  615. //
  616. //
  617. // REGISTRY_RESOLUTION_NOT_VALID if set, means that we failed to obtain the
  618. // resolution value from the registry when the VDD tried to read it.
  619. //
  620. //
  621. // REGISTRY_DPI_NOT_VALID if set, means that we failed to obtain the
  622. // DPI value from the registry when the VDD tried to read it.
  623. //
  624. //
  625. // MONITOR_DEVNODE_NOT_ACTIVE is set if someone tries to make a call to the
  626. // GET_DISPLAY_CONFIG function before the monitor DevNode has been created.
  627. // This is certainly not fatal by any means. It simply means that the
  628. // monitor refresh rate info in the DISPLAYINFO data structure is totally
  629. // invalid!
  630. //
  631. //
  632. // MONITOR_INFO_NOT_VALID indicates that something within the code which
  633. // retrieves and calculates the refresh rate data has failed. This indicates
  634. // that the values in diRefreshRateMax through diVertSyncPolarity are not
  635. // valid and could contain random data.
  636. //
  637. //
  638. // MONITOR_INFO_DISABLED_BY_USER indicates that the either the RefreshRate=
  639. // string in SYSTEM.INI had a negative number in it or that the string in
  640. // the display's software key RefreshRate = string was 0 or a negative number.
  641. //
  642. //
  643. // REFRESH_RATE_MAX_ONLY indicates that there was no diLowHorz, diHighHorz,
  644. // diLowVert, diHighVert, or sync polarity data in the registry. The
  645. // value returned in diRefreshRateMax is the only refresh rate data that
  646. // we have available. This was derived either from RefreshRate= in SYSTEM.INI
  647. // or the display software key RefreshRate = string in the registry.
  648. //
  649. //
  650. // CARD_VDD_LOADED_OK indicates that a second MiniVDD (which is useful for
  651. // display card manufacturers wishing to extend the capabilities of the chip level
  652. // MiniVDD's ) has successfully been loaded and initialized.
  653. //
  654. // DEVICE_IS_NOT_VGA indicates that this device is not the primary vga
  655. //
  656. #define NoTrace_VIRTUALIZE_CRTC_IN
  657. #define NoTrace_VIRTUALIZE_CRTC_OUT
  658. #define NoTrace_VIRTUALIZE_SEQUENCER_IN
  659. #define NoTrace_VIRTUALIZE_SEQUENCER_OUT
  660. #define NoTrace_VIRTUALIZE_GCR_IN
  661. #define NoTrace_VIRTUALIZE_GCR_OUT
  662. #define NoTrace_VIRTUALIZE_DAC_OUT
  663. #define NoTrace_VIRTUALIZE_DAC_IN
  664. #define NoTrace_CHECK_HIRES_MODE
  665. /*ASM
  666. ifdef NEC_98
  667. ;******************************************************************************
  668. ; E Q U A T E S
  669. ;******************************************************************************
  670. ;
  671. ; Mini-VDD Static Flags
  672. ;
  673. vFlg_Machine_Std equ 00000001b
  674. vFlg_Machine_Multi equ 00000010b
  675. vFlg_Machine_Mate equ 00000100b
  676. vFlg_Machine_H98 equ 00001000b
  677. vFlg_CRT_New equ 00010000b
  678. vFlg_CRT_NonInter equ 00100000b
  679. vFlg_GDC_5MHz equ 01000000b
  680. vFlg_GDC_Emulate equ 10000000b
  681. vFlg_Acc_Internal equ 0000000100000000b
  682. vFlg_Acc_External equ 0000001000000000b
  683. vFlg_Acc_PCI equ 0000010000000000b
  684. vFlg_Acc_ML equ 0000100000000000b
  685. vFlg_Acc_PVD equ 0001000000000000b
  686. vFlg_Mode_NH equ 0010000000000000b
  687. vFlg_Mode_H equ 0100000000000000b
  688. vFlg_Initialized equ 1000000000000000b
  689. vFlg_Opt_MFR equ 000000010000000000000000b
  690. vFlg_Opt_NewMFR equ 000000100000000000000000b
  691. vFlg_Opt_VDP equ 000001000000000000000000b
  692. vFlg_Opt_NewVDP equ 000010000000000000000000b
  693. vFlg_Local equ 000000000100000010000000b
  694. ;
  695. ; Mini-VDD Support Max
  696. ;
  697. MaxMiniVDD equ 16
  698. MaxMiniTrap equ 32
  699. MaxMultiTrap equ 3
  700. MaxMultiFunc equ MaxMiniVDD
  701. ;
  702. ; MiniVDD_LTrap_Struct.LTrap_Status
  703. ; MiniVDD_LTrap_Struct.LTrap_Flags.xxxx
  704. ;
  705. LT_Enable equ 00000001b
  706. LT_Enable_bit equ 0
  707. LT_Initialized equ 10000000b
  708. LT_Initialized_bit equ 7
  709. ;******************************************************************************
  710. ; D A T A S T R U C T U R E S
  711. ;******************************************************************************
  712. ;
  713. ; Vids_struct
  714. ;
  715. Vids_struct struc
  716. ;
  717. ; Common Data supplied by Base-VDD. Some data(bits) set by Mini-VDD.
  718. ;
  719. Vids_SFlags dd ? ; Static flags
  720. Vids_CB_Offset dd ? ;
  721. Vids_Msg_Pseudo_VM dd ? ;
  722. ;
  723. ; Common Procedure supplied by Base-VDD
  724. ;
  725. VDD_TGDC_Draw_Off dd ? ;
  726. VDD_TGDC_Sync_Off dd ? ;
  727. VDD_TGDC_Sync_On dd ? ;
  728. VDD_TGDC_FIFO_Empty dd ? ;
  729. VDD_GGDC_Draw_Off dd ? ;
  730. VDD_GGDC_Sync_Off dd ? ;
  731. VDD_GGDC_Sync_On dd ? ;
  732. VDD_GGDC_FIFO_Empty dd ? ;
  733. VDD_GGDC_MOD_Emulate dd ? ;
  734. ;
  735. ; Common Procedure supplied by Mini-VDD
  736. ;
  737. H98_FLORA_Change dd ? ; H98 - NH mode
  738. H98_Clear_Text dd ? ; H98 - NH mode
  739. H98_Rest_GCs dd ? ; H98
  740. H98_Rest_etc dd ? ; H98
  741. H98_Save_ModeFF dd ? ; H98
  742. Vids_struct ends
  743. Vid_SFlags equ <Vids.Vids_SFlags>
  744. VDD_CB_Offset equ <Vids.Vids_CB_Offset>
  745. VDD_Msg_Pseudo_VM equ <Vids.Vids_Msg_Pseudo_VM>
  746. TGDC_Draw_Off equ <Vids.VDD_TGDC_Draw_Off>
  747. GGDC_Draw_Off equ <Vids.VDD_GGDC_Draw_Off>
  748. TGDC_Sync_On equ <Vids.VDD_TGDC_Sync_On>
  749. TGDC_Sync_Off equ <Vids.VDD_TGDC_Sync_Off>
  750. TGDC_FIFO_Empty equ <Vids.VDD_TGDC_FIFO_Empty>
  751. GGDC_FIFO_Empty equ <Vids.VDD_GGDC_FIFO_Empty>
  752. ;
  753. ; RegTrapStruct
  754. ;
  755. MiniFuncStruct STRUC
  756. MF_ProcAddr dd ?
  757. ;;MF_Order dw ?
  758. ;;MF_MiniID db ?
  759. ;;MF_Flags db ?
  760. MiniFuncStruct ENDS
  761. ;
  762. ; MiniProcStruct
  763. ;
  764. MiniVDD_Proc_Struct STRUC
  765. Proc_Address dd ?
  766. Proc_Order dw ?
  767. Proc_MiniID db ?
  768. Proc_Flags db ?
  769. MiniVDD_Proc_Struct ENDS
  770. .errnz (size MiniVDD_Proc_Struct) mod 4
  771. ;
  772. ; MiniTrapTable - Global Info
  773. ; LocalTrapTable - Local Status
  774. ;
  775. MiniVDD_GTrap_Struct STRUC
  776. GTrap_ProcAddr dd ?
  777. GTrap_PortAddr dw ?
  778. GTrap_NumMini dw ?
  779. GTrap_ProcTable db ((size MiniVDD_Proc_Struct) * MaxMultiTrap) dup (?)
  780. MiniVDD_GTrap_Struct ENDS
  781. MiniVDD_LTrap_Struct STRUC
  782. LTrap_ProcAddr dd ?
  783. LTrap_Status db ?
  784. LTrap_Flags db MaxMultiTrap dup (?)
  785. MiniVDD_LTrap_Struct ENDS
  786. ;******************************************************************************
  787. ; M A C R O S
  788. ;******************************************************************************
  789. ;
  790. ; BeginMiniFunc TableName
  791. ; MiniFunc Function-ID, ProcedureName
  792. ; |
  793. ; EndMiniFunc TableName
  794. ;
  795. EndMiniFunc_ MACRO n
  796. ifdef MiniFunc&n
  797. dd OFFSET32 MiniFunc&n ; MiniFuncStruct
  798. else
  799. dd 0
  800. endif
  801. ENDM
  802. MiniFunc_ MACRO FuncID, FuncName
  803. MiniFunc&FuncID equ <FuncName>
  804. ENDM
  805. BeginMiniFunc MACRO TableName
  806. public TableName
  807. TableName label near
  808. ENDM
  809. if 1
  810. EndMiniFunc MACRO TableName
  811. x = 0
  812. REPT NBR_MINI_VDD_FUNCTIONS_41
  813. EndMiniFunc_ %x
  814. x = x + 1
  815. ENDM
  816. ENDM
  817. else
  818. EndMiniFunc MACRO TableName
  819. x = 0
  820. REPT NBR_MINI_VDD_FUNCTIONS
  821. EndMiniFunc_ %x
  822. x = x + 1
  823. ENDM
  824. ENDM
  825. endif
  826. MiniFunc MACRO FuncID, FuncName
  827. MiniFunc_ %(FuncID), <FuncName>
  828. ENDM
  829. ;
  830. ; MiniVDDCall Function-ID
  831. ;
  832. MiniVDDCall MACRO FuncID, SetCarry
  833. local MiniCall_Loop
  834. local MiniCall_Exit
  835. push ecx
  836. push esi
  837. lea esi, [MiniVDD_Func_Table][(size MiniVDD_Proc_Struct) * MaxMultiFunc * FuncID]
  838. mov ecx, [MiniVDD_NumMini]
  839. MiniCall_Loop:
  840. cmp dword ptr [esi.Proc_Address], 0
  841. jz MiniCall_Exit
  842. pushad
  843. ifnb <SetCarry>
  844. stc
  845. endif
  846. call dword ptr [esi.Proc_Address]
  847. popad
  848. jc MiniCall_Exit
  849. add esi, size MiniVDD_Proc_Struct
  850. loop MiniCall_Loop
  851. MiniCall_Exit:
  852. pop esi
  853. pop ecx
  854. ENDM
  855. ;
  856. ; MiniVDDCall2 Function-ID
  857. ;
  858. MiniVDDCall2 MACRO FuncID, SetCarry
  859. local MiniCall_Exit
  860. local MiniCall_Proc
  861. push ecx
  862. push esi
  863. lea esi, [MiniVDD_Func_Table][(size MiniVDD_Proc_Struct) * MaxMultiFunc * FuncID]
  864. MiniCall_Proc:
  865. cmp dword ptr [esi.Proc_Address], 0
  866. jz MiniCall_Exit
  867. pushad
  868. ifnb <SetCarry>
  869. stc
  870. endif
  871. call dword ptr [esi.Proc_Address]
  872. popad
  873. MiniCall_Exit:
  874. pop esi
  875. pop ecx
  876. ENDM
  877. ;
  878. ; MiniVDDCall3 Function-ID
  879. ;
  880. MiniVDDCall3 MACRO FuncID, MiniID, SetCarry
  881. local MiniCall_Exit
  882. local MiniCall_Loop
  883. local MiniCall_Proc
  884. push ecx
  885. push esi
  886. lea esi, [MiniVDD_Func_Table][(size MiniVDD_Proc_Struct) * MaxMultiFunc * FuncID]
  887. movzx ecx, MiniID
  888. MiniCall_Loop:
  889. cmp ecx, 0
  890. jz MiniCall_Proc
  891. add esi, size MiniVDD_Proc_Struct
  892. dec ecx
  893. jmp MiniCall_Loop
  894. MiniCall_Proc:
  895. cmp dword ptr [esi.Proc_Address], 0
  896. jz MiniCall_Exit
  897. pushad
  898. ifnb <SetCarry>
  899. stc
  900. endif
  901. call dword ptr [esi.Proc_Address]
  902. popad
  903. MiniCall_Exit:
  904. pop esi
  905. pop ecx
  906. ENDM
  907. ;
  908. ; MiniVDDCall Function-ID
  909. ;
  910. MiniVDDFunc MACRO TmpReg, FuncID
  911. mov TmpReg, [MiniVDD_Func_Table.Proc_Address][(size MiniVDD_Proc_Struct) * MaxMultiFunc * FuncID]
  912. ENDM
  913. ;
  914. ; ExecMode/ExecModeThru
  915. ; ExecModeNot/ExecModeThruNot
  916. ; ExecModeOnly
  917. ; ExecModeOnlyNot
  918. ; ExecModeElse
  919. ; ExecModeElseNot
  920. ; ExecModeEnd
  921. ;
  922. ExecModeLL macro Num
  923. ExecMode_L&Num:
  924. endm
  925. ExecModeLE macro Num
  926. ExecMode_E&Num:
  927. endm
  928. ExecModeJE macro Num
  929. jmp ExecMode_E&Num
  930. endm
  931. ExecModeJZ macro Num
  932. jz ExecMode_L&Num
  933. endm
  934. ExecModeJNZ macro Num
  935. jnz ExecMode_L&Num
  936. endm
  937. ExecModeJEZ macro Num
  938. jz ExecMode_E&Num
  939. endm
  940. ExecModeJENZ macro Num
  941. jnz ExecMode_E&Num
  942. endm
  943. ExecModeTest macro ModeFlag, CB_Reg
  944. if ModeFlag and vFlg_Local
  945. ifidni <CB_Reg>, <Vid>
  946. push ebx
  947. mov ebx, [Vid_VM_Handle]
  948. add ebx, [VDD_CB_Offset]
  949. test [ebx.VDD_SFlags], ModeFlag
  950. pop ebx
  951. else
  952. ifidni <CB_Reg>, <Cur>
  953. push ebx
  954. VMMCall Get_Cur_VM_Handle
  955. add ebx, [VDD_CB_Offset]
  956. test [ebx.VDD_SFlags], ModeFlag
  957. pop ebx
  958. else
  959. ifb <CB_Reg>
  960. push ebx
  961. add ebx, [VDD_CB_Offset]
  962. test [ebx.VDD_SFlags], ModeFlag
  963. pop ebx
  964. else
  965. test [CB_Reg.VDD_SFlags], ModeFlag
  966. endif
  967. endif
  968. endif
  969. else
  970. test [Vid_SFlags], ModeFlag
  971. endif
  972. endm
  973. ExecModeChk macro HdrFlag, JmpFlag, JmpLabel, ModeFlag, CB_Reg
  974. ifidni <HdrFlag>, <Jmp>
  975. .erre FlgExecMode
  976. ExecModeJE %EndExecMode
  977. endif
  978. ExecModeLL %NumExecMode
  979. NumExecMode = NumExecMode + 1
  980. FlgExecMode = 1
  981. ifnb <ModeFlag>
  982. ExecModeTest <ModeFlag>, <CB_Reg>
  983. ifidni <JmpLabel>, <End>
  984. ifidni <JmpFlag>, <Not>
  985. ExecModeJENZ %EndExecMode
  986. else
  987. ExecModeJEZ %EndExecMode
  988. endif
  989. else
  990. ifidni <JmpFlag>, <Not>
  991. ExecModeJNZ %NumExecMode
  992. else
  993. ExecModeJZ %NumExecMode
  994. endif
  995. endif
  996. endif
  997. endm
  998. ExecModeEnd macro
  999. ExecModeLL %NumExecMode
  1000. ExecModeLE %EndExecMode
  1001. NumExecMode = NumExecMode + 1
  1002. EndExecMode = EndExecMode + 1
  1003. FlgExecMode = 0
  1004. endm
  1005. ;
  1006. ; CB_Reg = Regs/Vid/Cur
  1007. ; ModeFlag = vFlg_xxxx
  1008. ;
  1009. ExecModeJmp macro JmpLabel, ModeFlag, CB_Reg
  1010. ExecModeTest %ModeFlag, <CB_Reg>
  1011. jnz JmpLabel
  1012. endm
  1013. ExecModeJmpNot macro JmpLabel, ModeFlag, CB_Reg
  1014. ExecModeTest %ModeFlag, <CB_Reg>
  1015. jz JmpLabel
  1016. endm
  1017. ExecMode macro ModeFlag, CB_Reg
  1018. ExecModeChk Top, Equ, Next, %ModeFlag, CB_Reg
  1019. endm
  1020. ExecModeNot macro ModeFlag, CB_Reg
  1021. ExecModeChk Top, Not, Next, %ModeFlag, CB_Reg
  1022. endm
  1023. ExecModeOnly macro ModeFlag, CB_Reg
  1024. ExecModeChk Top, Equ, End, %ModeFlag, CB_Reg
  1025. endm
  1026. ExecModeOnlyNot macro ModeFlag, CB_Reg
  1027. ExecModeChk Top, Not, End, %ModeFlag, CB_Reg
  1028. endm
  1029. ExecModeElse macro ModeFlag, CB_Reg
  1030. ExecModeChk Jmp, Equ, Next, %ModeFlag, CB_Reg
  1031. endm
  1032. ExecModeElseNot macro ModeFlag, CB_Reg
  1033. ExecModeChk Jmp, Not, Next, %ModeFlag, CB_Reg
  1034. endm
  1035. ExecModeThru macro ModeFlag, CB_Reg
  1036. ExecModeChk Thru, Equ, Next, %ModeFlag, CB_Reg
  1037. endm
  1038. ExecModeThruNot macro ModeFlag, CB_Reg
  1039. ExecModeChk Thru, Not, Next, %ModeFlag, CB_Reg
  1040. endm
  1041. NumExecMode = 1
  1042. EndExecMode = 1
  1043. FlgExecMode = 0
  1044. else ;NEC_98
  1045. ;
  1046. ;Some external definitions. Only define these if we're assembling the
  1047. ;device independent "main" portion of the Mini-VDD:
  1048. ;
  1049. ifdef MAINVDD
  1050. externdef MiniVDDDispatchTable:dword ;in VDDCTL.ASM
  1051. endif ;MAINVDD
  1052. ;
  1053. ;
  1054. MiniVDDDispatch macro FunctionCode, HandlerAddr
  1055. mov [edi+(FunctionCode*4)],OFFSET32 MiniVDD_&HandlerAddr
  1056. endm
  1057. ;
  1058. ;
  1059. CardVDDDispatch macro FunctionCode, HandlerAddr
  1060. mov [edi+(FunctionCode*4)],OFFSET32 CardVDD_&HandlerAddr
  1061. endm
  1062. ;
  1063. ;
  1064. MiniVDDCall macro FunctionCode, SaveFlags
  1065. local MiniVDDCallExit, MiniVDDCallLeave
  1066. ifdef MAXDEBUG
  1067. ifndef NoTrace_&FunctionCode&
  1068. Trace_Out "MiniVDDCall: &FunctionCode&"
  1069. endif
  1070. endif
  1071. push edi ;;save this register for now
  1072. ifnb <SaveFlags>
  1073. pushfd ;;save the flags state
  1074. endif
  1075. mov edi,OFFSET32 MiniVDDDispatchTable
  1076. cmp dword ptr [edi+(FunctionCode*4)],0
  1077. je MiniVDDCallLeave ;;MiniVDD doesn't support this
  1078. ifnb <SaveFlags>
  1079. popfd ;;just clear the Stack from the flags
  1080. endif
  1081. call dword ptr [edi+(FunctionCode*4)]
  1082. ifnb <SaveFlags>
  1083. jmp MiniVDDCallExit ;;we already restored the flags
  1084. endif
  1085. ;
  1086. MiniVDDCallLeave:
  1087. ifnb <SaveFlags>
  1088. popfd ;;
  1089. endif
  1090. ;
  1091. MiniVDDCallExit:
  1092. pop edi ;;we're done handling this call
  1093. endm
  1094. endif ;NEC_98
  1095. */
  1096. #endif // _MINIVDD_H_