|
|
1.1 root 1: /*
2: MS-DOS Player for Win32 console
3:
4: Author : Takeda.Toshiya
5: Date : 2009.11.09-
6: */
7:
8: #ifndef _MSDOS_H_
9: #define _MSDOS_H_
10:
1.1.1.12 root 11: #ifndef _WIN32_WINNT
12: #define _WIN32_WINNT 0x501
13: #endif
1.1 root 14: #include <windows.h>
15: #include <winioctl.h>
16: #include <tchar.h>
1.1.1.13 root 17: #include <stddef.h>
1.1 root 18: #include <stdlib.h>
19: #include <stdio.h>
1.1.1.2 root 20: #include <assert.h>
1.1 root 21: #include <conio.h>
1.1.1.27 root 22: #include <locale.h>
1.1.1.2 root 23: #include <math.h>
1.1 root 24: #include <dos.h>
25: #include <fcntl.h>
26: #include <sys/types.h>
27: #include <sys/stat.h>
28: #include <io.h>
29: #include <sys/locking.h>
30: #include <mbctype.h>
31: #include <direct.h>
32: #include <errno.h>
1.1.1.9 root 33: #include <tlhelp32.h>
34: #include <psapi.h>
1.1.1.20 root 35: #include <setupapi.h>
1.1.1.27 root 36: #include <winsock.h>
1.1 root 37:
1.1.1.15 root 38: #ifdef _DEBUG
39: #define _CRTDBG_MAP_ALLOC
40: #include <crtdbg.h>
41: #define calloc(c, s) _calloc_dbg(c, s, _NORMAL_BLOCK, __FILE__, __LINE__)
42: #define malloc(s) _malloc_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
43: #define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
44: #endif
45:
1.1.1.9 root 46: // variable scope of 'for' loop for Microsoft Visual C++ 6.0
47: #if defined(_MSC_VER) && (_MSC_VER == 1200)
1.1 root 48: #define for if(0);else for
49: #endif
1.1.1.9 root 50:
51: // disable warnings for Microsoft Visual C++ 2005 or later
1.1 root 52: #if defined(_MSC_VER) && (_MSC_VER >= 1400)
53: #pragma warning( disable : 4819 )
54: #pragma warning( disable : 4995 )
55: #pragma warning( disable : 4996 )
1.1.1.9 root 56: // for MAME i86/i386
57: #pragma warning( disable : 4018 )
58: #pragma warning( disable : 4065 )
59: #pragma warning( disable : 4146 )
60: #pragma warning( disable : 4244 )
61: #pragma warning( disable : 4267 )
62: #endif
63:
64: // endian
65: #if !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
66: #if defined(__BYTE_ORDER) && (defined(__LITTLE_ENDIAN) || defined(__BIG_ENDIAN))
67: #if __BYTE_ORDER == __LITTLE_ENDIAN
68: #define __LITTLE_ENDIAN__
69: #elif __BYTE_ORDER == __BIG_ENDIAN
70: #define __BIG_ENDIAN__
71: #endif
72: #elif defined(WORDS_LITTLEENDIAN)
73: #define __LITTLE_ENDIAN__
74: #elif defined(WORDS_BIGENDIAN)
75: #define __BIG_ENDIAN__
76: #endif
77: #endif
78: #if !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
79: // Microsoft Visual C++
80: #define __LITTLE_ENDIAN__
1.1 root 81: #endif
1.1.1.9 root 82:
1.1 root 83: // compat for mingw32 headers
84: #ifndef COMMON_LVB_UNDERSCORE
85: #define COMMON_LVB_UNDERSCORE 0x8000
86: #endif
87:
88: // type definition
89: #ifndef UINT8
90: typedef unsigned char UINT8;
91: #endif
92: #ifndef UINT16
93: typedef unsigned short UINT16;
94: #endif
95: #ifndef UINT32
96: typedef unsigned int UINT32;
97: #endif
1.1.1.27 root 98: #ifndef UINT64
99: typedef unsigned long long UINT64;
100: #endif
1.1 root 101: #ifndef INT8
102: typedef signed char INT8;
103: #endif
104: #ifndef INT16
105: typedef signed short INT16;
106: #endif
107: #ifndef INT32
108: typedef signed int INT32;
109: #endif
1.1.1.27 root 110: #ifndef INT64
111: typedef signed long long INT64;
112: #endif
1.1 root 113:
114: #pragma pack(1)
115: typedef union {
116: UINT32 dw;
117: struct {
1.1.1.9 root 118: #ifdef __BIG_ENDIAN__
119: UINT16 h, l;
120: #else
1.1 root 121: UINT16 l, h;
1.1.1.9 root 122: #endif
1.1 root 123: } w;
124: } PAIR32;
125: #pragma pack()
126:
1.1.1.24 root 127: // MAME i86/i386
128:
129: // src/emu/devcpu.h
130: // offsets and addresses are 32-bit (for now...)
131: typedef UINT32 offs_t;
132:
1.1 root 133: /* ----------------------------------------------------------------------------
134: FIFO buffer
135: ---------------------------------------------------------------------------- */
136:
137: class FIFO
138: {
139: private:
1.1.1.20 root 140: int size;
141: int *buf;
1.1.1.29 root 142: int cnt, rpt, wpt;
1.1 root 143: public:
1.1.1.20 root 144: FIFO(int s) {
145: size = s;
146: buf = (int *)malloc(size * sizeof(int));
1.1 root 147: cnt = rpt = wpt = 0;
148: }
1.1.1.20 root 149: void release()
150: {
1.1.1.29 root 151: if(buf != NULL) {
152: free(buf);
153: buf = NULL;
154: }
1.1.1.20 root 155: }
1.1.1.27 root 156: void clear()
157: {
158: cnt = rpt = wpt = 0;
159: }
1.1 root 160: void write(int val) {
1.1.1.20 root 161: if(cnt < size) {
1.1 root 162: buf[wpt++] = val;
1.1.1.20 root 163: if(wpt >= size) {
1.1 root 164: wpt = 0;
165: }
166: cnt++;
167: }
168: }
169: int read() {
170: int val = 0;
171: if(cnt) {
172: val = buf[rpt++];
1.1.1.20 root 173: if(rpt >= size) {
1.1 root 174: rpt = 0;
175: }
176: cnt--;
177: }
1.1.1.20 root 178: return(val);
1.1 root 179: }
180: int count() {
1.1.1.20 root 181: return(cnt);
182: }
183: int remain() {
184: return(size - cnt);
185: }
186: bool full()
187: {
188: return(cnt == size);
189: }
190: bool empty()
191: {
192: return(cnt == 0);
1.1 root 193: }
194: };
195:
196: /* ----------------------------------------------------------------------------
1.1.1.14 root 197: MAME i86/i386
198: ---------------------------------------------------------------------------- */
199:
200: #if defined(HAS_I86)
201: #define CPU_MODEL i8086
202: #elif defined(HAS_I186)
203: #define CPU_MODEL i80186
204: #elif defined(HAS_V30)
205: #define CPU_MODEL v30
206: #elif defined(HAS_I286)
207: #define CPU_MODEL i80286
208: #elif defined(HAS_I386)
209: #define CPU_MODEL i386
210: #else
211: // #if defined(HAS_I386SX)
212: // #define CPU_MODEL i386SX
213: // #else
214: #if defined(HAS_I486)
215: #define CPU_MODEL i486
216: #else
217: #if defined(HAS_PENTIUM)
218: #define CPU_MODEL pentium
219: #elif defined(HAS_MEDIAGX)
220: #define CPU_MODEL mediagx
221: #elif defined(HAS_PENTIUM_PRO)
222: #define CPU_MODEL pentium_pro
223: #elif defined(HAS_PENTIUM_MMX)
224: #define CPU_MODEL pentium_mmx
225: #elif defined(HAS_PENTIUM2)
226: #define CPU_MODEL pentium2
227: #elif defined(HAS_PENTIUM3)
228: #define CPU_MODEL pentium3
229: #elif defined(HAS_PENTIUM4)
230: #define CPU_MODEL pentium4
231: #endif
232: #define SUPPORT_RDTSC
233: #endif
234: #define SUPPORT_FPU
235: // #endif
236: #define HAS_I386
237: #endif
238:
239: /* ----------------------------------------------------------------------------
1.1.1.27 root 240: debugger
241: ---------------------------------------------------------------------------- */
242:
243: //#define USE_DEBUGGER
244:
245: #ifdef USE_DEBUGGER
246: #define MAX_BREAK_POINTS 8
247:
248: bool now_debugging = false;
249: bool now_going = false;
250: bool now_suspended = false;
251: bool force_suspend = false;
252:
253: typedef struct {
254: struct {
255: UINT32 addr;
256: UINT32 seg;
257: UINT32 ofs;
258: int status; // 0 = none, 1 = enabled, other = disabled
259: } table[MAX_BREAK_POINTS];
260: int hit;
261: } break_point_t;
262:
263: break_point_t break_point = {0};
264: break_point_t rd_break_point = {0};
265: break_point_t wr_break_point = {0};
266: break_point_t in_break_point = {0};
267: break_point_t out_break_point = {0};
268:
269: typedef struct {
270: struct {
271: int int_num;
272: UINT8 ah, ah_registered;
273: UINT8 al, al_registered;
274: int status; // 0 = none, 1 = enabled, other = disabled
275: } table[MAX_BREAK_POINTS];
276: int hit;
277: } int_break_point_t;
278:
279: int_break_point_t int_break_point = {0};
280:
281: FILE *fp_debugger = NULL;
282: FILE *fi_debugger = NULL;
283:
284: // these read/write interfaces do not check break points,
285: // debugger should use them not to hit any break point mistakely
286: UINT8 debugger_read_byte(offs_t byteaddress);
287: UINT16 debugger_read_word(offs_t byteaddress);
288: UINT32 debugger_read_dword(offs_t byteaddress);
289: void debugger_write_byte(offs_t byteaddress, UINT8 data);
290: void debugger_write_word(offs_t byteaddress, UINT16 data);
291: void debugger_write_dword(offs_t byteaddress, UINT32 data);
292: UINT8 debugger_read_io_byte(offs_t addr);
293: UINT16 debugger_read_io_word(offs_t addr);
294: UINT32 debugger_read_io_dword(offs_t addr);
295: void debugger_write_io_byte(offs_t addr, UINT8 val);
296: void debugger_write_io_word(offs_t addr, UINT16 val);
297: void debugger_write_io_dword(offs_t addr, UINT32 val);
298: #endif
299:
300: /* ----------------------------------------------------------------------------
1.1.1.29 root 301: service thread
302: ---------------------------------------------------------------------------- */
303:
304: #define USE_SERVICE_THREAD
305:
306: #ifdef USE_SERVICE_THREAD
307: CRITICAL_SECTION input_crit_sect;
308: CRITICAL_SECTION key_buf_crit_sect;
309: CRITICAL_SECTION putch_crit_sect;
310: bool in_service = false;
311: bool service_exit = false;
1.1.1.39 root 312: DWORD main_thread_id;
1.1.1.29 root 313:
314: void start_service_loop(LPTHREAD_START_ROUTINE lpStartAddress);
315: void finish_service_loop();
316: #endif
317:
1.1.1.40! root 318: bool in_service_29h = false;
! 319:
1.1.1.29 root 320: /* ----------------------------------------------------------------------------
1.1.1.14 root 321: PC/AT hardware emulation
322: ---------------------------------------------------------------------------- */
323:
1.1.1.22 root 324: //#define SUPPORT_GRAPHIC_SCREEN
325:
1.1.1.14 root 326: void hardware_init();
327: void hardware_finish();
1.1.1.22 root 328: void hardware_release();
1.1.1.14 root 329: void hardware_run();
1.1.1.39 root 330: void hardware_run_cpu();
1.1.1.14 root 331: void hardware_update();
332:
1.1.1.32 root 333: // drive
334:
335: typedef struct {
336: int initialized;
337: int valid;
338: DISK_GEOMETRY geometry;
339:
340: int is_fdd()
341: {
342: if(initialized && valid) {
343: switch(geometry.MediaType) {
344: case F5_1Pt2_512:
345: case F3_1Pt44_512:
346: case F3_2Pt88_512:
347: case F3_20Pt8_512:
348: case F3_720_512:
349: case F5_360_512:
350: case F5_320_512:
351: case F5_320_1024:
352: case F5_180_512:
353: case F5_160_512:
354: case F3_120M_512:
355: case F3_640_512:
356: case F5_640_512:
357: case F5_720_512:
358: case F3_1Pt2_512:
359: case F3_1Pt23_1024:
360: case F5_1Pt23_1024:
361: case F3_128Mb_512:
362: case F3_230Mb_512:
363: case F8_256_128:
364: case F3_200Mb_512:
365: case F3_240M_512:
366: case F3_32M_512:
367: return(1);
368: }
369: }
370: return(0);
371: }
372: int head_num()
373: {
374: if(initialized && valid) {
375: switch(geometry.MediaType) {
376: case F5_1Pt2_512:
377: case F3_1Pt44_512:
378: case F3_2Pt88_512:
379: case F3_20Pt8_512:
380: case F3_720_512:
381: case F5_360_512:
382: case F5_320_512:
383: case F5_320_1024:
384: // case F5_180_512:
385: // case F5_160_512:
386: case F3_120M_512:
387: case F3_640_512:
388: case F5_640_512:
389: case F5_720_512:
390: case F3_1Pt2_512:
391: case F3_1Pt23_1024:
392: case F5_1Pt23_1024:
393: case F3_128Mb_512:
394: case F3_230Mb_512:
395: // case F8_256_128:
396: case F3_200Mb_512:
397: case F3_240M_512:
398: case F3_32M_512:
399: return(2);
400: default:
401: return(1);
402: }
403: }
404: return(0);
405: }
406: } drive_param_t;
407:
408: drive_param_t drive_params[26] = {0};
409:
1.1.1.14 root 410: // memory
411:
412: #if defined(HAS_I386)
1.1.1.27 root 413: #define ADDR_MASK 0xffffffff
414: #define MAX_MEM 0x2000000 /* 32MB */
1.1.1.14 root 415: #elif defined(HAS_I286)
1.1.1.27 root 416: #define ADDR_MASK 0xffffff
417: #define MAX_MEM 0x1000000 /* 16MB */
1.1.1.14 root 418: #else
1.1.1.27 root 419: #define ADDR_MASK 0xfffff
420: #define MAX_MEM 0x100000 /* 1MB */
1.1.1.14 root 421: #endif
1.1.1.27 root 422: UINT8 mem[MAX_MEM + 15];
1.1.1.14 root 423:
424: // ems
425:
426: #define MAX_EMS_HANDLES 16
427: #define MAX_EMS_PAGES 2048 /* 32MB */
428:
1.1.1.21 root 429: typedef struct {
1.1.1.14 root 430: char name[8];
431: UINT8* buffer;
432: int pages;
433: bool allocated;
1.1.1.21 root 434: } ems_handle_t;
1.1.1.14 root 435:
1.1.1.21 root 436: typedef struct {
1.1.1.14 root 437: UINT16 handle;
438: UINT16 page;
439: bool mapped;
1.1.1.21 root 440: } ems_page_t;
1.1.1.14 root 441:
1.1.1.25 root 442: ems_handle_t ems_handles[MAX_EMS_HANDLES + 1] = {0};
1.1.1.21 root 443: ems_page_t ems_pages[4];
1.1.1.14 root 444: int free_ems_pages;
445:
446: void ems_init();
447: void ems_finish();
1.1.1.22 root 448: void ems_release();
1.1.1.14 root 449: void ems_allocate_pages(int handle, int pages);
450: void ems_reallocate_pages(int handle, int pages);
451: void ems_release_pages(int handle);
452: void ems_map_page(int physical, int handle, int logical);
453: void ems_unmap_page(int physical);
454:
1.1.1.20 root 455: // dma
456:
457: typedef struct {
458: struct {
459: union {
460: UINT16 w;
461: struct {
462: #ifdef __BIG_ENDIAN__
463: UINT8 h, l;
464: #else
465: UINT8 l, h;
466: #endif
467: } b;
468: } areg, creg, bareg, bcreg;
469: UINT8 mode;
470: UINT8 pagereg;
471: UINT32 port;
472: } ch[4];
473:
474: bool low_high;
475: UINT8 cmd;
476: UINT8 req;
477: UINT8 mask;
478: UINT8 tc;
479: UINT16 tmp;
480: } dma_t;
481:
1.1.1.21 root 482: dma_t dma[2];
1.1.1.20 root 483:
484: void dma_init();
485: void dma_reset(int c);
486: void dma_write(int c, UINT32 addr, UINT8 data);
487: UINT8 dma_read(int c, UINT32 addr);
488: void dma_page_write(int c, int ch, UINT8 data);
489: UINT8 dma_page_read(int c, int ch);
490: void dma_run(int c, int ch);
491:
1.1.1.14 root 492: // pic
493:
494: typedef struct {
495: UINT8 imr, isr, irr, prio;
496: UINT8 icw1, icw2, icw3, icw4;
497: UINT8 ocw3;
498: UINT8 icw2_r, icw3_r, icw4_r;
499: } pic_t;
500:
501: pic_t pic[2];
502: int pic_req_chip, pic_req_level;
503: UINT8 pic_req_bit;
504:
505: void pic_init();
506: void pic_write(int c, UINT32 addr, UINT8 data);
507: UINT8 pic_read(int c, UINT32 addr);
508: void pic_req(int c, int level, int signal);
509: int pic_ack();
510: void pic_update();
511:
1.1.1.20 root 512: // pio
513:
514: typedef struct {
515: UINT8 data, stat, ctrl;
1.1.1.30 root 516: // code conversion
517: bool conv_mode;
518: bool jis_mode;
519: UINT8 sjis_hi;
520: UINT8 esc_buf[8];
521: UINT32 esc_len;
522: // printer to file
523: char path[MAX_PATH];
524: FILE *fp;
525: SYSTEMTIME time;
1.1.1.20 root 526: } pio_t;
527:
1.1.1.21 root 528: pio_t pio[2];
1.1.1.20 root 529:
530: void pio_init();
1.1.1.30 root 531: void pio_finish();
532: void pio_release();
1.1.1.20 root 533: void pio_write(int c, UINT32 addr, UINT8 data);
534: UINT8 pio_read(int c, UINT32 addr);
1.1.1.30 root 535: void printer_out(int c, UINT8 data);
536: void pcbios_printer_out(int c, UINT8 data);
1.1.1.20 root 537:
1.1.1.14 root 538: // pit
539:
540: #define PIT_ALWAYS_RUNNING
541:
542: typedef struct {
543: INT32 count;
544: UINT16 latch;
1.1.1.21 root 545: UINT16 prev_latch, next_latch;
1.1.1.14 root 546: UINT16 count_reg;
547: UINT8 ctrl_reg;
548: int count_latched;
549: int low_read, high_read;
550: int low_write, high_write;
551: int mode;
552: int status_latched;
553: UINT8 status;
554: // constant clock
555: UINT32 expired_time;
556: UINT32 prev_time;
1.1.1.17 root 557: UINT64 accum;
1.1.1.14 root 558: } pit_t;
559:
560: pit_t pit[3];
561: #ifndef PIT_ALWAYS_RUNNING
562: int pit_active;
563: #endif
564:
565: void pit_init();
566: void pit_write(int ch, UINT8 val);
567: UINT8 pit_read(int ch);
568: int pit_run(int ch, UINT32 cur_time);
569: void pit_latch_count(int ch);
570: int pit_get_expired_time(int ch);
571:
572: UINT8 system_port = 0;
573:
1.1.1.20 root 574: // sio
575:
576: #define SIO_BUFFER_SIZE 1024
577:
578: typedef struct {
579: int channel;
580:
581: FIFO *send_buffer;
582: FIFO *recv_buffer;
583:
584: union {
585: UINT16 w;
586: struct {
587: #ifdef __BIG_ENDIAN__
588: UINT8 h, l;
589: #else
590: UINT8 l, h;
591: #endif
592: } b;
593: } divisor;
594: UINT16 prev_divisor;
595: UINT8 line_ctrl, prev_line_ctrl;
596: UINT8 selector;
597:
598: UINT8 modem_ctrl;
1.1.1.21 root 599: bool set_brk, set_rts, set_dtr;
600: bool prev_set_brk;
601: // bool prev_set_rts, prev_set_dtr;
1.1.1.20 root 602:
603: UINT8 line_stat_buf, line_stat_err;
604: UINT8 modem_stat, prev_modem_stat;
605:
606: UINT8 irq_enable;
607: UINT8 irq_identify;
608:
609: UINT8 scratch;
610: } sio_t;
611:
612: typedef struct {
613: HANDLE hThread;
614: CRITICAL_SECTION csSendData;
615: CRITICAL_SECTION csRecvData;
616: CRITICAL_SECTION csLineCtrl;
617: CRITICAL_SECTION csLineStat;
618: CRITICAL_SECTION csModemCtrl;
619: CRITICAL_SECTION csModemStat;
620: } sio_mt_t;
621:
1.1.1.23 root 622: sio_t sio[4] = {0};
623: sio_mt_t sio_mt[4];
1.1.1.20 root 624:
625: void sio_init();
626: void sio_finish();
1.1.1.22 root 627: void sio_release();
1.1.1.20 root 628: void sio_write(int c, UINT32 addr, UINT8 data);
629: UINT8 sio_read(int c, UINT32 addr);
630: void sio_update(int c);
631: void sio_update_irq(int c);
632: DWORD WINAPI sio_thread(void *lpx);
633:
1.1.1.14 root 634: // cmos
635:
636: UINT8 cmos[128];
637: UINT8 cmos_addr;
638:
639: void cmos_init();
640: void cmos_write(int addr, UINT8 val);
641: UINT8 cmos_read(int addr);
642:
643: // kbd (a20)
644:
645: UINT8 kbd_data;
646: UINT8 kbd_status;
647: UINT8 kbd_command;
648:
649: void kbd_init();
650: UINT8 kbd_read_data();
651: void kbd_write_data(UINT8 val);
652: UINT8 kbd_read_status();
653: void kbd_write_command(UINT8 val);
654:
655: /* ----------------------------------------------------------------------------
1.1 root 656: MS-DOS virtual machine
657: ---------------------------------------------------------------------------- */
658:
1.1.1.24 root 659: #if defined(HAS_I386)
660: //#define SUPPORT_VCPI
661: #endif
1.1.1.23 root 662: #if defined(HAS_I286) || defined(HAS_I386)
663: #define SUPPORT_XMS
664: //#define SUPPORT_HMA
665: #endif
666:
1.1 root 667: #define VECTOR_TOP 0
668: #define VECTOR_SIZE 0x400
669: #define BIOS_TOP (VECTOR_TOP + VECTOR_SIZE)
670: #define BIOS_SIZE 0x100
671: #define WORK_TOP (BIOS_TOP + BIOS_SIZE)
1.1.1.14 root 672: #define WORK_SIZE 0x200
1.1.1.20 root 673: // IO.SYS 0070:0000
674: #define DEVICE_TOP (WORK_TOP + WORK_SIZE)
1.1.1.21 root 675: #define DEVICE_SIZE 0x100 /* 22 + 18 * 12 + 7 */
1.1.1.20 root 676: #define DOS_INFO_TOP (DEVICE_TOP + DEVICE_SIZE)
1.1 root 677: #define DOS_INFO_SIZE 0x100
1.1.1.26 root 678: //#define EXT_BIOS_TOP (DOS_INFO_TOP + DOS_INFO_SIZE)
679: //#define EXT_BIOS_SIZE 0x400
680: #ifdef EXT_BIOS_TOP
1.1.1.20 root 681: #define DPB_TOP (EXT_BIOS_TOP + EXT_BIOS_SIZE)
1.1.1.26 root 682: #else
683: #define DPB_TOP (DOS_INFO_TOP + DOS_INFO_SIZE)
684: #endif
1.1.1.31 root 685: #define DPB_SIZE 0x600
1.1.1.16 root 686: #define SFT_TOP (DPB_TOP + DPB_SIZE)
687: #define SFT_SIZE 0x4b0 /* 6 + 0x3b * 20 */
688: #define DISK_BUF_TOP (SFT_TOP + SFT_SIZE)
1.1.1.14 root 689: #define DISK_BUF_SIZE 0x20
690: #define CDS_TOP (DISK_BUF_TOP + DISK_BUF_SIZE)
1.1.1.34 root 691: #define CDS_SIZE 0x8F0 /* 88 * 26 */
1.1 root 692: #define FCB_TABLE_TOP (CDS_TOP + CDS_SIZE)
693: #define FCB_TABLE_SIZE 0x10
1.1.1.26 root 694: #define SDA_TOP (FCB_TABLE_TOP + FCB_TABLE_SIZE)
1.1.1.18 root 695: #define SDA_SIZE 0xb0
1.1.1.13 root 696: // nls tables
1.1.1.18 root 697: #define UPPERTABLE_TOP (SDA_TOP + SDA_SIZE)
1.1.1.13 root 698: #define UPPERTABLE_SIZE 0x82
1.1.1.18 root 699: #define LOWERTABLE_TOP (UPPERTABLE_TOP + UPPERTABLE_SIZE)
700: #define LOWERTABLE_SIZE 0x82
701: #define FILENAME_UPPERTABLE_TOP (LOWERTABLE_TOP + LOWERTABLE_SIZE)
1.1.1.13 root 702: #define FILENAME_UPPERTABLE_SIZE 0x82
703: #define FILENAME_TERMINATOR_TOP (FILENAME_UPPERTABLE_TOP + FILENAME_UPPERTABLE_SIZE)
704: #define FILENAME_TERMINATOR_SIZE 0x20 /* requirement: 10 + 14(terminate chars) */
705: #define COLLATING_TABLE_TOP (FILENAME_TERMINATOR_TOP + FILENAME_TERMINATOR_SIZE)
706: #define COLLATING_TABLE_SIZE 0x102
707: #define DBCS_TOP (COLLATING_TABLE_TOP + COLLATING_TABLE_SIZE)
1.1 root 708: #define DBCS_TABLE (DBCS_TOP + 2)
709: #define DBCS_SIZE 0x10
1.1.1.13 root 710: #define MSDOS_SYSTEM_DATA_END (DBCS_TOP + DBCS_SIZE)
711: #define MEMORY_TOP ((MSDOS_SYSTEM_DATA_END + 15) & ~15U)
1.1.1.22 root 712: #ifdef SUPPORT_GRAPHIC_SCREEN
713: #define MEMORY_END 0xa0000
714: #define VGA_VRAM_TOP 0xa0000
715: #else
1.1.1.7 root 716: #define MEMORY_END 0xb8000
1.1.1.22 root 717: #endif
1.1.1.7 root 718: #define TEXT_VRAM_TOP 0xb8000
1.1.1.14 root 719: #define EMS_TOP 0xc0000
720: #define EMS_SIZE 0x10000
721: UINT32 UMB_TOP = EMS_TOP; // EMS is disabled
1.1.1.7 root 722: #define UMB_END 0xf8000
723: #define SHADOW_BUF_TOP 0xf8000
1.1.1.38 root 724: // text vram size: 80x25x2 = 4000 = 0fa0h
725: // fffa0h-fffefh can be used for dummy routines
726: #define DUMMY_TOP 0xfffc0
1.1.1.14 root 727: #define EMB_TOP 0x10fff0
1.1.1.35 root 728: //#define EMB_TOP 0x128000 // MEM.EXE invites this value???
1.1.1.14 root 729: #define EMB_END MAX_MEM
730:
731: UINT32 IRET_TOP = 0;
732: #define IRET_SIZE 0x100
733: UINT32 XMS_TOP = 0;
1.1.1.35 root 734: // XMS_TOP + 0x000 EMMXXXX0 driver
735: // XMS_TOP + 0x012 EMS dummy routine
736: // XMS_TOP + 0x015 XMS dummy routine
737: // XMS_TOP + 0x018 EMMXXXX0 ioctrl recv buffer
738: // XMS_TOP + 0x1b9 EMMXXXX0 driver dummy routine (at XMS_TOP + XMS_SIZE - 7)
739: #define XMS_SIZE 0x1c0 /* 18 + 6 + 413 + 7 */
1.1 root 740:
741: //#define ENV_SIZE 0x800
742: #define ENV_SIZE 0x2000
743: #define PSP_SIZE 0x100
1.1.1.27 root 744: #define PSP_SYSTEM 0x0008
1.1 root 745:
746: #define MAX_FILES 128
747: #define MAX_PROCESS 16
1.1.1.12 root 748: #define MAX_DTAINFO 128
1.1.1.11 root 749: #define LFN_DTA_LADDR 0x10FFF0
1.1.1.12 root 750: #define FIND_MAGIC 0x46696e64
1.1 root 751:
1.1.1.16 root 752: #define DUP_STDIN 27
753: #define DUP_STDOUT 28
754: #define DUP_STDERR 29
755: #define DUP_STDAUX 30
756: #define DUP_STDPRN 31
1.1 root 757:
1.1.1.16 root 758: //#define MAP_AUX_DEVICE_TO_FILE
1.1 root 759:
760: #pragma pack(1)
761: typedef struct {
762: UINT8 mz;
763: UINT16 psp;
1.1.1.24 root 764: UINT16 paragraphs;
765: UINT8 reserved[3];
1.1.1.3 root 766: char prog_name[8];
1.1 root 767: } mcb_t;
768: #pragma pack()
769:
1.1.1.23 root 770: #ifdef SUPPORT_HMA
771: #pragma pack(1)
772: typedef struct {
773: UINT8 ms[2];
774: UINT16 owner;
775: UINT16 size;
776: UINT16 next;
777: } hma_mcb_t;
778: #pragma pack()
779: #endif
780:
1.1 root 781: #pragma pack(1)
782: typedef struct {
783: UINT16 env_seg;
784: PAIR32 cmd_line;
785: PAIR32 fcb1;
786: PAIR32 fcb2;
787: UINT16 sp;
788: UINT16 ss;
789: UINT16 ip;
790: UINT16 cs;
791: } param_block_t;
792: #pragma pack()
793:
794: #pragma pack(1)
795: typedef struct {
796: UINT8 len;
797: char cmd[127];
798: } cmd_line_t;
799: #pragma pack()
800:
801: #pragma pack(1)
802: typedef struct {
803: UINT8 exit[2];
804: UINT16 first_mcb;
805: UINT8 reserved_1;
1.1.1.36 root 806: // UINT8 far_call;
807: // PAIR32 cpm_entry;
808: UINT8 call5[5];
1.1 root 809: PAIR32 int_22h;
810: PAIR32 int_23h;
811: PAIR32 int_24h;
812: UINT16 parent_psp;
813: UINT8 file_table[20];
814: UINT16 env_seg;
815: PAIR32 stack;
1.1.1.12 root 816: UINT16 file_table_size;
817: PAIR32 file_table_ptr;
818: UINT8 reserved_2[24];
1.1 root 819: UINT8 service[3];
820: UINT8 reserved_3[2];
821: UINT8 ex_fcb[7];
822: UINT8 fcb1[16];
823: UINT8 fcb2[20];
824: UINT8 buffer[128];
825: } psp_t;
826: #pragma pack()
827:
828: #pragma pack(1)
829: typedef struct {
830: UINT16 mz;
831: UINT16 extra_bytes;
832: UINT16 pages;
833: UINT16 relocations;
834: UINT16 header_size;
835: UINT16 min_alloc;
836: UINT16 max_alloc;
837: UINT16 init_ss;
838: UINT16 init_sp;
839: UINT16 check_sum;
840: UINT16 init_ip;
841: UINT16 init_cs;
842: UINT16 relocation_table;
843: UINT16 overlay;
844: } exe_header_t;
845: #pragma pack()
846:
847: #pragma pack(1)
848: typedef struct {
849: UINT8 flag;
850: UINT8 reserved[5];
851: UINT8 attribute;
852: } ext_fcb_t;
853: #pragma pack()
854:
855: #pragma pack(1)
856: typedef struct {
857: UINT8 drive;
858: UINT8 file_name[8 + 3];
859: UINT16 current_block;
860: UINT16 record_size;
861: UINT32 file_size;
862: UINT16 date;
863: UINT16 time;
1.1.1.12 root 864: union {
865: UINT8 reserved[8];
866: HANDLE handle;
867: };
1.1 root 868: UINT8 cur_record;
869: UINT32 rand_record;
870: } fcb_t;
871: #pragma pack()
872:
873: #pragma pack(1)
874: typedef struct {
875: UINT8 drive;
876: UINT8 file_name[8 + 3];
877: UINT8 attribute;
878: UINT8 nt_res;
879: UINT8 create_time_ms;
880: UINT16 creation_time;
881: UINT16 creation_date;
882: UINT16 last_access_date;
883: UINT16 cluster_hi;
884: UINT16 last_write_time;
885: UINT16 last_write_date;
886: UINT16 cluster_lo;
887: UINT32 file_size;
888: } find_fcb_t;
889: #pragma pack()
890:
891: #pragma pack(1)
892: typedef struct {
1.1.1.12 root 893: union {
894: UINT8 reserved[21];
895: struct {
896: UINT32 find_magic;
897: UINT32 dta_index;
898: };
899: };
1.1 root 900: UINT8 attrib;
901: UINT16 time;
902: UINT16 date;
903: UINT32 size;
904: char name[13];
905: } find_t;
906: #pragma pack()
907:
908: #pragma pack(1)
909: typedef struct {
910: UINT32 attrib;
911: PAIR32 ctime_lo;
912: PAIR32 ctime_hi;
913: PAIR32 atime_lo;
914: PAIR32 atime_hi;
915: PAIR32 mtime_lo;
916: PAIR32 mtime_hi;
917: UINT32 size_hi;
918: UINT32 size_lo;
919: UINT8 reserved[8];
920: char full_name[260];
921: char short_name[14];
922: } find_lfn_t;
923: #pragma pack()
924:
925: #pragma pack(1)
926: typedef struct {
927: UINT16 info_level;
928: UINT32 serial_number;
929: char volume_label[11];
930: char file_system[8];
931: } drive_info_t;
932: #pragma pack()
933:
934: #pragma pack(1)
935: typedef struct {
936: UINT16 size_of_structure;
937: UINT16 structure_version;
938: UINT32 sectors_per_cluster;
939: UINT32 bytes_per_sector;
940: UINT32 available_clusters_on_drive;
941: UINT32 total_clusters_on_drive;
942: UINT32 available_sectors_on_drive;
943: UINT32 total_sectors_on_drive;
944: UINT32 available_allocation_units;
945: UINT32 total_allocation_units;
946: UINT8 reserved[8];
947: } ext_space_info_t;
948: #pragma pack()
949:
950: #pragma pack(1)
951: typedef struct {
952: UINT8 drive_num;
953: UINT8 unit_num;
954: UINT16 bytes_per_sector;
955: UINT8 highest_sector_num;
956: UINT8 shift_count;
957: UINT16 reserved_sectors;
958: UINT8 fat_num;
959: UINT16 root_entries;
960: UINT16 first_data_sector;
961: UINT16 highest_cluster_num;
962: UINT16 sectors_per_fat;
963: UINT16 first_dir_sector;
964: UINT32 device_driver_header;
965: UINT8 media_type;
966: UINT8 drive_accessed;
967: UINT16 next_dpb_ofs;
968: UINT16 next_dpb_seg;
969: UINT16 first_free_cluster;
970: UINT16 free_clusters;
1.1.1.12 root 971: // extended
972: UINT16 fat_mirroring;
973: UINT16 info_sector;
974: UINT16 backup_boot_sector;
975: UINT32 first_cluster_sector;
976: UINT32 maximum_cluster_num;
977: UINT32 fat_sectors;
978: UINT32 root_cluster;
979: UINT32 free_search_cluster;
1.1 root 980: } dpb_t;
981: #pragma pack()
982:
983: #pragma pack(1)
984: typedef struct {
1.1.1.33 root 985: UINT16 bytes_per_sector;
986: UINT8 sectors_per_cluster;
987: UINT16 reserved_sectors;
988: UINT8 fat_num;
989: UINT16 root_entries;
990: UINT16 total_sectors;
991: UINT8 media_type;
992: UINT16 sectors_per_fat;
993: UINT16 sectors_per_track;
994: UINT16 heads_num;
995: UINT32 hidden_sectors;
996: // extended
997: UINT32 ext_total_sectors;
998: UINT32 ext_sectors_per_fat;
999: } bpb_t;
1000: #pragma pack()
1001:
1002: #pragma pack(1)
1003: typedef struct {
1.1 root 1004: char path_name[67];
1005: UINT16 drive_attrib;
1.1.1.34 root 1006: PAIR32 dpb_ptr;
1007: UINT16 word_1;
1008: UINT16 word_2;
1009: UINT16 word_3;
1010: UINT16 bs_offset;
1.1 root 1011: } cds_t;
1012: #pragma pack()
1013:
1014: #pragma pack(1)
1015: typedef struct {
1.1.1.37 root 1016: // UINT16 int21h_5d0ah_si; // -38
1017: // UINT16 int21h_5d0ah_ds; // -36
1.1.1.33 root 1018: // swappable data area
1019: UINT8 printer_cho_flag; // -34
1.1.1.37 root 1020: UINT16 int21h_5d0ah_dx; // -33
1.1.1.18 root 1021: UINT8 switchar; // -31 current switch character
1022: UINT8 malloc_strategy; // -30 current memory allocation strategy
1.1.1.37 root 1023: UINT8 int21h_5d0ah_cl; // -29
1024: UINT8 int21h_5e01h_counter; // -28
1025: UINT8 int21h_5e01h_name[16]; // -27
1.1.1.33 root 1026: UINT16 offset_lists[5]; // -11
1.1.1.37 root 1027: UINT8 int21h_5d0ah_called; // -1
1.1.1.18 root 1028: // ----- from DOSBox -----
1029: UINT8 crit_error_flag; // 0x00 Critical Error Flag
1030: UINT8 indos_flag; // 0x01 InDOS flag (count of active INT 21 calls)
1031: UINT8 drive_crit_error; // 0x02 Drive on which current critical error occurred or FFh
1032: UINT8 locus_of_last_error; // 0x03 locus of last error
1033: UINT16 extended_error_code; // 0x04 extended error code of last error
1034: UINT8 suggested_action; // 0x06 suggested action for last error
1035: UINT8 error_class; // 0x07 class of last error
1036: PAIR32 last_error_pointer; // 0x08 ES:DI pointer for last error
1037: PAIR32 current_dta; // 0x0C current DTA (Disk Transfer Address)
1038: UINT16 current_psp; // 0x10 current PSP
1039: UINT16 sp_int_23; // 0x12 stores SP across an INT 23
1040: UINT16 return_code; // 0x14 return code from last process termination (zerod after reading with AH=4Dh)
1041: UINT8 current_drive; // 0x16 current drive
1042: UINT8 extended_break_flag; // 0x17 extended break flag
1043: UINT8 fill[2]; // 0x18 flag: code page switching || flag: copy of previous byte in case of INT 24 Abort
1044: } sda_t;
1045: #pragma pack()
1046:
1047: #pragma pack(1)
1048: typedef struct {
1.1.1.14 root 1049: UINT8 reserved_0[4]; // -38
1050: UINT16 magic_word; // -34 from DOSBox
1051: UINT8 reserved_1[30]; // -32
1.1 root 1052: UINT16 first_mcb; // -2
1053: PAIR32 first_dpb; // +0
1.1.1.14 root 1054: PAIR32 first_sft; // +4
1.1.1.20 root 1055: PAIR32 clock_device; // +8
1056: PAIR32 con_device; // +12
1.1.1.14 root 1057: UINT16 max_sector_len; // +16
1058: PAIR32 disk_buf_info; // +18 from DOSBox
1.1 root 1059: PAIR32 cds; // +22
1060: PAIR32 fcb_table; // +26
1.1.1.20 root 1061: UINT8 reserved_2[3]; // +30
1.1 root 1062: UINT8 last_drive; // +33
1.1.1.14 root 1063: struct {
1.1.1.20 root 1064: PAIR32 next_driver; // +34
1.1.1.14 root 1065: UINT16 attributes; // +38
1066: UINT16 strategy; // +40
1067: UINT16 interrupt; // +42
1068: char dev_name[8]; // +44
1069: } nul_device;
1.1.1.20 root 1070: UINT8 reserved_3[11]; // +52
1.1 root 1071: UINT16 buffers_x; // +63
1072: UINT16 buffers_y; // +65
1073: UINT8 boot_drive; // +67
1074: UINT8 i386_or_later; // +68
1075: UINT16 ext_mem_size; // +69
1.1.1.14 root 1076: PAIR32 disk_buf_heads; // +71 from DOSBox
1.1.1.20 root 1077: UINT8 reserved_4[21]; // +75
1.1.1.5 root 1078: UINT8 dos_flag; // +96
1.1.1.20 root 1079: UINT8 reserved_5[2]; // +97
1.1.1.15 root 1080: UINT8 umb_linked; // +99 from DOSBox
1.1.1.20 root 1081: UINT8 reserved_6[2]; // +100
1.1.1.15 root 1082: UINT16 first_umb_fcb; // +102 from DOSBox
1083: UINT16 first_mcb_2; // +104 from DOSBox
1.1.1.21 root 1084: UINT8 nul_device_routine[7];
1.1 root 1085: } dos_info_t;
1086: #pragma pack()
1087:
1.1.1.14 root 1088: #pragma pack(1)
1089: typedef struct {
1.1.1.20 root 1090: PAIR32 next_driver;
1091: UINT16 attributes;
1092: UINT16 strategy;
1093: UINT16 interrupt;
1094: char dev_name[8];
1095: } device_t;
1096: #pragma pack()
1097:
1098: #pragma pack(1)
1099: typedef struct {
1.1.1.14 root 1100: UINT16 date_format;
1101: char currency_symbol[5];
1102: char thou_sep[2];
1103: char dec_sep[2];
1104: char date_sep[2];
1105: char time_sep[2];
1106: char currency_format;
1107: char currency_dec_digits;
1108: char time_format;
1109: PAIR32 case_map;
1110: char list_sep[2];
1111: char reserved[10];
1112: } country_info_t;
1113: #pragma pack()
1114:
1.1 root 1115: typedef struct {
1116: char path[MAX_PATH];
1117: int valid;
1118: int id;
1119: int atty;
1120: int mode;
1121: UINT16 info;
1122: UINT16 psp;
1.1.1.30 root 1123: int sio_port; // 1-4
1124: int lpt_port; // 1-3
1.1 root 1125: } file_handler_t;
1126:
1127: static const struct {
1128: int mode;
1129: int in;
1130: int out;
1131: } file_mode[] = {
1.1.1.11 root 1132: { _O_RDONLY | _O_BINARY, 1, 0 },
1.1 root 1133: { _O_WRONLY | _O_BINARY, 0, 1 },
1134: { _O_RDWR | _O_BINARY, 1, 1 },
1135: };
1136:
1137: typedef struct {
1138: UINT16 psp;
1139: char module_dir[MAX_PATH];
1.1.1.27 root 1140: #ifdef USE_DEBUGGER
1141: char module_path[MAX_PATH];
1142: #endif
1.1 root 1143: PAIR32 dta;
1144: UINT8 switchar;
1145: UINT8 verify;
1146: int max_files;
1147: char volume_label[MAX_PATH];
1148: bool parent_int_10h_feh_called;
1149: bool parent_int_10h_ffh_called;
1.1.1.12 root 1150: UINT16 parent_ds;
1.1.1.25 root 1151: UINT16 parent_es;
1.1.1.14 root 1152: struct {
1153: UINT16 handle;
1154: UINT16 page;
1155: bool mapped;
1156: } ems_pages[4];
1157: bool ems_pages_stored;
1.1.1.22 root 1158: bool called_by_int2eh;
1.1 root 1159: } process_t;
1160:
1.1.1.11 root 1161: typedef struct {
1162: UINT16 psp;
1163: UINT32 dta;
1.1.1.12 root 1164: UINT8 allowable_mask;
1165: UINT8 required_mask;
1.1.1.11 root 1166: HANDLE find_handle;
1167: } dtainfo_t;
1168:
1.1.1.24 root 1169: UINT8 dos_major_version = 7; // Windows 98 Second Edition
1170: UINT8 dos_minor_version = 10;
1171: UINT8 win_major_version = 4;
1172: UINT8 win_minor_version = 10;
1.1.1.8 root 1173:
1.1.1.7 root 1174: UINT16 first_mcb;
1.1 root 1175: UINT16 current_psp;
1176:
1177: int retval = 0;
1178: UINT16 error_code = 0;
1179:
1180: file_handler_t file_handler[MAX_FILES];
1181: UINT8 file_buffer[0x100000];
1182:
1183: process_t process[MAX_PROCESS];
1.1.1.11 root 1184: dtainfo_t dtalist[MAX_DTAINFO];
1.1 root 1185:
1.1.1.6 root 1186: UINT16 malloc_strategy = 0;
1187:
1.1.1.12 root 1188: char comspec_path[MAX_PATH] = "C:\\COMMAND.COM";
1189:
1.1 root 1190: void msdos_syscall(unsigned num);
1191: int msdos_init(int argc, char *argv[], char *envp[], int standard_env);
1192: void msdos_finish();
1193:
1194: // console
1195:
1.1.1.12 root 1196: #define SCR_BUF_WIDTH 256
1197: #define SCR_BUF_HEIGHT 128
1.1 root 1198:
1199: #define SET_RECT(rect, l, t, r, b) { \
1200: rect.Left = l; \
1201: rect.Top = t; \
1202: rect.Right = r; \
1203: rect.Bottom = b; \
1204: }
1205:
1.1.1.19 root 1206: DWORD dwConsoleMode = 0;
1207:
1.1.1.12 root 1208: CHAR_INFO scr_buf[SCR_BUF_WIDTH * SCR_BUF_HEIGHT];
1209: char scr_char[SCR_BUF_WIDTH * SCR_BUF_HEIGHT];
1210: WORD scr_attr[SCR_BUF_WIDTH * SCR_BUF_HEIGHT];
1.1 root 1211: COORD scr_buf_size;
1212: COORD scr_buf_pos;
1213: int scr_width, scr_height;
1.1.1.12 root 1214: int scr_top;
1.1.1.10 root 1215: bool restore_console_on_exit = false;
1.1 root 1216: bool cursor_moved;
1217:
1.1.1.22 root 1218: FIFO *key_buf_char = NULL;
1219: FIFO *key_buf_scan = NULL;
1.1.1.19 root 1220: bool key_changed = false;
1.1.1.4 root 1221: UINT32 key_code = 0;
1.1.1.27 root 1222: UINT32 key_recv = 0;
1.1 root 1223:
1.1.1.40! root 1224: void pcbios_clear_key_buffer();
! 1225: void pcbios_set_key_buffer(int key_char, int key_scan);
! 1226: bool pcbios_get_key_buffer(int *key_char, int *key_scan);
! 1227:
1.1.1.27 root 1228: UINT8 ctrl_break_checking = 0x00; // ???
1229: bool ctrl_break_detected = false;
1230: bool ctrl_break_pressed = false;
1.1.1.21 root 1231: bool ctrl_c_pressed = false;
1.1.1.27 root 1232: bool raise_int_1bh = false;
1.1.1.21 root 1233:
1.1 root 1234: int active_code_page;
1235: int system_code_page;
1.1.1.26 root 1236: int console_code_page;
1.1 root 1237:
1.1.1.12 root 1238: UINT32 text_vram_top_address;
1239: UINT32 text_vram_end_address;
1240: UINT32 shadow_buffer_top_address;
1241: UINT32 shadow_buffer_end_address;
1.1.1.40! root 1242: UINT32 cursor_position_address;
1.1.1.12 root 1243: int vram_pages;
1.1 root 1244: bool int_10h_feh_called = false;
1245: bool int_10h_ffh_called = false;
1246:
1.1.1.28 root 1247: #define MAX_MOUSE_BUTTONS 2
1.1.1.19 root 1248:
1.1.1.21 root 1249: typedef struct {
1.1.1.28 root 1250: bool enabled; // from DOSBox
1251: int hidden;
1252: int old_hidden; // from DOSBox
1.1.1.19 root 1253: struct {
1254: int x, y;
1255: } position, prev_position, max_position, min_position, mickey;
1256: struct {
1257: bool status;
1258: int pressed_times;
1259: int released_times;
1260: struct {
1261: int x, y;
1262: } pressed_position;
1263: struct {
1264: int x, y;
1265: } released_position;
1266: } buttons[MAX_MOUSE_BUTTONS];
1267: int get_buttons()
1268: {
1269: int val = 0;
1270: for(int i = 0; i < MAX_MOUSE_BUTTONS; i++) {
1271: if(buttons[i].status) {
1272: val |= 1 << i;
1273: }
1274: }
1275: return(val);
1276: }
1.1.1.33 root 1277: UINT16 status, status_alt;
1278: UINT16 status_irq, status_irq_alt;
1.1.1.19 root 1279: UINT16 call_mask;
1.1.1.33 root 1280: PAIR32 call_addr, call_addr_alt[8];
1.1.1.19 root 1281: // dummy
1282: UINT16 sensitivity[3];
1283: UINT16 display_page;
1284: UINT16 language;
1285: UINT16 hot_spot[2];
1.1.1.38 root 1286: UINT16 screen_mask;
1287: UINT16 cursor_mask;
1.1.1.21 root 1288: } mouse_t;
1289:
1290: mouse_t mouse;
1.1.1.19 root 1291:
1292: UINT16 mouse_push_ax;
1293: UINT16 mouse_push_bx;
1294: UINT16 mouse_push_cx;
1295: UINT16 mouse_push_dx;
1296: UINT16 mouse_push_si;
1297: UINT16 mouse_push_di;
1298:
1.1.1.23 root 1299: // hma
1300:
1301: #ifdef SUPPORT_HMA
1302: bool is_hma_used_by_xms = false;
1303: bool is_hma_used_by_int_2fh = false;
1304: #endif
1305:
1306: // xms
1307:
1308: #ifdef SUPPORT_XMS
1.1.1.24 root 1309: typedef struct emb_handle_s {
1310: UINT32 handle; // 0=allocated
1311: offs_t address;
1.1.1.23 root 1312: int size_kb;
1313: int lock;
1.1.1.24 root 1314: struct emb_handle_s *prev;
1315: struct emb_handle_s *next;
1316: } emb_handle_t;
1.1.1.23 root 1317:
1.1.1.24 root 1318: emb_handle_t *emb_handle_top = NULL;
1.1.1.23 root 1319: int xms_a20_local_enb_count;
1320: UINT16 xms_dx_after_call_08h = 0;
1.1.1.26 root 1321:
1322: void msdos_xms_init();
1323: void msdos_xms_finish();
1324: void msdos_xms_release();
1325: emb_handle_t *msdos_xms_get_emb_handle(int handle);
1326: int msdos_xms_get_unused_emb_handle_id();
1327: int msdos_xms_get_unused_emb_handle_count();
1328: void msdos_xms_split_emb_handle(emb_handle_t *emb_handle, int size_kb);
1329: void msdos_xms_combine_emb_handles(emb_handle_t *emb_handle);
1330: emb_handle_t *msdos_xms_alloc_emb_handle(int size_kb);
1331: void msdos_xms_free_emb_handle(emb_handle_t *emb_handle);
1.1.1.23 root 1332: #endif
1333:
1.1 root 1334: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.