|
|
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
1.1.1.41! root 666: //#define SUPPORT_MSCDEX
1.1.1.23 root 667:
1.1 root 668: #define VECTOR_TOP 0
669: #define VECTOR_SIZE 0x400
670: #define BIOS_TOP (VECTOR_TOP + VECTOR_SIZE)
671: #define BIOS_SIZE 0x100
672: #define WORK_TOP (BIOS_TOP + BIOS_SIZE)
1.1.1.14 root 673: #define WORK_SIZE 0x200
1.1.1.20 root 674: // IO.SYS 0070:0000
675: #define DEVICE_TOP (WORK_TOP + WORK_SIZE)
1.1.1.21 root 676: #define DEVICE_SIZE 0x100 /* 22 + 18 * 12 + 7 */
1.1.1.20 root 677: #define DOS_INFO_TOP (DEVICE_TOP + DEVICE_SIZE)
1.1 root 678: #define DOS_INFO_SIZE 0x100
1.1.1.26 root 679: //#define EXT_BIOS_TOP (DOS_INFO_TOP + DOS_INFO_SIZE)
680: //#define EXT_BIOS_SIZE 0x400
681: #ifdef EXT_BIOS_TOP
1.1.1.20 root 682: #define DPB_TOP (EXT_BIOS_TOP + EXT_BIOS_SIZE)
1.1.1.26 root 683: #else
684: #define DPB_TOP (DOS_INFO_TOP + DOS_INFO_SIZE)
685: #endif
1.1.1.31 root 686: #define DPB_SIZE 0x600
1.1.1.16 root 687: #define SFT_TOP (DPB_TOP + DPB_SIZE)
688: #define SFT_SIZE 0x4b0 /* 6 + 0x3b * 20 */
689: #define DISK_BUF_TOP (SFT_TOP + SFT_SIZE)
1.1.1.14 root 690: #define DISK_BUF_SIZE 0x20
691: #define CDS_TOP (DISK_BUF_TOP + DISK_BUF_SIZE)
1.1.1.34 root 692: #define CDS_SIZE 0x8F0 /* 88 * 26 */
1.1 root 693: #define FCB_TABLE_TOP (CDS_TOP + CDS_SIZE)
694: #define FCB_TABLE_SIZE 0x10
1.1.1.26 root 695: #define SDA_TOP (FCB_TABLE_TOP + FCB_TABLE_SIZE)
1.1.1.18 root 696: #define SDA_SIZE 0xb0
1.1.1.13 root 697: // nls tables
1.1.1.18 root 698: #define UPPERTABLE_TOP (SDA_TOP + SDA_SIZE)
1.1.1.13 root 699: #define UPPERTABLE_SIZE 0x82
1.1.1.18 root 700: #define LOWERTABLE_TOP (UPPERTABLE_TOP + UPPERTABLE_SIZE)
701: #define LOWERTABLE_SIZE 0x82
702: #define FILENAME_UPPERTABLE_TOP (LOWERTABLE_TOP + LOWERTABLE_SIZE)
1.1.1.13 root 703: #define FILENAME_UPPERTABLE_SIZE 0x82
704: #define FILENAME_TERMINATOR_TOP (FILENAME_UPPERTABLE_TOP + FILENAME_UPPERTABLE_SIZE)
705: #define FILENAME_TERMINATOR_SIZE 0x20 /* requirement: 10 + 14(terminate chars) */
706: #define COLLATING_TABLE_TOP (FILENAME_TERMINATOR_TOP + FILENAME_TERMINATOR_SIZE)
707: #define COLLATING_TABLE_SIZE 0x102
708: #define DBCS_TOP (COLLATING_TABLE_TOP + COLLATING_TABLE_SIZE)
1.1 root 709: #define DBCS_TABLE (DBCS_TOP + 2)
710: #define DBCS_SIZE 0x10
1.1.1.13 root 711: #define MSDOS_SYSTEM_DATA_END (DBCS_TOP + DBCS_SIZE)
712: #define MEMORY_TOP ((MSDOS_SYSTEM_DATA_END + 15) & ~15U)
1.1.1.22 root 713: #ifdef SUPPORT_GRAPHIC_SCREEN
714: #define MEMORY_END 0xa0000
715: #define VGA_VRAM_TOP 0xa0000
716: #else
1.1.1.7 root 717: #define MEMORY_END 0xb8000
1.1.1.22 root 718: #endif
1.1.1.7 root 719: #define TEXT_VRAM_TOP 0xb8000
1.1.1.14 root 720: #define EMS_TOP 0xc0000
721: #define EMS_SIZE 0x10000
722: UINT32 UMB_TOP = EMS_TOP; // EMS is disabled
1.1.1.7 root 723: #define UMB_END 0xf8000
724: #define SHADOW_BUF_TOP 0xf8000
1.1.1.38 root 725: // text vram size: 80x25x2 = 4000 = 0fa0h
726: // fffa0h-fffefh can be used for dummy routines
727: #define DUMMY_TOP 0xfffc0
1.1.1.14 root 728: #define EMB_TOP 0x10fff0
1.1.1.35 root 729: //#define EMB_TOP 0x128000 // MEM.EXE invites this value???
1.1.1.14 root 730: #define EMB_END MAX_MEM
731:
732: UINT32 IRET_TOP = 0;
733: #define IRET_SIZE 0x100
734: UINT32 XMS_TOP = 0;
1.1.1.35 root 735: // XMS_TOP + 0x000 EMMXXXX0 driver
736: // XMS_TOP + 0x012 EMS dummy routine
737: // XMS_TOP + 0x015 XMS dummy routine
738: // XMS_TOP + 0x018 EMMXXXX0 ioctrl recv buffer
739: // XMS_TOP + 0x1b9 EMMXXXX0 driver dummy routine (at XMS_TOP + XMS_SIZE - 7)
740: #define XMS_SIZE 0x1c0 /* 18 + 6 + 413 + 7 */
1.1 root 741:
742: //#define ENV_SIZE 0x800
743: #define ENV_SIZE 0x2000
744: #define PSP_SIZE 0x100
1.1.1.27 root 745: #define PSP_SYSTEM 0x0008
1.1 root 746:
747: #define MAX_FILES 128
748: #define MAX_PROCESS 16
1.1.1.12 root 749: #define MAX_DTAINFO 128
1.1.1.11 root 750: #define LFN_DTA_LADDR 0x10FFF0
1.1.1.12 root 751: #define FIND_MAGIC 0x46696e64
1.1 root 752:
1.1.1.16 root 753: #define DUP_STDIN 27
754: #define DUP_STDOUT 28
755: #define DUP_STDERR 29
756: #define DUP_STDAUX 30
757: #define DUP_STDPRN 31
1.1 root 758:
1.1.1.16 root 759: //#define MAP_AUX_DEVICE_TO_FILE
1.1 root 760:
761: #pragma pack(1)
762: typedef struct {
763: UINT8 mz;
764: UINT16 psp;
1.1.1.24 root 765: UINT16 paragraphs;
766: UINT8 reserved[3];
1.1.1.3 root 767: char prog_name[8];
1.1 root 768: } mcb_t;
769: #pragma pack()
770:
1.1.1.23 root 771: #ifdef SUPPORT_HMA
772: #pragma pack(1)
773: typedef struct {
774: UINT8 ms[2];
775: UINT16 owner;
776: UINT16 size;
777: UINT16 next;
778: } hma_mcb_t;
779: #pragma pack()
780: #endif
781:
1.1 root 782: #pragma pack(1)
783: typedef struct {
784: UINT16 env_seg;
785: PAIR32 cmd_line;
786: PAIR32 fcb1;
787: PAIR32 fcb2;
788: UINT16 sp;
789: UINT16 ss;
790: UINT16 ip;
791: UINT16 cs;
792: } param_block_t;
793: #pragma pack()
794:
795: #pragma pack(1)
796: typedef struct {
797: UINT8 len;
798: char cmd[127];
799: } cmd_line_t;
800: #pragma pack()
801:
802: #pragma pack(1)
803: typedef struct {
804: UINT8 exit[2];
805: UINT16 first_mcb;
806: UINT8 reserved_1;
1.1.1.36 root 807: // UINT8 far_call;
808: // PAIR32 cpm_entry;
809: UINT8 call5[5];
1.1 root 810: PAIR32 int_22h;
811: PAIR32 int_23h;
812: PAIR32 int_24h;
813: UINT16 parent_psp;
814: UINT8 file_table[20];
815: UINT16 env_seg;
816: PAIR32 stack;
1.1.1.12 root 817: UINT16 file_table_size;
818: PAIR32 file_table_ptr;
819: UINT8 reserved_2[24];
1.1 root 820: UINT8 service[3];
821: UINT8 reserved_3[2];
822: UINT8 ex_fcb[7];
823: UINT8 fcb1[16];
824: UINT8 fcb2[20];
825: UINT8 buffer[128];
826: } psp_t;
827: #pragma pack()
828:
829: #pragma pack(1)
830: typedef struct {
831: UINT16 mz;
832: UINT16 extra_bytes;
833: UINT16 pages;
834: UINT16 relocations;
835: UINT16 header_size;
836: UINT16 min_alloc;
837: UINT16 max_alloc;
838: UINT16 init_ss;
839: UINT16 init_sp;
840: UINT16 check_sum;
841: UINT16 init_ip;
842: UINT16 init_cs;
843: UINT16 relocation_table;
844: UINT16 overlay;
845: } exe_header_t;
846: #pragma pack()
847:
848: #pragma pack(1)
849: typedef struct {
850: UINT8 flag;
851: UINT8 reserved[5];
852: UINT8 attribute;
853: } ext_fcb_t;
854: #pragma pack()
855:
856: #pragma pack(1)
857: typedef struct {
858: UINT8 drive;
859: UINT8 file_name[8 + 3];
860: UINT16 current_block;
861: UINT16 record_size;
862: UINT32 file_size;
863: UINT16 date;
864: UINT16 time;
1.1.1.12 root 865: union {
866: UINT8 reserved[8];
867: HANDLE handle;
868: };
1.1 root 869: UINT8 cur_record;
870: UINT32 rand_record;
871: } fcb_t;
872: #pragma pack()
873:
874: #pragma pack(1)
875: typedef struct {
876: UINT8 drive;
877: UINT8 file_name[8 + 3];
878: UINT8 attribute;
879: UINT8 nt_res;
880: UINT8 create_time_ms;
881: UINT16 creation_time;
882: UINT16 creation_date;
883: UINT16 last_access_date;
884: UINT16 cluster_hi;
885: UINT16 last_write_time;
886: UINT16 last_write_date;
887: UINT16 cluster_lo;
888: UINT32 file_size;
889: } find_fcb_t;
890: #pragma pack()
891:
892: #pragma pack(1)
893: typedef struct {
1.1.1.12 root 894: union {
895: UINT8 reserved[21];
896: struct {
897: UINT32 find_magic;
898: UINT32 dta_index;
899: };
900: };
1.1 root 901: UINT8 attrib;
902: UINT16 time;
903: UINT16 date;
904: UINT32 size;
905: char name[13];
906: } find_t;
907: #pragma pack()
908:
909: #pragma pack(1)
910: typedef struct {
911: UINT32 attrib;
912: PAIR32 ctime_lo;
913: PAIR32 ctime_hi;
914: PAIR32 atime_lo;
915: PAIR32 atime_hi;
916: PAIR32 mtime_lo;
917: PAIR32 mtime_hi;
918: UINT32 size_hi;
919: UINT32 size_lo;
920: UINT8 reserved[8];
921: char full_name[260];
922: char short_name[14];
923: } find_lfn_t;
924: #pragma pack()
925:
926: #pragma pack(1)
927: typedef struct {
928: UINT16 info_level;
929: UINT32 serial_number;
930: char volume_label[11];
931: char file_system[8];
932: } drive_info_t;
933: #pragma pack()
934:
935: #pragma pack(1)
936: typedef struct {
937: UINT16 size_of_structure;
938: UINT16 structure_version;
939: UINT32 sectors_per_cluster;
940: UINT32 bytes_per_sector;
941: UINT32 available_clusters_on_drive;
942: UINT32 total_clusters_on_drive;
943: UINT32 available_sectors_on_drive;
944: UINT32 total_sectors_on_drive;
945: UINT32 available_allocation_units;
946: UINT32 total_allocation_units;
947: UINT8 reserved[8];
948: } ext_space_info_t;
949: #pragma pack()
950:
951: #pragma pack(1)
952: typedef struct {
953: UINT8 drive_num;
954: UINT8 unit_num;
955: UINT16 bytes_per_sector;
956: UINT8 highest_sector_num;
957: UINT8 shift_count;
958: UINT16 reserved_sectors;
959: UINT8 fat_num;
960: UINT16 root_entries;
961: UINT16 first_data_sector;
962: UINT16 highest_cluster_num;
963: UINT16 sectors_per_fat;
964: UINT16 first_dir_sector;
965: UINT32 device_driver_header;
966: UINT8 media_type;
967: UINT8 drive_accessed;
968: UINT16 next_dpb_ofs;
969: UINT16 next_dpb_seg;
970: UINT16 first_free_cluster;
971: UINT16 free_clusters;
1.1.1.12 root 972: // extended
973: UINT16 fat_mirroring;
974: UINT16 info_sector;
975: UINT16 backup_boot_sector;
976: UINT32 first_cluster_sector;
977: UINT32 maximum_cluster_num;
978: UINT32 fat_sectors;
979: UINT32 root_cluster;
980: UINT32 free_search_cluster;
1.1 root 981: } dpb_t;
982: #pragma pack()
983:
984: #pragma pack(1)
985: typedef struct {
1.1.1.33 root 986: UINT16 bytes_per_sector;
987: UINT8 sectors_per_cluster;
988: UINT16 reserved_sectors;
989: UINT8 fat_num;
990: UINT16 root_entries;
991: UINT16 total_sectors;
992: UINT8 media_type;
993: UINT16 sectors_per_fat;
994: UINT16 sectors_per_track;
995: UINT16 heads_num;
996: UINT32 hidden_sectors;
997: // extended
998: UINT32 ext_total_sectors;
999: UINT32 ext_sectors_per_fat;
1000: } bpb_t;
1001: #pragma pack()
1002:
1003: #pragma pack(1)
1004: typedef struct {
1.1 root 1005: char path_name[67];
1006: UINT16 drive_attrib;
1.1.1.34 root 1007: PAIR32 dpb_ptr;
1008: UINT16 word_1;
1009: UINT16 word_2;
1010: UINT16 word_3;
1011: UINT16 bs_offset;
1.1 root 1012: } cds_t;
1013: #pragma pack()
1014:
1015: #pragma pack(1)
1016: typedef struct {
1.1.1.37 root 1017: // UINT16 int21h_5d0ah_si; // -38
1018: // UINT16 int21h_5d0ah_ds; // -36
1.1.1.33 root 1019: // swappable data area
1020: UINT8 printer_cho_flag; // -34
1.1.1.37 root 1021: UINT16 int21h_5d0ah_dx; // -33
1.1.1.18 root 1022: UINT8 switchar; // -31 current switch character
1023: UINT8 malloc_strategy; // -30 current memory allocation strategy
1.1.1.37 root 1024: UINT8 int21h_5d0ah_cl; // -29
1025: UINT8 int21h_5e01h_counter; // -28
1026: UINT8 int21h_5e01h_name[16]; // -27
1.1.1.33 root 1027: UINT16 offset_lists[5]; // -11
1.1.1.37 root 1028: UINT8 int21h_5d0ah_called; // -1
1.1.1.18 root 1029: // ----- from DOSBox -----
1030: UINT8 crit_error_flag; // 0x00 Critical Error Flag
1031: UINT8 indos_flag; // 0x01 InDOS flag (count of active INT 21 calls)
1032: UINT8 drive_crit_error; // 0x02 Drive on which current critical error occurred or FFh
1033: UINT8 locus_of_last_error; // 0x03 locus of last error
1034: UINT16 extended_error_code; // 0x04 extended error code of last error
1035: UINT8 suggested_action; // 0x06 suggested action for last error
1036: UINT8 error_class; // 0x07 class of last error
1037: PAIR32 last_error_pointer; // 0x08 ES:DI pointer for last error
1038: PAIR32 current_dta; // 0x0C current DTA (Disk Transfer Address)
1039: UINT16 current_psp; // 0x10 current PSP
1040: UINT16 sp_int_23; // 0x12 stores SP across an INT 23
1041: UINT16 return_code; // 0x14 return code from last process termination (zerod after reading with AH=4Dh)
1042: UINT8 current_drive; // 0x16 current drive
1043: UINT8 extended_break_flag; // 0x17 extended break flag
1044: UINT8 fill[2]; // 0x18 flag: code page switching || flag: copy of previous byte in case of INT 24 Abort
1045: } sda_t;
1046: #pragma pack()
1047:
1048: #pragma pack(1)
1049: typedef struct {
1.1.1.14 root 1050: UINT8 reserved_0[4]; // -38
1051: UINT16 magic_word; // -34 from DOSBox
1052: UINT8 reserved_1[30]; // -32
1.1 root 1053: UINT16 first_mcb; // -2
1054: PAIR32 first_dpb; // +0
1.1.1.14 root 1055: PAIR32 first_sft; // +4
1.1.1.20 root 1056: PAIR32 clock_device; // +8
1057: PAIR32 con_device; // +12
1.1.1.14 root 1058: UINT16 max_sector_len; // +16
1059: PAIR32 disk_buf_info; // +18 from DOSBox
1.1 root 1060: PAIR32 cds; // +22
1061: PAIR32 fcb_table; // +26
1.1.1.20 root 1062: UINT8 reserved_2[3]; // +30
1.1 root 1063: UINT8 last_drive; // +33
1.1.1.14 root 1064: struct {
1.1.1.20 root 1065: PAIR32 next_driver; // +34
1.1.1.14 root 1066: UINT16 attributes; // +38
1067: UINT16 strategy; // +40
1068: UINT16 interrupt; // +42
1069: char dev_name[8]; // +44
1070: } nul_device;
1.1.1.20 root 1071: UINT8 reserved_3[11]; // +52
1.1 root 1072: UINT16 buffers_x; // +63
1073: UINT16 buffers_y; // +65
1074: UINT8 boot_drive; // +67
1075: UINT8 i386_or_later; // +68
1076: UINT16 ext_mem_size; // +69
1.1.1.14 root 1077: PAIR32 disk_buf_heads; // +71 from DOSBox
1.1.1.20 root 1078: UINT8 reserved_4[21]; // +75
1.1.1.5 root 1079: UINT8 dos_flag; // +96
1.1.1.20 root 1080: UINT8 reserved_5[2]; // +97
1.1.1.15 root 1081: UINT8 umb_linked; // +99 from DOSBox
1.1.1.20 root 1082: UINT8 reserved_6[2]; // +100
1.1.1.15 root 1083: UINT16 first_umb_fcb; // +102 from DOSBox
1084: UINT16 first_mcb_2; // +104 from DOSBox
1.1.1.21 root 1085: UINT8 nul_device_routine[7];
1.1 root 1086: } dos_info_t;
1087: #pragma pack()
1088:
1.1.1.14 root 1089: #pragma pack(1)
1090: typedef struct {
1.1.1.20 root 1091: PAIR32 next_driver;
1092: UINT16 attributes;
1093: UINT16 strategy;
1094: UINT16 interrupt;
1095: char dev_name[8];
1096: } device_t;
1097: #pragma pack()
1098:
1099: #pragma pack(1)
1100: typedef struct {
1.1.1.14 root 1101: UINT16 date_format;
1102: char currency_symbol[5];
1103: char thou_sep[2];
1104: char dec_sep[2];
1105: char date_sep[2];
1106: char time_sep[2];
1107: char currency_format;
1108: char currency_dec_digits;
1109: char time_format;
1110: PAIR32 case_map;
1111: char list_sep[2];
1112: char reserved[10];
1113: } country_info_t;
1114: #pragma pack()
1115:
1.1 root 1116: typedef struct {
1117: char path[MAX_PATH];
1118: int valid;
1119: int id;
1120: int atty;
1121: int mode;
1122: UINT16 info;
1123: UINT16 psp;
1.1.1.30 root 1124: int sio_port; // 1-4
1125: int lpt_port; // 1-3
1.1 root 1126: } file_handler_t;
1127:
1128: static const struct {
1129: int mode;
1130: int in;
1131: int out;
1132: } file_mode[] = {
1.1.1.11 root 1133: { _O_RDONLY | _O_BINARY, 1, 0 },
1.1 root 1134: { _O_WRONLY | _O_BINARY, 0, 1 },
1135: { _O_RDWR | _O_BINARY, 1, 1 },
1136: };
1137:
1138: typedef struct {
1139: UINT16 psp;
1140: char module_dir[MAX_PATH];
1.1.1.27 root 1141: #ifdef USE_DEBUGGER
1142: char module_path[MAX_PATH];
1143: #endif
1.1 root 1144: PAIR32 dta;
1145: UINT8 switchar;
1146: UINT8 verify;
1147: int max_files;
1148: char volume_label[MAX_PATH];
1149: bool parent_int_10h_feh_called;
1150: bool parent_int_10h_ffh_called;
1.1.1.12 root 1151: UINT16 parent_ds;
1.1.1.25 root 1152: UINT16 parent_es;
1.1.1.14 root 1153: struct {
1154: UINT16 handle;
1155: UINT16 page;
1156: bool mapped;
1157: } ems_pages[4];
1158: bool ems_pages_stored;
1.1.1.22 root 1159: bool called_by_int2eh;
1.1 root 1160: } process_t;
1161:
1.1.1.11 root 1162: typedef struct {
1163: UINT16 psp;
1164: UINT32 dta;
1.1.1.12 root 1165: UINT8 allowable_mask;
1166: UINT8 required_mask;
1.1.1.11 root 1167: HANDLE find_handle;
1168: } dtainfo_t;
1169:
1.1.1.24 root 1170: UINT8 dos_major_version = 7; // Windows 98 Second Edition
1171: UINT8 dos_minor_version = 10;
1172: UINT8 win_major_version = 4;
1173: UINT8 win_minor_version = 10;
1.1.1.8 root 1174:
1.1.1.7 root 1175: UINT16 first_mcb;
1.1 root 1176: UINT16 current_psp;
1177:
1178: int retval = 0;
1179: UINT16 error_code = 0;
1180:
1181: file_handler_t file_handler[MAX_FILES];
1182: UINT8 file_buffer[0x100000];
1183:
1184: process_t process[MAX_PROCESS];
1.1.1.11 root 1185: dtainfo_t dtalist[MAX_DTAINFO];
1.1 root 1186:
1.1.1.6 root 1187: UINT16 malloc_strategy = 0;
1188:
1.1.1.12 root 1189: char comspec_path[MAX_PATH] = "C:\\COMMAND.COM";
1190:
1.1 root 1191: void msdos_syscall(unsigned num);
1192: int msdos_init(int argc, char *argv[], char *envp[], int standard_env);
1193: void msdos_finish();
1194:
1195: // console
1196:
1.1.1.12 root 1197: #define SCR_BUF_WIDTH 256
1198: #define SCR_BUF_HEIGHT 128
1.1 root 1199:
1200: #define SET_RECT(rect, l, t, r, b) { \
1201: rect.Left = l; \
1202: rect.Top = t; \
1203: rect.Right = r; \
1204: rect.Bottom = b; \
1205: }
1206:
1.1.1.19 root 1207: DWORD dwConsoleMode = 0;
1208:
1.1.1.12 root 1209: CHAR_INFO scr_buf[SCR_BUF_WIDTH * SCR_BUF_HEIGHT];
1210: char scr_char[SCR_BUF_WIDTH * SCR_BUF_HEIGHT];
1211: WORD scr_attr[SCR_BUF_WIDTH * SCR_BUF_HEIGHT];
1.1 root 1212: COORD scr_buf_size;
1213: COORD scr_buf_pos;
1214: int scr_width, scr_height;
1.1.1.12 root 1215: int scr_top;
1.1.1.10 root 1216: bool restore_console_on_exit = false;
1.1 root 1217: bool cursor_moved;
1218:
1.1.1.22 root 1219: FIFO *key_buf_char = NULL;
1220: FIFO *key_buf_scan = NULL;
1.1.1.19 root 1221: bool key_changed = false;
1.1.1.4 root 1222: UINT32 key_code = 0;
1.1.1.27 root 1223: UINT32 key_recv = 0;
1.1 root 1224:
1.1.1.40 root 1225: void pcbios_clear_key_buffer();
1226: void pcbios_set_key_buffer(int key_char, int key_scan);
1227: bool pcbios_get_key_buffer(int *key_char, int *key_scan);
1228:
1.1.1.27 root 1229: UINT8 ctrl_break_checking = 0x00; // ???
1230: bool ctrl_break_detected = false;
1231: bool ctrl_break_pressed = false;
1.1.1.21 root 1232: bool ctrl_c_pressed = false;
1.1.1.27 root 1233: bool raise_int_1bh = false;
1.1.1.21 root 1234:
1.1 root 1235: int active_code_page;
1236: int system_code_page;
1.1.1.26 root 1237: int console_code_page;
1.1 root 1238:
1.1.1.12 root 1239: UINT32 text_vram_top_address;
1240: UINT32 text_vram_end_address;
1241: UINT32 shadow_buffer_top_address;
1242: UINT32 shadow_buffer_end_address;
1.1.1.40 root 1243: UINT32 cursor_position_address;
1.1.1.12 root 1244: int vram_pages;
1.1 root 1245: bool int_10h_feh_called = false;
1246: bool int_10h_ffh_called = false;
1247:
1.1.1.28 root 1248: #define MAX_MOUSE_BUTTONS 2
1.1.1.19 root 1249:
1.1.1.21 root 1250: typedef struct {
1.1.1.28 root 1251: bool enabled; // from DOSBox
1252: int hidden;
1253: int old_hidden; // from DOSBox
1.1.1.19 root 1254: struct {
1255: int x, y;
1256: } position, prev_position, max_position, min_position, mickey;
1257: struct {
1258: bool status;
1259: int pressed_times;
1260: int released_times;
1261: struct {
1262: int x, y;
1263: } pressed_position;
1264: struct {
1265: int x, y;
1266: } released_position;
1267: } buttons[MAX_MOUSE_BUTTONS];
1268: int get_buttons()
1269: {
1270: int val = 0;
1271: for(int i = 0; i < MAX_MOUSE_BUTTONS; i++) {
1272: if(buttons[i].status) {
1273: val |= 1 << i;
1274: }
1275: }
1276: return(val);
1277: }
1.1.1.33 root 1278: UINT16 status, status_alt;
1279: UINT16 status_irq, status_irq_alt;
1.1.1.19 root 1280: UINT16 call_mask;
1.1.1.33 root 1281: PAIR32 call_addr, call_addr_alt[8];
1.1.1.19 root 1282: // dummy
1283: UINT16 sensitivity[3];
1284: UINT16 display_page;
1285: UINT16 language;
1286: UINT16 hot_spot[2];
1.1.1.38 root 1287: UINT16 screen_mask;
1288: UINT16 cursor_mask;
1.1.1.21 root 1289: } mouse_t;
1290:
1291: mouse_t mouse;
1.1.1.19 root 1292:
1293: UINT16 mouse_push_ax;
1294: UINT16 mouse_push_bx;
1295: UINT16 mouse_push_cx;
1296: UINT16 mouse_push_dx;
1297: UINT16 mouse_push_si;
1298: UINT16 mouse_push_di;
1299:
1.1.1.23 root 1300: // hma
1301:
1302: #ifdef SUPPORT_HMA
1303: bool is_hma_used_by_xms = false;
1304: bool is_hma_used_by_int_2fh = false;
1305: #endif
1306:
1307: // xms
1308:
1309: #ifdef SUPPORT_XMS
1.1.1.24 root 1310: typedef struct emb_handle_s {
1311: UINT32 handle; // 0=allocated
1312: offs_t address;
1.1.1.23 root 1313: int size_kb;
1314: int lock;
1.1.1.24 root 1315: struct emb_handle_s *prev;
1316: struct emb_handle_s *next;
1317: } emb_handle_t;
1.1.1.23 root 1318:
1.1.1.24 root 1319: emb_handle_t *emb_handle_top = NULL;
1.1.1.23 root 1320: int xms_a20_local_enb_count;
1321: UINT16 xms_dx_after_call_08h = 0;
1.1.1.26 root 1322:
1323: void msdos_xms_init();
1324: void msdos_xms_finish();
1325: void msdos_xms_release();
1326: emb_handle_t *msdos_xms_get_emb_handle(int handle);
1327: int msdos_xms_get_unused_emb_handle_id();
1328: int msdos_xms_get_unused_emb_handle_count();
1329: void msdos_xms_split_emb_handle(emb_handle_t *emb_handle, int size_kb);
1330: void msdos_xms_combine_emb_handles(emb_handle_t *emb_handle);
1331: emb_handle_t *msdos_xms_alloc_emb_handle(int size_kb);
1332: void msdos_xms_free_emb_handle(emb_handle_t *emb_handle);
1.1.1.23 root 1333: #endif
1334:
1.1 root 1335: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.