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