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.

502 lines
17 KiB

  1. #include <windows.h>
  2. #include <stdio.h>
  3. #include <conio.h>
  4. #include "demexp.h"
  5. #include "cmdsvc.h"
  6. #include "rdrexp.h"
  7. #include "dbgexp.h"
  8. #include "softpc.h"
  9. #include "fun.h"
  10. //
  11. // This module contains the fake function definitions for bop functions
  12. //
  13. extern CONTEXT IntelRegisters;
  14. extern VOID switch_to_real_mode();
  15. extern VOID host_unsimulate();
  16. HANDLE hWOWDll;
  17. FARPROC WOWDispatchEntry;
  18. FARPROC WOWInitEntry;
  19. void DBGDispatch( void );
  20. void reset(){}
  21. void dummy_int(){}
  22. void unexpected_int(){}
  23. void illegal_bop(){}
  24. void print_screen(){}
  25. void time_int(){}
  26. void keyboard_int(){}
  27. void diskette_int(){}
  28. void video_io(){}
  29. void equipment(){}
  30. void memory_size(){}
  31. void disk_io(){}
  32. void rs232_io(){}
  33. void cassette_io(){}
  34. void keyboard_io(){}
  35. void printer_io(){}
  36. void rom_basic(){}
  37. void bootstrap(){}
  38. void time_of_day(){}
  39. void critical_region(){}
  40. void cmd_install(){}
  41. void cmd_load(){}
  42. void redirector(){}
  43. void ega_video_io(){}
  44. void MsBop0(){
  45. DemDispatch((ULONG)(*Sim32GetVDMPointer(
  46. ((ULONG)getCS() << 16) + (getIP()), 1, FALSE)));
  47. setIP(getIP() + 1);
  48. }
  49. void MsBop1(){
  50. static WowModeInitialized = FALSE;
  51. if (!WowModeInitialized) {
  52. // Load the WOW DLL
  53. if ((hWOWDll = LoadLibrary ("WOW32")) == NULL){
  54. VDprint(
  55. VDP_LEVEL_ERROR,
  56. ("SoftPC: error initializing WOW\n")
  57. );
  58. TerminateVDM();
  59. return;
  60. }
  61. // Get the init entry point and dispatch entry point
  62. if ((WOWInitEntry = GetProcAddress (hWOWDll, "W32Init")) == NULL) {
  63. VDprint(
  64. VDP_LEVEL_ERROR,
  65. ("SoftPC: error initializing WOW\n")
  66. );
  67. FreeLibrary (hWOWDll);
  68. TerminateVDM();
  69. return;
  70. }
  71. if ((WOWDispatchEntry = GetProcAddress (hWOWDll, "W32Dispatch")) == NULL) {
  72. VDprint(
  73. VDP_LEVEL_ERROR,
  74. ("SoftPC: error initializing WOW\n")
  75. );
  76. FreeLibrary (hWOWDll);
  77. TerminateVDM();
  78. return;
  79. }
  80. // Call the Init Routine
  81. if ((*WOWInitEntry)() == FALSE) {
  82. VDprint(
  83. VDP_LEVEL_ERROR,
  84. ("SoftPC: error initializing WOW\n")
  85. );
  86. TerminateVDM();
  87. return;
  88. }
  89. WowModeInitialized = TRUE;
  90. }
  91. (*WOWDispatchEntry)();
  92. }
  93. void MsBop2(){
  94. XMSDispatch((ULONG)(*Sim32GetVDMPointer(
  95. ((ULONG)getCS() << 16) + (getIP()), 1, FALSE)));
  96. setIP(getIP() + 1);
  97. }
  98. void MsBop3(){
  99. DpmiDispatch();
  100. }
  101. void MsBop4(){
  102. CmdDispatch((ULONG)(*Sim32GetVDMPointer(
  103. ((ULONG)getCS() << 16) + (getIP()), 1, FALSE)));
  104. setIP(getIP() + 1);
  105. }
  106. //
  107. // MsBop5 - used to dispatch to Vdm Redir (Vr) support functions
  108. //
  109. void MsBop5()
  110. {
  111. #ifdef NTVDM_NET_SUPPORT
  112. VrDispatch((ULONG)(*Sim32GetVDMPointer(
  113. ((ULONG)getCS() << 16) + (getIP()), 1, FALSE)));
  114. setIP(getIP() + 1);
  115. #endif
  116. }
  117. //
  118. // MsBop6 - used to dispatch to debugger support functions
  119. //
  120. void MsBop6()
  121. {
  122. /*
  123. ** All of the parameters for the debugger support
  124. ** should be on the VDMs stack.
  125. */
  126. DBGDispatch();
  127. }
  128. void MsBop7(){}
  129. void MsBop8(){}
  130. void MsBop9(){}
  131. void MsBopA(){}
  132. void MsBopB(){
  133. switch (getAH()) {
  134. case 0 :
  135. setAH(0);
  136. while (!tkbhit());
  137. setAL((BYTE)tgetch());
  138. break;
  139. case 1 :
  140. tputch(getAL());
  141. break;
  142. }
  143. }
  144. void MsBopC(){
  145. BiosKbd();
  146. }
  147. void MsBopD(){
  148. BiosVid();
  149. }
  150. void MsBopE(){}
  151. void MsBopF(){
  152. UCHAR *Instruction;
  153. USHORT i;
  154. // Unimplemented interrupt bop
  155. Instruction = RMSEGOFFTOLIN(getSS(), getSP());
  156. Instruction = RMSEGOFFTOLIN(*((PWORD)Instruction + 1),
  157. *(PWORD)(Instruction));
  158. i = (USHORT)(*(Instruction - 1));
  159. VDprint(
  160. VDP_LEVEL_WARNING,
  161. ("SoftPC Bop Support: Unimplemented Interrupt %x\n",
  162. i)
  163. );
  164. }
  165. void emm_init(){}
  166. void emm_io(){}
  167. void return_from_call(){}
  168. void rtc_int(){}
  169. void re_direct(){}
  170. void D11_int(){}
  171. void int_287(){}
  172. void worm_init(){}
  173. void worm_io(){}
  174. void ps_private_1(){}
  175. void ps_private_2(){}
  176. void ps_private_3(){}
  177. void ps_private_4(){}
  178. void ps_private_5(){}
  179. void ps_private_6(){}
  180. void ps_private_7(){}
  181. void ps_private_8(){}
  182. void ps_private_9(){}
  183. void ps_private_10(){}
  184. void ps_private_11(){}
  185. void ps_private_12(){}
  186. void ps_private_13(){}
  187. void ps_private_14(){}
  188. void ps_private_15(){}
  189. void bootstrap1(){}
  190. void bootstrap2(){}
  191. void bootstrap3(){}
  192. void ms_windows(){}
  193. void msw_mouse(){}
  194. void mouse_install1(){}
  195. void mouse_install2(){}
  196. void mouse_int1(){}
  197. void mouse_int2(){}
  198. void mouse_io_language(){}
  199. void mouse_io_interrupt(){}
  200. void mouse_video_io(){}
  201. void control_bop(){}
  202. void diskette_io(){}
  203. void illegal_op_int(){}
  204. VOID (*BIOS[])(VOID) = { reset,
  205. dummy_int,
  206. unexpected_int,
  207. illegal_bop,
  208. illegal_bop,
  209. print_screen,
  210. illegal_op_int,
  211. illegal_bop,
  212. time_int,
  213. keyboard_int,
  214. illegal_bop,
  215. illegal_bop,
  216. illegal_bop,
  217. illegal_bop,
  218. diskette_int,
  219. illegal_bop,
  220. video_io,
  221. equipment,
  222. memory_size,
  223. disk_io,
  224. rs232_io,
  225. cassette_io,
  226. keyboard_io,
  227. printer_io,
  228. rom_basic,
  229. bootstrap,
  230. time_of_day,
  231. illegal_bop,
  232. illegal_bop,
  233. illegal_bop,
  234. illegal_bop,
  235. illegal_bop,
  236. illegal_bop,
  237. illegal_bop,
  238. illegal_bop,
  239. illegal_bop,
  240. illegal_bop,
  241. illegal_bop,
  242. illegal_bop,
  243. illegal_bop,
  244. illegal_bop,
  245. illegal_bop,
  246. critical_region,
  247. cmd_install,
  248. cmd_load,
  249. illegal_bop,
  250. illegal_bop,
  251. redirector,
  252. illegal_bop,
  253. illegal_bop,
  254. illegal_bop,
  255. illegal_bop,
  256. illegal_bop,
  257. illegal_bop,
  258. illegal_bop,
  259. illegal_bop,
  260. illegal_bop,
  261. illegal_bop,
  262. illegal_bop,
  263. illegal_bop,
  264. illegal_bop,
  265. illegal_bop,
  266. illegal_bop,
  267. illegal_bop,
  268. diskette_io,
  269. illegal_bop,
  270. ega_video_io,
  271. illegal_bop,
  272. illegal_bop,
  273. illegal_bop,
  274. illegal_bop,
  275. illegal_bop,
  276. illegal_bop,
  277. illegal_bop,
  278. illegal_bop,
  279. illegal_bop,
  280. illegal_bop,
  281. illegal_bop,
  282. illegal_bop,
  283. illegal_bop,
  284. MsBop0,
  285. MsBop1,
  286. MsBop2,
  287. MsBop3,
  288. MsBop4,
  289. MsBop5,
  290. MsBop6,
  291. MsBop7,
  292. MsBop8,
  293. MsBop9,
  294. MsBopA,
  295. MsBopB,
  296. MsBopC,
  297. MsBopD,
  298. MsBopE,
  299. MsBopF,
  300. illegal_bop,
  301. illegal_bop,
  302. illegal_bop,
  303. illegal_bop,
  304. illegal_bop,
  305. illegal_bop,
  306. emm_init,
  307. emm_io,
  308. return_from_call,
  309. illegal_bop,
  310. illegal_bop,
  311. illegal_bop,
  312. illegal_bop,
  313. illegal_bop,
  314. illegal_bop,
  315. illegal_bop,
  316. rtc_int,
  317. re_direct,
  318. D11_int,
  319. D11_int,
  320. D11_int,
  321. int_287,
  322. D11_int,
  323. D11_int,
  324. worm_init,
  325. worm_io,
  326. illegal_bop,
  327. illegal_bop,
  328. illegal_bop,
  329. illegal_bop,
  330. illegal_bop,
  331. illegal_bop,
  332. ps_private_1,
  333. ps_private_2,
  334. ps_private_3,
  335. ps_private_4,
  336. ps_private_5,
  337. ps_private_6,
  338. ps_private_7,
  339. ps_private_8,
  340. ps_private_9,
  341. ps_private_10,
  342. ps_private_11,
  343. ps_private_12,
  344. ps_private_13,
  345. ps_private_14,
  346. ps_private_15,
  347. illegal_bop,
  348. bootstrap1,
  349. bootstrap2,
  350. bootstrap3,
  351. illegal_bop,
  352. illegal_bop,
  353. illegal_bop,
  354. illegal_bop,
  355. illegal_bop,
  356. ms_windows,
  357. msw_mouse,
  358. illegal_bop,
  359. illegal_bop,
  360. illegal_bop,
  361. illegal_bop,
  362. illegal_bop,
  363. illegal_bop,
  364. illegal_bop,
  365. illegal_bop,
  366. illegal_bop,
  367. illegal_bop,
  368. illegal_bop,
  369. illegal_bop,
  370. illegal_bop,
  371. illegal_bop,
  372. illegal_bop,
  373. illegal_bop,
  374. illegal_bop,
  375. illegal_bop,
  376. illegal_bop,
  377. illegal_bop,
  378. illegal_bop,
  379. illegal_bop,
  380. illegal_bop,
  381. illegal_bop,
  382. illegal_bop,
  383. illegal_bop,
  384. illegal_bop,
  385. illegal_bop,
  386. illegal_bop,
  387. illegal_bop,
  388. mouse_install1,
  389. mouse_install2,
  390. mouse_int1,
  391. mouse_int2,
  392. mouse_io_language,
  393. mouse_io_interrupt,
  394. mouse_video_io,
  395. illegal_bop,
  396. illegal_bop,
  397. illegal_bop,
  398. illegal_bop,
  399. illegal_bop,
  400. illegal_bop,
  401. illegal_bop,
  402. illegal_bop,
  403. illegal_bop,
  404. illegal_bop,
  405. illegal_bop,
  406. illegal_bop,
  407. illegal_bop,
  408. illegal_bop,
  409. illegal_bop,
  410. illegal_bop,
  411. illegal_bop,
  412. illegal_bop,
  413. illegal_bop,
  414. illegal_bop,
  415. illegal_bop,
  416. illegal_bop,
  417. illegal_bop,
  418. illegal_bop,
  419. illegal_bop,
  420. illegal_bop,
  421. illegal_bop,
  422. illegal_bop,
  423. illegal_bop,
  424. illegal_bop,
  425. illegal_bop,
  426. illegal_bop,
  427. illegal_bop,
  428. illegal_bop,
  429. illegal_bop,
  430. illegal_bop,
  431. illegal_bop,
  432. illegal_bop,
  433. illegal_bop,
  434. illegal_bop,
  435. illegal_bop,
  436. illegal_bop,
  437. illegal_bop,
  438. illegal_bop,
  439. illegal_bop,
  440. illegal_bop,
  441. illegal_bop,
  442. illegal_bop,
  443. illegal_bop,
  444. illegal_bop,
  445. illegal_bop,
  446. illegal_bop,
  447. illegal_bop,
  448. illegal_bop,
  449. illegal_bop,
  450. illegal_bop,
  451. illegal_bop,
  452. illegal_bop,
  453. illegal_bop,
  454. illegal_bop,
  455. illegal_bop,
  456. illegal_bop,
  457. switch_to_real_mode,
  458. host_unsimulate,
  459. control_bop };