diff --git a/src/86box.h b/src/86box.h index 5c25289ec..a2a75cc27 100644 --- a/src/86box.h +++ b/src/86box.h @@ -8,7 +8,7 @@ * * Main include file for the application. * - * Version: @(#)86box.h 1.0.10 2017/10/30 + * Version: @(#)86box.h 1.0.11 2017/11/01 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -79,6 +79,19 @@ extern int vid_cga_contrast, /* (C) video */ enable_overscan, /* (C) video */ force_43, /* (C) video */ video_speed; /* (C) video */ +extern int serial_enabled[], /* (C) enable serial ports */ + lpt_enabled, /* (C) enable LPT ports */ + bugger_enabled; /* (C) enable ISAbugger */ +extern int gfxcard; /* (C) graphics/video card */ +extern int GAMEBLASTER, /* (C) sound option */ + GUS, /* (C) sound option */ + SSI2001, /* (C) sound option */ + voodoo_enabled; /* (C) video option */ +extern int mem_size; /* (C) memory size */ +extern int cpu_manufacturer, /* (C) cpu manufacturer */ + cpu, /* (C) cpu type */ + cpu_use_dynarec, /* (C) cpu uses/needs Dyna */ + enable_external_fpu; /* (C) enable external FPU */ #ifdef ENABLE_LOG_TOGGLES @@ -95,7 +108,7 @@ extern wchar_t exe_path[1024]; /* path (dir) of executable */ extern wchar_t cfg_path[1024]; /* path (dir) of user data */ extern int scrnsz_x, /* current screen size, X */ scrnsz_y; /* current screen size, Y */ -extern int config_changed; /* configuration has changed */ +extern int config_changed; /* config has changed */ /* Function prototypes. */ diff --git a/src/bugger.c b/src/bugger.c index 6a45a5c13..7f2ced877 100644 --- a/src/bugger.c +++ b/src/bugger.c @@ -86,7 +86,7 @@ static uint8_t bug_buff[FIFO_LEN], /* serial port data buffer */ static char bug_str[UISTR_LEN]; /* UI output string */ -extern void set_bugui(char *__str); +extern void ui_sb_bugui(char *__str); /* Update the system's UI with the actual Bugger status. */ @@ -106,7 +106,7 @@ bug_setui(void) (bug_ledr&0x02)?'R':'r', (bug_ledr&0x01)?'R':'r'); /* Send formatted string to the UI. */ - ui_sb_set_text(bug_str); + ui_sb_bugui(bug_str); } diff --git a/src/cdrom/cdrom.h b/src/cdrom/cdrom.h index 78d3fba50..ca6650621 100644 --- a/src/cdrom/cdrom.h +++ b/src/cdrom/cdrom.h @@ -9,7 +9,7 @@ * Implementation of the CD-ROM drive with SCSI(-like) * commands, for both ATAPI and SCSI usage. * - * Version: @(#)cdrom.h 1.0.3 2017/10/15 + * Version: @(#)cdrom.h 1.0.4 2017/11/01 * * Author: Miran Grca, * @@ -21,6 +21,12 @@ #define CDROM_NUM 4 +#define CD_STATUS_EMPTY 0 +#define CD_STATUS_DATA_ONLY 1 +#define CD_STATUS_PLAYING 2 +#define CD_STATUS_PAUSED 3 +#define CD_STATUS_STOPPED 4 + #define CDROM_PHASE_IDLE 0 #define CDROM_PHASE_COMMAND 1 #define CDROM_PHASE_COMPLETE 2 @@ -38,6 +44,15 @@ #define CDROM_TIME (5LL * 100LL * (1LL << TIMER_SHIFT)) +enum { + CDROM_BUS_DISABLED = 0, + CDROM_BUS_ATAPI_PIO_ONLY = 4, + CDROM_BUS_ATAPI_PIO_AND_DMA, + CDROM_BUS_SCSI, + CDROM_BUS_USB = 8 +}; + + typedef struct { int (*ready)(uint8_t id); int (*medium_changed)(uint8_t id); diff --git a/src/config.c b/src/config.c index ccb9eb07c..b7948792e 100644 --- a/src/config.c +++ b/src/config.c @@ -8,7 +8,7 @@ * * Configuration file handler. * - * Version: @(#)config.c 1.0.29 2017/10/28 + * Version: @(#)config.c 1.0.30 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -975,7 +975,7 @@ load_removable_devices(void) wcsncpy(floppyfns[c], wp, sizeof_w(floppyfns[c])); if (*wp != L'\0') - printf("Floppy%d: %ls\n", c, floppyfns[c]); + pclog("Floppy%d: %ls\n", c, floppyfns[c]); sprintf(temp, "fdd_%02i_writeprot", c+1); ui_writeprot[c] = !!config_get_int(cat, temp, 0); sprintf(temp, "fdd_%02i_turbo", c + 1); diff --git a/src/cpu/386.c b/src/cpu/386.c index abdcf668e..2813767ba 100644 --- a/src/cpu/386.c +++ b/src/cpu/386.c @@ -14,6 +14,7 @@ #include "x87.h" #include "../mem.h" #include "../pic.h" +#include "../pit.h" #include "../timer.h" #include "../floppy/floppy.h" #include "../floppy/fdc.h" diff --git a/src/cpu/386_dynarec.c b/src/cpu/386_dynarec.c index 88f97ae7f..de1d97603 100644 --- a/src/cpu/386_dynarec.c +++ b/src/cpu/386_dynarec.c @@ -13,6 +13,7 @@ #include "x86.h" #include "x86_ops.h" #include "x87.h" +#include "../io.h" #include "../mem.h" #include "../nmi.h" #include "../pic.h" diff --git a/src/cpu/808x.c b/src/cpu/808x.c index 026908c4d..60c906546 100644 --- a/src/cpu/808x.c +++ b/src/cpu/808x.c @@ -18,7 +18,7 @@ * 2 clocks - fetch opcode 1 2 clocks - execute * 2 clocks - fetch opcode 2 etc * - * Version: @(#)808x.c 1.0.5 2017/10/16 + * Version: @(#)808x.c 1.0.6 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -34,6 +34,8 @@ #include "../ibm.h" #include "cpu.h" #include "x86.h" +#include "../machine/machine.h" +#include "../io.h" #include "../mem.h" #include "../rom.h" #include "../nmi.h" @@ -537,41 +539,41 @@ void dumpregs(int force) pclog("Dumping done\n"); #endif if (is386) - printf("EAX=%08X EBX=%08X ECX=%08X EDX=%08X\nEDI=%08X ESI=%08X EBP=%08X ESP=%08X\n",EAX,EBX,ECX,EDX,EDI,ESI,EBP,ESP); + pclog("EAX=%08X EBX=%08X ECX=%08X EDX=%08X\nEDI=%08X ESI=%08X EBP=%08X ESP=%08X\n",EAX,EBX,ECX,EDX,EDI,ESI,EBP,ESP); else - printf("AX=%04X BX=%04X CX=%04X DX=%04X DI=%04X SI=%04X BP=%04X SP=%04X\n",AX,BX,CX,DX,DI,SI,BP,SP); - printf("PC=%04X CS=%04X DS=%04X ES=%04X SS=%04X FLAGS=%04X\n",cpu_state.pc,CS,DS,ES,SS,flags); - printf("%04X:%04X %04X:%04X\n",oldcs,cpu_state.oldpc, oldcs2, oldpc2); - printf("%i ins\n",ins); + pclog("AX=%04X BX=%04X CX=%04X DX=%04X DI=%04X SI=%04X BP=%04X SP=%04X\n",AX,BX,CX,DX,DI,SI,BP,SP); + pclog("PC=%04X CS=%04X DS=%04X ES=%04X SS=%04X FLAGS=%04X\n",cpu_state.pc,CS,DS,ES,SS,flags); + pclog("%04X:%04X %04X:%04X\n",oldcs,cpu_state.oldpc, oldcs2, oldpc2); + pclog("%i ins\n",ins); if (is386) - printf("In %s mode\n",(msw&1)?((eflags&VM_FLAG)?"V86":"protected"):"real"); + pclog("In %s mode\n",(msw&1)?((eflags&VM_FLAG)?"V86":"protected"):"real"); else - printf("In %s mode\n",(msw&1)?"protected":"real"); - printf("CS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",cs,_cs.limit,_cs.access, _cs.limit_low, _cs.limit_high); - printf("DS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",ds,_ds.limit,_ds.access, _ds.limit_low, _ds.limit_high); - printf("ES : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",es,_es.limit,_es.access, _es.limit_low, _es.limit_high); + pclog("In %s mode\n",(msw&1)?"protected":"real"); + pclog("CS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",cs,_cs.limit,_cs.access, _cs.limit_low, _cs.limit_high); + pclog("DS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",ds,_ds.limit,_ds.access, _ds.limit_low, _ds.limit_high); + pclog("ES : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",es,_es.limit,_es.access, _es.limit_low, _es.limit_high); if (is386) { - printf("FS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",seg_fs,_fs.limit,_fs.access, _fs.limit_low, _fs.limit_high); - printf("GS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",gs,_gs.limit,_gs.access, _gs.limit_low, _gs.limit_high); + pclog("FS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",seg_fs,_fs.limit,_fs.access, _fs.limit_low, _fs.limit_high); + pclog("GS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",gs,_gs.limit,_gs.access, _gs.limit_low, _gs.limit_high); } - printf("SS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",ss,_ss.limit,_ss.access, _ss.limit_low, _ss.limit_high); - printf("GDT : base=%06X limit=%04X\n",gdt.base,gdt.limit); - printf("LDT : base=%06X limit=%04X\n",ldt.base,ldt.limit); - printf("IDT : base=%06X limit=%04X\n",idt.base,idt.limit); - printf("TR : base=%06X limit=%04X\n", tr.base, tr.limit); + pclog("SS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",ss,_ss.limit,_ss.access, _ss.limit_low, _ss.limit_high); + pclog("GDT : base=%06X limit=%04X\n",gdt.base,gdt.limit); + pclog("LDT : base=%06X limit=%04X\n",ldt.base,ldt.limit); + pclog("IDT : base=%06X limit=%04X\n",idt.base,idt.limit); + pclog("TR : base=%06X limit=%04X\n", tr.base, tr.limit); if (is386) { - printf("386 in %s mode stack in %s mode\n",(use32)?"32-bit":"16-bit",(stack32)?"32-bit":"16-bit"); - printf("CR0=%08X CR2=%08X CR3=%08X CR4=%08x\n",cr0,cr2,cr3, cr4); + pclog("386 in %s mode stack in %s mode\n",(use32)?"32-bit":"16-bit",(stack32)?"32-bit":"16-bit"); + pclog("CR0=%08X CR2=%08X CR3=%08X CR4=%08x\n",cr0,cr2,cr3, cr4); } - printf("Entries in readlookup : %i writelookup : %i\n",readlnum,writelnum); + pclog("Entries in readlookup : %i writelookup : %i\n",readlnum,writelnum); for (c=0;c<1024*1024;c++) { if (readlookup2[c]!=0xFFFFFFFF) d++; if (writelookup2[c]!=0xFFFFFFFF) e++; } - printf("Entries in readlookup : %i writelookup : %i\n",d,e); + pclog("Entries in readlookup : %i writelookup : %i\n",d,e); x87_dumpregs(); indump = 0; } @@ -1025,7 +1027,7 @@ void execx86(int cycs) cpu_state.pc--; if (output) { - if (!skipnextprint) printf("%04X:%04X : %04X %04X %04X %04X %04X %04X %04X %04X %04X %04X %04X %04X %02X %04X %i %p %02X\n",cs,cpu_state.pc,AX,BX,CX,DX,CS,DS,ES,SS,DI,SI,BP,SP,opcode,flags, ins, ram, ram[0x1a925]); + if (!skipnextprint) pclog("%04X:%04X : %04X %04X %04X %04X %04X %04X %04X %04X %04X %04X %04X %04X %02X %04X %i %p %02X\n",cs,cpu_state.pc,AX,BX,CX,DX,CS,DS,ES,SS,DI,SI,BP,SP,opcode,flags, ins, ram, ram[0x1a925]); skipnextprint=0; } cpu_state.pc++; @@ -2910,7 +2912,7 @@ void execx86(int cycs) } else { - printf("DIVb BY 0 %04X:%04X\n",cs>>4,cpu_state.pc); + pclog("DIVb BY 0 %04X:%04X\n",cs>>4,cpu_state.pc); writememw(ss,(SP-2)&0xFFFF,flags|0xF000); writememw(ss,(SP-4)&0xFFFF,CS); writememw(ss,(SP-6)&0xFFFF,cpu_state.pc); @@ -2934,7 +2936,7 @@ void execx86(int cycs) } else { - printf("IDIVb BY 0 %04X:%04X\n",cs>>4,cpu_state.pc); + pclog("IDIVb BY 0 %04X:%04X\n",cs>>4,cpu_state.pc); writememw(ss,(SP-2)&0xFFFF,flags|0xF000); writememw(ss,(SP-4)&0xFFFF,CS); writememw(ss,(SP-6)&0xFFFF,cpu_state.pc); @@ -3006,7 +3008,7 @@ void execx86(int cycs) } else { - printf("DIVw BY 0 %04X:%04X\n",cs>>4,cpu_state.pc); + pclog("DIVw BY 0 %04X:%04X\n",cs>>4,cpu_state.pc); writememw(ss,(SP-2)&0xFFFF,flags|0xF000); writememw(ss,(SP-4)&0xFFFF,CS); writememw(ss,(SP-6)&0xFFFF,cpu_state.pc); @@ -3030,7 +3032,7 @@ void execx86(int cycs) } else { - printf("IDIVw BY 0 %04X:%04X\n",cs>>4,cpu_state.pc); + pclog("IDIVw BY 0 %04X:%04X\n",cs>>4,cpu_state.pc); writememw(ss,(SP-2)&0xFFFF,flags|0xF000); writememw(ss,(SP-4)&0xFFFF,CS); writememw(ss,(SP-6)&0xFFFF,cpu_state.pc); diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 346373790..7d6997235 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -8,7 +8,7 @@ * * CPU type handler. * - * Version: @(#)cpu.c 1.0.5 2017/10/16 + * Version: @(#)cpu.c 1.0.6 2017/11/01 * * Authors: Sarah Walker, * leilei, @@ -97,7 +97,6 @@ enum CPUID_FXSR = (1 << 24) }; -int cpu = 3, cpu_manufacturer = 0; CPU *cpu_s; int cpu_multi; int cpu_iscyrix; @@ -107,10 +106,9 @@ int cpu_hasrdtsc; int cpu_hasMMX, cpu_hasMSR; int cpu_hasCR4; int cpu_hasVME; -int cpu_use_dynarec; int cpu_cyrix_alignment; - int hasfpu; +int cpuspeed; uint64_t cpu_CR4_mask; @@ -621,12 +619,12 @@ CPU cpus_PentiumPro[] = {"", -1, 0, 0, 0} }; + void cpu_set_edx() { EDX = machines[machine].cpu[cpu_manufacturer].cpus[cpu].edx_reset; } -int enable_external_fpu = 0; void cpu_set() { diff --git a/src/cpu/x87.c b/src/cpu/x87.c index 5d95b6fa9..0e88e8a39 100644 --- a/src/cpu/x87.c +++ b/src/cpu/x87.c @@ -6,6 +6,7 @@ #include #include "../86box.h" #include "../ibm.h" +#include "../mem.h" #include "../pic.h" #include "x86.h" #include "x86_flags.h" diff --git a/src/disk/hdc.c b/src/disk/hdc.c index 88521befe..7b57b20a1 100644 --- a/src/disk/hdc.c +++ b/src/disk/hdc.c @@ -8,7 +8,7 @@ * * Common code to handle all sorts of disk controllers. * - * Version: @(#)hdc.c 1.0.4 2017/10/16 + * Version: @(#)hdc.c 1.0.5 2017/11/01 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -21,10 +21,8 @@ #include #include #include "../86box.h" -#include "../ibm.h" -#include "../cpu/cpu.h" -#include "../device.h" #include "../machine/machine.h" +#include "../device.h" #include "hdc.h" diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index 097d85c01..21ad0218a 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -9,7 +9,7 @@ * Implementation of the IDE emulation for hard disks and ATAPI * CD-ROM devices. * - * Version: @(#)hdc_ide.c 1.0.17 2017/10/27 + * Version: @(#)hdc_ide.c 1.0.18 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -28,6 +28,7 @@ #include #include "../86box.h" #include "../ibm.h" +#include "../machine/machine.h" #include "../io.h" #include "../pic.h" #include "../pci.h" diff --git a/src/disk/hdd.c b/src/disk/hdd.c index ade328272..ef87d8c5a 100644 --- a/src/disk/hdd.c +++ b/src/disk/hdd.c @@ -8,7 +8,7 @@ * * Common code to handle all sorts of hard disk images. * - * Version: @(#)hdd.c 1.0.5 2017/10/16 + * Version: @(#)hdd.c 1.0.6 2017/11/01 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -21,7 +21,6 @@ #include #include #include "../86box.h" -#include "../ibm.h" #include "../ui.h" #include "hdd.h" diff --git a/src/disk/hdd_image.c b/src/disk/hdd_image.c index 0630cdc3c..e7f4f83b9 100644 --- a/src/disk/hdd_image.c +++ b/src/disk/hdd_image.c @@ -8,7 +8,7 @@ * * Handling of hard disk image files. * - * Version: @(#)hdd_image.c 1.0.6 2017/10/19 + * Version: @(#)hdd_image.c 1.0.7 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -29,7 +29,6 @@ #include #include #include "../86box.h" -#include "../ibm.h" #include "../plat.h" #include "hdd.h" diff --git a/src/disk/hdd_table.c b/src/disk/hdd_table.c index 98045f031..95490a014 100644 --- a/src/disk/hdd_table.c +++ b/src/disk/hdd_table.c @@ -9,10 +9,11 @@ * Implementation of the IDE emulation for hard disks and ATAPI * CD-ROM devices. * - * Version: @(#)hdd_table.c 1.0.4 2017/10/16 + * Version: @(#)hdd_table.c 1.0.5 2017/11/01 * * Authors: Miran Grca, * Fred N. van Kempen, + * * Copyright 2016,2017 Miran Grca. * Copyright 2017 Fred N. van Kempen. */ @@ -22,11 +23,6 @@ #include #include #include "../86box.h" -#include "../ibm.h" -#include "../io.h" -#include "../pic.h" -#include "../pci.h" -#include "../timer.h" #include "hdd.h" diff --git a/src/dma.c b/src/dma.c index 32efc672e..17727713b 100644 --- a/src/dma.c +++ b/src/dma.c @@ -8,7 +8,7 @@ * * Implementation of the Intel DMA controllers. * - * Version: @(#)dma.c 1.0.4 2017/10/16 + * Version: @(#)dma.c 1.0.5 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -23,6 +23,7 @@ #include "86box.h" #include "ibm.h" #include "cpu/x86.h" +#include "machine/machine.h" #include "mem.h" #include "io.h" #include "dma.h" diff --git a/src/dma.h b/src/dma.h index 8e791d9dc..d8bbbbf04 100644 --- a/src/dma.h +++ b/src/dma.h @@ -8,10 +8,11 @@ * * Implementation of the Intel DMA controllers. * - * Version: @(#)dma.h 1.0.2 2017/08/23 + * Version: @(#)dma.h 1.0.3 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, + * * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ @@ -19,9 +20,35 @@ # define EMU_DMA_H -#define DMA_NODATA -1 -#define DMA_OVER 0x10000 -#define DMA_VERIFY 0x20000 +#define DMA_NODATA -1 +#define DMA_OVER 0x10000 +#define DMA_VERIFY 0x20000 + + +typedef struct DMA { + uint32_t ab[4], + ac[4]; + uint16_t cb[4]; + int cc[4]; + int wp; + uint8_t m, + mode[4]; + uint8_t page[4]; + uint8_t stat; + uint8_t command; + uint8_t request; + + int xfr_command, + xfr_channel; + int byte_ptr; + + int is_ps2; + uint8_t arb_level[4]; + uint8_t ps2_mode[4]; +} DMA; + + +extern DMA dma, dma16; extern void dma_init(void); diff --git a/src/floppy/fdc.c b/src/floppy/fdc.c index a190126d9..4f72bc87c 100644 --- a/src/floppy/fdc.c +++ b/src/floppy/fdc.c @@ -9,7 +9,7 @@ * Implementation of the NEC uPD-765 and compatible floppy disk * controller. * - * Version: @(#)fdc.c 1.0.6 2017/10/16 + * Version: @(#)fdc.c 1.0.7 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -24,6 +24,7 @@ #include #include "../86box.h" #include "../ibm.h" +#include "../machine/machine.h" #include "../io.h" #include "../mem.h" #include "../rom.h" diff --git a/src/floppy/fdd.c b/src/floppy/fdd.c index d6ea4f0e5..372b9c7d8 100644 --- a/src/floppy/fdd.c +++ b/src/floppy/fdd.c @@ -21,7 +21,7 @@ #include #include #include "../86box.h" -#include "../ibm.h" +//#include "../ibm.h" #include "floppy.h" #include "fdc.h" #include "fdd.h" diff --git a/src/floppy/fdd.h b/src/floppy/fdd.h index f365b5b79..627317ffc 100644 --- a/src/floppy/fdd.h +++ b/src/floppy/fdd.h @@ -8,10 +8,11 @@ * * Implementation of the floppy drive emulation. * - * Version: @(#)fdd.h 1.0.2 2017/09/03 + * Version: @(#)fdd.h 1.0.3 2017/10/01 * * Authors: Sarah Walker, * Miran Grca, + * * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ @@ -22,6 +23,10 @@ #define SEEK_RECALIBRATE -999 +#ifdef __cplusplus +extern "C" { +#endif + extern int fdd_swap; @@ -60,5 +65,9 @@ extern int fdd_get_from_internal_name(char *s); extern int fdd_track(int drive); +#ifdef __cplusplus +} +#endif + #endif /*EMU_FDD_H*/ diff --git a/src/floppy/fdi2raw.c b/src/floppy/fdi2raw.c index 3b80d888c..7b4234556 100644 --- a/src/floppy/fdi2raw.c +++ b/src/floppy/fdi2raw.c @@ -31,7 +31,7 @@ /* ELSE */ #define xmalloc malloc #include "../86box.h" -#include "../ibm.h" +//#include "../ibm.h" #include "fdi2raw.h" diff --git a/src/floppy/floppy.c b/src/floppy/floppy.c index 9118a85bb..116684d06 100644 --- a/src/floppy/floppy.c +++ b/src/floppy/floppy.c @@ -9,7 +9,7 @@ * Generic floppy disk interface that communicates with the * other handlers. * - * Version: @(#)floppy.c 1.0.10 2017/10/16 + * Version: @(#)floppy.c 1.0.11 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -23,6 +23,7 @@ #include #include "../86box.h" #include "../ibm.h" +#include "../machine/machine.h" #include "../mem.h" #include "../rom.h" #include "../config.h" diff --git a/src/floppy/floppy.h b/src/floppy/floppy.h index 03bc68dfb..5ec47642b 100644 --- a/src/floppy/floppy.h +++ b/src/floppy/floppy.h @@ -9,7 +9,7 @@ * Generic floppy disk interface that communicates with the * other handlers. * - * Version: @(#)floppy.h 1.0.4 2017/10/15 + * Version: @(#)floppy.h 1.0.5 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -24,26 +24,29 @@ #define FDD_NUM 4 -typedef struct -{ - void (*seek)(int drive, int track); - void (*readsector)(int drive, int sector, int track, int side, int density, int sector_size); - void (*writesector)(int drive, int sector, int track, int side, int density, int sector_size); - void (*comparesector)(int drive, int sector, int track, int side, int density, int sector_size); - void (*readaddress)(int drive, int side, int density); - void (*format)(int drive, int side, int density, uint8_t fill); - int (*hole)(int drive); - double (*byteperiod)(int drive); - void (*stop)(int drive); - void (*poll)(int drive); +typedef struct { + void (*seek)(int drive, int track); + void (*readsector)(int drive, int sector, int track, int side, int density, int sector_size); + void (*writesector)(int drive, int sector, int track, int side, int density, int sector_size); + void (*comparesector)(int drive, int sector, int track, int side, int density, int sector_size); + void (*readaddress)(int drive, int side, int density); + void (*format)(int drive, int side, int density, uint8_t fill); + int (*hole)(int drive); + double (*byteperiod)(int drive); + void (*stop)(int drive); + void (*poll)(int drive); } DRIVE; extern DRIVE drives[FDD_NUM]; +extern wchar_t floppyfns[FDD_NUM][512]; +extern int driveempty[FDD_NUM]; +extern int64_t floppy_poll_time[FDD_NUM]; + extern int curdrive; extern int floppy_time; -extern int64_t floppy_poll_time[FDD_NUM]; +extern int64_t floppytime; extern void floppy_load(int drive, wchar_t *fn); @@ -84,9 +87,11 @@ extern void fdc_sectorid(uint8_t track, uint8_t side, uint8_t sector, uint8_t size, uint8_t crc1, uint8_t crc2); extern void fdc_indexpulse(void); -/*extern int fdc_time; +#if 0 +extern int fdc_time; extern int fdc_ready; -extern int fdc_indexcount;*/ +extern int fdc_indexcount; +#endif extern int motorspin; extern int64_t motoron[FDD_NUM]; diff --git a/src/floppy/floppy_86f.c b/src/floppy/floppy_86f.c index 5f122ed4b..a9d5e7658 100644 --- a/src/floppy/floppy_86f.c +++ b/src/floppy/floppy_86f.c @@ -10,7 +10,7 @@ * data in the form of FM/MFM-encoded transitions) which also * forms the core of the emulator's floppy disk emulation. * - * Version: @(#)floppy_86f.c 1.0.9 2017/10/19 + * Version: @(#)floppy_86f.c 1.0.10 2017/11/01 * * Author: Miran Grca, * Copyright 2016,2017 Miran Grca. @@ -1303,7 +1303,7 @@ void d86f_read_sector_id(int drive, int side, int match) if (d86f[drive].calc_crc.word != d86f[drive].track_crc.word) { d86f[drive].id_find.sync_marks = d86f[drive].id_find.bits_obtained = d86f[drive].id_find.bytes_obtained = 0; - printf("ID CRC error: %04X != %04X (%08X)\n", d86f[drive].track_crc.word, d86f[drive].calc_crc.word, d86f[drive].last_sector.dword); + pclog("86F: ID CRC error: %04X != %04X (%08X)\n", d86f[drive].track_crc.word, d86f[drive].calc_crc.word, d86f[drive].last_sector.dword); if ((d86f[drive].state != STATE_02_READ_ID) && (d86f[drive].state != STATE_0A_READ_ID)) { d86f[drive].error_condition = 0; @@ -1495,7 +1495,7 @@ void d86f_read_sector_data(int drive, int side) if ((d86f[drive].calc_crc.word != d86f[drive].track_crc.word) && (d86f[drive].state != STATE_02_READ_DATA)) { - printf("Data CRC error: %04X != %04X (%08X)\n", d86f[drive].track_crc.word, d86f[drive].calc_crc.word, d86f[drive].last_sector.dword); + pclog("86F: Data CRC error: %04X != %04X (%08X)\n", d86f[drive].track_crc.word, d86f[drive].calc_crc.word, d86f[drive].last_sector.dword); d86f[drive].data_find.sync_marks = d86f[drive].data_find.bits_obtained = d86f[drive].data_find.bytes_obtained = 0; d86f[drive].error_condition = 0; d86f[drive].state = STATE_IDLE; diff --git a/src/floppy/floppy_common.c b/src/floppy/floppy_common.c index d6d0b218c..009ba0d45 100644 --- a/src/floppy/floppy_common.c +++ b/src/floppy/floppy_common.c @@ -19,7 +19,7 @@ #include #include #include "../86box.h" -#include "../ibm.h" +//#include "../ibm.h" #include "../floppy/floppy.h" #include "floppy_common.h" diff --git a/src/floppy/floppy_fdi.c b/src/floppy/floppy_fdi.c index 67c179aa4..746f74c22 100644 --- a/src/floppy/floppy_fdi.c +++ b/src/floppy/floppy_fdi.c @@ -22,7 +22,7 @@ #include #include #include "../86box.h" -#include "../ibm.h" +//#include "../ibm.h" #include "../plat.h" #include "floppy.h" #include "floppy_86f.h" diff --git a/src/floppy/floppy_img.c b/src/floppy/floppy_img.c index 9c5e4d9c1..3d947d1a4 100644 --- a/src/floppy/floppy_img.c +++ b/src/floppy/floppy_img.c @@ -9,7 +9,7 @@ * Implementation of the raw sector-based floppy image format, * as well as the Japanese FDI, CopyQM, and FDF formats. * - * Version: @(#)floppy_img.c 1.0.5 2017/10/16 + * Version: @(#)floppy_img.c 1.0.6 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -674,7 +674,7 @@ void img_load(int drive, wchar_t *fn) } } } - printf("Finished reading CopyQM image data\n"); + pclog("Finished reading CopyQM image data\n"); cqm = 1; img[drive].disk_at_once = 1; diff --git a/src/floppy/floppy_json.c b/src/floppy/floppy_json.c index c4822f095..8a277a38e 100644 --- a/src/floppy/floppy_json.c +++ b/src/floppy/floppy_json.c @@ -20,7 +20,7 @@ #include #include #include "../86box.h" -#include "../ibm.h" +//#include "../ibm.h" #include "../plat.h" #include "floppy.h" #include "fdc.h" diff --git a/src/floppy/floppy_td0.c b/src/floppy/floppy_td0.c index 97e5e45a2..37ce9fd38 100644 --- a/src/floppy/floppy_td0.c +++ b/src/floppy/floppy_td0.c @@ -43,7 +43,7 @@ #include #include #include "../86box.h" -#include "../ibm.h" +//#include "../ibm.h" #include "../plat.h" #include "floppy.h" #include "floppy_td0.h" diff --git a/src/game/gameport.c b/src/game/gameport.c index 9756facb8..ebc4131e0 100644 --- a/src/game/gameport.c +++ b/src/game/gameport.c @@ -8,6 +8,7 @@ #include #include "../86box.h" #include "../ibm.h" +#include "../machine/machine.h" #include "../cpu/cpu.h" #include "../device.h" #include "../io.h" diff --git a/src/ibm.h b/src/ibm.h index 17a41f1cc..7b774d0bc 100644 --- a/src/ibm.h +++ b/src/ibm.h @@ -10,10 +10,11 @@ * * !!!NOTE!!! The goal is to GET RID of this file. Do NOT add stuff !! * - * Version: @(#)ibm.h 1.0.11 2017/10/17 + * Version: @(#)ibm.h 1.0.12 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, + * * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ @@ -21,162 +22,115 @@ # define EMU_IBM_H -#define printf pclog - - -/*Memory*/ -extern uint8_t *ram; -extern uint32_t rammask; - -extern int readlookup[256],readlookupp[256]; -extern uintptr_t *readlookup2; -extern int readlnext; -extern int writelookup[256],writelookupp[256]; -extern uintptr_t *writelookup2; -extern int writelnext; - -extern int mmu_perm; - -#define readmemb(a) ((readlookup2[(a)>>12]==-1)?readmembl(a):*(uint8_t *)(readlookup2[(a) >> 12] + (a))) -#define readmemw(s,a) ((readlookup2[(uint32_t)((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a)) & 1))?readmemwl(s,a):*(uint16_t *)(readlookup2[(uint32_t)((s)+(a))>>12]+(uint32_t)((s)+(a)))) -#define readmeml(s,a) ((readlookup2[(uint32_t)((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a)) & 3))?readmemll(s,a):*(uint32_t *)(readlookup2[(uint32_t)((s)+(a))>>12]+(uint32_t)((s)+(a)))) - -extern uint8_t readmembl(uint32_t addr); -extern void writemembl(uint32_t addr, uint8_t val); -extern uint8_t readmemb386l(uint32_t seg, uint32_t addr); -extern void writememb386l(uint32_t seg, uint32_t addr, uint8_t val); -extern uint16_t readmemwl(uint32_t seg, uint32_t addr); -extern void writememwl(uint32_t seg, uint32_t addr, uint16_t val); -extern uint32_t readmemll(uint32_t seg, uint32_t addr); -extern void writememll(uint32_t seg, uint32_t addr, uint32_t val); -extern uint64_t readmemql(uint32_t seg, uint32_t addr); -extern void writememql(uint32_t seg, uint32_t addr, uint64_t val); - -extern uint8_t *getpccache(uint32_t a); -extern uint32_t mmutranslatereal(uint32_t addr, int rw); -extern void addreadlookup(uint32_t virt, uint32_t phys); -extern void addwritelookup(uint32_t virt, uint32_t phys); - - -/*IO*/ -extern uint8_t inb(uint16_t port); -extern void outb(uint16_t port, uint8_t val); -extern uint16_t inw(uint16_t port); -extern void outw(uint16_t port, uint16_t val); -extern uint32_t inl(uint16_t port); -extern void outl(uint16_t port, uint32_t val); - -extern int shadowbios,shadowbios_write; -extern int mem_size; -extern int readlnum,writelnum; - - /*Processor*/ -#define EAX cpu_state.regs[0].l -#define ECX cpu_state.regs[1].l -#define EDX cpu_state.regs[2].l -#define EBX cpu_state.regs[3].l -#define ESP cpu_state.regs[4].l -#define EBP cpu_state.regs[5].l -#define ESI cpu_state.regs[6].l -#define EDI cpu_state.regs[7].l -#define AX cpu_state.regs[0].w -#define CX cpu_state.regs[1].w -#define DX cpu_state.regs[2].w -#define BX cpu_state.regs[3].w -#define SP cpu_state.regs[4].w -#define BP cpu_state.regs[5].w -#define SI cpu_state.regs[6].w -#define DI cpu_state.regs[7].w -#define AL cpu_state.regs[0].b.l -#define AH cpu_state.regs[0].b.h -#define CL cpu_state.regs[1].b.l -#define CH cpu_state.regs[1].b.h -#define DL cpu_state.regs[2].b.l -#define DH cpu_state.regs[2].b.h -#define BL cpu_state.regs[3].b.l -#define BH cpu_state.regs[3].b.h - -typedef union -{ - uint32_t l; - uint16_t w; - struct - { - uint8_t l,h; - } b; +typedef union { + uint32_t l; + uint16_t w; + struct { + uint8_t l, + h; + } b; } x86reg; -typedef struct -{ - uint32_t base; - uint32_t limit; - uint8_t access; - uint16_t seg; - uint32_t limit_low, limit_high; - int checked; /*Non-zero if selector is known to be valid*/ +typedef struct { + uint32_t base; + uint32_t limit; + uint8_t access; + uint16_t seg; + uint32_t limit_low, + limit_high; + int checked; /*Non-zero if selector is known to be valid*/ } x86seg; -typedef union MMX_REG -{ - uint64_t q; - int64_t sq; - uint32_t l[2]; - int32_t sl[2]; - uint16_t w[4]; - int16_t sw[4]; - uint8_t b[8]; - int8_t sb[8]; +typedef union MMX_REG { + uint64_t q; + int64_t sq; + uint32_t l[2]; + int32_t sl[2]; + uint16_t w[4]; + int16_t sw[4]; + uint8_t b[8]; + int8_t sb[8]; } MMX_REG; -struct _cpustate_ -{ - x86reg regs[8]; +struct _cpustate_ { + x86reg regs[8]; - uint8_t tag[8]; + uint8_t tag[8]; - x86seg *ea_seg; - uint32_t eaaddr; + x86seg *ea_seg; + uint32_t eaaddr; - int flags_op; - uint32_t flags_res; - uint32_t flags_op1, flags_op2; - - uint32_t pc; - uint32_t oldpc; - uint32_t op32; + int flags_op; + uint32_t flags_res; + uint32_t flags_op1, + flags_op2; - int TOP; - - union - { - struct - { - int8_t rm, mod, reg; - } rm_mod_reg; - uint32_t rm_mod_reg_data; - } rm_data; - - int8_t ssegs; - int8_t ismmx; - int8_t abrt; + uint32_t pc; + uint32_t oldpc; + uint32_t op32; - int _cycles; - int cpu_recomp_ins; - - uint16_t npxs, npxc; + int TOP; - double ST[8]; - - uint16_t MM_w4[8]; - - MMX_REG MM[8]; - - uint16_t old_npxc, new_npxc; - uint32_t last_ea; + union { + struct { + int8_t rm, + mod, + reg; + } rm_mod_reg; + int32_t rm_mod_reg_data; + } rm_data; + + int8_t ssegs; + int8_t ismmx; + int8_t abrt; + + int _cycles; + int cpu_recomp_ins; + + uint16_t npxs, + npxc; + + double ST[8]; + + uint16_t MM_w4[8]; + + MMX_REG MM[8]; + + uint16_t old_npxc, + new_npxc; + uint32_t last_ea; } cpu_state; +#define EAX cpu_state.regs[0].l +#define AX cpu_state.regs[0].w +#define AL cpu_state.regs[0].b.l +#define AH cpu_state.regs[0].b.h +#define ECX cpu_state.regs[1].l +#define CX cpu_state.regs[1].w +#define CL cpu_state.regs[1].b.l +#define CH cpu_state.regs[1].b.h +#define EDX cpu_state.regs[2].l +#define DX cpu_state.regs[2].w +#define DL cpu_state.regs[2].b.l +#define DH cpu_state.regs[2].b.h +#define EBX cpu_state.regs[3].l +#define BX cpu_state.regs[3].w +#define BL cpu_state.regs[3].b.l +#define BH cpu_state.regs[3].b.h +#define ESP cpu_state.regs[4].l +#define EBP cpu_state.regs[5].l +#define ESI cpu_state.regs[6].l +#define EDI cpu_state.regs[7].l +#define SP cpu_state.regs[4].w +#define BP cpu_state.regs[5].w +#define SI cpu_state.regs[6].w +#define DI cpu_state.regs[7].w -#define cycles cpu_state._cycles +#define cycles cpu_state._cycles + +#define cpu_rm cpu_state.rm_data.rm_mod_reg.rm +#define cpu_mod cpu_state.rm_data.rm_mod_reg.mod +#define cpu_reg cpu_state.rm_data.rm_mod_reg.reg extern uint32_t cpu_cur_status; @@ -185,10 +139,6 @@ extern uint32_t cpu_cur_status; #define CPU_STATUS_FLATDS (1 << 2) #define CPU_STATUS_FLATSS (1 << 3) -#define cpu_rm cpu_state.rm_data.rm_mod_reg.rm -#define cpu_mod cpu_state.rm_data.rm_mod_reg.mod -#define cpu_reg cpu_state.rm_data.rm_mod_reg.reg - #ifdef __MSC__ # define COMPILE_TIME_ASSERT(expr) /*nada*/ #else @@ -272,9 +222,6 @@ extern uint32_t dr[8]; #define IOPLp ((!(msw&1)) || (CPL<=IOPL)) extern int cycles_lost; -extern int israpidcad; -extern int is486; -extern int is_pentium; extern uint8_t opcode; extern int insc; extern int fpucount; @@ -285,108 +232,15 @@ extern int CPUID; extern int cpl_override; +extern int is286, is386, is486; +extern int is_rapidcad, is_pentium; +extern int hasfpu; +extern int cpuspeed; -/*Timer*/ -typedef struct PIT_nr -{ - int64_t nr; - struct PIT *pit; -} PIT_nr; - -typedef struct PIT -{ - uint32_t l[3]; - int64_t c[3]; - uint8_t m[3]; - uint8_t ctrl,ctrls[3]; - int64_t wp,rm[3],wm[3]; - uint16_t rl[3]; - int64_t thit[3]; - int64_t delay[3]; - int64_t rereadlatch[3]; - int64_t gate[3]; - int64_t out[3]; - int64_t running[3]; - int64_t enabled[3]; - int64_t newcount[3]; - int64_t count[3]; - int64_t using_timer[3]; - int64_t initial[3]; - int64_t latched[3]; - int64_t disabled[3]; - - uint8_t read_status[3]; - int64_t do_read_status[3]; - - PIT_nr pit_nr[3]; - - void (*set_out_funcs[3])(int64_t new_out, int64_t old_out); -} PIT; - -PIT pit, pit2; -extern void setpitclock(float clock); -extern float pit_timer0_freq(void); - - - -/*DMA*/ -typedef struct DMA -{ - uint32_t ab[4],ac[4]; - uint16_t cb[4]; - int cc[4]; - int wp; - uint8_t m,mode[4]; - uint8_t page[4]; - uint8_t stat; - uint8_t command; - uint8_t request; - - int xfr_command, xfr_channel; - int byte_ptr; - - int is_ps2; - uint8_t arb_level[4]; - uint8_t ps2_mode[4]; -} DMA; - -extern DMA dma, dma16; - - -/*PPI*/ -typedef struct PPI -{ - int s2; - uint8_t pa,pb; -} PPI; - -extern PPI ppi; - - -/*PIC*/ -typedef struct PIC -{ - uint8_t icw1,icw3,icw4,mask,ins,pend,mask2; - int icw; - uint8_t vector; - int read; -} PIC; - -extern PIC pic, pic2; -extern int pic_intpending; - - -extern int64_t floppytime; -extern wchar_t floppyfns[4][512]; -extern int driveempty[4]; #define MDA ((gfxcard==GFX_MDA || gfxcard==GFX_HERCULES || gfxcard==GFX_HERCULESPLUS || gfxcard==GFX_INCOLOR || gfxcard==GFX_GENIUS) && (romset=ROM_IBMAT)) #define VGA ((gfxcard>=GFX_TVGA) && gfxcard!=GFX_COLORPLUS && gfxcard!=GFX_INCOLOR && gfxcard!=GFX_WY700 && gfxcard!=GFX_GENIUS && gfxcard!=GFX_COMPAQ_EGA && gfxcard!=GFX_SUPER_EGA && gfxcard!=GFX_HERCULESPLUS && romset!=ROM_PC1640 && romset!=ROM_PC1512 && romset!=ROM_TANDY && romset!=ROM_PC200) -int GAMEBLASTER, GUS, SSI2001, voodoo_enabled; -extern int AMSTRAD, AT, is286, is386, PCI, TANDY; -extern int hasfpu; - enum { GFX_CGA = 0, @@ -460,10 +314,6 @@ enum extern int gfx_present[GFX_MAX]; -int gfxcard; - -int cpuspeed; - /*Video*/ extern int egareads,egawrites; @@ -471,14 +321,9 @@ extern int changeframecount; /*Sound*/ -extern int ppispeakon; -extern float CGACONST; -extern float MDACONST; -extern float VGACONST1,VGACONST2; -extern float RTCCONST; -extern int gated,speakval,speakon; - #define SOUNDBUFLEN (48000/50) +extern int ppispeakon; +extern int gated,speakval,speakon; /*Sound Blaster*/ @@ -494,32 +339,13 @@ extern int gated,speakval,speakon; #define SND_PAS16 10 /*Pro Audio Spectrum 16*/ -/*Keyboard*/ -extern int64_t keybsenddelay; - - /*CD-ROM*/ -enum -{ - CDROM_BUS_DISABLED = 0, - CDROM_BUS_ATAPI_PIO_ONLY = 4, - CDROM_BUS_ATAPI_PIO_AND_DMA, - CDROM_BUS_SCSI, - CDROM_BUS_USB = 8 -}; - extern int64_t idecallback[5]; -#define CD_STATUS_EMPTY 0 -#define CD_STATUS_DATA_ONLY 1 -#define CD_STATUS_PLAYING 2 -#define CD_STATUS_PAUSED 3 -#define CD_STATUS_STOPPED 4 - extern uint32_t SCSIGetCDVolume(int channel); extern uint32_t SCSIGetCDChannel(int channel); -#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) #define ELEMENTS(Array) (sizeof(Array) / sizeof((Array)[0])) extern int ui_writeprot[4]; @@ -558,12 +384,6 @@ extern PCI_RESET pci_reset_handler; extern void trc_init(void); -extern int enable_external_fpu; - -extern int serial_enabled[2]; -extern int lpt_enabled, bugger_enabled; -extern int romset; - uint32_t svga_color_transform(uint32_t color); diff --git a/src/intel.c b/src/intel.c index 10442aff1..35b8bb312 100644 --- a/src/intel.c +++ b/src/intel.c @@ -7,6 +7,7 @@ #include #include "ibm.h" #include "cpu/cpu.h" +#include "machine/machine.h" #include "io.h" #include "mem.h" #include "pit.h" diff --git a/src/io.c b/src/io.c index 5b6d04926..c2f5acdce 100644 --- a/src/io.c +++ b/src/io.c @@ -6,7 +6,6 @@ #include #include #include "86box.h" -#include "ibm.h" #include "io.h" diff --git a/src/io.h b/src/io.h index 1ff610788..081fbbff4 100644 --- a/src/io.h +++ b/src/io.h @@ -38,3 +38,10 @@ extern void io_removehandler_interleaved(uint16_t base, int size, void (*outw)(uint16_t addr, uint16_t val, void *priv), void (*outl)(uint16_t addr, uint32_t val, void *priv), void *priv); + +extern uint8_t inb(uint16_t port); +extern void outb(uint16_t port, uint8_t val); +extern uint16_t inw(uint16_t port); +extern void outw(uint16_t port, uint16_t val); +extern uint32_t inl(uint16_t port); +extern void outl(uint16_t port, uint32_t val); diff --git a/src/keyboard.c b/src/keyboard.c index a6ad9d6dc..495976326 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -8,7 +8,7 @@ * * Host to guest keyboard interface and keyboard scan code sets. * - * Version: @(#)keyboard.c 1.0.7 2017/10/28 + * Version: @(#)keyboard.c 1.0.8 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -21,7 +21,7 @@ #include #include #include "86box.h" -#include "ibm.h" +#include "machine/machine.h" #include "keyboard.h" diff --git a/src/keyboard.h b/src/keyboard.h index eb5c648d4..9094d3563 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -8,7 +8,7 @@ * * Host to guest keyboard interface and keyboard scan code sets. * - * Version: @(#)keyboard.h 1.0.3 2017/10/24 + * Version: @(#)keyboard.h 1.0.4 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -26,6 +26,7 @@ extern "C" { extern uint8_t keyboard_mode; extern int keyboard_scan; +extern int64_t keybsenddelay; extern uint8_t keyboard_set3_flags[272]; extern uint8_t keyboard_set3_all_repeat; extern uint8_t keyboard_set3_all_break; diff --git a/src/keyboard_amstrad.c b/src/keyboard_amstrad.c index 022ecb4a1..6ae16808a 100644 --- a/src/keyboard_amstrad.c +++ b/src/keyboard_amstrad.c @@ -8,9 +8,9 @@ #include "86box.h" #include "ibm.h" #include "io.h" -#include "mem.h" #include "pic.h" #include "pit.h" +#include "ppi.h" #include "timer.h" #include "sound/sound.h" #include "sound/snd_speaker.h" diff --git a/src/keyboard_at.c b/src/keyboard_at.c index b88857d0a..cd490fd7d 100644 --- a/src/keyboard_at.c +++ b/src/keyboard_at.c @@ -8,7 +8,7 @@ * * Intel 8042 (AT keyboard controller) emulation. * - * Version: @(#)keyboard_at.c 1.0.6 2017/10/24 + * Version: @(#)keyboard_at.c 1.0.7 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -27,6 +27,7 @@ #include "io.h" #include "pic.h" #include "pit.h" +#include "ppi.h" #include "mem.h" #include "rom.h" #include "timer.h" diff --git a/src/keyboard_olim24.c b/src/keyboard_olim24.c index 36f820045..2e2192fbe 100644 --- a/src/keyboard_olim24.c +++ b/src/keyboard_olim24.c @@ -4,11 +4,10 @@ #include #include #include "86box.h" -#include "ibm.h" #include "io.h" -#include "mem.h" #include "pic.h" #include "pit.h" +#include "ppi.h" #include "timer.h" #include "mouse.h" #include "sound/sound.h" diff --git a/src/keyboard_xt.c b/src/keyboard_xt.c index d413575b7..300e0f688 100644 --- a/src/keyboard_xt.c +++ b/src/keyboard_xt.c @@ -7,11 +7,13 @@ #include #include "86box.h" #include "ibm.h" +#include "machine/machine.h" #include "io.h" #include "mem.h" #include "rom.h" #include "pic.h" #include "pit.h" +#include "ppi.h" #include "timer.h" #include "device.h" #include "tandy_eeprom.h" diff --git a/src/lpt.c b/src/lpt.c index b510f62ce..93c84e89c 100644 --- a/src/lpt.c +++ b/src/lpt.c @@ -5,7 +5,7 @@ #include #include #include -#include "ibm.h" +#include "86box.h" #include "io.h" #include "lpt.h" #include "sound/snd_lpt_dac.h" diff --git a/src/machine/machine.c b/src/machine/machine.c index 9e6cf7d4e..a4fb5fbf5 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -8,7 +8,7 @@ * * Handling of the emulated machines. * - * Version: @(#)machine.c 1.0.22 2017/10/30 + * Version: @(#)machine.c 1.0.23 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -40,8 +40,6 @@ int machine; int AMSTRAD, AT, PCI, TANDY; -int serial_enabled[SERIAL_MAX] = { 0, 0 }; -int lpt_enabled = 0, bugger_enabled = 0; int romset; diff --git a/src/machine/machine.h b/src/machine/machine.h index 590d13a07..85fe8af57 100644 --- a/src/machine/machine.h +++ b/src/machine/machine.h @@ -8,7 +8,7 @@ * * Handling of the emulated machines. * - * Version: @(#)machine.h 1.0.7 2017/10/12 + * Version: @(#)machine.h 1.0.8 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -73,6 +73,8 @@ typedef struct _machine_ { /* Global variables. */ extern machine_t machines[]; extern int machine; +extern int romset; +extern int AMSTRAD, TANDY, AT, PCI; /* Core functions. */ diff --git a/src/machine/machine_at_opti495.c b/src/machine/machine_at_opti495.c index 54ac72178..2fa74d5d1 100644 --- a/src/machine/machine_at_opti495.c +++ b/src/machine/machine_at_opti495.c @@ -275,7 +275,7 @@ static void opti495_write(uint16_t addr, uint8_t val, void *p) optireg=val; break; case 0x24: - printf("Writing OPTI reg %02X %02X\n",optireg,val); + pclog("OPTI: writing reg %02X %02X\n",optireg,val); if (optireg>=0x20 && optireg<=0x2C) { optiregs[optireg-0x20]=val; diff --git a/src/mca.c b/src/mca.c index 65dcd9eda..3d0677b26 100644 --- a/src/mca.c +++ b/src/mca.c @@ -2,9 +2,7 @@ #include #include #include -#include "ibm.h" #include "io.h" -#include "mem.h" #include "mca.h" diff --git a/src/mcr.c b/src/mcr.c index 9f753639f..4a7f17575 100644 --- a/src/mcr.c +++ b/src/mcr.c @@ -7,6 +7,7 @@ #include #include "86box.h" #include "ibm.h" +#include "mem.h" int nextreg6; @@ -23,7 +24,7 @@ void resetmcr(void) void writemcr(uint16_t addr, uint8_t val) { - printf("Write MCR %04X %02X %04X:%04X\n",addr,val,CS,cpu_state.pc); + pclog("MCR: write %04X %02X %04X:%04X\n",addr,val,CS,cpu_state.pc); switch (addr) { case 0x22: diff --git a/src/mem.c b/src/mem.c index db519d6fa..f7e30d0cc 100644 --- a/src/mem.c +++ b/src/mem.c @@ -11,6 +11,7 @@ #include "cpu/cpu.h" #include "cpu/x86_ops.h" #include "cpu/x86.h" +#include "machine/machine.h" #include "config.h" #include "io.h" #include "mem.h" diff --git a/src/mem.h b/src/mem.h index 29dd69b15..6d28c0892 100644 --- a/src/mem.h +++ b/src/mem.h @@ -4,6 +4,43 @@ #ifndef _MEM_H_ #define _MEM_H_ + +extern uint8_t *ram; +extern uint32_t rammask; + +extern int readlookup[256],readlookupp[256]; +extern uintptr_t *readlookup2; +extern int readlnext; +extern int writelookup[256],writelookupp[256]; +extern uintptr_t *writelookup2; +extern int writelnext; + +extern int mmu_perm; + +#define readmemb(a) ((readlookup2[(a)>>12]==-1)?readmembl(a):*(uint8_t *)(readlookup2[(a) >> 12] + (a))) +#define readmemw(s,a) ((readlookup2[(uint32_t)((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a)) & 1))?readmemwl(s,a):*(uint16_t *)(readlookup2[(uint32_t)((s)+(a))>>12]+(uint32_t)((s)+(a)))) +#define readmeml(s,a) ((readlookup2[(uint32_t)((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a)) & 3))?readmemll(s,a):*(uint32_t *)(readlookup2[(uint32_t)((s)+(a))>>12]+(uint32_t)((s)+(a)))) + +extern uint8_t readmembl(uint32_t addr); +extern void writemembl(uint32_t addr, uint8_t val); +extern uint8_t readmemb386l(uint32_t seg, uint32_t addr); +extern void writememb386l(uint32_t seg, uint32_t addr, uint8_t val); +extern uint16_t readmemwl(uint32_t seg, uint32_t addr); +extern void writememwl(uint32_t seg, uint32_t addr, uint16_t val); +extern uint32_t readmemll(uint32_t seg, uint32_t addr); +extern void writememll(uint32_t seg, uint32_t addr, uint32_t val); +extern uint64_t readmemql(uint32_t seg, uint32_t addr); +extern void writememql(uint32_t seg, uint32_t addr, uint64_t val); + +extern uint8_t *getpccache(uint32_t a); +extern uint32_t mmutranslatereal(uint32_t addr, int rw); +extern void addreadlookup(uint32_t virt, uint32_t phys); +extern void addwritelookup(uint32_t virt, uint32_t phys); + +extern int shadowbios,shadowbios_write; +extern int readlnum,writelnum; + + typedef struct mem_mapping_t { struct mem_mapping_t *prev, *next; diff --git a/src/mouse.c b/src/mouse.c index 584da5937..bc5050886 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -8,7 +8,7 @@ * * Common driver module for MOUSE devices. * - * Version: @(#)mouse.c 1.0.13 2017/10/25 + * Version: @(#)mouse.c 1.0.14 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -22,7 +22,7 @@ #include #include #include -#include "ibm.h" +#include "86box.h" #include "device.h" #include "mouse.h" #include "machine/machine.h" diff --git a/src/mouse_bus.c b/src/mouse_bus.c index 20d10f93c..8c7f209ae 100644 --- a/src/mouse_bus.c +++ b/src/mouse_bus.c @@ -32,7 +32,7 @@ * Based on an early driver for MINIX 1.5. * Based on the 86Box PS/2 mouse driver as a framework. * - * Version: @(#)mouse_bus.c 1.0.20 2017/10/25 + * Version: @(#)mouse_bus.c 1.0.21 2017/11/01 * * Authors: Fred N. van Kempen, * @@ -44,7 +44,6 @@ #include #include #include "86box.h" -#include "ibm.h" #include "io.h" #include "pic.h" #include "timer.h" @@ -407,6 +406,7 @@ bm_init(mouse_t *info) break; } ms->flags |= MOUSE_ENABLED; + ms->flags |= MOUSE_SCALED; /* Request an I/O range. */ io_sethandler(ms->port, ms->portlen, diff --git a/src/network/net_ne2000.c b/src/network/net_ne2000.c index f9149d941..6923e5da0 100644 --- a/src/network/net_ne2000.c +++ b/src/network/net_ne2000.c @@ -10,7 +10,7 @@ * * NOTE: The file will also implement an NE1000 for 8-bit ISA systems. * - * Version: @(#)net_ne2000.c 1.0.21 2017/10/28 + * Version: @(#)net_ne2000.c 1.0.22 2017/11/01 * * Authors: Fred N. van Kempen, * Peter Grehan, grehan@iprg.nokia.com> @@ -30,6 +30,7 @@ #include "../86box.h" #include "../config.h" #include "../ibm.h" +#include "../machine/machine.h" #include "../io.h" #include "../mem.h" #include "../rom.h" diff --git a/src/network/network.h b/src/network/network.h index f3cc817d7..df14f20e0 100644 --- a/src/network/network.h +++ b/src/network/network.h @@ -8,7 +8,7 @@ * * Definitions for the network module. * - * Version: @(#)network.h 1.0.9 2017/10/28 + * Version: @(#)network.h 1.0.10 2017/11/01 * * Author: Fred N. van Kempen, */ @@ -47,6 +47,10 @@ typedef struct { } netdev_t; +#ifdef __cplusplus +extern "C" { +#endif + /* Global variables. */ extern int nic_do_log; /* config */ extern int network_card; /* config */ @@ -88,5 +92,9 @@ extern char *network_card_get_internal_name(int); extern int network_card_get_from_internal_name(char *); extern device_t *network_card_getdevice(int); +#ifdef __cplusplus +} +#endif + #endif /*EMU_NETWORK_H*/ diff --git a/src/nvr.c b/src/nvr.c index 776420629..5b0111f04 100644 --- a/src/nvr.c +++ b/src/nvr.c @@ -186,7 +186,7 @@ * (DS12887A) which implemented a "century" register to be * compatible with Y2K. * - * Version: @(#)nvr.c 1.0.11 2017/10/28 + * Version: @(#)nvr.c 1.0.12 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -204,11 +204,9 @@ #include #include #include "86Box.h" -#include "ibm.h" -#include "cpu/cpu.h" #include "pic.h" +#include "pit.h" #include "timer.h" -#include "device.h" #include "machine/machine.h" #include "plat.h" #include "nvr.h" diff --git a/src/nvr_ps2.c b/src/nvr_ps2.c index 2be9a2fba..4750d17e9 100644 --- a/src/nvr_ps2.c +++ b/src/nvr_ps2.c @@ -3,6 +3,8 @@ #include #include #include +#include "86box.h" +#include "machine/machine.h" #include "ibm.h" #include "device.h" #include "io.h" diff --git a/src/pc.c b/src/pc.c index 14fd6b4c4..df66a52f7 100644 --- a/src/pc.c +++ b/src/pc.c @@ -8,7 +8,7 @@ * * Main emulator module where most things are controlled. * - * Version: @(#)pc.c 1.0.38 2017/10/30 + * Version: @(#)pc.c 1.0.39 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -102,6 +102,19 @@ int vid_cga_contrast = 0, /* (C) video */ enable_overscan = 0, /* (C) video */ force_43 = 0, /* (C) video */ video_speed = 0; /* (C) video */ +int serial_enabled[SERIAL_MAX] = {0,0}, /* (C) enable serial ports */ + lpt_enabled = 0, /* (C) enable LPT ports */ + bugger_enabled = 0; /* (C) enable ISAbugger */ +int gfxcard = 0; /* (C) graphics/video card */ +int GAMEBLASTER = 0, /* (C) sound option */ + GUS = 0, /* (C) sound option */ + SSI2001 = 0, /* (C) sound option */ + voodoo_enabled = 0; /* (C) video option */ +int mem_size = 0; /* (C) memory size */ +int cpu_manufacturer = 0, /* (C) cpu manufacturer */ + cpu_use_dynarec = 0, /* (C) cpu uses/needs Dyna */ + cpu = 3, /* (C) cpu type */ + enable_external_fpu = 0; /* (C) enable external FPU */ /* Statistics. */ @@ -134,7 +147,8 @@ wchar_t exe_path[1024]; /* path (dir) of executable */ wchar_t cfg_path[1024]; /* path (dir) of user data */ int scrnsz_x = SCREEN_RES_X, /* current screen size, X */ scrnsz_y = SCREEN_RES_Y; /* current screen size, Y */ -int config_changed; /* configuration has changed */ +int config_changed; /* config has changed */ +int romset; /* current machine ID */ int title_update; int64_t main_time; @@ -168,7 +182,7 @@ fatal(const char *format, ...) va_start(ap, format); vsprintf(msg, format, ap); - printf(msg); + fprintf(stdout, msg); va_end(ap); fflush(stdout); diff --git a/src/pci.c b/src/pci.c index 23042cfce..cb3f246b9 100644 --- a/src/pci.c +++ b/src/pci.c @@ -3,6 +3,8 @@ #include #include #include +#include "86box.h" +#include "machine/machine.h" #include "ibm.h" #include "io.h" #include "pic.h" diff --git a/src/pic.c b/src/pic.c index 9c9639209..1a7ea3d3b 100644 --- a/src/pic.c +++ b/src/pic.c @@ -3,7 +3,7 @@ #include #include #include "86box.h" -#include "ibm.h" +#include "machine/machine.h" #include "io.h" #include "pci.h" #include "pic.h" diff --git a/src/pic.h b/src/pic.h index 09dd45c99..b300c11a9 100644 --- a/src/pic.h +++ b/src/pic.h @@ -1,10 +1,29 @@ -extern void pic_init(void); -extern void pic2_init(void); -extern void pic_reset(void); +#ifndef EMU_PIC_H +# define EMU_PIC_H -extern void picint(uint16_t num); -extern void picintlevel(uint16_t num); -extern void picintc(uint16_t num); -extern uint8_t picinterrupt(void); -extern void picclear(int num); -extern void dumppic(void); + +typedef struct PIC { + uint8_t icw1,icw3,icw4,mask,ins,pend,mask2; + int icw; + uint8_t vector; + int read; +} PIC; + + +extern PIC pic, pic2; +extern int pic_intpending; + + +extern void pic_init(void); +extern void pic2_init(void); +extern void pic_reset(void); + +extern void picint(uint16_t num); +extern void picintlevel(uint16_t num); +extern void picintc(uint16_t num); +extern uint8_t picinterrupt(void); +extern void picclear(int num); +extern void dumppic(void); + + +#endif /*EMU_PIC_H*/ diff --git a/src/pit.c b/src/pit.c index 493e0a130..750af6c0b 100644 --- a/src/pit.c +++ b/src/pit.c @@ -12,6 +12,7 @@ #include "io.h" #include "pic.h" #include "pit.h" +#include "ppi.h" #include "device.h" #include "timer.h" #include "machine/machine.h" @@ -23,14 +24,17 @@ /*B4 to 40, two writes to 43, then two reads - value _does_ change!*/ int64_t displine; -double PITCONST; +PIT pit, + pit2; float cpuclock; float isa_timing, bus_timing; -float CGACONST; -float MDACONST; -float VGACONST1,VGACONST2; -float RTCCONST; +double PITCONST; +float CGACONST; +float MDACONST; +float VGACONST1, + VGACONST2; +float RTCCONST; int64_t firsttime=1; void setpitclock(float clock) diff --git a/src/pit.h b/src/pit.h index 3fceeca27..5f48a283a 100644 --- a/src/pit.h +++ b/src/pit.h @@ -1,17 +1,72 @@ -extern double PITCONST; - -extern void pit_init(void); -extern void pit_ps2_init(void); -extern void pit_reset(PIT *pit); -extern void pit_set_gate(PIT *pit, int64_t channel, int64_t gate); -extern void pit_set_using_timer(PIT *pit, int64_t t, int64_t using_timer); -extern void pit_set_out_func(PIT *pit, int64_t t, void (*func)(int64_t new_out, int64_t old_out)); -extern void pit_clock(PIT *pit, int64_t t); +#ifndef EMU_PIT_H +# define EMU_PIT_H -extern void pit_null_timer(int64_t new_out, int64_t old_out); -extern void pit_irq0_timer(int64_t new_out, int64_t old_out); -extern void pit_irq0_timer_pcjr(int64_t new_out, int64_t old_out); -extern void pit_refresh_timer_xt(int64_t new_out, int64_t old_out); -extern void pit_refresh_timer_at(int64_t new_out, int64_t old_out); -extern void pit_speaker_timer(int64_t new_out, int64_t old_out); +typedef struct { + int64_t nr; + struct PIT *pit; +} PIT_nr; + +typedef struct PIT { + uint32_t l[3]; + int64_t c[3]; + uint8_t m[3]; + uint8_t ctrl, + ctrls[3]; + int64_t wp, + rm[3], + wm[3]; + uint16_t rl[3]; + int64_t thit[3]; + int64_t delay[3]; + int64_t rereadlatch[3]; + int64_t gate[3]; + int64_t out[3]; + int64_t running[3]; + int64_t enabled[3]; + int64_t newcount[3]; + int64_t count[3]; + int64_t using_timer[3]; + int64_t initial[3]; + int64_t latched[3]; + int64_t disabled[3]; + + uint8_t read_status[3]; + int64_t do_read_status[3]; + + PIT_nr pit_nr[3]; + + void (*set_out_funcs[3])(int64_t new_out, int64_t old_out); +} PIT; + + +extern PIT pit, + pit2; +extern double PITCONST; +extern float CGACONST, + MDACONST, + VGACONST1, + VGACONST2, + RTCCONST; + + +extern void pit_init(void); +extern void pit_ps2_init(void); +extern void pit_reset(PIT *pit); +extern void pit_set_gate(PIT *pit, int64_t channel, int64_t gate); +extern void pit_set_using_timer(PIT *pit, int64_t t, int64_t using_timer); +extern void pit_set_out_func(PIT *pit, int64_t t, void (*func)(int64_t new_out, int64_t old_out)); +extern void pit_clock(PIT *pit, int64_t t); + +extern void setpitclock(float clock); +extern float pit_timer0_freq(void); + +extern void pit_null_timer(int64_t new_out, int64_t old_out); +extern void pit_irq0_timer(int64_t new_out, int64_t old_out); +extern void pit_irq0_timer_pcjr(int64_t new_out, int64_t old_out); +extern void pit_refresh_timer_xt(int64_t new_out, int64_t old_out); +extern void pit_refresh_timer_at(int64_t new_out, int64_t old_out); +extern void pit_speaker_timer(int64_t new_out, int64_t old_out); + + +#endif /*EMU_PIT_H*/ diff --git a/src/ppi.c b/src/ppi.c index 0eaa4a474..e57a92324 100644 --- a/src/ppi.c +++ b/src/ppi.c @@ -13,6 +13,7 @@ #include #include "ibm.h" #include "pit.h" +#include "ppi.h" PPI ppi; diff --git a/src/ppi.h b/src/ppi.h new file mode 100644 index 000000000..a46a407f5 --- /dev/null +++ b/src/ppi.h @@ -0,0 +1,18 @@ +#ifndef EMU_PPI_H +# define EMU_PPI_H + + +typedef struct PPI { + int s2; + uint8_t pa,pb; +} PPI; + + +extern int ppispeakon; +extern PPI ppi; + + +extern void ppi_reset(void); + + +#endif /*EMU_PPI_H*/ diff --git a/src/sio_w83877f.c b/src/sio_w83877f.c index 65cc05c74..fff774ed2 100644 --- a/src/sio_w83877f.c +++ b/src/sio_w83877f.c @@ -11,7 +11,7 @@ * Winbond W83877F Super I/O Chip * Used by the Award 430HX * - * Version: @(#)sio_w83877f.c 1.0.4 2017/10/16 + * Version: @(#)sio_w83877f.c 1.0.5 2017/11/01 * * Author: Miran Grca, * Copyright 2016,2017 Miran Grca. @@ -22,6 +22,7 @@ #include #include "86box.h" #include "ibm.h" +#include "machine/machine.h" #include "io.h" #include "mem.h" #include "rom.h" diff --git a/src/sound/snd_gus.c b/src/sound/snd_gus.c index 9c0a84ffb..666240747 100644 --- a/src/sound/snd_gus.c +++ b/src/sound/snd_gus.c @@ -1020,7 +1020,7 @@ void *gus_init(device_t *info) out/=1.002709201; /* 0.0235 dB Steps */ } - printf("Top volume %f %f %f %f\n",vol16bit[4095],vol16bit[3800],vol16bit[3000],vol16bit[2048]); + pclog("GUS: top volume %f %f %f %f\n",vol16bit[4095],vol16bit[3800],vol16bit[3000],vol16bit[2048]); gus->voices=14; gus->samp_timer = gus->samp_latch = (int64_t)(TIMER_USEC * (1000000.0 / 44100.0)); diff --git a/src/sound/snd_lpt_dac.c b/src/sound/snd_lpt_dac.c index 8730c2c8e..bec89b930 100644 --- a/src/sound/snd_lpt_dac.c +++ b/src/sound/snd_lpt_dac.c @@ -6,6 +6,7 @@ #include "../86box.h" #include "../ibm.h" #include "../cpu/cpu.h" +#include "../machine/machine.h" #include "../lpt.h" #include "../timer.h" #include "sound.h" diff --git a/src/sound/snd_lpt_dss.c b/src/sound/snd_lpt_dss.c index a3c914709..34cfe24cf 100644 --- a/src/sound/snd_lpt_dss.c +++ b/src/sound/snd_lpt_dss.c @@ -6,6 +6,7 @@ #include "../86box.h" #include "../ibm.h" #include "../cpu/cpu.h" +#include "../machine/machine.h" #include "../timer.h" #include "../lpt.h" #include "sound.h" diff --git a/src/sound/snd_pas16.c b/src/sound/snd_pas16.c index 234bb7751..93c174a24 100644 --- a/src/sound/snd_pas16.c +++ b/src/sound/snd_pas16.c @@ -416,7 +416,7 @@ static void pas16_pit_out(uint16_t port, uint8_t val, void *p) pas16->pit.ctrls[t] = pas16->pit.ctrl = val; if (t == 3) { - printf("Bad PIT reg select\n"); + pclog("PAS16: bad PIT reg select\n"); return; } if (!(pas16->pit.ctrl & 0x30)) diff --git a/src/sound/snd_speaker.c b/src/sound/snd_speaker.c index 3109d66e8..d71e05ab6 100644 --- a/src/sound/snd_speaker.c +++ b/src/sound/snd_speaker.c @@ -4,6 +4,7 @@ #include #include "../86box.h" #include "../ibm.h" +#include "../pit.h" #include "sound.h" #include "snd_speaker.h" diff --git a/src/tandy_eeprom.c b/src/tandy_eeprom.c index 423b0e251..96f62b390 100644 --- a/src/tandy_eeprom.c +++ b/src/tandy_eeprom.c @@ -7,6 +7,7 @@ #include #include #include "ibm.h" +#include "machine/machine.h" #include "device.h" #include "mem.h" #include "rom.h" diff --git a/src/ui.h b/src/ui.h index b23b7d5ab..f1da22301 100644 --- a/src/ui.h +++ b/src/ui.h @@ -8,7 +8,7 @@ * * Define the various UI functions. * - * Version: @(#)ui.h 1.0.8 2017/10/28 + * Version: @(#)ui.h 1.0.9 2017/11/01 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -64,6 +64,7 @@ extern void ui_sb_update_icon(int tag, int val); extern void ui_sb_update_icon_state(int tag, int active); extern void ui_sb_set_text_w(wchar_t *wstr); extern void ui_sb_set_text(char *str); +extern void ui_sb_bugui(char *str); #ifdef __cplusplus } diff --git a/src/video/vid_ati28800.c b/src/video/vid_ati28800.c index b2065f459..0c2d4ef8b 100644 --- a/src/video/vid_ati28800.c +++ b/src/video/vid_ati28800.c @@ -8,7 +8,7 @@ * * ATI 28800 emulation (VGA Charger) * - * Version: @(#)vid_ati28800.c 1.0.2 2017/10/31 + * Version: @(#)vid_ati28800.c 1.0.3 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -24,6 +24,7 @@ #include "../86box.h" #include "../ibm.h" #include "../io.h" +#include "../pit.h" #include "../mem.h" #include "../rom.h" #include "../device.h" diff --git a/src/video/vid_ati_mach64.c b/src/video/vid_ati_mach64.c index 8be9e02b1..e18d93479 100644 --- a/src/video/vid_ati_mach64.c +++ b/src/video/vid_ati_mach64.c @@ -8,7 +8,7 @@ * * ATi Mach64 graphics card emulation. * - * Version: @(#)vid_ati_mach64.c 1.0.6 2017/10/31 + * Version: @(#)vid_ati_mach64.c 1.0.7 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -23,6 +23,7 @@ #include #include "../86box.h" #include "../ibm.h" +#include "../machine/machine.h" #include "../device.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_cga.c b/src/video/vid_cga.c index d6742e337..5951e4b88 100644 --- a/src/video/vid_cga.c +++ b/src/video/vid_cga.c @@ -8,7 +8,7 @@ * * Emulation of the old and new IBM CGA graphics cards. * - * Version: @(#)vid_cga.c 1.0.8 2017/10/22 + * Version: @(#)vid_cga.c 1.0.9 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -25,6 +25,7 @@ #include "../86box.h" #include "../ibm.h" #include "../io.h" +#include "../pit.h" #include "../mem.h" #include "../rom.h" #include "../timer.h" diff --git a/src/video/vid_colorplus.c b/src/video/vid_colorplus.c index 337058c8a..07f92989c 100644 --- a/src/video/vid_colorplus.c +++ b/src/video/vid_colorplus.c @@ -8,7 +8,7 @@ * * Plantronics ColorPlus emulation. * - * Version: @(#)vid_colorplus.c 1.0.4 2017/10/22 + * Version: @(#)vid_colorplus.c 1.0.5 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -25,6 +25,7 @@ #include "../86box.h" #include "../ibm.h" #include "../io.h" +#include "../pit.h" #include "../mem.h" #include "../timer.h" #include "../device.h" diff --git a/src/video/vid_ega.c b/src/video/vid_ega.c index c739d9049..b86a4e24f 100644 --- a/src/video/vid_ega.c +++ b/src/video/vid_ega.c @@ -9,7 +9,7 @@ * Emulation of the EGA, Chips & Technologies SuperEGA, and * AX JEGA graphics cards. * - * Version: @(#)vid_ega.c 1.0.9 2017/10/31 + * Version: @(#)vid_ega.c 1.0.10 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -26,6 +26,7 @@ #include "../86box.h" #include "../ibm.h" #include "../io.h" +#include "../pit.h" #include "../mem.h" #include "../rom.h" #include "../timer.h" diff --git a/src/video/vid_genius.c b/src/video/vid_genius.c index 1999cd4a8..d821d72c9 100644 --- a/src/video/vid_genius.c +++ b/src/video/vid_genius.c @@ -8,7 +8,7 @@ * * MDSI Genius VHR emulation. * - * Version: @(#)vid_genius.c 1.0.5 2017/10/31 + * Version: @(#)vid_genius.c 1.0.6 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -24,6 +24,7 @@ #include "../86box.h" #include "../ibm.h" #include "../io.h" +#include "../pit.h" #include "../mem.h" #include "../rom.h" #include "../timer.h" diff --git a/src/video/vid_hercules.c b/src/video/vid_hercules.c index 4cd758e8d..9174078d8 100644 --- a/src/video/vid_hercules.c +++ b/src/video/vid_hercules.c @@ -8,7 +8,7 @@ * * Hercules emulation. * - * Version: @(#)vid_hercules.c 1.0.5 2017/10/22 + * Version: @(#)vid_hercules.c 1.0.6 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -26,6 +26,7 @@ #include "../mem.h" #include "../rom.h" #include "../io.h" +#include "../pit.h" #include "../timer.h" #include "../device.h" #include "video.h" diff --git a/src/video/vid_herculesplus.c b/src/video/vid_herculesplus.c index 0f1fd0efc..fb896df0d 100644 --- a/src/video/vid_herculesplus.c +++ b/src/video/vid_herculesplus.c @@ -8,7 +8,7 @@ * * Hercules InColor emulation. * - * Version: @(#)vid_herculesplus.c 1.0.3 2017/10/18 + * Version: @(#)vid_herculesplus.c 1.0.4 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -24,6 +24,7 @@ #include "../86box.h" #include "../ibm.h" #include "../io.h" +#include "../pit.h" #include "../mem.h" #include "../rom.h" #include "../timer.h" diff --git a/src/video/vid_incolor.c b/src/video/vid_incolor.c index cc2d96a26..675c44cfe 100644 --- a/src/video/vid_incolor.c +++ b/src/video/vid_incolor.c @@ -8,7 +8,7 @@ * * Hercules InColor emulation. * - * Version: @(#)vid_incolor.c 1.0.4 2017/10/31 + * Version: @(#)vid_incolor.c 1.0.5 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -24,6 +24,7 @@ #include "../86box.h" #include "../ibm.h" #include "../io.h" +#include "../pit.h" #include "../mem.h" #include "../rom.h" #include "../timer.h" diff --git a/src/video/vid_mda.c b/src/video/vid_mda.c index f22f8881e..3a4bae0b4 100644 --- a/src/video/vid_mda.c +++ b/src/video/vid_mda.c @@ -8,7 +8,7 @@ * * MDA emulation. * - * Version: @(#)vid_mda.c 1.0.6 2017/10/31 + * Version: @(#)vid_mda.c 1.0.7 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -24,6 +24,7 @@ #include "../86box.h" #include "../ibm.h" #include "../io.h" +#include "../pit.h" #include "../mem.h" #include "../rom.h" #include "../timer.h" diff --git a/src/video/vid_nv_riva128.c b/src/video/vid_nv_riva128.c index d8822e8af..5e9af6d70 100644 --- a/src/video/vid_nv_riva128.c +++ b/src/video/vid_nv_riva128.c @@ -8,7 +8,7 @@ * * nVidia RIVA 128 emulation. * - * Version: @(#)vid_nv_riva128.c 1.0.1 2017/10/16 + * Version: @(#)vid_nv_riva128.c 1.0.2 2017/11/01 * * Author: Melissa Goad * Miran Grca, @@ -23,6 +23,7 @@ #include #include "../86box.h" #include "../ibm.h" +#include "../machine/machine.h" #include "../io.h" #include "../mem.h" #include "../pci.h" diff --git a/src/video/vid_olivetti_m24.c b/src/video/vid_olivetti_m24.c index a10c192a8..bce38c717 100644 --- a/src/video/vid_olivetti_m24.c +++ b/src/video/vid_olivetti_m24.c @@ -8,7 +8,7 @@ * * Olivetti M24 video emulation- essentially double-res CGA. * - * Version: @(#)vid_olivetti_m24.c 1.0.4 2017/10/22 + * Version: @(#)vid_olivetti_m24.c 1.0.5 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -24,6 +24,7 @@ #include "../86box.h" #include "../ibm.h" #include "../io.h" +#include "../pit.h" #include "../mem.h" #include "../timer.h" #include "../device.h" diff --git a/src/video/vid_pc1512.c b/src/video/vid_pc1512.c index 1b1511d27..ea8fae7e7 100644 --- a/src/video/vid_pc1512.c +++ b/src/video/vid_pc1512.c @@ -15,7 +15,7 @@ * time as between 12 and 46 cycles. We currently always use * the lower number. * - * Version: @(#)vid_pc1512.c 1.0.4 2017/10/22 + * Version: @(#)vid_pc1512.c 1.0.5 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -31,6 +31,7 @@ #include "../86box.h" #include "../ibm.h" #include "../io.h" +#include "../pit.h" #include "../mem.h" #include "../timer.h" #include "../device.h" diff --git a/src/video/vid_pcjr.c b/src/video/vid_pcjr.c index 6e810533a..f6d94ac63 100644 --- a/src/video/vid_pcjr.c +++ b/src/video/vid_pcjr.c @@ -8,7 +8,7 @@ * * Video emulation for IBM PCjr. * - * Version: @(#)vid_pcjr.c 1.0.4 2017/10/22 + * Version: @(#)vid_pcjr.c 1.0.5 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -25,6 +25,7 @@ #include "../86box.h" #include "../ibm.h" #include "../io.h" +#include "../pit.h" #include "../mem.h" #include "../pic.h" #include "../timer.h" diff --git a/src/video/vid_svga.c b/src/video/vid_svga.c index 96d910444..7d73d7b4f 100644 --- a/src/video/vid_svga.c +++ b/src/video/vid_svga.c @@ -11,7 +11,7 @@ * This is intended to be used by another SVGA driver, * and not as a card in it's own right. * - * Version: @(#)vid_svga.c 1.0.7 2017/10/18 + * Version: @(#)vid_svga.c 1.0.9 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -26,7 +26,9 @@ #include #include "../86box.h" #include "../ibm.h" +#include "../machine/machine.h" #include "../io.h" +#include "../pit.h" #include "../mem.h" #include "../rom.h" #include "../timer.h" @@ -92,19 +94,19 @@ void svga_out(uint16_t addr, uint8_t val, void *p) { #ifdef DEV_BRANCH case 0x32CB: - printf("Write 32CB: %04X\n", val); + pclog("SVGA: write 32CB: %04X\n", val); charedit_on = (val & 0x10) ? 1 : 0; charsettings = val; return; case 0x22CB: - printf("Write 22CB: %04X\n", val); + pclog("SVGA: write 22CB: %04X\n", val); charmode = val; charptr = 0; return; case 0x22CF: - printf("Write 22CF: %04X\n", val); + pclog("SVGA: write 22CF: %04X\n", val); switch(charmode) { case 1: case 2: @@ -121,7 +123,7 @@ void svga_out(uint16_t addr, uint8_t val, void *p) return; case 0x22CA: case 0x22CE: case 0x32CA: - printf("OUT SVGA %03X %02X %04X:%04X\n",addr,val,CS,cpu_state.pc); + pclog("SVGA: OUT SVGA %03X %02X %04X:%04X\n",addr,val,CS,cpu_state.pc); return; #endif @@ -689,9 +691,9 @@ void svga_recalctimings(svga_t *svga) svga->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT)); svga->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT)); -/* printf("SVGA horiz total %i display end %i vidclock %f\n",svga->crtc[0],svga->crtc[1],svga->clock); - printf("SVGA vert total %i display end %i max row %i vsync %i\n",svga->vtotal,svga->dispend,(svga->crtc[9]&31)+1,svga->vsyncstart); - printf("total %f on %i cycles off %i cycles frame %i sec %i %02X\n",disptime*crtcconst,svga->dispontime,svga->dispofftime,(svga->dispontime+svga->dispofftime)*svga->vtotal,(svga->dispontime+svga->dispofftime)*svga->vtotal*70,svga->seqregs[1]); +/* pclog("SVGA horiz total %i display end %i vidclock %f\n",svga->crtc[0],svga->crtc[1],svga->clock); + pclog("SVGA vert total %i display end %i max row %i vsync %i\n",svga->vtotal,svga->dispend,(svga->crtc[9]&31)+1,svga->vsyncstart); + pclog("total %f on %i cycles off %i cycles frame %i sec %i %02X\n",disptime*crtcconst,svga->dispontime,svga->dispofftime,(svga->dispontime+svga->dispofftime)*svga->vtotal,(svga->dispontime+svga->dispofftime)*svga->vtotal*70,svga->seqregs[1]); pclog("svga->render %08X\n", svga->render);*/ } diff --git a/src/video/vid_tandy.c b/src/video/vid_tandy.c index 6a09822d7..2972934b6 100644 --- a/src/video/vid_tandy.c +++ b/src/video/vid_tandy.c @@ -8,7 +8,7 @@ * * Emulation of the Tandy Model 1000 video. * - * Version: @(#)vid_tandy.c 1.0.3 2017/10/22 + * Version: @(#)vid_tandy.c 1.0.4 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -25,6 +25,7 @@ #include "../86box.h" #include "../ibm.h" #include "../io.h" +#include "../pit.h" #include "../mem.h" #include "../timer.h" #include "../device.h" diff --git a/src/video/vid_tandysl.c b/src/video/vid_tandysl.c index 6ae2ded61..63d82532e 100644 --- a/src/video/vid_tandysl.c +++ b/src/video/vid_tandysl.c @@ -8,7 +8,7 @@ * * Emulation of the Tandy Model 1000/SL video. * - * Version: @(#)vid_tandysl.c 1.0.4 2017/10/22 + * Version: @(#)vid_tandysl.c 1.0.5 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -25,6 +25,7 @@ #include "../86box.h" #include "../ibm.h" #include "../io.h" +#include "../pit.h" #include "../mem.h" #include "../timer.h" #include "../device.h" diff --git a/src/video/vid_voodoo.c b/src/video/vid_voodoo.c index c295a5504..e518fee57 100644 --- a/src/video/vid_voodoo.c +++ b/src/video/vid_voodoo.c @@ -8,7 +8,7 @@ * * Emulation of the 3DFX Voodoo Graphics controller. * - * Version: @(#)vid_voodoo.c 1.0.4 2017/10/28 + * Version: @(#)vid_voodoo.c 1.0.5 2017/11/01 * * Authors: Sarah Walker, * leilei @@ -25,6 +25,7 @@ #include "../86box.h" #include "../ibm.h" #include "../cpu/cpu.h" +#include "../machine/machine.h" #include "../device.h" #include "../mem.h" #include "../pci.h" diff --git a/src/video/vid_wy700.c b/src/video/vid_wy700.c index f8887f4e4..e11880f31 100644 --- a/src/video/vid_wy700.c +++ b/src/video/vid_wy700.c @@ -8,7 +8,7 @@ * * Wyse-700 emulation. * - * Version: @(#)vid_wy700.c 1.0.4 2017/10/22 + * Version: @(#)vid_wy700.c 1.0.5 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -24,6 +24,7 @@ #include "../86box.h" #include "../ibm.h" #include "../io.h" +#include "../pit.h" #include "../mem.h" #include "../timer.h" #include "../device.h" diff --git a/src/video/video.c b/src/video/video.c index dfb67a89f..ecc839b63 100644 --- a/src/video/video.c +++ b/src/video/video.c @@ -40,7 +40,7 @@ * W = 3 bus clocks * L = 4 bus clocks * - * Version: @(#)video.c 1.0.6 2017/10/27 + * Version: @(#)video.c 1.0.7 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -57,6 +57,7 @@ #include "../86box.h" #include "../ibm.h" #include "../cpu/cpu.h" +#include "../machine/machine.h" #include "../io.h" #include "../mem.h" #include "../rom.h" diff --git a/src/win/win.c b/src/win/win.c index 78b8b43e3..d4bf8bd79 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -8,7 +8,7 @@ * * Platform main support module for Windows. * - * Version: @(#)win.c 1.0.30 2017/10/28 + * Version: @(#)win.c 1.0.31 2017/11/01 * * Authors: Sarah Walker, * Miran Grca, @@ -38,6 +38,7 @@ #include "../86box.h" #include "../config.h" #include "../ibm.h" +#include "../machine/machine.h" #include "../mem.h" // because of load_config #include "../rom.h" // because of load_config #include "../device.h" diff --git a/src/win/win_status.c b/src/win/win_status.c index c6bb72e64..ebcac3eae 100644 --- a/src/win/win_status.c +++ b/src/win/win_status.c @@ -11,6 +11,7 @@ #include #include "../86box.h" #include "../ibm.h" +#include "../pit.h" #include "../mem.h" #include "../cpu/x86_ops.h" #ifdef USE_DYNAREC diff --git a/src/win/win_stbar.c b/src/win/win_stbar.c index f20fe3530..3642bd936 100644 --- a/src/win/win_stbar.c +++ b/src/win/win_stbar.c @@ -8,7 +8,7 @@ * * Implement the application's Status Bar. * - * Version: @(#)win_stbar.c 1.0.4 2017/10/28 + * Version: @(#)win_stbar.c 1.0.5 2017/11/01 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -1140,14 +1140,25 @@ ui_sb_set_text_w(wchar_t *wstr) } - /* API */ void ui_sb_set_text(char *str) { static wchar_t wstr[512]; - memset(wstr, 0x00, 1024); + memset(wstr, 0x00, sizeof(wstr)); + mbstowcs(wstr, str, strlen(str) + 1); + ui_sb_set_text_w(wstr); +} + + +/* API */ +void +ui_sb_bugui(char *str) +{ + static wchar_t wstr[512]; + + memset(wstr, 0x00, sizeof(wstr)); mbstowcs(wstr, str, strlen(str) + 1); ui_sb_set_text_w(wstr); }