From 43b055b5ee0c2e8ac1e27caab27cb55a0b331362 Mon Sep 17 00:00:00 2001 From: waltje Date: Mon, 25 Sep 2017 04:31:20 -0400 Subject: [PATCH] Another massive cleanup run. Ibm.h no longer includes system header files. ROM loading simplified, and moved from mem.c to rom.c. Fixes in Makefile. Corrected mamy wrong includes. Removed old junk from days long gone. First phase of new SCAT chipset driver - no longer gives errors in BIOS, but NOT DONE YET. --- src/Makefile.mingw | 182 ++-- src/bugger.c | 6 +- src/cdrom/cdrom.c | 7 +- src/cdrom/cdrom_image.cc | 5 +- src/cdrom/cdrom_ioctl.c | 12 +- src/cdrom/cdrom_null.c | 8 +- src/config.c | 5 +- src/cpu/386.c | 8 +- src/cpu/386_dynarec.c | 8 +- src/cpu/386_dynarec_ops.c | 4 + src/cpu/808x.c | 28 +- src/cpu/codegen.c | 6 +- src/cpu/codegen_ops.c | 4 + src/cpu/codegen_timing_486.c | 6 +- src/cpu/codegen_timing_686.c | 7 +- src/cpu/codegen_timing_common.c | 5 + src/cpu/codegen_timing_pentium.c | 8 +- src/cpu/codegen_timing_winchip.c | 4 + src/cpu/codegen_x86-64.c | 4 + src/cpu/codegen_x86.c | 6 +- src/cpu/cpu.c | 8 +- src/cpu/x86seg.c | 12 +- src/cpu/x87.c | 4 + src/device.c | 6 +- src/dma.c | 8 +- src/floppy/fdc.c | 8 +- src/floppy/fdd.c | 6 +- src/floppy/fdi2raw.c | 6 +- src/floppy/floppy.c | 10 +- src/floppy/floppy_86f.c | 6 +- src/floppy/floppy_common.c | 6 +- src/floppy/floppy_fdi.c | 3 +- src/floppy/floppy_imd.c | 9 +- src/floppy/floppy_img.c | 5 +- src/floppy/floppy_json.c | 7 +- src/floppy/floppy_td0.c | 7 +- src/gameport.c | 3 + src/hdd/hdd.c | 6 +- src/hdd/hdd_esdi_at.c | 8 +- src/hdd/hdd_esdi_mca.c | 10 +- src/hdd/hdd_ide_at.c | 5 +- src/hdd/hdd_ide_xt.c | 8 +- src/hdd/hdd_image.c | 12 +- src/hdd/hdd_mfm_at.c | 7 +- src/hdd/hdd_mfm_xebec.c | 11 +- src/i82335.c | 3 + src/ibm.h | 126 +-- src/intel.c | 4 + src/intel_flash.c | 9 +- src/intel_sio.c | 5 +- src/io.c | 4 + src/joystick_ch_flightstick_pro.c | 4 + src/joystick_standard.c | 4 + src/joystick_sw_pad.c | 5 +- src/joystick_tm_fcs.c | 4 + src/keyboard.c | 11 +- src/keyboard_amstrad.c | 3 + src/keyboard_at.c | 6 +- src/keyboard_olim24.c | 4 + src/keyboard_pcjr.c | 3 + src/keyboard_xt.c | 4 + src/lpt.c | 7 +- src/machine/machine.c | 125 +-- src/machine/machine_amstrad.c | 5 + src/machine/machine_at.c | 4 + src/machine/machine_at_430fx.c | 6 +- src/machine/machine_at_430hx.c | 5 +- src/machine/machine_at_430lx_nx.c | 8 +- src/machine/machine_at_430vx.c | 7 +- src/machine/machine_at_440fx.c | 7 +- src/machine/machine_at_ali1429.c | 3 + src/machine/machine_at_commodore.c | 4 + src/machine/machine_at_compaq.c | 4 + src/machine/machine_at_headland.c | 4 + src/machine/machine_at_neat.c | 4 + src/machine/machine_at_opti495.c | 4 + src/machine/machine_at_scat.c | 1194 ++++++++++++++++----------- src/machine/machine_at_sis_85c471.c | 6 +- src/machine/machine_at_sis_85c496.c | 4 + src/machine/machine_at_sis_85c50x.c | 6 +- src/machine/machine_at_wd76c10.c | 4 + src/machine/machine_common.c | 4 + src/machine/machine_europc.c | 3 + src/machine/machine_olivetti_m24.c | 4 + src/machine/machine_pcjr.c | 4 + src/machine/machine_ps1.c | 16 +- src/machine/machine_ps2_isa.c | 4 + src/machine/machine_ps2_mca.c | 4 + src/machine/machine_tandy.c | 5 + src/machine/machine_xt.c | 4 + src/machine/machine_xt_laserxt.c | 4 + src/mca.c | 4 + src/mcr.c | 4 + src/mem.c | 842 +------------------ src/mem.h | 23 +- src/memregs.c | 8 +- src/mouse.c | 8 +- src/mouse_bus.c | 5 +- src/mouse_ps2.c | 4 + src/mouse_serial.c | 6 +- src/network/net_ne2000.c | 10 +- src/network/net_pcap.c | 7 +- src/network/net_slirp.c | 7 +- src/network/network.c | 9 +- src/nmi.c | 4 + src/nvr.c | 5 +- src/nvr_ps2.c | 5 + src/pc.c | 11 +- src/pci.c | 4 + src/pci_dummy.c | 4 + src/pic.c | 4 + src/piix.c | 16 +- src/pit.c | 4 +- src/ppi.c | 10 +- src/random.c | 2 +- src/rom.c | 843 ++++++++++++++++--- src/rom.h | 151 +++- src/rtc.c | 8 +- src/scsi/scsi.c | 7 +- src/scsi/scsi_aha154x.c | 9 +- src/scsi/scsi_bios_command.c | 8 +- src/scsi/scsi_buslogic.c | 11 +- src/scsi/scsi_device.c | 6 +- src/scsi/scsi_disk.c | 6 +- src/serial.c | 10 +- src/sio_detect.c | 4 + src/sio_fdc37c665.c | 6 +- src/sio_fdc37c669.c | 6 +- src/sio_fdc37c932fr.c | 6 +- src/sio_pc87306.c | 6 +- src/sio_um8669f.c | 4 + src/sio_w83877f.c | 8 +- src/sound/dbopl.cpp | 3 +- src/sound/midi.c | 10 +- src/sound/midi_fluidsynth.c | 9 +- src/sound/midi_mt32.c | 9 +- src/sound/midi_system.c | 6 +- src/sound/openal.c | 2 + src/sound/snd_ad1848.c | 4 + src/sound/snd_adlib.c | 4 + src/sound/snd_adlibgold.c | 5 +- src/sound/snd_cms.c | 3 + src/sound/snd_emu8k.c | 10 +- src/sound/snd_gus.c | 4 +- src/sound/snd_lpt_dac.c | 10 +- src/sound/snd_lpt_dss.c | 12 +- src/sound/snd_mpu401.c | 18 +- src/sound/snd_opl.c | 5 +- src/sound/snd_pas16.c | 6 +- src/sound/snd_ps1.c | 4 + src/sound/snd_pssj.c | 4 + src/sound/snd_sb.c | 14 +- src/sound/snd_sb_dsp.c | 6 +- src/sound/snd_sn76489.c | 4 + src/sound/snd_speaker.c | 4 + src/sound/snd_ssi2001.c | 4 + src/sound/snd_wss.c | 4 + src/sound/snd_ym7128.c | 4 + src/sound/sound.c | 8 +- src/tandy_eeprom.c | 5 + src/tandy_rom.c | 8 +- src/timer.c | 13 +- src/usb.c | 3 + src/video/vid_ati18800.c | 4 + src/video/vid_ati28800.c | 4 + src/video/vid_ati68860_ramdac.c | 4 + src/video/vid_ati_eeprom.c | 4 + src/video/vid_ati_mach64.c | 8 +- src/video/vid_bt485_ramdac.c | 4 + src/video/vid_cga.c | 13 +- src/video/vid_cga_comp.c | 13 +- src/video/vid_cl_gd.c | 3 + src/video/vid_cl_gd_blit.c | 4 + src/video/vid_cl_ramdac.c | 4 + src/video/vid_colorplus.c | 4 + src/video/vid_ega.c | 11 +- src/video/vid_ega_render.c | 8 +- src/video/vid_et4000.c | 4 + src/video/vid_et4000w32.c | 4 + src/video/vid_et4000w32i.c | 4 + src/video/vid_genius.c | 4 + src/video/vid_hercules.c | 5 + src/video/vid_herculesplus.c | 6 +- src/video/vid_icd2061.c | 4 + src/video/vid_ics2595.c | 4 + src/video/vid_incolor.c | 5 + src/video/vid_mda.c | 5 + src/video/vid_nv_riva128.c | 4 + src/video/vid_olivetti_m24.c | 4 + src/video/vid_oti067.c | 4 + src/video/vid_paradise.c | 4 + src/video/vid_pc1512.c | 4 + src/video/vid_pc1640.c | 4 + src/video/vid_pc200.c | 4 + src/video/vid_pcjr.c | 4 + src/video/vid_ps1_svga.c | 4 + src/video/vid_s3.c | 4 + src/video/vid_s3_virge.c | 4 + src/video/vid_sc1502x_ramdac.c | 4 + src/video/vid_sdac_ramdac.c | 4 + src/video/vid_stg_ramdac.c | 4 + src/video/vid_svga.c | 8 +- src/video/vid_svga_render.c | 10 +- src/video/vid_tandy.c | 4 + src/video/vid_tandysl.c | 4 + src/video/vid_tgui9440.c | 4 + src/video/vid_tkd8001_ramdac.c | 4 + src/video/vid_tvga.c | 4 + src/video/vid_vga.c | 4 + src/video/vid_voodoo.c | 6 +- src/video/vid_wy700.c | 4 + src/video/video.c | 7 +- src/win/86Box.rc | 49 +- src/win/resource.h | 3 +- src/win/win.c | 81 +- src/win/win_deviceconfig.c | 8 +- src/win/win_dynld.c | 9 +- src/win/win_iodev.c | 9 +- src/win/win_joystick.cc | 7 +- src/win/win_joystickconfig.c | 5 +- src/win/win_keyboard.c | 8 +- src/win/win_language.c | 10 +- src/win/win_midi.c | 4 + src/win/win_mouse.cc | 4 +- src/win/win_opendir.c | 7 +- src/win/win_settings.c | 10 +- src/win/win_status.c | 5 +- 227 files changed, 2861 insertions(+), 2082 deletions(-) diff --git a/src/Makefile.mingw b/src/Makefile.mingw index 8a2f10928..b60ac76f4 100644 --- a/src/Makefile.mingw +++ b/src/Makefile.mingw @@ -8,7 +8,7 @@ # # Modified Makefile for Win32 (MinGW32) environment. # -# Version: @(#)Makefile.mingw 1.0.46 2017/09/19 +# Version: @(#)Makefile.mingw 1.0.47 2017/09/24 # # Authors: Miran Grca, # Fred N. van Kempen, @@ -101,14 +101,14 @@ CC = gcc.exe -m32 endif WINDRES = windres.exe -OPTS = -DWIN32 -I$(PLAT) $(EXTRAS) $(STUFF) +# Set up the correct toolchain flags. +OPTS = -DWIN32 -I$(PLAT) $(EXTRAS) $(STUFF) ifdef EXFLAGS -OPTS += $(EXFLAGS) +OPTS += $(EXFLAGS) endif ifdef EXINC -OPTS += -I$(EXINC) +OPTS += -I$(EXINC) endif - ifeq ($(X64), y) ifeq ($(OPTIM), y) DFLAGS = -march=native @@ -152,17 +152,6 @@ ifeq ($(VRAMDUMP), y) CFLAGS += -DENABLE_VRAM_DUMP RFLAGS += -DENABLE_VRAM_DUMP endif -ifeq ($(FLUIDSYNTH), y) -CFLAGS += -DUSE_FLUIDSYNTH -FSYNTHOBJ = midi_fluidsynth.o -endif -ifeq ($(MUNT), y) -CFLAGS += -DUSE_MUNT -endif -ifeq ($(NETWORK), y) -CFLAGS += -DUSE_NETWORK -RFLAGS += -DUSE_NETWORK -endif ifeq ($(X64), y) PLATCG = codegen_x86-64.o CGOPS = codegen_ops_x86-64.h @@ -174,20 +163,57 @@ VCG = vid_voodoo_codegen_x86.h endif +# Optional modules. +ifeq ($(FLUIDSYNTH), y) +CFLAGS += -DUSE_FLUIDSYNTH +FSYNTHOBJ = midi_fluidsynth.o +endif + +ifeq ($(MUNT), y) +CFLAGS += -DUSE_MUNT +MUNTOBJ = midi_mt32.o \ + Analog.o BReverbModel.o File.o FileStream.o LA32Ramp.o \ + LA32FloatWaveGenerator.o LA32WaveGenerator.o \ + MidiStreamParser.o Part.o Partial.o PartialManager.o \ + Poly.o ROMInfo.o SampleRateConverter_dummy.o Synth.o \ + Tables.o TVA.o TVF.o TVP.o sha1.o c_interface.o +endif + +ifeq ($(NETWORK), y) +CFLAGS += -DUSE_NETWORK +RFLAGS += -DUSE_NETWORK +NETOBJ = network.o \ + net_pcap.o \ + net_slirp.o \ + bootp.o ip_icmp.o misc.o socket.o tcp_timer.o cksum.o \ + ip_input.o queue.o tcp_input.o debug.o ip_output.o \ + sbuf.o tcp_output.o udp.o if.o mbuf.o slirp.o tcp_subr.o \ + net_ne2000.o +endif + + # Options for the DEV branch. ifeq ($(DEV_BRANCH), y) CFLAGS += -DDEV_BRANCH +DEVBROBJ = + ifeq ($(CIRRUS), y) CFLAGS += -DUSE_CIRRUS +DEVBROBJ += vid_cl_gd.o vid_cl_gd_blit.o vid_cl_ramdac.o endif + ifeq ($(NV_RIVA), y) CFLAGS += -DUSE_RIVA +DEVBROBJ += vid_nv_riva128.o endif + ifeq ($(PAS16), y) CFLAGS += -DUSE_PAS16 +DEVBROBJ += snd_pas16.o endif endif + # Options for works-in-progress. ifndef SERIAL SERIAL = serial.o @@ -210,24 +236,24 @@ CPUOBJ = cpu.o 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o \ codegen_timing_winchip.o $(PLATCG) \ x86seg.o x87.o -MACHINEOBJ = machine.o \ - machine_common.o \ - machine_amstrad.o $(EUROPC) \ - machine_olivetti_m24.o \ - machine_pcjr.o \ - machine_tandy.o \ - machine_xt.o machine_xt_laserxt.o \ - machine_at.o \ - machine_at_ali1429.o machine_at_commodore.o \ - machine_at_neat.o machine_at_headland.o \ - machine_at_opti495.o machine_at_scat.o \ - machine_at_wd76c10.o \ - machine_at_sis_85c471.o machine_at_sis_85c496.o \ - machine_at_430lx_nx.o machine_at_430fx.o \ - machine_at_430hx.o machine_at_430vx.o \ - machine_at_440fx.o \ - machine_ps1.o \ - machine_ps2_isa.o machine_ps2_mca.o +MCHOBJ = machine.o \ + machine_common.o \ + machine_amstrad.o $(EUROPC) \ + machine_olivetti_m24.o \ + machine_pcjr.o \ + machine_tandy.o \ + machine_xt.o machine_xt_laserxt.o \ + machine_at.o \ + machine_at_ali1429.o machine_at_commodore.o \ + machine_at_neat.o machine_at_headland.o \ + machine_at_opti495.o machine_at_scat.o \ + machine_at_wd76c10.o \ + machine_at_sis_85c471.o machine_at_sis_85c496.o \ + machine_at_430lx_nx.o machine_at_430fx.o \ + machine_at_430hx.o machine_at_430vx.o \ + machine_at_440fx.o \ + machine_ps1.o \ + machine_ps2_isa.o machine_ps2_mca.o DEVOBJ = bugger.o lpt.o $(SERIAL) \ tandy_eeprom.o tandy_rom.o \ @@ -240,64 +266,49 @@ DEVOBJ = bugger.o lpt.o $(SERIAL) \ gameport.o \ joystick_standard.o joystick_ch_flightstick_pro.o \ joystick_sw_pad.o joystick_tm_fcs.o \ - mouse.o mouse_serial.o mouse_ps2.o mouse_bus.o + mouse.o \ + mouse_serial.o mouse_ps2.o mouse_bus.o FDDOBJ = fdd.o fdc.o fdi2raw.o \ - floppy.o floppy_common.o floppy_86f.o \ - floppy_fdi.o floppy_imd.o floppy_img.o floppy_json.o floppy_td0.o + floppy.o floppy_common.o floppy_86f.o \ + floppy_fdi.o floppy_imd.o floppy_img.o floppy_json.o floppy_td0.o CDROMOBJ= cdrom.o \ - cdrom_dosbox.o cdrom_image.o cdrom_ioctl.o cdrom_null.o + cdrom_dosbox.o cdrom_image.o cdrom_ioctl.o cdrom_null.o HDDOBJ = hdd.o hdd_image.o \ - hdd_mfm_at.o hdd_mfm_xebec.o hdd_esdi_at.o hdd_esdi_mca.o \ - hdd_ide_at.o hdd_ide_xt.o piix.o + hdd_mfm_at.o hdd_mfm_xebec.o hdd_esdi_at.o hdd_esdi_mca.o \ + hdd_ide_at.o hdd_ide_xt.o piix.o + ifeq ($(USB), y) USBOBJ = usb.o endif -ifeq ($(MUNT), y) -MUNTOBJ = midi_mt32.o \ - Analog.o BReverbModel.o File.o FileStream.o LA32Ramp.o \ - LA32FloatWaveGenerator.o LA32WaveGenerator.o \ - MidiStreamParser.o Part.o Partial.o PartialManager.o \ - Poly.o ROMInfo.o SampleRateConverter_dummy.o Synth.o \ - Tables.o TVA.o TVF.o TVP.o sha1.o c_interface.o -endif -ifeq ($(NETWORK), y) -NETOBJ = network.o \ - net_pcap.o \ - net_slirp.o \ - bootp.o ip_icmp.o misc.o socket.o tcp_timer.o cksum.o \ - ip_input.o queue.o tcp_input.o debug.o ip_output.o \ - sbuf.o tcp_output.o udp.o if.o mbuf.o slirp.o tcp_subr.o \ - net_ne2000.o -endif -SCSIOBJ = scsi.o scsi_bios_command.o scsi_device.o scsi_disk.o \ - scsi_buslogic.o scsi_aha154x.o -ifeq ($(DEV_BRANCH), y) -ifeq ($(PAS16), y) -PAS16OBJ = snd_pas16.o -endif -endif + +SCSIOBJ = scsi.o \ + scsi_bios_command.o scsi_device.o scsi_disk.o \ + scsi_buslogic.o scsi_aha154x.o + SNDOBJ = sound.o \ openal.o \ dbopl.o nukedopl.o \ - convolve.o convolve-sse.o envelope.o extfilt.o \ - filter.o pot.o sid.o voice.o wave6581__ST.o \ - wave6581_P_T.o wave6581_PS_.o wave6581_PST.o \ - wave8580__ST.o wave8580_P_T.o wave8580_PS_.o \ - wave8580_PST.o wave.o \ + snd_resid.o \ + convolve.o convolve-sse.o envelope.o extfilt.o \ + filter.o pot.o sid.o voice.o wave6581__ST.o \ + wave6581_P_T.o wave6581_PS_.o wave6581_PST.o \ + wave8580__ST.o wave8580_P_T.o wave8580_PS_.o \ + wave8580_PST.o wave.o \ midi.o $(FSYNTHOBJ) $(MUNTOBJ) \ - midi_system.o \ + midi_system.o \ snd_speaker.o \ snd_ps1.o snd_pssj.o \ snd_lpt_dac.o snd_lpt_dss.o \ snd_adlib.o snd_adlibgold.o snd_ad1848.o \ snd_sb.o snd_sb_dsp.o snd_cms.o snd_dbopl.o \ snd_emu8k.o snd_gus.o snd_opl.o \ - snd_mpu401.o $(PAS16OBJ) snd_resid.o \ + snd_mpu401.o \ snd_sn76489.o snd_ssi2001.o snd_wss.o \ snd_ym7128.o + VIDOBJ = video.o \ vid_cga.o vid_cga_comp.o vid_mda.o \ vid_ega.o vid_ega_render.o \ @@ -311,17 +322,20 @@ VIDOBJ = video.o \ vid_paradise.o \ vid_tvga.o vid_tgui9440.o vid_tkd8001_ramdac.o \ vid_ati_eeprom.o vid_ati18800.o vid_ati28800.o \ - vid_ati68860_ramdac.o vid_ati_mach64.o \ - vid_ics2595.o \ + vid_ati68860_ramdac.o vid_ati_mach64.o \ + vid_ics2595.o \ vid_sc1502x_ramdac.o \ vid_sdac_ramdac.o \ vid_stg_ramdac.o \ vid_wy700.o \ vid_voodoo.o \ - vid_pcjr.o vid_ps1_svga.o \ + vid_pcjr.o \ + vid_ps1_svga.o \ vid_olivetti_m24.o \ - vid_pc1512.o vid_pc1640.o vid_pc200.o \ + vid_pc1512.o vid_pc1640.o \ + vid_pc200.o \ vid_tandy.o vid_tandysl.o + WINOBJ = win.o \ win_ddraw.o win_ddraw_fs.o win_ddraw_screenshot.o \ win_d3d.o win_d3d_fs.o \ @@ -330,19 +344,11 @@ WINOBJ = win.o \ win_iodev.o win_joystick.o win_midi.o \ win_settings.o win_deviceconfig.o win_joystickconfig.o \ 86Box.res -ifeq ($(DEV_BRANCH), y) -ifeq ($(CIRRUS), y) -CIRRUSOBJ = vid_cl_gd.o vid_cl_gd_blit.o vid_cl_ramdac.o -endif -ifeq ($(NV_RIVA), y) -RIVAOBJ = vid_nv_riva128.o -endif -DEVBRANCHOBJ = $(CIRRUSOBJ) $(RIVAOBJ) -endif -OBJ = $(MAINOBJ) $(CPUOBJ) $(MACHINEOBJ) $(DEVOBJ) \ + +OBJ = $(MAINOBJ) $(CPUOBJ) $(MCHOBJ) $(DEVOBJ) \ $(FDDOBJ) $(CDROMOBJ) $(HDDOBJ) \ $(USBOBJ) $(NETOBJ) $(SCSIOBJ) $(SNDOBJ) $(VIDOBJ) \ - $(WINOBJ) $(DEVBRANCHOBJ) + $(WINOBJ) $(DEVBROBJ) ifdef EXOBJ OBJ += $(EXOBJ) endif @@ -690,7 +696,7 @@ nvr.o: ibm.h cpu/cpu.h device.h io.h mem.h nvr.h machine/machine.h \ nvr_ps2.o: ibm.h device.h io.h mem.h nvr.h nvr_ps2.h -pc.o: 86box.h config.h random.h ibm.h mem.h \ +pc.o: 86box.h config.h random.h ibm.h mem.h rom.h \ cpu/cpu.h cpu/x86_ops.h cpu/codegen.h \ dma.h nvr.h pic.h pit.h timer.h device.h machine/machine.h \ floppy.h floppy_86f.h floppy_fdi.h floppy_imd.h floppy_img.h floppy_td0.h \ @@ -976,7 +982,7 @@ win_opendir.o: ibm.h win/plat_dir.h win/resource.h win_serial.o: win/plat_thread.h win/plat_serial.h win/resource.h -win_settings.o: ibm.h mem.h cpu/cpu.h nvr.h device.h machine/machine.h cdrom.h floppy.h fdd.h hdd/hdd.h hdd/hdd_ide_at.h scsi/scsi.h network/network.h sound/midi.h \ +win_settings.o: ibm.h mem.h rom.h cpu/cpu.h nvr.h device.h machine/machine.h cdrom.h floppy.h fdd.h hdd/hdd.h hdd/hdd_ide_at.h scsi/scsi.h network/network.h sound/midi.h \ sound/sound.h sound/snd_dbopl.h sound/snd_mpu401.h video/video.h video/vid_voodoo.h gameport.h mouse.h win/plat_midi.h \ win/resource.h win/win.h win/win_language.h diff --git a/src/bugger.c b/src/bugger.c index ce5ed03a9..a527c3a6b 100644 --- a/src/bugger.c +++ b/src/bugger.c @@ -44,11 +44,15 @@ * configuration register (CTRL_SPCFG bit set) but have to * remember that stuff first... * - * Version: @(#)bugger.c 1.0.4 2017/05/09 + * Version: @(#)bugger.c 1.0.5 2017/09/24 * * Author: Fred N. van Kempen, * Copyright 1989-2017 Fred N. van Kempen. */ +#include +#include +#include +#include #include "ibm.h" #include "io.h" #include "bugger.h" diff --git a/src/cdrom/cdrom.c b/src/cdrom/cdrom.c index 625297b40..de9a3f9b9 100644 --- a/src/cdrom/cdrom.c +++ b/src/cdrom/cdrom.c @@ -9,16 +9,17 @@ * Implementation of the CD-ROM drive with SCSI(-like) * commands, for both ATAPI and SCSI usage. * - * Version: @(#)cdrom.c 1.0.5 2017/09/19 + * Version: @(#)cdrom.c 1.0.6 2017/09/24 * * Author: Miran Grca, * Copyright 2016,2017 Miran Grca. */ -#include #include -#include #include #include +#include +#include +#include #include "../86box.h" #include "../ibm.h" #include "../piix.h" diff --git a/src/cdrom/cdrom_image.cc b/src/cdrom/cdrom_image.cc index bee50d072..e1d5a0dce 100644 --- a/src/cdrom/cdrom_image.cc +++ b/src/cdrom/cdrom_image.cc @@ -6,8 +6,11 @@ #define __USE_LARGEFILE64 #define _LARGEFILE_SOURCE #define _LARGEFILE64_SOURCE -#include +#include +#include +#include #include +#include #include "../config.h" #include "cdrom_dosbox.h" #include "cdrom.h" diff --git a/src/cdrom/cdrom_ioctl.c b/src/cdrom/cdrom_ioctl.c index 2829f524c..eb5671731 100644 --- a/src/cdrom/cdrom_ioctl.c +++ b/src/cdrom/cdrom_ioctl.c @@ -9,18 +9,22 @@ * Implementation of the CD-ROM host drive IOCTL interface for * Windows using SCSI Passthrough Direct. * - * Version: @(#)cdrom_ioctl.c 1.0.3 2017/09/03 + * Version: @(#)cdrom_ioctl.c 1.0.4 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2016 Sarah Walker. - * Copyright 2016-2017 Miran Grca. + * Copyright 2016,2017 Miran Grca. */ #define WINVER 0x0600 #include #include -#include "ntddcdrm.h" -#include "ntddscsi.h" +#include +#include +#include +#include +#include +#include #include "../ibm.h" #include "../scsi/scsi.h" #include "cdrom.h" diff --git a/src/cdrom/cdrom_null.c b/src/cdrom/cdrom_null.c index f0bc68f0c..c98023935 100644 --- a/src/cdrom/cdrom_null.c +++ b/src/cdrom/cdrom_null.c @@ -9,13 +9,17 @@ * Implementation of the CD-ROM null interface for unmounted * guest CD-ROM drives. * - * Version: @(#)cdrom_null.c 1.0.2 2017/09/03 + * Version: @(#)cdrom_null.c 1.0.3 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2016 Sarah Walker. - * Copyright 2016-2017 Miran Grca. + * Copyright 2016,2017 Miran Grca. */ +#include +#include +#include +#include #include "../ibm.h" #include "cdrom.h" #include "cdrom_ioctl.h" diff --git a/src/config.c b/src/config.c index 396fb7d37..24ec3806c 100644 --- a/src/config.c +++ b/src/config.c @@ -8,7 +8,7 @@ * * Configuration file handler. * - * Version: @(#)config.c 1.0.5 2017/09/22 + * Version: @(#)config.c 1.0.6 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, @@ -22,11 +22,12 @@ * it on Windows XP, and possibly also Vista. Use the * -DANSI_CFG for use on these systems. */ -#include #include #include #include #include +#include +#include #include "ibm.h" #include "cpu/cpu.h" #include "config.h" diff --git a/src/cpu/386.c b/src/cpu/386.c index 08bd8bf41..a050fde14 100644 --- a/src/cpu/386.c +++ b/src/cpu/386.c @@ -1,10 +1,12 @@ +#include +#include +#include +#include +#include #include #ifndef INFINITY # define INFINITY (__builtin_inff()) #endif -#include -#include -#include #include "../ibm.h" #include "cpu.h" #include "x86.h" diff --git a/src/cpu/386_dynarec.c b/src/cpu/386_dynarec.c index 8ff50b946..9c5ad3a95 100644 --- a/src/cpu/386_dynarec.c +++ b/src/cpu/386_dynarec.c @@ -1,10 +1,12 @@ +#include +#include +#include +#include +#include #include #ifndef INFINITY # define INFINITY (__builtin_inff()) #endif -#include -#include -#include #include "../ibm.h" #include "cpu.h" #include "x86.h" diff --git a/src/cpu/386_dynarec_ops.c b/src/cpu/386_dynarec_ops.c index e0e018872..e6526bf47 100644 --- a/src/cpu/386_dynarec_ops.c +++ b/src/cpu/386_dynarec_ops.c @@ -1,3 +1,7 @@ +#include +#include +#include +#include #include #ifndef INFINITY # define INFINITY (__builtin_inff()) diff --git a/src/cpu/808x.c b/src/cpu/808x.c index 0a56f7499..8c8dee9fb 100644 --- a/src/cpu/808x.c +++ b/src/cpu/808x.c @@ -8,30 +8,34 @@ * * 808x CPU emulation. * - * Version: @(#)808x.c 1.0.1 2017/09/19 + * SHR AX,1 + * + * 4 clocks - fetch opcode + * 4 clocks - fetch mod/rm + * 2 clocks - execute 2 clocks - fetch opcode 1 + * 2 clocks - fetch opcode 2 + * 4 clocks - fetch mod/rm + * 2 clocks - fetch opcode 1 2 clocks - execute + * 2 clocks - fetch opcode 2 etc + * + * Version: @(#)808x.c 1.0.2 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ - -/*SHR AX,1 - - 4 clocks - fetch opcode - 4 clocks - fetch mod/rm - 2 clocks - execute 2 clocks - fetch opcode 1 - 2 clocks - fetch opcode 2 - 4 clocks - fetch mod/rm - 2 clocks - fetch opcode 1 2 clocks - execute - 2 clocks - fetch opcode 2 etc*/ #include -#include +#include +#include +//#include +#include #include "../ibm.h" #include "cpu.h" #include "x86.h" #include "../keyboard.h" #include "../mem.h" +#include "../rom.h" #include "../nmi.h" #include "../pic.h" #include "../timer.h" diff --git a/src/cpu/codegen.c b/src/cpu/codegen.c index afe795601..e3773089b 100644 --- a/src/cpu/codegen.c +++ b/src/cpu/codegen.c @@ -1,6 +1,10 @@ +#include +#include +#include +#include #include "../ibm.h" -#include "x86_ops.h" #include "../mem.h" +#include "x86_ops.h" #include "codegen.h" void (*codegen_timing_start)(); diff --git a/src/cpu/codegen_ops.c b/src/cpu/codegen_ops.c index c91a0d9db..309241c0e 100644 --- a/src/cpu/codegen_ops.c +++ b/src/cpu/codegen_ops.c @@ -1,3 +1,7 @@ +#include +#include +#include +#include #include "../ibm.h" #include "../mem.h" #include "x86.h" diff --git a/src/cpu/codegen_timing_486.c b/src/cpu/codegen_timing_486.c index 8317e2c49..56f654313 100644 --- a/src/cpu/codegen_timing_486.c +++ b/src/cpu/codegen_timing_486.c @@ -1,9 +1,13 @@ +#include +#include +#include +#include #include "../ibm.h" +#include "../mem.h" #include "cpu.h" #include "x86.h" #include "x86_ops.h" #include "x87.h" -#include "../mem.h" #include "codegen.h" #include "codegen_ops.h" #include "codegen_timing_common.h" diff --git a/src/cpu/codegen_timing_686.c b/src/cpu/codegen_timing_686.c index f62e63429..17ec4ab43 100644 --- a/src/cpu/codegen_timing_686.c +++ b/src/cpu/codegen_timing_686.c @@ -8,13 +8,16 @@ - FPU queue - Out of order execution (beyond most simplistic approximation) */ - +#include +#include +#include +#include #include "../ibm.h" +#include "../mem.h" #include "cpu.h" #include "x86.h" #include "x86_ops.h" #include "x87.h" -#include "../mem.h" #include "codegen.h" #include "codegen_timing_common.h" diff --git a/src/cpu/codegen_timing_common.c b/src/cpu/codegen_timing_common.c index d32247f35..d02ff2a42 100644 --- a/src/cpu/codegen_timing_common.c +++ b/src/cpu/codegen_timing_common.c @@ -1,6 +1,11 @@ +#include +#include +#include +#include #include "../ibm.h" #include "codegen_timing_common.h" + uint64_t opcode_deps[256] = { /* ADD ADD ADD ADD*/ diff --git a/src/cpu/codegen_timing_pentium.c b/src/cpu/codegen_timing_pentium.c index 74f4a0f3d..95edbe1d6 100644 --- a/src/cpu/codegen_timing_pentium.c +++ b/src/cpu/codegen_timing_pentium.c @@ -9,19 +9,21 @@ - PMMX decode queue - MMX latencies */ - +#include +#include +#include +#include #include "../ibm.h" +#include "../mem.h" #include "cpu.h" #include "x86.h" #include "x86_ops.h" #include "x87.h" -#include "../mem.h" #include "codegen.h" #include "codegen_ops.h" #include "codegen_timing_common.h" - /*Instruction has different execution time for 16 and 32 bit data. Does not pair */ #define CYCLES_HAS_MULTI (1 << 28) diff --git a/src/cpu/codegen_timing_winchip.c b/src/cpu/codegen_timing_winchip.c index 2726bbcc9..06644e90f 100644 --- a/src/cpu/codegen_timing_winchip.c +++ b/src/cpu/codegen_timing_winchip.c @@ -1,3 +1,7 @@ +#include +#include +#include +#include #include "../ibm.h" #include "cpu.h" #include "x86.h" diff --git a/src/cpu/codegen_x86-64.c b/src/cpu/codegen_x86-64.c index 6a3e714f1..17d10646c 100644 --- a/src/cpu/codegen_x86-64.c +++ b/src/cpu/codegen_x86-64.c @@ -1,6 +1,10 @@ #ifdef __amd64__ +#include +#include +#include #include +#include #include "../ibm.h" #include "../mem.h" #include "cpu.h" diff --git a/src/cpu/codegen_x86.c b/src/cpu/codegen_x86.c index b8f4be818..1b03efdfd 100644 --- a/src/cpu/codegen_x86.c +++ b/src/cpu/codegen_x86.c @@ -1,13 +1,17 @@ #if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined WIN32 || defined _WIN32 || defined _WIN32 +#include +#include +#include #include +#include #include "../ibm.h" +#include "../mem.h" #include "cpu.h" #include "x86.h" #include "x86_flags.h" #include "x86_ops.h" #include "x87.h" -#include "../mem.h" #include "386_common.h" diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index a7e2e7b9a..f875901c4 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -8,15 +8,19 @@ * * CPU type handler. * - * Version: @(#)cpu.c 1.0.1 2017/06/03 + * Version: @(#)cpu.c 1.0.2 2017/09/24 * * Authors: Sarah Walker, * leilei, * Miran Grca, * Copyright 2008-2017 Sarah Walker. * Copyright 2016-2017 leilei. - * Copyright 2016-2017 Miran Grca. + * Copyright 2016,2017 Miran Grca. */ +#include +#include +#include +#include #include "../ibm.h" #include "cpu.h" #include "../device.h" diff --git a/src/cpu/x86seg.c b/src/cpu/x86seg.c index 177a555ca..df1829ed3 100644 --- a/src/cpu/x86seg.c +++ b/src/cpu/x86seg.c @@ -8,17 +8,19 @@ * * x86 CPU segment emulation. * - * Version: @(#)x86seg.c 1.0.0 2017/05/30 + * Version: @(#)x86seg.c 1.0.1 2017/09/24 * - * Author: Sarah Walker, + * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. - * Copyright 2016-2017 Miran Grca. + * Copyright 2016,2017 Miran Grca. */ - #include -#include +#include +#include #include +#include +#include #include "../ibm.h" #include "../mem.h" #include "../nvr.h" diff --git a/src/cpu/x87.c b/src/cpu/x87.c index a241130fb..362e288d7 100644 --- a/src/cpu/x87.c +++ b/src/cpu/x87.c @@ -1,3 +1,7 @@ +#include +#include +#include +#include #define fplog 0 #include #include "../ibm.h" diff --git a/src/device.c b/src/device.c index 647c25850..168a8a9b1 100644 --- a/src/device.c +++ b/src/device.c @@ -9,13 +9,17 @@ * Implementation of the generic device interface to handle * all devices attached to the emulator. * - * Version: @(#)device.c 1.0.3 2017/09/02 + * Version: @(#)device.c 1.0.4 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2016 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ +#include +#include +#include +#include #include "ibm.h" #include "cpu/cpu.h" #include "config.h" diff --git a/src/dma.c b/src/dma.c index ec2530ba0..f31bfe475 100644 --- a/src/dma.c +++ b/src/dma.c @@ -8,13 +8,17 @@ * * Implementation of the Intel DMA controllers. * - * Version: @(#)dma.c 1.0.2 2017/08/23 + * Version: @(#)dma.c 1.0.3 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. - * Copyright 2016-2017 Miran Grca. + * Copyright 2016,2017 Miran Grca. */ +#include +#include +#include +#include #include "ibm.h" #include "cpu/x86.h" #include "mem.h" diff --git a/src/floppy/fdc.c b/src/floppy/fdc.c index 5a694baf7..565ba2283 100644 --- a/src/floppy/fdc.c +++ b/src/floppy/fdc.c @@ -9,18 +9,22 @@ * Implementation of the NEC uPD-765 and compatible floppy disk * controller. * - * Version: @(#)fdc.c 1.0.2 2017/09/03 + * Version: @(#)fdc.c 1.0.3 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ -#include #include +#include #include +#include +#include #include "../ibm.h" #include "../io.h" +#include "../mem.h" +#include "../rom.h" #include "../dma.h" #include "../pic.h" #include "../timer.h" diff --git a/src/floppy/fdd.c b/src/floppy/fdd.c index b0cfdd2d0..10a755dc8 100644 --- a/src/floppy/fdd.c +++ b/src/floppy/fdd.c @@ -8,13 +8,17 @@ * * Implementation of the floppy drive emulation. * - * Version: @(#)fdd.c 1.0.2 2017/09/03 + * Version: @(#)fdd.c 1.0.3 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ +#include +#include +#include +#include #include "../ibm.h" #include "floppy.h" #include "fdc.h" diff --git a/src/floppy/fdi2raw.c b/src/floppy/fdi2raw.c index c8dd9820c..84009b87a 100644 --- a/src/floppy/fdi2raw.c +++ b/src/floppy/fdi2raw.c @@ -19,9 +19,10 @@ #define STATIC_INLINE #include -#include -#include #include +#include +#include +#include /* IF UAE */ /*#include "sysconfig.h" @@ -37,7 +38,6 @@ #define VERBOSE #undef VERBOSE -#include #ifdef DEBUG static char *datalog(uae_u8 *src, int len) diff --git a/src/floppy/floppy.c b/src/floppy/floppy.c index da40cf9fb..f833afbf9 100644 --- a/src/floppy/floppy.c +++ b/src/floppy/floppy.c @@ -9,16 +9,20 @@ * Generic floppy disk interface that communicates with the * other handlers. * - * Version: @(#)floppy.c 1.0.3 2017/09/12 + * Version: @(#)floppy.c 1.0.4 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ -#define UNICODE -#include +#include +#include +#include +#include #include "../ibm.h" +#include "../mem.h" +#include "../rom.h" #include "../config.h" #include "../timer.h" #include "floppy.h" diff --git a/src/floppy/floppy_86f.c b/src/floppy/floppy_86f.c index 08bdfc0ac..930891f83 100644 --- a/src/floppy/floppy_86f.c +++ b/src/floppy/floppy_86f.c @@ -10,16 +10,16 @@ * 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.3 2017/09/19 + * Version: @(#)floppy_86f.c 1.0.4 2017/09/24 * * Author: Miran Grca, * Copyright 2016,2017 Miran Grca. */ -#include #include #include -#include #include +#include +#include #include #include #include "../lzf/lzf.h" diff --git a/src/floppy/floppy_common.c b/src/floppy/floppy_common.c index b5f181bf5..167dc6efb 100644 --- a/src/floppy/floppy_common.c +++ b/src/floppy/floppy_common.c @@ -8,12 +8,16 @@ * * Shared code for all the floppy modules. * - * Version: @(#)floppy_common.c 1.0.1 2017/09/10 + * Version: @(#)floppy_common.c 1.0.2 2017/09/24 * * Author: Fred N. van Kempen, * Copyright 2017 Fred N. van Kempen. */ +#include +#include +#include #include +#include #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 ff33b4a2a..acb46491f 100644 --- a/src/floppy/floppy_fdi.c +++ b/src/floppy/floppy_fdi.c @@ -9,7 +9,7 @@ * Implementation of the FDI floppy stream image format * interface to the FDI2RAW module. * - * Version: @(#)floppy_fdi.c 1.0.1 2017/09/03 + * Version: @(#)floppy_fdi.c 1.0.2 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, @@ -18,6 +18,7 @@ */ #include #include +#include #include #include "../ibm.h" #include "floppy.h" diff --git a/src/floppy/floppy_imd.c b/src/floppy/floppy_imd.c index b9058e0ff..97c9480b0 100644 --- a/src/floppy/floppy_imd.c +++ b/src/floppy/floppy_imd.c @@ -8,12 +8,15 @@ * * Implementation of the IMD floppy image format. * - * Version: @(#)floppy_imd.c 1.0.1 2017/09/03 + * Version: @(#)floppy_imd.c 1.0.2 2017/09/24 * * Author: Miran Grca, - * Copyright 2016-2017 Miran Grca. + * Copyright 2016,2017 Miran Grca. */ -#include +#include +#include +#include +#include #include #include "../ibm.h" #include "floppy.h" diff --git a/src/floppy/floppy_img.c b/src/floppy/floppy_img.c index 2fb9e60e8..b1567cb9b 100644 --- a/src/floppy/floppy_img.c +++ b/src/floppy/floppy_img.c @@ -9,13 +9,16 @@ * 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.1 2017/09/03 + * Version: @(#)floppy_img.c 1.0.2 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ +#include +#include +#include #include #include #include "../ibm.h" diff --git a/src/floppy/floppy_json.c b/src/floppy/floppy_json.c index 5e9319baf..659e82776 100644 --- a/src/floppy/floppy_json.c +++ b/src/floppy/floppy_json.c @@ -8,13 +8,16 @@ * * Implementation of the PCjs JSON floppy image format. * - * Version: @(#)floppy_json.c 1.0.2 2017/09/16 + * Version: @(#)floppy_json.c 1.0.3 2017/09/24 * * Author: Fred N. van Kempen, * Copyright 2017 Fred N. van Kempen. */ -#include +#include +#include +#include #include +#include #include "../ibm.h" #include "floppy.h" #include "fdc.h" diff --git a/src/floppy/floppy_td0.c b/src/floppy/floppy_td0.c index c2d695ccc..ca4d4ceef 100644 --- a/src/floppy/floppy_td0.c +++ b/src/floppy/floppy_td0.c @@ -8,7 +8,7 @@ * * Implementation of the Teledisk floppy image format. * - * Version: @(#)floppy_td0.c 1.0.2 2017/09/-3 + * Version: @(#)floppy_td0.c 1.0.3 2017/09/24 * * Authors: Milodrag Milanovic, * Haruhiko OKUMURA, @@ -37,8 +37,11 @@ * Adaptive Huffman Coding coded by Haruyasu YOSHIZAKI * Edited and translated to English by Kenji RIKITAKE */ -#include +#include +#include +#include #include +#include #include "../ibm.h" #include "floppy.h" #include "floppy_td0.h" diff --git a/src/gameport.c b/src/gameport.c index 7cb0e0142..c1cff71e7 100644 --- a/src/gameport.c +++ b/src/gameport.c @@ -1,8 +1,11 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ +#include #include +#include #include +#include #include "ibm.h" #include "cpu/cpu.h" #include "device.h" diff --git a/src/hdd/hdd.c b/src/hdd/hdd.c index 723539dab..626ebdb7d 100644 --- a/src/hdd/hdd.c +++ b/src/hdd/hdd.c @@ -1,10 +1,12 @@ +#include +#include +#include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../device.h" #include "../machine/machine.h" - #include "hdd.h" - #include "hdd_esdi_at.h" #include "hdd_esdi_mca.h" #include "hdd_mfm_at.h" diff --git a/src/hdd/hdd_esdi_at.c b/src/hdd/hdd_esdi_at.c index f637c3ae9..9be45fd85 100644 --- a/src/hdd/hdd_esdi_at.c +++ b/src/hdd/hdd_esdi_at.c @@ -1,23 +1,19 @@ #define _LARGEFILE_SOURCE #define _LARGEFILE64_SOURCE #define _GNU_SOURCE - #include #include #include #include - -#include - +#include #include "../ibm.h" #include "../device.h" -#include "hdd_image.h" #include "../io.h" #include "../mem.h" #include "../pic.h" #include "../rom.h" #include "../timer.h" - +#include "hdd_image.h" #include "hdd_esdi_at.h" diff --git a/src/hdd/hdd_esdi_mca.c b/src/hdd/hdd_esdi_mca.c index 8e1895d33..242d4efa6 100644 --- a/src/hdd/hdd_esdi_mca.c +++ b/src/hdd/hdd_esdi_mca.c @@ -52,24 +52,28 @@ * however, are auto-configured by the system software as * shown above. * - * Version: @(#)hdd_esdi_mca.c 1.0.2 2017/08/27 + * Version: @(#)hdd_esdi_mca.c 1.0.3 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. * Copyright 2017 Fred N. van Kempen. */ -#include +#include +#include +#include +#include +#include #include "../ibm.h" #include "../device.h" #include "../dma.h" -#include "hdd_image.h" #include "../io.h" #include "../mca.h" #include "../mem.h" #include "../pic.h" #include "../rom.h" #include "../timer.h" +#include "hdd_image.h" #include "hdd_esdi_mca.h" diff --git a/src/hdd/hdd_ide_at.c b/src/hdd/hdd_ide_at.c index 4e08941b2..39a090940 100644 --- a/src/hdd/hdd_ide_at.c +++ b/src/hdd/hdd_ide_at.c @@ -9,7 +9,7 @@ * Implementation of the IDE emulation for hard disks and ATAPI * CD-ROM devices. * - * Version: @(#)hdd_ide_at.c 1.0.6 2017/09/03 + * Version: @(#)hdd_ide_at.c 1.0.7 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, @@ -17,8 +17,9 @@ * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ +#include #include -#include +#include #include #include #include "../86box.h" diff --git a/src/hdd/hdd_ide_xt.c b/src/hdd/hdd_ide_xt.c index 1608cff11..7c1515961 100644 --- a/src/hdd/hdd_ide_xt.c +++ b/src/hdd/hdd_ide_xt.c @@ -8,14 +8,18 @@ * * XT IDE controller emulation. * - * Version: @(#)xtide.c 1.0.3 2017/08/24 + * Version: @(#)xtide.c 1.0.4 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ -#include +#include +#include +#include +#include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/hdd/hdd_image.c b/src/hdd/hdd_image.c index cbd8b11ac..8c56fae30 100644 --- a/src/hdd/hdd_image.c +++ b/src/hdd/hdd_image.c @@ -1,15 +1,17 @@ #define _LARGEFILE_SOURCE #define _LARGEFILE64_SOURCE #define _GNU_SOURCE -#include -#include #include -#include #include - +#include +#include +#include +#include +#include #include "../ibm.h" -#include "hdd_ide_at.h" #include "hdd_image.h" +#include "hdd_ide_at.h" + typedef struct { diff --git a/src/hdd/hdd_mfm_at.c b/src/hdd/hdd_mfm_at.c index 67c0794fe..feca7ef2d 100644 --- a/src/hdd/hdd_mfm_at.c +++ b/src/hdd/hdd_mfm_at.c @@ -12,15 +12,20 @@ * based design. Most cards were WD1003-WA2 or -WAH, where the * -WA2 cards had a floppy controller as well (to save space.) * - * Version: @(#)hdd_mfm_at.c 1.0.2 2017/09/23 + * Version: @(#)hdd_mfm_at.c 1.0.3 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Fred N. van Kempen, * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. + * Copyright 2017 Fred N. van Kempen. */ +#include +#include +#include #include +#include #include "../ibm.h" #include "../device.h" #include "../io.h" diff --git a/src/hdd/hdd_mfm_xebec.c b/src/hdd/hdd_mfm_xebec.c index d4647ac31..b5a8993b6 100644 --- a/src/hdd/hdd_mfm_xebec.c +++ b/src/hdd/hdd_mfm_xebec.c @@ -1,16 +1,17 @@ -#include -#include - +#include +#include +#include +#include +#include #include "../ibm.h" - #include "../device.h" #include "../dma.h" -#include "hdd_image.h" #include "../io.h" #include "../mem.h" #include "../pic.h" #include "../rom.h" #include "../timer.h" +#include "hdd_image.h" #include "hdd_mfm_xebec.h" diff --git a/src/i82335.c b/src/i82335.c index 981ea8f55..a29303b2b 100644 --- a/src/i82335.c +++ b/src/i82335.c @@ -1,6 +1,9 @@ /* Intel 82335 SX emulation, used by the Phoenix 386 clone. */ +#include #include +#include +#include #include "ibm.h" #include "io.h" #include "mem.h" diff --git a/src/ibm.h b/src/ibm.h index a5ca95b68..a052f3a1e 100644 --- a/src/ibm.h +++ b/src/ibm.h @@ -8,18 +8,18 @@ * * General include file. * - * Version: @(#)ibm.h 1.0.4 2017/09/19 + * Version: @(#)ibm.h 1.0.5 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ -#include -#include -#include -#include -#define printf pclog +#ifndef EMU_IBM_H +# define EMU_IBM_H + + +#define printf pclog /*Memory*/ @@ -379,120 +379,11 @@ 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 || romset==ROM_ACER386) && 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) -#define PCJR (romset == ROM_IBMPCJR) -#define AMIBIOS (romset==ROM_AMI386SX || romset==ROM_AMI486 || romset == ROM_WIN486) int GAMEBLASTER, GUS, SSI2001, voodoo_enabled, buslogic_enabled; extern int AMSTRAD, AT, is286, is386, PCI, TANDY; -enum -{ - ROM_IBMPC = 0, /*301 keyboard error, 131 cassette (!!!) error*/ - ROM_IBMXT, /*301 keyboard error*/ - ROM_IBMPCJR, - ROM_GENXT, /*'Generic XT BIOS'*/ - ROM_DTKXT, - ROM_EUROPC, - ROM_OLIM24, - ROM_TANDY, - ROM_PC1512, - ROM_PC200, - ROM_PC1640, - ROM_PC2086, - ROM_PC3086, - ROM_AMIXT, /*XT Clone with AMI BIOS*/ - ROM_LTXT, - ROM_LXT3, - ROM_PX386, - ROM_DTK386, - ROM_PXXT, - ROM_JUKOPC, - ROM_TANDY1000HX, - ROM_TANDY1000SL2, - ROM_IBMAT, - ROM_CMDPC30, - ROM_AMI286, - ROM_AWARD286, - ROM_DELL200, - ROM_MISC286, - ROM_IBMAT386, - ROM_ACER386, - ROM_MEGAPC, - ROM_AMI386SX, - ROM_AMI486, - ROM_WIN486, - ROM_PCI486, - ROM_SIS496, - ROM_430VX, - ROM_ENDEAVOR, - ROM_REVENGE, - ROM_IBMPS1_2011, - ROM_DESKPRO_386, - ROM_PORTABLE, -#if 0 - ROM_PORTABLEII, - ROM_PORTABLEIII, - ROM_PORTABLEIII386, /* The original Compaq Portable III shipped with an Intel 80286 CPU, but later switched to a 386DX. */ -#endif - ROM_IBMPS1_2121, - - ROM_AMI386DX_OPTI495, - ROM_MR386DX_OPTI495, - - ROM_IBMPS2_M30_286, - ROM_IBMPS2_M50, - ROM_IBMPS2_M55SX, - ROM_IBMPS2_M80, - - ROM_DTK486, /*DTK PKM-0038S E-2 / SiS 471 / Award BIOS / SiS 85C471*/ - ROM_VLI486SV2G, /*ASUS VL/I-486SV2G / SiS 471 / Award BIOS / SiS 85C471*/ - ROM_R418, /*Rise Computer R418 / SiS 496/497 / Award BIOS / SMC FDC37C665*/ - ROM_586MC1, /*Micro Star 586MC1 MS-5103 / 430LX / Award BIOS*/ - ROM_PLATO, /*Intel Premiere/PCI II / 430NX / AMI BIOS / SMC FDC37C665*/ - ROM_MB500N, /*PC Partner MB500N / 430FX / Award BIOS / SMC FDC37C665*/ - ROM_P54TP4XE, /*ASUS P/I-P55TP4XE / 430FX / Award BIOS / SMC FDC37C665*/ - ROM_AP53, /*AOpen AP53 / 430HX / AMI BIOS / SMC FDC37C665/669*/ - ROM_P55T2S, /*ASUS P/I-P55T2S / 430HX / AMI BIOS / National Semiconductors PC87306*/ - ROM_ACERM3A, /*Acer M3A / 430HX / Acer BIOS / SMC FDC37C932FR*/ - ROM_ACERV35N, /*Acer V35N / 430HX / Acer BIOS / SMC FDC37C932FR*/ - ROM_P55T2P4, /*ASUS P/I-P55T2P4 / 430HX / Award BIOS / Winbond W8387F*/ - ROM_P55TVP4, /*ASUS P/I-P55TVP4 / 430HX / Award BIOS / Winbond W8387F*/ - ROM_P55VA, /*Epox P55-VA / 430VX / Award BIOS / SMC FDC37C932FR*/ - - ROM_440FX, /*Tyan Titan-Pro AT / 440FX / Award BIOS / SMC FDC37C665*/ - - ROM_MARL, /*Intel Advanced/ML / 430HX / AMI BIOS / National Semiconductors PC87306*/ - ROM_THOR, /*Intel Advanced/ATX / 430FX / AMI BIOS / National Semiconductors PC87306*/ - ROM_MRTHOR, /*Intel Advanced/ATX / 430FX / MR.BIOS / National Semiconductors PC87306*/ - ROM_POWERMATE_V,/*NEC PowerMate V / 430FX / Phoenix BIOS / SMC FDC37C665*/ - - ROM_IBMPS1_2121_ISA,/*IBM PS/1 Model 2121 with ISA expansion bus*/ - - ROM_SPC4200P, /*Samsung SPC-4200P / SCAT / Phoenix BIOS*/ - ROM_SUPER286TR, /*Hyundai Super-286TR / SCAT / Award BIOS*/ - - ROM_AWARD386SX_OPTI495, - ROM_AWARD386DX_OPTI495, - ROM_AWARD486_OPTI495, - - ROM_MEGAPCDX, /*386DX mdoel of the Mega PC - Note by Tohka: The documentation (that I have in German) clearly says such a model exists.*/ - ROM_ZAPPA, /*Intel Advanced/ZP / 430FX / AMI BIOS / National Semiconductors PC87306*/ - - ROM_CMDPC60, - - ROM_S1668, /*Tyan Titan-Pro ATX / 440FX / AMI BIOS / SMC FDC37C669*/ - ROM_IBMPS1_2133, - - ROM_PRESIDENT, /*President Award 430FX PCI / 430FX / Award BIOS / Unknown Super I/O chip*/ - ROM_IBMPS2_M80_486, - - ROM_MAX -}; - -extern int romspresent[ROM_MAX]; - extern int hasfpu; -extern int romset; enum { @@ -733,11 +624,11 @@ extern PCI_RESET pci_reset_handler; extern void trc_init(void); -extern int enable_xtide; extern int enable_external_fpu; extern int serial_enabled[2]; extern int lpt_enabled, bugger_enabled; +extern int romset; extern int invert_display; @@ -812,3 +703,6 @@ extern void status_settext(char *str); /* Configuration values. */ #define SERIAL_MAX 2 #define PARALLEL_MAX 1 + + +#endif /*EMU_IBM_H*/ diff --git a/src/intel.c b/src/intel.c index 01560852f..41462046f 100644 --- a/src/intel.c +++ b/src/intel.c @@ -1,6 +1,10 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ +#include +#include +#include +#include #include "ibm.h" #include "cpu/cpu.h" #include "io.h" diff --git a/src/intel_flash.c b/src/intel_flash.c index 59955a0ca..fab8c57c9 100644 --- a/src/intel_flash.c +++ b/src/intel_flash.c @@ -8,15 +8,18 @@ * * Implementation of the Intel 2 Mbit 8-bit flash devices. * - * Version: @(#)intel_flash.c 1.0.2 2017/09/19 + * Version: @(#)intel_flash.c 1.0.3 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. - * Copyright 2016-2017 Miran Grca. + * Copyright 2016,2017 Miran Grca. */ - +#include +#include +#include #include +#include #include "ibm.h" #include "cpu/cpu.h" #include "device.h" diff --git a/src/intel_sio.c b/src/intel_sio.c index 7210b1a2d..9dfe965ba 100644 --- a/src/intel_sio.c +++ b/src/intel_sio.c @@ -6,14 +6,17 @@ * * Emulation of Intel System I/O PCI chip. * - * Version: @(#)intel_sio.c 1.0.5 2017/09/03 + * Version: @(#)intel_sio.c 1.0.6 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ +#include +#include #include +#include #include "ibm.h" #include "io.h" #include "dma.h" diff --git a/src/io.c b/src/io.c index dd10e42c9..d10793439 100644 --- a/src/io.c +++ b/src/io.c @@ -1,6 +1,10 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ +#include +#include +#include +#include #include "ibm.h" #include "io.h" diff --git a/src/joystick_ch_flightstick_pro.c b/src/joystick_ch_flightstick_pro.c index 9697c1c6a..94a7e5e0f 100644 --- a/src/joystick_ch_flightstick_pro.c +++ b/src/joystick_ch_flightstick_pro.c @@ -1,4 +1,8 @@ +#include +#include +#include #include +#include #include "ibm.h" #include "device.h" #include "timer.h" diff --git a/src/joystick_standard.c b/src/joystick_standard.c index c73260cac..c7d2ed704 100644 --- a/src/joystick_standard.c +++ b/src/joystick_standard.c @@ -1,4 +1,8 @@ +#include +#include +#include #include +#include #include "ibm.h" #include "device.h" #include "timer.h" diff --git a/src/joystick_sw_pad.c b/src/joystick_sw_pad.c index d256c290f..13b0e99b3 100644 --- a/src/joystick_sw_pad.c +++ b/src/joystick_sw_pad.c @@ -19,8 +19,11 @@ - Some DOS stuff will write to 0x201 while a packet is being transferred. This seems to be ignored. */ - +#include +#include +#include #include +#include #include "ibm.h" #include "device.h" #include "timer.h" diff --git a/src/joystick_tm_fcs.c b/src/joystick_tm_fcs.c index 93babc162..2742f5430 100644 --- a/src/joystick_tm_fcs.c +++ b/src/joystick_tm_fcs.c @@ -1,4 +1,8 @@ +#include +#include +#include #include +#include #include "ibm.h" #include "device.h" #include "timer.h" diff --git a/src/keyboard.c b/src/keyboard.c index cf9729715..91822a804 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -8,21 +8,26 @@ * * Host to guest keyboard interface and keyboard scan code sets. * - * Version: @(#)keyboard.c 1.0.1 2017/08/23 + * Version: @(#)keyboard.c 1.0.2 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. - * Copyright 2016-2017 Miran Grca. + * Copyright 2016,2017 Miran Grca. */ - +#include +#include +#include +#include #include "ibm.h" #include "plat_keyboard.h" #include "keyboard.h" + int keybsendcallback = 0; int keybsenddelay; + typedef struct { int scancodes_make[9]; diff --git a/src/keyboard_amstrad.c b/src/keyboard_amstrad.c index 96273fa20..14743091d 100644 --- a/src/keyboard_amstrad.c +++ b/src/keyboard_amstrad.c @@ -1,7 +1,10 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ +#include #include +#include +#include #include "ibm.h" #include "io.h" #include "mem.h" diff --git a/src/keyboard_at.c b/src/keyboard_at.c index 7230189a9..86e3f5509 100644 --- a/src/keyboard_at.c +++ b/src/keyboard_at.c @@ -8,19 +8,23 @@ * * Intel 8042 (AT keyboard controller) emulation. * - * Version: @(#)keyboard_at.c 1.0.2 2017/09/03 + * Version: @(#)keyboard_at.c 1.0.3 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ +#include #include +#include +#include #include "ibm.h" #include "io.h" #include "pic.h" #include "pit.h" #include "mem.h" +#include "rom.h" #include "timer.h" #include "floppy/floppy.h" #include "floppy/fdc.h" diff --git a/src/keyboard_olim24.c b/src/keyboard_olim24.c index 3923483bf..c0b9506cb 100644 --- a/src/keyboard_olim24.c +++ b/src/keyboard_olim24.c @@ -1,4 +1,8 @@ +#include +#include +#include #include +#include #include "ibm.h" #include "io.h" #include "mem.h" diff --git a/src/keyboard_pcjr.c b/src/keyboard_pcjr.c index 682c84ce7..9d5fd7e91 100644 --- a/src/keyboard_pcjr.c +++ b/src/keyboard_pcjr.c @@ -1,7 +1,10 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ +#include #include +#include +#include #include "ibm.h" #include "io.h" #include "mem.h" diff --git a/src/keyboard_xt.c b/src/keyboard_xt.c index e0784e1c4..14d773ed2 100644 --- a/src/keyboard_xt.c +++ b/src/keyboard_xt.c @@ -1,10 +1,14 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ +#include #include +#include +#include #include "ibm.h" #include "io.h" #include "mem.h" +#include "rom.h" #include "pic.h" #include "pit.h" #include "timer.h" diff --git a/src/lpt.c b/src/lpt.c index 459346bf0..b510f62ce 100644 --- a/src/lpt.c +++ b/src/lpt.c @@ -1,15 +1,20 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ +#include +#include +#include +#include #include "ibm.h" #include "io.h" - #include "lpt.h" #include "sound/snd_lpt_dac.h" #include "sound/snd_lpt_dss.h" + char lpt1_device_name[16]; + static struct { char name[64]; diff --git a/src/machine/machine.c b/src/machine/machine.c index aeadf50e4..4f38fefcd 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -8,18 +8,22 @@ * * Handling of the emulated machines. * - * Version: @(#)machine.c 1.0.14 2017/09/21 + * Version: @(#)machine.c 1.0.15 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ -#include #include +#include +#include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../io.h" +#include "../mem.h" +#include "../rom.h" #include "../device.h" #include "../floppy/floppy.h" #include "../floppy/fdc.h" @@ -161,103 +165,108 @@ machine_t machines[] = }; -int machine_count(void) +void +machine_init(void) { - return (sizeof(machines) / sizeof(machine)) - 1; + pclog("Initializing as \"%s\"\n", machine_getname()); + + AMSTRAD = AT = PCI = TANDY = 0; + + io_init(); + + fdc_update_is_nsc(0); + + machines[machine].init(); + + if (machines[machine].get_device) + device_add(machines[machine].get_device()); } -int machine_getromset(void) +int +machine_count(void) { - return machines[machine].id; + return((sizeof(machines) / sizeof(machine)) - 1); } -int machine_getromset_ex(int m) +int +machine_getromset(void) { - return machines[m].id; + return(machines[machine].id); } -int machine_getmachine(int romset) +int +machine_getromset_ex(int m) { - int c = 0; - - while (machines[c].id != -1) - { - if (machines[c].id == romset) - return c; - c++; - } - - return 0; + return(machines[m].id); } -char *machine_getname(void) +int +machine_getmachine(int romset) { - return machines[machine].name; + int c = 0; + + while (machines[c].id != -1) { + if (machines[c].id == romset) + return(c); + c++; + } + + return(0); } -device_t *machine_getdevice(int machine) +char * +machine_getname(void) { - if (machines[machine].get_device) - { - return machines[machine].get_device(); - } - else - { - return NULL; - } + return(machines[machine].name); } -char *machine_get_internal_name(void) +device_t * +machine_getdevice(int machine) { - return machines[machine].internal_name; + if (machines[machine].get_device) + return(machines[machine].get_device()); + + return(NULL); } -char *machine_get_internal_name_ex(int m) +char * +machine_get_internal_name(void) { - return machines[m].internal_name; + return(machines[machine].internal_name); } -int machine_get_nvrmask(int m) +char * +machine_get_internal_name_ex(int m) { - return machines[m].nvrmask; + return(machines[m].internal_name); } -int machine_get_machine_from_internal_name(char *s) +int +machine_get_nvrmask(int m) { - int c = 0; - - while (machines[c].id != -1) - { - if (!strcmp(machines[c].internal_name, s)) - return c; - c++; - } - - return 0; + return(machines[m].nvrmask); } -void machine_init(void) +int +machine_get_machine_from_internal_name(char *s) { - pclog("Initializing as %s\n", machine_getname()); + int c = 0; - AMSTRAD = AT = PCI = TANDY = 0; + while (machines[c].id != -1) { + if (!strcmp(machines[c].internal_name, s)) + return(c); + c++; + } - io_init(); - - fdc_update_is_nsc(0); - - machines[machine].init(); - - if (machines[machine].get_device) - device_add(machines[machine].get_device()); + return(0); } diff --git a/src/machine/machine_amstrad.c b/src/machine/machine_amstrad.c index 7808f4086..467ec0b27 100644 --- a/src/machine/machine_amstrad.c +++ b/src/machine/machine_amstrad.c @@ -1,9 +1,14 @@ +#include +#include +#include #include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../io.h" #include "../nmi.h" #include "../mem.h" +#include "../rom.h" #include "../device.h" #include "../nvr.h" #include "../gameport.h" diff --git a/src/machine/machine_at.c b/src/machine/machine_at.c index 93483af9c..86d6ae051 100644 --- a/src/machine/machine_at.c +++ b/src/machine/machine_at.c @@ -1,3 +1,7 @@ +#include +#include +#include +#include #include "../ibm.h" #include "../pic.h" #include "../pit.h" diff --git a/src/machine/machine_at_430fx.c b/src/machine/machine_at_430fx.c index bc2aa9900..4dabc055c 100644 --- a/src/machine/machine_at_430fx.c +++ b/src/machine/machine_at_430fx.c @@ -8,18 +8,22 @@ * * Implementation of the Intel 430FX PCISet chip. * - * Version: @(#)machine_at_430fx.c 1.0.4 2017/09/03 + * Version: @(#)machine_at_430fx.c 1.0.5 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ +#include +#include #include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../mem.h" #include "../memregs.h" +#include "../rom.h" #include "../pci.h" #include "../device.h" #include "../piix.h" diff --git a/src/machine/machine_at_430hx.c b/src/machine/machine_at_430hx.c index 508aba2a0..9bb59025f 100644 --- a/src/machine/machine_at_430hx.c +++ b/src/machine/machine_at_430hx.c @@ -8,14 +8,17 @@ * * Implementation of the Intel 430HX PCISet chip. * - * Version: @(#)machine_at_430hx.c 1.0.4 2017/09/03 + * Version: @(#)machine_at_430hx.c 1.0.5 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. * Copyright 2016-2017 Miran Grca. */ +#include +#include #include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../io.h" diff --git a/src/machine/machine_at_430lx_nx.c b/src/machine/machine_at_430lx_nx.c index 981e62aab..2eeabbee7 100644 --- a/src/machine/machine_at_430lx_nx.c +++ b/src/machine/machine_at_430lx_nx.c @@ -8,18 +8,22 @@ * * Implementation of the Intel 430LX and 430NX PCISet chips. * - * Version: @(#)machine_at_430lx_nx.c 1.0.4 2017/09/03 + * Version: @(#)machine_at_430lx_nx.c 1.0.5 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. - * Copyright 2016-2017 Miran Grca. + * Copyright 2016,2017 Miran Grca. */ +#include +#include #include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../mem.h" #include "../memregs.h" +#include "../rom.h" #include "../pci.h" #include "../device.h" #include "../intel.h" diff --git a/src/machine/machine_at_430vx.c b/src/machine/machine_at_430vx.c index 3f8971cc5..8576e4b24 100644 --- a/src/machine/machine_at_430vx.c +++ b/src/machine/machine_at_430vx.c @@ -8,14 +8,17 @@ * * Implementation of the Intel 430VX PCISet chip. * - * Version: @(#)machine_at_430vx.c 1.0.5 2017/09/03 + * Version: @(#)machine_at_430vx.c 1.0.6 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. - * Copyright 2016-2017 Miran Grca. + * Copyright 2016,2017 Miran Grca. */ +#include +#include #include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../io.h" diff --git a/src/machine/machine_at_440fx.c b/src/machine/machine_at_440fx.c index cd42685e6..ee8c5aadc 100644 --- a/src/machine/machine_at_440fx.c +++ b/src/machine/machine_at_440fx.c @@ -8,14 +8,17 @@ * * Implementation of the Intel 440FX PCISet chip. * - * Version: @(#)machine_at_440fx.c 1.0.4 2017/09/03 + * Version: @(#)machine_at_440fx.c 1.0.5 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. - * Copyright 2016-2017 Miran Grca. + * Copyright 2016,2017 Miran Grca. */ +#include +#include #include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../io.h" diff --git a/src/machine/machine_at_ali1429.c b/src/machine/machine_at_ali1429.c index d991dfb06..2a5328b7f 100644 --- a/src/machine/machine_at_ali1429.c +++ b/src/machine/machine_at_ali1429.c @@ -1,7 +1,10 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ +#include +#include #include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../io.h" diff --git a/src/machine/machine_at_commodore.c b/src/machine/machine_at_commodore.c index 5651fdb96..8cf2b4b8c 100644 --- a/src/machine/machine_at_commodore.c +++ b/src/machine/machine_at_commodore.c @@ -1,3 +1,7 @@ +#include +#include +#include +#include #include "../ibm.h" #include "../io.h" #include "../lpt.h" diff --git a/src/machine/machine_at_compaq.c b/src/machine/machine_at_compaq.c index 098b6c350..2864221b1 100644 --- a/src/machine/machine_at_compaq.c +++ b/src/machine/machine_at_compaq.c @@ -1,6 +1,10 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ +#include +#include +#include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../mem.h" diff --git a/src/machine/machine_at_headland.c b/src/machine/machine_at_headland.c index b5f5ae512..92df0e05a 100644 --- a/src/machine/machine_at_headland.c +++ b/src/machine/machine_at_headland.c @@ -1,6 +1,10 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ +#include +#include +#include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../io.h" diff --git a/src/machine/machine_at_neat.c b/src/machine/machine_at_neat.c index fb2f92280..96d0ff124 100644 --- a/src/machine/machine_at_neat.c +++ b/src/machine/machine_at_neat.c @@ -2,6 +2,10 @@ see COPYING for more details */ /*This is the chipset used in the AMI 286 clone model*/ +#include +#include +#include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../io.h" diff --git a/src/machine/machine_at_opti495.c b/src/machine/machine_at_opti495.c index f838efd2a..049e45481 100644 --- a/src/machine/machine_at_opti495.c +++ b/src/machine/machine_at_opti495.c @@ -251,6 +251,10 @@ Note: the block address is forced to be a multiple of the block size by ignoring the appropriate number of the least-significant bits SeeAlso: #P0178,#P0187 */ +#include +#include +#include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../io.h" diff --git a/src/machine/machine_at_scat.c b/src/machine/machine_at_scat.c index f369bfb0e..07c6d23d0 100644 --- a/src/machine/machine_at_scat.c +++ b/src/machine/machine_at_scat.c @@ -1,4 +1,25 @@ -/*This is the chipset used in the Award 286 clone model*/ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Implementation of Chips&Technology's SCAT (82C235) chipset. + * + * Re-worked version based on the 82C235 datasheet and errata. + * + * Version: @(#)at_scat.c 1.0.2 2017/09/24 + * + * Authors: Original by GreatPsycho for PCem. + * Fred N. van Kempen, + * Copyright 2017 Fred N. van Kempen. + */ +#include +#include +#include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../cpu/x86.h" @@ -8,550 +29,737 @@ #include "machine_at_scat.h" -#define SCAT_DMA_WAIT_STATE_CONTROL 0x01 -#define SCAT_VERSION 0x40 -#define SCAT_CLOCK_CONTROL 0x41 -#define SCAT_PERIPHERAL_CONTROL 0x44 -#define SCAT_MISCELLANEOUS_STATUS 0x45 -#define SCAT_POWER_MANAGEMENT 0x46 -#define SCAT_ROM_ENABLE 0x48 -#define SCAT_RAM_WRITE_PROTECT 0x49 -#define SCAT_SHADOW_RAM_ENABLE_1 0x4A -#define SCAT_SHADOW_RAM_ENABLE_2 0x4B -#define SCAT_SHADOW_RAM_ENABLE_3 0x4C -#define SCAT_DRAM_CONFIGURATION 0x4D -#define SCAT_EXTENDED_BOUNDARY 0x4E -#define SCAT_EMS_CONTROL 0x4F +#define SCAT_DEBUG 2 -typedef struct scat_t +#define SCAT_DMA_WS_CTL 0x01 +#define SCAT_VERSION 0x40 +#define SCAT_CLOCK_CTL 0x41 +#define SCAT_PERIPH_CTL 0x44 +#define SCAT_MISC_STATUS 0x45 +#define SCAT_POWER_MGMT 0x46 +#define SCAT_ROM_ENABLE 0x48 +#define SCAT_RAM_WR_PROTECT 0x49 +#define SCAT_SHADOW_RAM_EN_1 0x4a +#define SCAT_SHADOW_RAM_EN_2 0x4b +#define SCAT_SHADOW_RAM_EN_3 0x4c +#define SCAT_DRAM_CONFIG 0x4d +#define SCAT_EXT_BOUNDARY 0x4e +#define SCAT_EMS_CTL 0x4f +#define SCAT_SYS_CTL 0x7f /* port 92 */ + + +typedef struct { + uint8_t regs_2x8; + uint8_t regs_2x9; +} ems_t; + + +static uint8_t scat_regs[128]; +static int scat_index; +static uint32_t scat_xms_bound; +static uint8_t scat_ems_reg = 0; +static ems_t scat_ems[32]; /* EMS page regs */ +static mem_mapping_t scat_mapping[32]; /* EMS pages */ +static mem_mapping_t scat_top_mapping[24]; /* top 384K mapping */ +static mem_mapping_t scat_A000_mapping; /* A000-C000 mapping */ +static mem_mapping_t scat_shadowram_mapping[6]; /* BIOS shadowing */ +static mem_mapping_t scat_high_mapping[16]; /* >1M mapping */ + + +static void +shadow_state_update(void) { - uint8_t regs_2x8; - uint8_t regs_2x9; -} scat_t; + int i, val; -static uint8_t scat_regs[256]; -static int scat_index; -static uint8_t scat_port_92 = 0; -static uint8_t scat_ems_reg_2xA = 0; -static mem_mapping_t scat_mapping[32]; -static mem_mapping_t scat_high_mapping[16]; -static scat_t scat_stat[32]; -static uint32_t scat_xms_bound; -static mem_mapping_t scat_shadowram_mapping[6]; -static mem_mapping_t scat_4000_9FFF_mapping[24]; -static mem_mapping_t scat_A000_BFFF_mapping; + /* TODO - ROMCS enable features should be implemented later. */ + for (i=0; i<24; i++) { + val = ((scat_regs[SCAT_SHADOW_RAM_EN_1 + (i >> 3)] >> (i & 7)) & 1) ? MEM_READ_INTERNAL : MEM_READ_EXTERNAL; + if (i < 8) { + val |= ((scat_regs[SCAT_SHADOW_RAM_EN_1 + (i >> 3)] >> (i & 7)) & 1) ? MEM_WRITE_INTERNAL : MEM_WRITE_EXTERNAL; + } else { + if ((scat_regs[SCAT_RAM_WR_PROTECT] >> ((i - 8) >> 1)) & 1) + val |= MEM_WRITE_DISABLED; + else + val |= ((scat_regs[SCAT_SHADOW_RAM_EN_1 + (i >> 3)] >> (i & 7)) & 1) ? MEM_WRITE_INTERNAL : MEM_WRITE_EXTERNAL; + } + mem_set_mem_state((i + 40) << 14, 0x4000, val); + } - -uint8_t scat_read(uint16_t port, void *priv); -void scat_write(uint16_t port, uint8_t val, void *priv); - - -void scat_shadow_state_update(void) -{ - int i, val; - - /* TODO - ROMCS enable features should be implemented later. */ - for (i = 0; i < 24; i++) - { - val = ((scat_regs[SCAT_SHADOW_RAM_ENABLE_1 + (i >> 3)] >> (i & 7)) & 1) ? MEM_READ_INTERNAL : MEM_READ_EXTERNAL; - if (i < 8) - { - val |= ((scat_regs[SCAT_SHADOW_RAM_ENABLE_1 + (i >> 3)] >> (i & 7)) & 1) ? MEM_WRITE_INTERNAL : MEM_WRITE_EXTERNAL; - } - else - { - if ((scat_regs[SCAT_RAM_WRITE_PROTECT] >> ((i - 8) >> 1)) & 1) - { - val |= MEM_WRITE_DISABLED; - } - else - { - val |= ((scat_regs[SCAT_SHADOW_RAM_ENABLE_1 + (i >> 3)] >> (i & 7)) & 1) ? MEM_WRITE_INTERNAL : MEM_WRITE_EXTERNAL; - } - } - mem_set_mem_state((i + 40) << 14, 0x4000, val); - } - - flushmmucache(); + flushmmucache(); } -void scat_set_xms_bound(uint8_t val) +static void +set_xms_bound(uint8_t val) { - uint32_t max_xms_size = (mem_size >= 16384) ? 0xFC0000 : mem_size << 10; - int i; + uint32_t max_xms, max_mem; + int i; - switch (val & 0x0F) - { - case 1: - scat_xms_bound = 0x100000; - break; - case 2: - scat_xms_bound = 0x140000; - break; - case 3: - scat_xms_bound = 0x180000; - break; - case 4: - scat_xms_bound = 0x200000; - break; - case 5: - scat_xms_bound = 0x300000; - break; - case 6: - scat_xms_bound = 0x400000; - break; - case 7: - scat_xms_bound = 0x600000; - break; - case 8: - scat_xms_bound = 0x800000; - break; - case 9: - scat_xms_bound = 0xA00000; - break; - case 10: - scat_xms_bound = 0xC00000; - break; - case 11: - scat_xms_bound = 0xE00000; - break; - default: - scat_xms_bound = (mem_size >= 16384 ? 0xFC0000 : mem_size << 10); - break; - } + max_mem = (mem_size << 10); + max_xms = (mem_size >= 16384) ? 0xFC0000 : max_mem; + pclog("SCAT: set_xms_bound(%02x): max_mem=%d, max_xms=%d\n", + val, max_mem, max_xms); - if ((val & 0x40) == 0 && (scat_regs[SCAT_DRAM_CONFIGURATION] & 0x0F) == 3) - { - if (val != 1) - { - if(mem_size > 1024) mem_mapping_disable(&ram_high_mapping); - for(i=0;i<6;i++) - mem_mapping_enable(&scat_shadowram_mapping[i]); - if ((val & 0x0F) == 0) - scat_xms_bound = 0x160000; - } - else - { - for(i=0;i<6;i++) - mem_mapping_disable(&scat_shadowram_mapping[i]); - if(mem_size > 1024) mem_mapping_enable(&ram_high_mapping); - } - pclog("Set XMS bound(%02X) = %06X(%dKbytes for EMS access)\n", val, scat_xms_bound, (0x160000 - scat_xms_bound) >> 10); - if (scat_xms_bound > 0x100000) - mem_set_mem_state(0x100000, scat_xms_bound - 0x100000, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); - if (scat_xms_bound < 0x160000) - mem_set_mem_state(scat_xms_bound, 0x160000 - scat_xms_bound, MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL); - } - else - { - for(i=0;i<6;i++) - mem_mapping_disable(&scat_shadowram_mapping[i]); - if(mem_size > 1024) mem_mapping_enable(&ram_high_mapping); + switch (val & 0x0f) { + case 1: + scat_xms_bound = 0x100000; + break; - if (scat_xms_bound > max_xms_size) - scat_xms_bound = max_xms_size; - pclog("Set XMS bound(%02X) = %06X(%dKbytes for EMS access)\n", val, scat_xms_bound, ((mem_size << 10) - scat_xms_bound) >> 10); - if (scat_xms_bound > 0x100000) - mem_set_mem_state(0x100000, scat_xms_bound - 0x100000, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); - if (scat_xms_bound < (mem_size << 10)) - mem_set_mem_state(scat_xms_bound, (mem_size << 10) - scat_xms_bound, MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL); - } -} + case 2: + scat_xms_bound = 0x140000; + break; + case 3: + scat_xms_bound = 0x180000; + break; -uint32_t get_scat_addr(uint32_t addr, scat_t *p) -{ - if (p && (scat_regs[SCAT_EMS_CONTROL] & 0x80) && (p->regs_2x9 & 0x80)) - { - addr = (addr & 0x3fff) | (((p->regs_2x9 & 3) << 8) | p->regs_2x8) << 14; - } + case 4: + scat_xms_bound = 0x200000; + break; - if (mem_size < 2048 && ((scat_regs[SCAT_DRAM_CONFIGURATION] & 0x0F) > 7 || (scat_regs[SCAT_EXTENDED_BOUNDARY] & 0x40) != 0)) - addr = (addr & ~0x780000) | ((addr & 0x600000) >> 2); - else if((scat_regs[SCAT_DRAM_CONFIGURATION] & 0x0F) < 8 && (scat_regs[SCAT_EXTENDED_BOUNDARY] & 0x40) == 0) - { - addr &= ~0x600000; - if(mem_size > 2048 || (mem_size == 2048 && (scat_regs[SCAT_DRAM_CONFIGURATION] & 0x0F) < 6)) - addr |= (addr & 0x180000) << 2; - } + case 5: + scat_xms_bound = 0x300000; + break; - if ((scat_regs[SCAT_EXTENDED_BOUNDARY] & 0x40) == 0 && (scat_regs[SCAT_DRAM_CONFIGURATION] & 0x0F) == 3 && (addr & ~0x600000) >= 0x100000 && (addr & ~0x600000) < 0x160000) - addr ^= mem_size < 2048 ? 0x1F0000 : 0x670000; - return addr; -} + case 6: + scat_xms_bound = 0x400000; + break; + case 7: + scat_xms_bound = 0x600000; + break; -void scat_memmap_state_update(void) -{ - int i; - uint32_t addr; + case 8: + scat_xms_bound = 0x800000; + break; - for(i=16;i<24;i++) - { - addr = get_scat_addr(0x40000 + (i << 14), NULL); - mem_mapping_set_exec(&scat_4000_9FFF_mapping[i], addr < (mem_size << 10) ? ram + addr : NULL); - } - addr = get_scat_addr(0xA0000, NULL); - mem_mapping_set_exec(&scat_A000_BFFF_mapping, addr < (mem_size << 10) ? ram + addr : NULL); - for(i=0;i<6;i++) - { - addr = get_scat_addr(0x100000 + (i << 16), NULL); - mem_mapping_set_exec(&scat_shadowram_mapping[i], addr < (mem_size << 10) ? ram + addr : NULL); - } + case 9: + scat_xms_bound = 0xA00000; + break; - flushmmucache(); -} + case 10: + scat_xms_bound = 0xC00000; + break; + case 11: + scat_xms_bound = 0xE00000; + break; -void scat_set_global_EMS_state(int state) -{ - int i; - uint32_t base_addr, virt_addr; + default: + scat_xms_bound = max_xms; + break; + } - for(i=0; i<32; i++) - { - base_addr = (i + 16) << 14; - if(i >= 24) - base_addr += 0x30000; - if(state && (scat_stat[i].regs_2x9 & 0x80)) - { - virt_addr = get_scat_addr(base_addr, &scat_stat[i]); - if(i < 24) mem_mapping_disable(&scat_4000_9FFF_mapping[i]); - mem_mapping_enable(&scat_mapping[i]); - if(virt_addr < (mem_size << 10)) mem_mapping_set_exec(&scat_mapping[i], ram + virt_addr); - else mem_mapping_set_exec(&scat_mapping[i], NULL); - } - else - { - mem_mapping_set_exec(&scat_mapping[i], ram + base_addr); - mem_mapping_disable(&scat_mapping[i]); - if(i < 24) mem_mapping_enable(&scat_4000_9FFF_mapping[i]); - } - } -} + if ((val & 0x40) == 0 && (scat_regs[SCAT_DRAM_CONFIG] & 0x0f) == 3) { + if (val != 1) { + if (mem_size > 1024) + mem_mapping_disable(&ram_high_mapping); + for (i=0; i<6; i++) + mem_mapping_enable(&scat_shadowram_mapping[i]); + if ((val & 0x0f) == 0) + scat_xms_bound = 0x160000; + } else { + for (i=0; i<6; i++) + mem_mapping_disable(&scat_shadowram_mapping[i]); + if (mem_size > 1024) + mem_mapping_enable(&ram_high_mapping); + } + pclog("SCAT: set XMS bound(%02X) = %06X (%dK for EMS)\n", + val, scat_xms_bound, (0x160000-scat_xms_bound)>>10); - -void scat_write(uint16_t port, uint8_t val, void *priv) -{ - uint8_t scat_reg_valid = 0, scat_shadow_update = 0, scat_map_update = 0, index; - uint32_t base_addr, virt_addr; - - switch (port) - { - case 0x22: - scat_index = val; - break; - - case 0x23: - switch (scat_index) - { - case SCAT_CLOCK_CONTROL: - case SCAT_PERIPHERAL_CONTROL: - scat_reg_valid = 1; - break; - case SCAT_EMS_CONTROL: - if(val & 0x40) - { - if(val & 1) - { - io_sethandler(0x0218, 0x0003, scat_read, NULL, NULL, scat_write, NULL, NULL, NULL); - io_removehandler(0x0208, 0x0003, scat_read, NULL, NULL, scat_write, NULL, NULL, NULL); - } - else - { - io_sethandler(0x0208, 0x0003, scat_read, NULL, NULL, scat_write, NULL, NULL, NULL); - io_removehandler(0x0218, 0x0003, scat_read, NULL, NULL, scat_write, NULL, NULL, NULL); - } - } - else - { - io_removehandler(0x0208, 0x0003, scat_read, NULL, NULL, scat_write, NULL, NULL, NULL); - io_removehandler(0x0218, 0x0003, scat_read, NULL, NULL, scat_write, NULL, NULL, NULL); - } - scat_set_global_EMS_state(val & 0x80); - scat_reg_valid = 1; - break; - case SCAT_POWER_MANAGEMENT: - val &= 0x40; - scat_reg_valid = 1; - break; - case SCAT_DRAM_CONFIGURATION: - if((scat_regs[SCAT_EXTENDED_BOUNDARY] & 0x40) == 0) - { - if((val & 0x0F) == 3) - { - if(mem_size > 1024) mem_mapping_disable(&ram_high_mapping); - for(index=0;index<6;index++) - mem_mapping_enable(&scat_shadowram_mapping[index]); - } - else - { - for(index=0;index<6;index++) - mem_mapping_disable(&scat_shadowram_mapping[index]); - if(mem_size > 1024) mem_mapping_enable(&ram_high_mapping); - } - } - else - { - for(index=0;index<6;index++) - mem_mapping_disable(&scat_shadowram_mapping[index]); - if(mem_size > 1024) mem_mapping_enable(&ram_high_mapping); - } - scat_map_update = 1; - - cpu_waitstates = (val & 0x70) == 0 ? 1 : 2; - cpu_update_waitstates(); - - scat_reg_valid = 1; - break; - case SCAT_EXTENDED_BOUNDARY: - scat_set_xms_bound(val & 0x4f); - mem_set_mem_state(0x40000, 0x60000, (val & 0x20) ? MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL : MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); - if((val ^ scat_regs[SCAT_EXTENDED_BOUNDARY]) & 0x40) scat_map_update = 1; - scat_reg_valid = 1; - break; - case SCAT_ROM_ENABLE: - case SCAT_RAM_WRITE_PROTECT: - case SCAT_SHADOW_RAM_ENABLE_1: - case SCAT_SHADOW_RAM_ENABLE_2: - case SCAT_SHADOW_RAM_ENABLE_3: - scat_reg_valid = 1; - scat_shadow_update = 1; - break; - default: - break; - } - if (scat_reg_valid) - scat_regs[scat_index] = val; -#ifndef RELEASE_BUILD - else pclog("Attemped to write unimplemented SCAT register %02X at %04X:%04X\n", scat_index, val, CS, cpu_state.pc); + if (scat_xms_bound > 0x100000) + mem_set_mem_state(0x100000, + scat_xms_bound - 0x100000, + MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); + if (scat_xms_bound < 0x160000) + mem_set_mem_state(scat_xms_bound, + 0x160000 - scat_xms_bound, + MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL); + } else { +#if 0 + for (i=0; i<6; i++) + mem_mapping_disable(&scat_shadowram_mapping[i]); + if (mem_size > 1024) + mem_mapping_enable(&ram_high_mapping); #endif - if (scat_shadow_update) - scat_shadow_state_update(); - if (scat_map_update) - scat_memmap_state_update(); - break; - case 0x92: - if ((mem_a20_alt ^ val) & 2) - { - mem_a20_alt = val & 2; - mem_a20_recalc(); - } - if ((~scat_port_92 & val) & 1) - { - softresetx86(); - cpu_set_edx(); - } - scat_port_92 = val; - break; + if (scat_xms_bound > max_xms) + scat_xms_bound = max_xms; + pclog("SCAT: set XMS bound(%02X) = %06X (%dK for EMS)\n", + val, scat_xms_bound, (max_mem-scat_xms_bound)>>10); - case 0x208: - case 0x218: - if ((scat_regs[SCAT_EMS_CONTROL] & 0x41) == (0x40 | ((port & 0x10) >> 4))) - { - index = scat_ems_reg_2xA & 0x1F; - scat_stat[index].regs_2x8 = val; - base_addr = (index + 16) << 14; - if(index >= 24) - base_addr += 0x30000; - - if((scat_regs[SCAT_EMS_CONTROL] & 0x80) && (scat_stat[index].regs_2x9 & 0x80)) - { - virt_addr = get_scat_addr(base_addr, &scat_stat[index]); - if(virt_addr < (mem_size << 10)) mem_mapping_set_exec(&scat_mapping[index], ram + virt_addr); - else mem_mapping_set_exec(&scat_mapping[index], NULL); - flushmmucache(); - } - } - break; - case 0x209: - case 0x219: - if ((scat_regs[SCAT_EMS_CONTROL] & 0x41) == (0x40 | ((port & 0x10) >> 4))) - { - index = scat_ems_reg_2xA & 0x1F; - scat_stat[index].regs_2x9 = val; - base_addr = (index + 16) << 14; - if(index >= 24) - base_addr += 0x30000; - - if (scat_regs[SCAT_EMS_CONTROL] & 0x80) - { - if (val & 0x80) - { - virt_addr = get_scat_addr(base_addr, &scat_stat[index]); - if(index < 24) mem_mapping_disable(&scat_4000_9FFF_mapping[index]); - if(virt_addr < (mem_size << 10)) mem_mapping_set_exec(&scat_mapping[index], ram + virt_addr); - else mem_mapping_set_exec(&scat_mapping[index], NULL); - mem_mapping_enable(&scat_mapping[index]); - } - else - { - mem_mapping_set_exec(&scat_mapping[index], ram + base_addr); - mem_mapping_disable(&scat_mapping[index]); - if(index < 24) mem_mapping_enable(&scat_4000_9FFF_mapping[index]); - } - flushmmucache(); - } - - if (scat_ems_reg_2xA & 0x80) - { - scat_ems_reg_2xA = (scat_ems_reg_2xA & 0xe0) | ((scat_ems_reg_2xA + 1) & 0x1f); - } - } - break; - case 0x20A: - case 0x21A: - if ((scat_regs[SCAT_EMS_CONTROL] & 0x41) == (0x40 | ((port & 0x10) >> 4))) - { - scat_ems_reg_2xA = val; - } - break; - } + if (scat_xms_bound > 0x100000) + mem_set_mem_state(0x100000, + scat_xms_bound-0x100000, + MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); + if (scat_xms_bound < max_mem) + mem_set_mem_state(scat_xms_bound, + (mem_size<<10)-scat_xms_bound, + MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL); + } } -uint8_t scat_read(uint16_t port, void *priv) +static uint32_t +get_addr(uint32_t addr, ems_t *p) { - uint8_t val = 0xff, index; - switch (port) - { - case 0x23: - switch (scat_index) - { - case SCAT_MISCELLANEOUS_STATUS: - val = (scat_regs[scat_index] & 0xbf) | ((mem_a20_key & 2) << 5); - break; - case SCAT_DRAM_CONFIGURATION: - val = (scat_regs[scat_index] & 0x8f) | (cpu_waitstates == 1 ? 0 : 0x10); - break; - default: - val = scat_regs[scat_index]; - break; - } - break; + if (p && (scat_regs[SCAT_EMS_CTL] & 0x80) && (p->regs_2x9 & 0x80)) { + addr = (addr & 0x3fff) | (((p->regs_2x9 & 3)<<8) | p->regs_2x8)<<14; + } - case 0x92: - val = scat_port_92; - break; + if (mem_size < 2048 && + ((scat_regs[SCAT_DRAM_CONFIG] & 0x0F) > 7 || + (scat_regs[SCAT_EXT_BOUNDARY] & 0x40) != 0)) + addr = (addr & ~0x780000) | ((addr & 0x600000) >> 2); + else + if ((scat_regs[SCAT_DRAM_CONFIG] & 0x0F) < 8 && + (scat_regs[SCAT_EXT_BOUNDARY] & 0x40) == 0) { + addr &= ~0x600000; + if (mem_size > 2048 || (mem_size == 2048 && + (scat_regs[SCAT_DRAM_CONFIG] & 0x0F) < 6)) + addr |= (addr & 0x180000) << 2; + } - case 0x208: - case 0x218: - if ((scat_regs[SCAT_EMS_CONTROL] & 0x41) == (0x40 | ((port & 0x10) >> 4))) - { - index = scat_ems_reg_2xA & 0x1F; - val = scat_stat[index].regs_2x8; - } - break; - case 0x209: - case 0x219: - if ((scat_regs[SCAT_EMS_CONTROL] & 0x41) == (0x40 | ((port & 0x10) >> 4))) - { - index = scat_ems_reg_2xA & 0x1F; - val = scat_stat[index].regs_2x9; - } - break; - case 0x20A: - case 0x21A: - if ((scat_regs[SCAT_EMS_CONTROL] & 0x41) == (0x40 | ((port & 0x10) >> 4))) - { - val = scat_ems_reg_2xA; - } - break; - } - return val; + if ((scat_regs[SCAT_EXT_BOUNDARY] & 0x40) == 0 && + (scat_regs[SCAT_DRAM_CONFIG] & 0x0F) == 3 && + (addr & ~0x600000) >= 0x100000 && (addr & ~0x600000) < 0x160000) + addr ^= mem_size < 2048 ? 0x1F0000 : 0x670000; + + return(addr); } -uint8_t mem_read_scatems(uint32_t addr, void *priv) +static void +memmap_state_update(void) { - uint8_t val = 0xff; - scat_t *stat = (scat_t *)priv; + uint32_t addr; + int i; - addr = get_scat_addr(addr, stat); - if (addr < (mem_size << 10)) - val = mem_read_ram(addr, priv); + for (i=16; i<24; i++) { + addr = get_addr(0x40000 + (i<<14), NULL); + mem_mapping_set_exec(&scat_top_mapping[i], + addr < (mem_size<<10) ? ram+addr : NULL); + } - return val; + addr = get_addr(0xA0000, NULL); + mem_mapping_set_exec(&scat_A000_mapping, + addr < (mem_size<<10) ? ram+addr : NULL); + + for (i=0; i<6; i++) { + addr = get_addr(0x100000 + (i<<16), NULL); + mem_mapping_set_exec(&scat_shadowram_mapping[i], + addr < (mem_size<<10) ? ram+addr : NULL); + } + + flushmmucache(); } -void mem_write_scatems(uint32_t addr, uint8_t val, void *priv) +static void +ems_state(int state) { - scat_t *stat = (scat_t *)priv; + uint32_t base_addr, virt_addr; + int i; - addr = get_scat_addr(addr, stat); - if (addr < (mem_size << 10)) - mem_write_ram(addr, val, priv); + for (i=0; i<32; i++) { + base_addr = (i + 16) << 14; + + if (i >= 24) + base_addr += 0x30000; + + if (state && (scat_ems[i].regs_2x9 & 0x80)) { + virt_addr = get_addr(base_addr, &scat_ems[i]); + if (i < 24) + mem_mapping_disable(&scat_top_mapping[i]); + mem_mapping_enable(&scat_mapping[i]); + if (virt_addr < (mem_size<<10)) + mem_mapping_set_exec(&scat_mapping[i], ram+virt_addr); + else + mem_mapping_set_exec(&scat_mapping[i], NULL); + } else { + mem_mapping_set_exec(&scat_mapping[i], ram+base_addr); + mem_mapping_disable(&scat_mapping[i]); +#if 0 + if (i < 24) + mem_mapping_enable(&scat_top_mapping[i]); +#endif + } + } } -static void scat_init(void) +/* Read a byte from a LIM/EMS page. */ +static uint8_t +ems_pgrd(uint32_t vaddr, void *priv) { - int i; + ems_t *ems = (ems_t *)priv; + uint32_t addr; + uint8_t val = 0xff; - io_sethandler(0x0022, 0x0002, scat_read, NULL, NULL, scat_write, NULL, NULL, NULL); - io_sethandler(0x0092, 0x0001, scat_read, NULL, NULL, scat_write, NULL, NULL, NULL); + addr = get_addr(vaddr, ems); + if (addr < (mem_size << 10)) + val = mem_read_ram(addr, priv); +#if SCAT_DEBUG > 1 + pclog("SCAT: ems_pgrd(%06x->%06x) = %02x\n", vaddr, addr, val); +#endif - for (i = 0; i < 256; i++) - { - scat_regs[i] = 0xff; - } - - scat_regs[SCAT_DMA_WAIT_STATE_CONTROL] = 0; - scat_regs[SCAT_VERSION] = 10; - scat_regs[SCAT_CLOCK_CONTROL] = 2; - scat_regs[SCAT_PERIPHERAL_CONTROL] = 0x80; - scat_regs[SCAT_MISCELLANEOUS_STATUS] = 0x37; - scat_regs[SCAT_POWER_MANAGEMENT] = 0; - scat_regs[SCAT_ROM_ENABLE] = 0xC0; - scat_regs[SCAT_RAM_WRITE_PROTECT] = 0; - scat_regs[SCAT_SHADOW_RAM_ENABLE_1] = 0; - scat_regs[SCAT_SHADOW_RAM_ENABLE_2] = 0; - scat_regs[SCAT_SHADOW_RAM_ENABLE_3] = 0; - scat_regs[SCAT_DRAM_CONFIGURATION] = cpu_waitstates == 1 ? 2 : 0x12; - scat_regs[SCAT_EXTENDED_BOUNDARY] = 0; - scat_regs[SCAT_EMS_CONTROL] = 0; - scat_port_92 = 0; - - mem_mapping_set_addr(&ram_low_mapping, 0, 0x40000); - - for (i = 0; i < 24; i++) - { - mem_mapping_add(&scat_4000_9FFF_mapping[i], 0x40000 + (i << 14), 0x4000, mem_read_scatems, NULL, NULL, mem_write_scatems, NULL, NULL, mem_size > 256 + (i << 4) ? ram + 0x40000 + (i << 14) : NULL, MEM_MAPPING_INTERNAL, NULL); - mem_mapping_enable(&scat_4000_9FFF_mapping[i]); - } - - mem_mapping_add(&scat_A000_BFFF_mapping, 0xA0000, 0x20000, mem_read_scatems, NULL, NULL, mem_write_scatems, NULL, NULL, ram + 0xA0000, MEM_MAPPING_INTERNAL, NULL); - mem_mapping_enable(&scat_A000_BFFF_mapping); - - for (i = 0; i < 32; i++) - { - scat_stat[i].regs_2x8 = 0xff; - scat_stat[i].regs_2x9 = 0x03; - mem_mapping_add(&scat_mapping[i], (i + (i >= 24 ? 28 : 16)) << 14, 0x04000, mem_read_scatems, NULL, NULL, mem_write_scatems, NULL, NULL, ram + ((i + (i >= 24 ? 28 : 16)) << 14), 0, &scat_stat[i]); - mem_mapping_disable(&scat_mapping[i]); - } - - for(i=4;i<10;i++) isram[i] = 0; - - for (i = 12; i < 16; i++) - { - mem_mapping_add(&scat_high_mapping[i], (i << 14) + 0xFC0000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (i << 14), 0, NULL); - } - - for(i=0;i<6;i++) - mem_mapping_add(&scat_shadowram_mapping[i], 0x100000 + (i << 16), 0x10000, mem_read_scatems, NULL, NULL, mem_write_scatems, NULL, NULL, mem_size >= 1024 ? ram + get_scat_addr(0x100000 + (i << 16), NULL) : NULL, MEM_MAPPING_INTERNAL, NULL); - - scat_set_xms_bound(0); - scat_shadow_state_update(); + return(val); } -void machine_at_scat_init(void) +/* Write a byte to a LIM/EMS page. */ +static void +ems_pgwr(uint32_t vaddr, uint8_t val, void *priv) { - machine_at_init(); + ems_t *ems = (ems_t *)priv; + uint32_t addr; - scat_init(); + addr = get_addr(vaddr, ems); +#if SCAT_DEBUG > 1 + pclog("SCAT: ems_pgwr(%06x->%06x, %02x)\n", vaddr, addr, val); +#endif + if (addr < (mem_size << 10)) + mem_write_ram(addr, val, priv); +} + + +/* Read from a LIM/EMS control register. */ +static uint8_t +ems_read(uint16_t port, void *priv) +{ + uint8_t val = 0xff; + uint8_t idx; + + switch (port) { + case 0x208: + case 0x218: + if ((scat_regs[SCAT_EMS_CTL] & 0x41) == (0x40 | ((port & 0x10) >> 4))) { + idx = scat_ems_reg & 0x1f; + val = scat_ems[idx].regs_2x8; + } + break; + + case 0x209: + case 0x219: + if ((scat_regs[SCAT_EMS_CTL] & 0x41) == (0x40 | ((port & 0x10) >> 4))) { + idx = scat_ems_reg & 0x1f; + val = scat_ems[idx].regs_2x9; + } + break; + + case 0x20A: + case 0x21A: + if ((scat_regs[SCAT_EMS_CTL] & 0x41) == (0x40 | ((port & 0x10) >> 4))) { + val = scat_ems_reg; + } + break; + } + +#if SCAT_DEBUG > 2 + pclog("SCAT: ems_read(%04x) = %02x\n", port, val); +#endif + return(val); +} + + +/* Write to one of the LIM/EMS control registers. */ +static void +ems_write(uint16_t port, uint8_t val, void *priv) +{ + uint32_t base_addr, virt_addr; + uint8_t idx; + +#if SCAT_DEBUG > 1 + pclog("SCAT: ems_write(%04x, %02x)\n", port, val); +#endif + switch(port) { + case 0x208: + case 0x218: + if ((scat_regs[SCAT_EMS_CTL] & 0x41) == (0x40 | ((port & 0x10) >> 4))) { + idx = scat_ems_reg & 0x1f; + scat_ems[idx].regs_2x8 = val; + base_addr = (idx + 16) << 14; + if (idx >= 24) + base_addr += 0x30000; + + if ((scat_regs[SCAT_EMS_CTL] & 0x80) && (scat_ems[idx].regs_2x9 & 0x80)) { + virt_addr = get_addr(base_addr, &scat_ems[idx]); + if (virt_addr < (mem_size << 10)) + mem_mapping_set_exec(&scat_mapping[idx], ram + virt_addr); + else + mem_mapping_set_exec(&scat_mapping[idx], NULL); + flushmmucache(); + } + } + break; + + case 0x209: + case 0x219: + if ((scat_regs[SCAT_EMS_CTL] & 0x41) == (0x40 | ((port & 0x10) >> 4))) { + idx = scat_ems_reg & 0x1f; + scat_ems[idx].regs_2x9 = val; + base_addr = (idx + 16) << 14; + if (idx >= 24) + base_addr += 0x30000; + + if (scat_regs[SCAT_EMS_CTL] & 0x80) { + if (val & 0x80) { + virt_addr = get_addr(base_addr, &scat_ems[idx]); + if (idx < 24) + mem_mapping_disable(&scat_top_mapping[idx]); + if (virt_addr < (mem_size << 10)) + mem_mapping_set_exec(&scat_mapping[idx], ram+virt_addr); + else + mem_mapping_set_exec(&scat_mapping[idx], NULL); + mem_mapping_enable(&scat_mapping[idx]); + } else { + mem_mapping_set_exec(&scat_mapping[idx], ram + base_addr); + mem_mapping_disable(&scat_mapping[idx]); + if (idx < 24) + mem_mapping_enable(&scat_top_mapping[idx]); + } + flushmmucache(); + } + + if (scat_ems_reg & 0x80) { + scat_ems_reg = (scat_ems_reg & 0xe0) | ((scat_ems_reg + 1) & 0x1f); + } + } + break; + + case 0x20A: + case 0x21A: + if ((scat_regs[SCAT_EMS_CTL] & 0x41) == (0x40 | ((port & 0x10) >> 4))) { + scat_ems_reg = val; + } + break; + } +} + + +static uint8_t +scat_read(uint16_t port, void *priv) +{ + uint8_t val = 0xff; + + switch (port) { + case 0x23: + switch (scat_index) { + case SCAT_MISC_STATUS: + val = (scat_regs[scat_index] & 0xbf) | ((mem_a20_key & 2) << 5); + break; + + case SCAT_DRAM_CONFIG: + val = (scat_regs[scat_index] & 0x8f) | (cpu_waitstates == 1 ? 0 : 0x10); + break; + + default: + val = scat_regs[scat_index]; + break; + } + break; + + case 0x92: + val = scat_regs[SCAT_SYS_CTL]; + break; + + } + +#if SCAT_DEBUG > 2 + pclog("SCAT: read(%04x) = %02x\n", port, val); +#endif + return(val); +} + + +/* Write to one of the Internal Control Registers. */ +static void +ics_write(uint8_t idx, uint8_t val) +{ + uint8_t reg_valid = 0; + uint8_t shadow_update = 0; + uint8_t map_update = 0; + +#if SCAT_DEBUG > 1 + pclog("SCAT: icr_write(%02x, %02x)\n", idx, val); +#endif + switch (idx) { + case SCAT_CLOCK_CTL: + case SCAT_PERIPH_CTL: + reg_valid = 1; + break; + + case SCAT_EMS_CTL: +pclog("SCAT: EMSctrl(%02x)\n", val); + if (val & 0x40) { + if (val & 1) { + io_sethandler(0x0218, 3, + ems_read, NULL, NULL, + ems_write, NULL, NULL, NULL); + io_removehandler(0x0208, 3, + ems_read, NULL, NULL, + ems_write, NULL, NULL, NULL); + } else { + io_sethandler(0x0208, 3, + ems_read, NULL, NULL, + ems_write, NULL, NULL, NULL); + io_removehandler(0x0218, 3, + ems_read, NULL, NULL, + ems_write, NULL, NULL, NULL); + } + } else { + io_removehandler(0x0208, 3, + ems_read, NULL, NULL, + ems_write, NULL, NULL, NULL); + io_removehandler(0x0218, 3, + ems_read, NULL, NULL, + ems_write, NULL, NULL, NULL); + } + ems_state(val & 0x80); + reg_valid = 1; + break; + + case SCAT_POWER_MGMT: + val &= 0x40; + reg_valid = 1; + break; + + case SCAT_DRAM_CONFIG: + if ((scat_regs[SCAT_EXT_BOUNDARY] & 0x40) == 0) { +pclog("SCAT: 0\n"); + if ((val & 0x0f) == 3) { +pclog("SCAT: 3\n"); + if (mem_size > 1024) + mem_mapping_disable(&ram_high_mapping); + for (idx=0; idx<6; idx++) + mem_mapping_enable(&scat_shadowram_mapping[idx]); + } else { +pclog("SCAT: 0\n"); + for (idx=0; idx<6; idx++) + mem_mapping_disable(&scat_shadowram_mapping[idx]); +#if 0 + if (mem_size > 1024) + mem_mapping_enable(&ram_high_mapping); +#endif + } + } else { +pclog("SCAT: 1\n"); + for (idx=0; idx<6; idx++) + mem_mapping_disable(&scat_shadowram_mapping[idx]); + if (mem_size > 1024) + mem_mapping_enable(&ram_high_mapping); + } + map_update = 1; + + cpu_waitstates = (val & 0x70) == 0 ? 1 : 2; + cpu_update_waitstates(); + + reg_valid = 1; + break; + + case SCAT_EXT_BOUNDARY: + set_xms_bound(val & 0x4f); + mem_set_mem_state(0x40000, 0x60000, + (val & 0x20) ? MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL : MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); + if ((val ^ scat_regs[SCAT_EXT_BOUNDARY]) & 0x40) + map_update = 1; + reg_valid = 1; + break; + + case SCAT_ROM_ENABLE: + case SCAT_RAM_WR_PROTECT: + case SCAT_SHADOW_RAM_EN_1: + case SCAT_SHADOW_RAM_EN_2: + case SCAT_SHADOW_RAM_EN_3: + reg_valid = 1; + shadow_update = 1; + break; + + default: + break; + } + + if (reg_valid) + scat_regs[scat_index] = val; +#ifndef RELEASE_BUILD + else + pclog("SCAT: attemped write to register %02X at %04X:%04X\n", + idx, val, CS, cpu_state.pc); +#endif + + if (shadow_update) + shadow_state_update(); + + if (map_update) + memmap_state_update(); +} + + +static void +scat_write(uint16_t port, uint8_t val, void *priv) +{ +#if SCAT_DEBUG > 2 + pclog("SCAT: write(%04x, %02x)\n", port, val); +#endif + switch (port) { + case 0x22: + scat_index = val; + break; + + case 0x23: + ics_write(scat_index, val); + break; + + case 0x92: + if ((mem_a20_alt ^ val) & 2) { + mem_a20_alt = val & 2; + mem_a20_recalc(); + } + + if ((~scat_regs[SCAT_SYS_CTL] & val) & 1) { + softresetx86(); + cpu_set_edx(); + } + scat_regs[SCAT_SYS_CTL] = val; + break; + } +} + + +static void +scat_init(void) +{ + int i; + +#if SCAT_DEBUG + pclog("SCAT: initializing..\n"); +#endif + io_sethandler(0x0022, 2, + scat_read, NULL, NULL, scat_write, NULL, NULL, NULL); + io_sethandler(0x0092, 1, + scat_read, NULL, NULL, scat_write, NULL, NULL, NULL); + + for (i=0; i<128; i++) + scat_regs[i] = 0xff; + scat_regs[SCAT_DMA_WS_CTL] = 0x00; + scat_regs[SCAT_VERSION] = 0x0a; + scat_regs[SCAT_CLOCK_CTL] = 0x02; + scat_regs[SCAT_PERIPH_CTL] = 0x80; + scat_regs[SCAT_MISC_STATUS] = 0x37; + scat_regs[SCAT_POWER_MGMT] = 0x00; + scat_regs[SCAT_ROM_ENABLE] = 0xC0; + scat_regs[SCAT_RAM_WR_PROTECT] = 0x00; + scat_regs[SCAT_SHADOW_RAM_EN_1] = 0x00; + scat_regs[SCAT_SHADOW_RAM_EN_2] = 0x00; + scat_regs[SCAT_SHADOW_RAM_EN_3] = 0x00; + scat_regs[SCAT_DRAM_CONFIG] = cpu_waitstates == 1 ? 0x00 : 0x10; + scat_regs[SCAT_EXT_BOUNDARY] = 0x00; + scat_regs[SCAT_EMS_CTL] = 0x00; + scat_regs[SCAT_SYS_CTL] = 0x00; + + /* Limit RAM size to 16MB. */ + mem_mapping_set_addr(&ram_low_mapping, 0x000000, 0x40000); + + /* + * Configure the DRAM controller. + * + * Since SCAT allows mixing of the various-sized DRAM chips, + * memory configuration is not simple. The SCAT datasheet + * tells us in table 6-6 how to set up the four banks: + * + * MEM SIZE MIX_EN RAMCFG Ext RAM Comments + * 0 K 0 0x00 No RAM installed + * 512 K 0 0x01 0 K + * 640 K 0 0x02 0 K + * 1 M 0 0x03 384K + * 1 M 0 0x04 0 K + * 1.5 M 0 0x05 512K + * 2 M 0 0x06 1 M 4x512K + * 2 M 0 0x08 1 M 1x2M + * 2.5 M 1 0x01 1.5M 2M+512K + * 3 M 1 0x04 2 M 1x2M + * 4 M 0 0x09 3 M 2x2M + * 4.5 M 1 0x02 3.5M 2x2M+512K + * 5 M 1 0x05 4 M 2x2M+2x512K + * 6 M 0 0x0a 5 M 3x2M + * 6.5 M 1 0x03 5.5M 3x2M+512K + * 8 M 0 0x0b 7 M 4x2M + */ + pclog("SCAT: mem_size=%d\n", mem_size); + + +#if 0 + /* Create the 32 EMS page frame mappings for 256-640K. */ + for (i=0; i<24; i++) { + mem_mapping_add(&scat_top_mapping[i], + 0x40000 + (i<<14), 0x4000, + ems_pgrd, NULL, NULL, + ems_pgwr, NULL, NULL, + mem_size > 256+(i<<4) ? ram+0x40000+(i<<14) : NULL, + MEM_MAPPING_INTERNAL, NULL); +// mem_mapping_enable(&scat_top_mapping[i]); + mem_mapping_disable(&scat_top_mapping[i]); + } +#endif + +#if 0 + /* Re-map the 128K at A0000 (video BIOS) to above 16MB+top. */ + mem_mapping_add(&scat_A000_mapping, + 0xA0000, 0x20000, + ems_pgrd, NULL, NULL, + ems_pgwr, NULL, NULL, + ram+0xA0000, + MEM_MAPPING_INTERNAL, NULL); + mem_mapping_disable(&scat_A000_mapping); +#endif + +#if 0 + /* Create 32 page frames for EMS, each 16K. */ + for (i=0; i<32; i++) { + scat_ems[i].regs_2x8 = 0xff; + scat_ems[i].regs_2x9 = 0x03; + mem_mapping_add(&scat_mapping[i], + (i + (i >= 24 ? 28 : 16)) << 14, 0x04000, + ems_pgrd, NULL, NULL, + ems_pgwr, NULL, NULL, + ram + ((i + (i >= 24 ? 28 : 16)) << 14), + 0, &scat_ems[i]); + mem_mapping_disable(&scat_mapping[i]); + } +#endif + +// for (i=4; i<10; i++) isram[i] = 0; + + /* Re-map the BIOS ROM (C0000-FFFFF) area. */ + for (i=12; i<16; i++) { + mem_mapping_add(&scat_high_mapping[i], + (i<<14) + 0xFC0000, 0x04000, + mem_read_bios, mem_read_biosw, mem_read_biosl, + mem_write_null, mem_write_nullw, mem_write_nulll, + rom+(i<<14), + 0, NULL); + } + +#if 0 + for (i=0; i<6; i++) { + mem_mapping_add(&scat_shadowram_mapping[i], + 0x100000 + (i<<16), 0x10000, + ems_pgrd, NULL, NULL, + ems_pgwr, NULL, NULL, + mem_size >= 1024 ? ram+get_addr(0x100000+(i<<16), NULL) : NULL, + MEM_MAPPING_INTERNAL, NULL); + } +#endif + + set_xms_bound(0); + shadow_state_update(); +} + + +void +machine_at_scat_init(void) +{ + machine_at_init(); + + scat_init(); } diff --git a/src/machine/machine_at_sis_85c471.c b/src/machine/machine_at_sis_85c471.c index 399c46b04..cde72f6d6 100644 --- a/src/machine/machine_at_sis_85c471.c +++ b/src/machine/machine_at_sis_85c471.c @@ -9,11 +9,15 @@ * SiS sis85c471 Super I/O Chip * Used by DTK PKM-0038S E-2 * - * Version: @(#)sis85c471.c 1.0.4 2017/09/03 + * Version: @(#)sis85c471.c 1.0.5 2017/09/24 * * Author: Miran Grca, * Copyright 2017 Miran Grca. */ +#include +#include +#include +#include #include "../ibm.h" #include "../io.h" #include "../memregs.h" diff --git a/src/machine/machine_at_sis_85c496.c b/src/machine/machine_at_sis_85c496.c index 7e3640c22..56cb59b2f 100644 --- a/src/machine/machine_at_sis_85c496.c +++ b/src/machine/machine_at_sis_85c496.c @@ -1,7 +1,11 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ +#include +#include +#include #include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../io.h" diff --git a/src/machine/machine_at_sis_85c50x.c b/src/machine/machine_at_sis_85c50x.c index 4d17558c4..8c94f540b 100644 --- a/src/machine/machine_at_sis_85c50x.c +++ b/src/machine/machine_at_sis_85c50x.c @@ -6,12 +6,16 @@ * * Emulation of the SiS 50x PCI chips. * - * Version: @(#)machine_at_sis_85c50x.c 1.0.2 2017/09/02 + * Version: @(#)machine_at_sis_85c50x.c 1.0.3 2017/09/24 * * Author: Miran Grca, * Copyright 2017 Miran Grca. */ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../pci.h" diff --git a/src/machine/machine_at_wd76c10.c b/src/machine/machine_at_wd76c10.c index 430d7c8b7..ab6f7dcd7 100644 --- a/src/machine/machine_at_wd76c10.c +++ b/src/machine/machine_at_wd76c10.c @@ -1,6 +1,10 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ +#include +#include +#include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/machine/machine_common.c b/src/machine/machine_common.c index 23ed67310..480e669d3 100644 --- a/src/machine/machine_common.c +++ b/src/machine/machine_common.c @@ -1,3 +1,7 @@ +#include +#include +#include +#include #include "../ibm.h" #include "../dma.h" #include "../pic.h" diff --git a/src/machine/machine_europc.c b/src/machine/machine_europc.c index 5cd8daa4e..0f69cb93d 100644 --- a/src/machine/machine_europc.c +++ b/src/machine/machine_europc.c @@ -2,7 +2,9 @@ see COPYING for more details */ #include +#include #include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../io.h" @@ -10,6 +12,7 @@ #include "../mem.h" #include "../rom.h" #include "../device.h" +#include "../nvr.h" #include "../gameport.h" #include "../keyboard_xt.h" #include "../lpt.h" diff --git a/src/machine/machine_olivetti_m24.c b/src/machine/machine_olivetti_m24.c index de2b301c9..8818b2af4 100644 --- a/src/machine/machine_olivetti_m24.c +++ b/src/machine/machine_olivetti_m24.c @@ -1,6 +1,10 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ +#include +#include +#include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../io.h" diff --git a/src/machine/machine_pcjr.c b/src/machine/machine_pcjr.c index ba65cc113..3eb1e4545 100644 --- a/src/machine/machine_pcjr.c +++ b/src/machine/machine_pcjr.c @@ -1,3 +1,7 @@ +#include +#include +#include +#include #include "../ibm.h" #include "../nmi.h" #include "../pic.h" diff --git a/src/machine/machine_ps1.c b/src/machine/machine_ps1.c index 0fb45f05a..f0f95f98f 100644 --- a/src/machine/machine_ps1.c +++ b/src/machine/machine_ps1.c @@ -1,6 +1,10 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ +#include +#include +#include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../io.h" @@ -149,7 +153,8 @@ void ps1mb_init(void) io_sethandler(0x0320, 0x0001, ps1_read, NULL, NULL, ps1_write, NULL, NULL, NULL); io_sethandler(0x0322, 0x0001, ps1_read, NULL, NULL, ps1_write, NULL, NULL, NULL); io_sethandler(0x0324, 0x0001, ps1_read, NULL, NULL, ps1_write, NULL, NULL, NULL); - + +#if 0 if (!enable_xtide) { rom_init(&ps1_high_rom, @@ -160,14 +165,7 @@ void ps1mb_init(void) 0, MEM_MAPPING_EXTERNAL); } -/* rom_init_interleaved(&ps1_high_rom, - L"roms/machines/ibmps1es/ibm_1057757_24-05-90.bin", - L"roms/machines/ibmps1es/ibm_1057757_29-15-90.bin", - 0xfc0000, - 0x40000, - 0x3ffff, - 0, - MEM_MAPPING_EXTERNAL);*/ +#endif ps1_190 = 0; lpt1_remove(); diff --git a/src/machine/machine_ps2_isa.c b/src/machine/machine_ps2_isa.c index 3521570b3..01ea160bd 100644 --- a/src/machine/machine_ps2_isa.c +++ b/src/machine/machine_ps2_isa.c @@ -1,3 +1,7 @@ +#include +#include +#include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../io.h" diff --git a/src/machine/machine_ps2_mca.c b/src/machine/machine_ps2_mca.c index 36336570e..d546efa5d 100644 --- a/src/machine/machine_ps2_mca.c +++ b/src/machine/machine_ps2_mca.c @@ -1,3 +1,7 @@ +#include +#include +#include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../cpu/x86.h" diff --git a/src/machine/machine_tandy.c b/src/machine/machine_tandy.c index 2690089db..a9eed1c03 100644 --- a/src/machine/machine_tandy.c +++ b/src/machine/machine_tandy.c @@ -1,6 +1,11 @@ +#include +#include +#include +#include #include "../ibm.h" #include "../nmi.h" #include "../mem.h" +#include "../rom.h" #include "../device.h" #include "../gameport.h" #include "../keyboard_xt.h" diff --git a/src/machine/machine_xt.c b/src/machine/machine_xt.c index 6933069af..9cf724174 100644 --- a/src/machine/machine_xt.c +++ b/src/machine/machine_xt.c @@ -1,3 +1,7 @@ +#include +#include +#include +#include #include "../ibm.h" #include "../nmi.h" #include "../pit.h" diff --git a/src/machine/machine_xt_laserxt.c b/src/machine/machine_xt_laserxt.c index ab08e9e67..564f0f4c0 100644 --- a/src/machine/machine_xt_laserxt.c +++ b/src/machine/machine_xt_laserxt.c @@ -1,4 +1,8 @@ /*This is the chipset used in the LaserXT series model*/ +#include +#include +#include +#include #include "../ibm.h" #include "../cpu/cpu.h" #include "../io.h" diff --git a/src/mca.c b/src/mca.c index 878b6f53d..65dcd9eda 100644 --- a/src/mca.c +++ b/src/mca.c @@ -1,3 +1,7 @@ +#include +#include +#include +#include #include "ibm.h" #include "io.h" #include "mem.h" diff --git a/src/mcr.c b/src/mcr.c index 1638afa1a..bdde8e27e 100644 --- a/src/mcr.c +++ b/src/mcr.c @@ -1,6 +1,10 @@ /*INTEL 82355 MCR emulation This chip was used as part of many 386 chipsets It controls memory addressing and shadowing*/ +#include +#include +#include +#include #include "ibm.h" diff --git a/src/mem.c b/src/mem.c index d19a70a52..bb7778fc2 100644 --- a/src/mem.c +++ b/src/mem.c @@ -1,14 +1,11 @@ /* Copyright holders: Sarah Walker, Tenshi see COPYING for more details */ -/*MESS ROM notes : - - - pc2386 BIOS is corrupt (JMP at F000:FFF0 points to RAM) - - pc2386 video BIOS is underdumped (16k instead of 24k) - - c386sx16 BIOS fails checksum -*/ -#include +#include +#include #include +#include +#include #include "ibm.h" #include "cpu/cpu.h" #include "cpu/x86_ops.h" @@ -18,12 +15,8 @@ #include "mem.h" #include "rom.h" #include "cpu/codegen.h" -#include "video/video.h" -page_t *pages; -page_t **page_lookup; - static uint8_t (*_mem_read_b[0x40000])(uint32_t addr, void *priv); static uint16_t (*_mem_read_w[0x40000])(uint32_t addr, void *priv); static uint32_t (*_mem_read_l[0x40000])(uint32_t addr, void *priv); @@ -38,14 +31,17 @@ static mem_mapping_t *_mem_mapping_w[0x40000]; static int _mem_state[0x40000]; static mem_mapping_t base_mapping; +static mem_mapping_t ram_remapped_mapping; mem_mapping_t ram_low_mapping; mem_mapping_t ram_high_mapping; mem_mapping_t ram_mid_mapping; -static mem_mapping_t ram_remapped_mapping; mem_mapping_t bios_mapping[8]; mem_mapping_t bios_high_mapping[8]; mem_mapping_t romext_mapping; +page_t *pages; +page_t **page_lookup; + uint8_t *ram; uint32_t rammask; @@ -67,8 +63,6 @@ unsigned char isram[0x10000]; static uint8_t ff_array[0x1000]; -int enable_xtide = 0; - int mem_size; uint32_t biosmask; int readlnum=0,writelnum=0; @@ -79,802 +73,8 @@ uint8_t romext[32768]; uint32_t ram_mapped_addr[64]; -static void mem_load_atide115_bios() -{ - FILE *f; - f=romfopen(L"roms/hdd/xtide/ide_at_1_1_5.bin",L"rb"); - if (f) - { - fread(romext,16384,1,f); - mem_mapping_enable(&romext_mapping); - fclose(f); - } -} - -int loadbios() -{ - FILE *f=NULL,*ff=NULL; - int c; - - loadfont(L"roms/video/mda/mda.rom", 0); - loadfont(L"roms/video/wyse700/wy700.rom", 3); - - biosmask = 0xffff; - - if (!rom) - rom = malloc(0x20000); - memset(romext,0xff,0x8000); - memset(rom, 0xff, 0x20000); - - pclog("Starting with romset %i\n", romset); - - mem_mapping_disable(&romext_mapping); - - switch (romset) - { - case ROM_PC1512: - f=romfopen(L"roms/machines/pc1512/40043.v1",L"rb"); - ff=romfopen(L"roms/machines/pc1512/40044.v1",L"rb"); - if (!f || !ff) break; - for (c=0xC000;c<0x10000;c+=2) - { - rom[c]=getc(f); - rom[c+1]=getc(ff); - } - fclose(ff); - fclose(f); - loadfont(L"roms/machines/pc1512/40078.ic127", 2); - return 1; - case ROM_PC1640: - f=romfopen(L"roms/machines/pc1640/40044.v3",L"rb"); - ff=romfopen(L"roms/machines/pc1640/40043.v3",L"rb"); - if (!f || !ff) break; - for (c=0xC000;c<0x10000;c+=2) - { - rom[c]=getc(f); - rom[c+1]=getc(ff); - } - fclose(ff); - fclose(f); - f=romfopen(L"roms/machines/pc1640/40100",L"rb"); - if (!f) break; - fclose(f); - return 1; - case ROM_PC200: - f=romfopen(L"roms/machines/pc200/pc20v2.1",L"rb"); - ff=romfopen(L"roms/machines/pc200/pc20v2.0",L"rb"); - if (!f || !ff) break; - for (c=0xC000;c<0x10000;c+=2) - { - rom[c]=getc(f); - rom[c+1]=getc(ff); - } - fclose(ff); - fclose(f); - loadfont(L"roms/machines/pc200/40109.bin", 1); - return 1; - case ROM_TANDY: - f=romfopen(L"roms/machines/tandy/tandy1t1.020",L"rb"); - if (!f) break; - fread(rom,65536,1,f); - fclose(f); - return 1; - case ROM_TANDY1000HX: - f = romfopen(L"roms/machines/tandy1000hx/v020000.u12", L"rb"); - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - case ROM_TANDY1000SL2: - f = romfopen(L"roms/machines/tandy1000sl2/8079047.hu1" ,L"rb"); - ff = romfopen(L"roms/machines/tandy1000sl2/8079048.hu2",L"rb"); - if (!f || !ff) break; - fseek(f, 0x30000/2, SEEK_SET); - fseek(ff, 0x30000/2, SEEK_SET); - for (c = 0x0000; c < 0x10000; c += 2) - { - rom[c] = getc(f); - rom[c + 1] = getc(ff); - } - fclose(ff); - fclose(f); - return 1; - case ROM_IBMXT: - f=romfopen(L"roms/machines/ibmxt/xt.rom",L"rb"); - if (!f) - { - f = romfopen(L"roms/machines/ibmxt/5000027.u19", L"rb"); - ff = romfopen(L"roms/machines/ibmxt/1501512.u18", L"rb"); - if (!f || !ff) break; - fread(rom, 0x8000, 1, f); - fread(rom + 0x8000, 0x8000, 1, ff); - fclose(ff); - fclose(f); - return 1; - } - else - { - fread(rom,65536,1,f); - fclose(f); - return 1; - } - break; - - case ROM_IBMPCJR: - f = romfopen(L"roms/machines/ibmpcjr/bios.rom", L"rb"); - if (!f) break; - fread(rom, 0x10000, 1, f); - fclose(f); - return 1; - - case ROM_PORTABLE: - f=romfopen(L"roms/machines/portable/Compaq Portable Plus 100666-001 Rev C u47.bin",L"rb"); - if (!f) break; - fread(rom+0xE000,8192,1,f); - fclose(f); - return 1; - -#if 0 - case ROM_PORTABLEII: - f = romfopen(L"roms/machines/portableii/106438-001.BIN", L"rb"); - ff =romfopen(L"roms/machines/portableii/106437-001.BIN", L"rb"); - if (!f || !ff) break; - for (c=0x0000;c<0x8000;c+=2) - { - rom[c]=getc(f); - rom[c+1]=getc(ff); - } - fclose(ff); - fclose(f); - biosmask = 0x7fff; - return 1; - - case ROM_PORTABLEIII: - case ROM_PORTABLEIII386: - f = romfopen(L"roms/machines/portableiii/109738-002.BIN", L"rb"); - ff =romfopen(L"roms/machines/portableiii/109737-002.BIN", L"rb"); - if (!f || !ff) break; - for (c=0x0000;c<0x10000;c+=2) - { - rom[c]=getc(f); - rom[c+1]=getc(ff); - } - fclose(ff); - fclose(f); - return 1; -#endif - - case ROM_GENXT: - f=romfopen(L"roms/machines/genxt/pcxt.rom",L"rb"); - if (!f) break; - fread(rom+0xE000,8192,1,f); - fclose(f); - return 1; - case ROM_DTKXT: - f=romfopen(L"roms/machines/dtk/DTK_ERSO_2.42_2764.bin",L"rb"); - if (!f) break; - fread(rom+0xE000,8192,1,f); - fclose(f); - return 1; - case ROM_OLIM24: - f = romfopen(L"roms/machines/olivetti_m24/olivetti_m24_version_1.43_low.bin" ,L"rb"); - ff = romfopen(L"roms/machines/olivetti_m24/olivetti_m24_version_1.43_high.bin",L"rb"); - if (!f || !ff) break; - for (c = 0x0000; c < 0x4000; c += 2) - { - rom[c + 0xc000] = getc(f); - rom[c + 0xc001] = getc(ff); - } - fclose(ff); - fclose(f); - return 1; - - case ROM_PC2086: - f = romfopen(L"roms/machines/pc2086/40179.ic129" ,L"rb"); - ff = romfopen(L"roms/machines/pc2086/40180.ic132",L"rb"); - if (!f || !ff) break; - pclog("Loading BIOS\n"); - for (c = 0x0000; c < 0x4000; c += 2) - { - rom[c + 0x0000] = getc(f); - rom[c + 0x0001] = getc(ff); - } - pclog("%02X %02X %02X\n", rom[0xfff0], rom[0xfff1], rom[0xfff2]); - fclose(ff); - fclose(f); - f = romfopen(L"roms/machines/pc2086/40186.ic171", L"rb"); - if (!f) break; - fclose(f); - biosmask = 0x3fff; - return 1; - - case ROM_PC3086: - f = romfopen(L"roms/machines/pc3086/fc00.bin", L"rb"); - if (!f) break; - fread(rom, 0x4000, 1, f); - fclose(f); - f = romfopen(L"roms/machines/pc3086/c000.bin", L"rb"); - if (!f) break; - fclose(f); - biosmask = 0x3fff; - return 1; - - case ROM_IBMAT: - f = romfopen(L"roms/machines/ibmat/62x0820.u27", L"rb"); - ff =romfopen(L"roms/machines/ibmat/62x0821.u47", L"rb"); - if (!f || !ff) break; - for (c=0x0000;c<0x10000;c+=2) - { - rom[c]=getc(f); - rom[c+1]=getc(ff); - } - fclose(ff); - fclose(f); - return 1; - - case ROM_CMDPC30: - f = romfopen(L"roms/machines/cmdpc30/commodore pc 30 iii even.bin", L"rb"); - ff = romfopen(L"roms/machines/cmdpc30/commodore pc 30 iii odd.bin", L"rb"); - if (!f || !ff) break; - for (c = 0x0000; c < 0x8000; c += 2) - { - rom[c] = getc(f); - rom[c + 1] = getc(ff); - } - fclose(ff); - fclose(f); - biosmask = 0x7fff; - return 1; - - case ROM_AMI386SX: - f=romfopen(L"roms/machines/ami386/ami386.bin",L"rb"); - if (!f) break; - fread(rom,65536,1,f); - fclose(f); - return 1; - - case ROM_AMI386DX_OPTI495: /*This uses the OPTi 82C495 chipset*/ - f=romfopen(L"roms/machines/ami386dx/OPT495SX.AMI",L"rb"); - if (!f) break; - fread(rom,65536,1,f); - fclose(f); - return 1; - case ROM_MR386DX_OPTI495: /*This uses the OPTi 82C495 chipset*/ - f=romfopen(L"roms/machines/mr386dx/OPT495SX.MR",L"rb"); - if (!f) break; - fread(rom,65536,1,f); - fclose(f); - return 1; - - case ROM_AWARD386SX_OPTI495: /*This uses the OPTi 82C495 chipset*/ - case ROM_AWARD386DX_OPTI495: /*This uses the OPTi 82C495 chipset*/ - case ROM_AWARD486_OPTI495: /*This uses the OPTi 82C495 chipset*/ - f=romfopen(L"roms/machines/award495/OPT495S.AWA",L"rb"); - if (!f) break; - fread(rom,65536,1,f); - fclose(f); - return 1; - - case ROM_AMI286: - f=romfopen(L"roms/machines/ami286/amic206.bin",L"rb"); - if (!f) break; - fread(rom,65536,1,f); - fclose(f); - return 1; - - case ROM_AWARD286: - f=romfopen(L"roms/machines/award286/award.bin",L"rb"); - if (!f) break; - fread(rom,65536,1,f); - fclose(f); - return 1; - - case ROM_EUROPC: - f=romfopen(L"roms/machines/europc/50145",L"rb"); - if (!f) break; - fread(rom+0x8000,32768,1,f); - fclose(f); - return 1; - - case ROM_IBMPC: - f=romfopen(L"roms/machines/ibmpc/pc102782.bin",L"rb"); - if (!f) break; - fread(rom+0xE000,8192,1,f); - fclose(f); - f=romfopen(L"roms/ibmpc/ibm-basic-1.10.rom",L"rb"); - if (!f) - { - f=romfopen(L"roms/machines/ibmpc/basicc11.f6",L"rb"); - if (!f) return 1; /*I don't really care if BASIC is there or not*/ - fread(rom+0x6000,8192,1,f); - fclose(f); - f=romfopen(L"roms/machines/ibmpc/basicc11.f8",L"rb"); - if (!f) break; /*But if some of it is there, then all of it must be*/ - fread(rom+0x8000,8192,1,f); - fclose(f); - f=romfopen(L"roms/machines/ibmpc/basicc11.fa",L"rb"); - if (!f) break; - fread(rom+0xA000,8192,1,f); - fclose(f); - f=romfopen(L"roms/machines/ibmpc/basicc11.fc",L"rb"); - if (!f) break; - fread(rom+0xC000,8192,1,f); - fclose(f); - } - else - { - fread(rom+0x6000,32768,1,f); - fclose(f); - } - - return 1; - - case ROM_MEGAPC: - case ROM_MEGAPCDX: - f = romfopen(L"roms/machines/megapc/41651-bios lo.u18", L"rb"); - ff = romfopen(L"roms/machines/megapc/211253-bios hi.u19", L"rb"); - if (!f || !ff) break; - fseek(f, 0x8000, SEEK_SET); - fseek(ff, 0x8000, SEEK_SET); - for (c = 0x0000; c < 0x10000; c+=2) - { - rom[c]=getc(f); - rom[c+1]=getc(ff); - } - fclose(ff); - fclose(f); - return 1; - - case ROM_AMI486: - f=romfopen(L"roms/machines/ami486/ami486.BIN",L"rb"); - if (!f) break; - fread(rom,65536,1,f); - fclose(f); - return 1; - - case ROM_WIN486: - f=romfopen(L"roms/machines/win486/ALI1429G.AMW",L"rb"); - if (!f) break; - fread(rom,65536,1,f); - fclose(f); - return 1; - - case ROM_430VX: - f = romfopen(L"roms/machines/430vx/55XWUQ0E.BIN", L"rb"); - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_REVENGE: - f = romfopen(L"roms/machines/revenge/1009AF2_.BIO", L"rb"); - if (!f) break; - fseek(f, 0x80, SEEK_SET); - fread(rom + 0x10000, 0x10000, 1, f); - fclose(f); - f = romfopen(L"roms/machines/revenge/1009AF2_.BI1", L"rb"); - if (!f) break; - fseek(f, 0x80, SEEK_SET); - fread(rom, 0xc000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - case ROM_ENDEAVOR: - f = romfopen(L"roms/machines/endeavor/1006CB0_.BIO", L"rb"); - if (!f) break; - fseek(f, 0x80, SEEK_SET); - fread(rom + 0x10000, 0x10000, 1, f); - fclose(f); - f = romfopen(L"roms/machines/endeavor/1006CB0_.BI1", L"rb"); - if (!f) break; - fseek(f, 0x80, SEEK_SET); - fread(rom, 0xd000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_IBMPS1_2011: - f = romfopen(L"roms/machines/ibmps1es/f80000.bin", L"rb"); - if (!f) break; - fseek(f, 0x60000, SEEK_SET); - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_IBMPS1_2121: - case ROM_IBMPS1_2121_ISA: - f = romfopen(L"roms/machines/ibmps1_2121/fc0000.bin", L"rb"); - if (!f) break; - fseek(f, 0x20000, SEEK_SET); - fread(rom, 0x20000, 1, f); - fclose(f); - if (enable_xtide) - { - mem_load_atide115_bios(); - } - biosmask = 0x1ffff; - return 1; - - case ROM_IBMPS1_2133: - f = romfopen(L"roms/machines/ibmps1_2133/PS1_2133_52G2974_ROM.bin", L"rb"); - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_DESKPRO_386: - f=romfopen(L"roms/machines/deskpro386/109592-005.U11.bin",L"rb"); - ff=romfopen(L"roms/machines/deskpro386/109591-005.U13.bin",L"rb"); - if (!f || !ff) break; - for (c = 0x0000; c < 0x8000; c += 2) - { - rom[c] = getc(f); - rom[c+1] = getc(ff); - } - fclose(ff); - fclose(f); - biosmask = 0x7fff; - return 1; - - case ROM_AMIXT: - f = romfopen(L"roms/machines/amixt/AMI_8088_BIOS_31JAN89.BIN", L"rb"); - if (!f) break; - fread(rom + 0xE000, 8192, 1, f); - fclose(f); - return 1; - - case ROM_LTXT: - f = romfopen(L"roms/machines/ltxt/27C64.bin", L"rb"); - if (!f) break; - fread(rom + 0xE000, 8192, 1, f); - fclose(f); - f=romfopen(L"roms/ltxt/ibm-basic-1.10.rom",L"rb"); - if (!f) - { - f=romfopen(L"roms/machines/ltxt/basicc11.f6",L"rb"); - if (!f) return 1; /*I don't really care if BASIC is there or not*/ - fread(rom+0x6000,8192,1,f); - fclose(f); - f=romfopen(L"roms/machines/ltxt/basicc11.f8",L"rb"); - if (!f) break; /*But if some of it is there, then all of it must be*/ - fread(rom+0x8000,8192,1,f); - fclose(f); - f=romfopen(L"roms/machines/ltxt/basicc11.fa",L"rb"); - if (!f) break; - fread(rom+0xA000,8192,1,f); - fclose(f); - f=romfopen(L"roms/machines/ltxt/basicc11.fc",L"rb"); - if (!f) break; - fread(rom+0xC000,8192,1,f); - fclose(f); - } - else - { - fread(rom+0x6000,32768,1,f); - fclose(f); - } - - return 1; - - case ROM_LXT3: - f = romfopen(L"roms/machines/lxt3/27C64D.bin", L"rb"); - if (!f) break; - fread(rom + 0xE000, 8192, 1, f); - fclose(f); - f=romfopen(L"roms/machines/lxt3/ibm-basic-1.10.rom",L"rb"); - if (!f) - { - f=romfopen(L"roms/machines/lxt3/basicc11.f6",L"rb"); - if (!f) return 1; /*I don't really care if BASIC is there or not*/ - fread(rom+0x6000,8192,1,f); - fclose(f); - f=romfopen(L"roms/machines/lxt3/basicc11.f8",L"rb"); - if (!f) break; /*But if some of it is there, then all of it must be*/ - fread(rom+0x8000,8192,1,f); - fclose(f); - f=romfopen(L"roms/machines/lxt3/basicc11.fa",L"rb"); - if (!f) break; - fread(rom+0xA000,8192,1,f); - fclose(f); - f=romfopen(L"roms/machines/lxt3/basicc11.fc",L"rb"); - if (!f) break; - fread(rom+0xC000,8192,1,f); - fclose(f); - } - else - { - fread(rom+0x6000,32768,1,f); - fclose(f); - } - - return 1; - - case ROM_SPC4200P: /*Samsung SPC-4200P*/ - f = romfopen(L"roms/machines/spc4200p/U8.01", L"rb"); - if (!f) break; - fread(rom, 65536, 1, f); - fclose(f); - return 1; - - case ROM_SUPER286TR: /*Hyundai Super-286TR*/ - f = romfopen(L"roms/machines/super286tr/hyundai_award286.bin", L"rb"); - if (!f) break; - fread(rom, 65536, 1, f); - fclose(f); - return 1; - - case ROM_DTK386: /*Uses NEAT chipset*/ - f = romfopen(L"roms/machines/dtk386/3cto001.bin", L"rb"); - if (!f) break; - fread(rom, 65536, 1, f); - fclose(f); - return 1; - - case ROM_PXXT: - f = romfopen(L"roms/machines/pxxt/000p001.bin", L"rb"); - if (!f) break; - fread(rom + 0xE000, 8192, 1, f); - fclose(f); - return 1; - - case ROM_JUKOPC: - f = romfopen(L"roms/machines/jukopc/000o001.bin", L"rb"); - if (!f) break; - fread(rom + 0xE000, 8192, 1, f); - fclose(f); - return 1; - - case ROM_IBMPS2_M30_286: - f = romfopen(L"roms/machines/ibmps2_m30_286/33f5381a.bin", L"rb"); - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - if (enable_xtide) - { - mem_load_atide115_bios(); - } - biosmask = 0x1ffff; - return 1; - - case ROM_DTK486: - f = romfopen(L"roms/machines/dtk486/4siw005.bin", L"rb"); - if (!f) break; - fread(rom, 0x10000, 1, f); - fclose(f); - return 1; - - case ROM_R418: - f = romfopen(L"roms/machines/r418/r418i.bin", L"rb"); - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - pclog("Load R418 %x %x\n", rom[0x1fff0], rom[0xfff0]); - return 1; - -#if 0 - case ROM_586MC1: - f = romfopen(L"roms/machines/586mc1/IS.34", L"rb"); - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; -#endif - - case ROM_PLATO: - f = romfopen(L"roms/machines/plato/1016AX1_.BIO", L"rb"); - if (!f) break; - fseek(f, 0x80, SEEK_SET); - fread(rom + 0x10000, 0x10000, 1, f); - fclose(f); - f = romfopen(L"roms/machines/plato/1016AX1_.BI1", L"rb"); - if (!f) break; - fseek(f, 0x80, SEEK_SET); - fread(rom, 0xd000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_MB500N: - f = romfopen(L"roms/machines/mb500n/031396S.BIN", L"rb"); /* Works */ - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_AP53: - f = romfopen(L"roms/machines/ap53/AP53R2C0.ROM", L"rb"); /* Works */ - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_P55T2S: - f = romfopen(L"roms/machines/p55t2s/S6Y08T.ROM", L"rb"); /* Works */ - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_PRESIDENT: - f = romfopen(L"roms/machines/president/BIOS.BIN", L"rb"); - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_P54TP4XE: - f = romfopen(L"roms/machines/p54tp4xe/T15I0302.AWD", L"rb"); - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_ACERM3A: - f = romfopen(L"roms/machines/acerm3a/r01-b3.bin", L"rb"); - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_ACERV35N: - f = romfopen(L"roms/machines/acerv35n/V35ND1S1.BIN", L"rb"); - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_P55VA: - f = romfopen(L"roms/machines/p55va/VA021297.BIN", L"rb"); - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_P55T2P4: - f = romfopen(L"roms/machines/p55t2p4/0207_J2.BIN", L"rb"); - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_P55TVP4: - f = romfopen(L"roms/machines/p55tvp4/TV5I0204.AWD", L"rb"); - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_440FX: - f = romfopen(L"roms/machines/440fx/NTMAW501.BIN", L"rb"); /* Working Tyan BIOS. */ - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_S1668: - f = romfopen(L"roms/machines/tpatx/S1668P.ROM", L"rb"); /* Working Tyan BIOS. */ - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_THOR: - f = romfopen(L"roms/machines/thor/1006CN0_.BIO", L"rb"); - if (!f) break; - fseek(f, 0x80, SEEK_SET); - fread(rom + 0x10000, 0x10000, 1, f); - fclose(f); - f = romfopen(L"roms/machines/thor/1006CN0_.BI1", L"rb"); - if (!f) break; - fseek(f, 0x80, SEEK_SET); - fread(rom, 0x10000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_MRTHOR: - f = romfopen(L"roms/machines/mrthor/MR_ATX.BIO", L"rb"); - if (!f) break; - fread(rom, 0x20000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_ZAPPA: - f = romfopen(L"roms/machines/zappa/1006BS0_.BIO", L"rb"); - if (!f) break; - fseek(f, 0x80, SEEK_SET); - fread(rom + 0x10000, 0x10000, 1, f); - fclose(f); - f = romfopen(L"roms/machines/zappa/1006BS0_.BI1", L"rb"); - if (!f) break; - fseek(f, 0x80, SEEK_SET); - fread(rom, 0x10000, 1, f); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_IBMPS2_M50: - f=romfopen(L"roms/machines/ibmps2_m50/90x7423.zm14",L"rb"); - ff=romfopen(L"roms/machines/ibmps2_m50/90x7426.zm16",L"rb"); - if (!f || !ff) break; - for (c = 0x0000; c < 0x10000; c += 2) - { - rom[c] = getc(f); - rom[c+1] = getc(ff); - } - fclose(ff); - fclose(f); - f=romfopen(L"roms/machines/ibmps2_m50/90x7420.zm13",L"rb"); - ff=romfopen(L"roms/machines/ibmps2_m50/90x7429.zm18",L"rb"); - if (!f || !ff) break; - for (c = 0x10000; c < 0x20000; c += 2) - { - rom[c] = getc(f); - rom[c+1] = getc(ff); - } - fclose(ff); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_IBMPS2_M55SX: - f=romfopen(L"roms/machines/ibmps2_m55sx/33f8146.zm41",L"rb"); - ff=romfopen(L"roms/machines/ibmps2_m55sx/33f8145.zm40",L"rb"); - if (!f || !ff) break; - for (c = 0x0000; c < 0x20000; c += 2) - { - rom[c] = getc(f); - rom[c+1] = getc(ff); - } - fclose(ff); - fclose(f); - biosmask = 0x1ffff; - return 1; - - case ROM_IBMPS2_M80: - case ROM_IBMPS2_M80_486: - f=romfopen(L"roms/machines/ibmps2_m80/15f6637.bin",L"rb"); - ff=romfopen(L"roms/machines/ibmps2_m80/15f6639.bin",L"rb"); - if (!f || !ff) break; - for (c = 0x0000; c < 0x20000; c += 2) - { - rom[c] = getc(f); - rom[c+1] = getc(ff); - } - fclose(ff); - fclose(f); - biosmask = 0x1ffff; - return 1; - } - printf("Failed to load ROM!\n"); - if (f) fclose(f); - if (ff) fclose(ff); - return 0; -} - - - -void resetreadlookup() +void resetreadlookup(void) { int c; memset(readlookup2,0xFF,1024*1024*sizeof(uintptr_t)); @@ -890,7 +90,7 @@ void resetreadlookup() int mmuflush=0; int mmu_perm=4; -void flushmmucache() +void flushmmucache(void) { int c; for (c=0;c<256;c++) @@ -914,7 +114,7 @@ void flushmmucache() codegen_flush(); } -void flushmmucache_nopc() +void flushmmucache_nopc(void) { int c; for (c=0;c<256;c++) @@ -933,7 +133,7 @@ void flushmmucache_nopc() } } -void flushmmucache_cr3() +void flushmmucache_cr3(void) { int c; for (c=0;c<256;c++) @@ -982,7 +182,7 @@ int pctrans=0; extern uint32_t testr[9]; -int mem_cpl3_check() +int mem_cpl3_check(void) { if ((CPL == 3) && !cpl_override) { @@ -2120,7 +1320,7 @@ void mem_add_bios() int mem_a20_key = 0, mem_a20_alt = 0; int mem_a20_state = 1; -void mem_init() +void mem_init(void) { int c; @@ -2299,9 +1499,10 @@ void mem_reset_page_blocks() } } + static int port_92_reg = 0; -void mem_a20_recalc() +void mem_a20_recalc(void) { int state = mem_a20_key | mem_a20_alt; if (state && !mem_a20_state) @@ -2317,11 +1518,13 @@ void mem_a20_recalc() mem_a20_state = state; } + static uint8_t port_92_read(uint16_t port, void *priv) { return port_92_reg; } + static void port_92_write(uint16_t port, uint8_t val, void *priv) { if ((mem_a20_alt ^ val) & 2) @@ -2339,22 +1542,23 @@ static void port_92_write(uint16_t port, uint8_t val, void *priv) port_92_reg = val; } -void port_92_clear_reset() + +void port_92_clear_reset(void) { port_92_reg &= 2; } -void port_92_add() +void port_92_add(void) { io_sethandler(0x0092, 0x0001, port_92_read, NULL, NULL, port_92_write, NULL, NULL, NULL); } -void port_92_remove() +void port_92_remove(void) { io_removehandler(0x0092, 0x0001, port_92_read, NULL, NULL, port_92_write, NULL, NULL, NULL); } -void port_92_reset() +void port_92_reset(void) { port_92_reg = 0; mem_a20_alt = 0; diff --git a/src/mem.h b/src/mem.h index ec9c44740..29dd69b15 100644 --- a/src/mem.h +++ b/src/mem.h @@ -173,26 +173,23 @@ void mem_write_ramw_page(uint32_t addr, uint16_t val, page_t *p); void mem_write_raml_page(uint32_t addr, uint32_t val, page_t *p); void mem_flush_write_page(uint32_t addr, uint32_t virt); -void mem_reset_page_blocks(); +extern void mem_reset_page_blocks(void); extern mem_mapping_t ram_low_mapping; extern mem_mapping_t ram_mid_mapping; -void mem_remap_top_256k(); -void mem_remap_top_384k(); +extern void mem_remap_top_256k(void); +extern void mem_remap_top_384k(void); -void flushmmucache_nopc(); +extern void flushmmucache_nopc(void); -int loadbios(); +extern void mem_add_bios(void); -void mem_add_bios(); +extern void mem_init(void); +extern void mem_resize(void); -void mem_init(); -void mem_resize(); - -void port_92_reset(); - -void port_92_add(); -void port_92_remove(); +extern void port_92_reset(void); +extern void port_92_add(void); +extern void port_92_remove(void); #endif diff --git a/src/memregs.c b/src/memregs.c index 75b8a1a58..018f07d84 100644 --- a/src/memregs.c +++ b/src/memregs.c @@ -9,12 +9,15 @@ * Emulation of the memory I/O scratch registers on ports 0xE1 * and 0xE2, used by just about any emulated machine. * - * Version: @(#)memregs.c 1.0.1 2017/08/23 + * Version: @(#)memregs.c 1.0.2 2017/09/24 * * Author: Miran Grca, * Copyright 2016-2017 Miran Grca. */ - +#include +#include +#include +#include #include "ibm.h" #include "io.h" #include "memregs.h" @@ -24,6 +27,7 @@ static uint8_t mem_regs[16] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0 static uint8_t mem_reg_ffff = 0; + void memregs_write(uint16_t port, uint8_t val, void *priv) { if (port == 0xffff) diff --git a/src/mouse.c b/src/mouse.c index 4bf146548..3c72cdc06 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -8,15 +8,19 @@ * * Common driver module for MOUSE devices. * - * Version: @(#)mouse.c 1.0.7 2017/09/02 + * Version: @(#)mouse.c 1.0.8 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * TheCollector1995, * Fred N. van Kempen, * Copyright 2008-2017 Sarah Walker. - * Copyright 2016-2017 Miran Grca. + * Copyright 2016,2017 Miran Grca. */ +#include +#include +#include +#include #include "ibm.h" #include "cpu/cpu.h" #include "device.h" diff --git a/src/mouse_bus.c b/src/mouse_bus.c index 7b70ca712..fa2225685 100644 --- a/src/mouse_bus.c +++ b/src/mouse_bus.c @@ -32,14 +32,17 @@ * 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.8 2017/08/03 + * Version: @(#)mouse_bus.c 1.0.9 2017/09/24 * * Authors: Fred N. van Kempen, * TheCollector1995 * Copyright 1989-2017 Fred N. van Kempen. */ #include +#include +#include #include +#include #include "ibm.h" #include "io.h" #include "pic.h" diff --git a/src/mouse_ps2.c b/src/mouse_ps2.c index 9d3b677f0..a7dd4319a 100644 --- a/src/mouse_ps2.c +++ b/src/mouse_ps2.c @@ -1,4 +1,8 @@ +#include +#include +#include #include +#include #include "ibm.h" #include "keyboard_at.h" #include "mouse.h" diff --git a/src/mouse_serial.c b/src/mouse_serial.c index 40b80f44a..c52e20cce 100644 --- a/src/mouse_serial.c +++ b/src/mouse_serial.c @@ -10,11 +10,15 @@ * * Based on the 86Box Serial Mouse driver as a framework. * - * Version: @(#)mouse_serial.c 1.0.8 2017/08/03 + * Version: @(#)mouse_serial.c 1.0.9 2017/09/24 * * Author: Fred N. van Kempen, */ +#include +#include +#include #include +#include #include "ibm.h" #include "timer.h" #include "serial.h" diff --git a/src/network/net_ne2000.c b/src/network/net_ne2000.c index 92c28fd89..0b0bfe30d 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.14 2017/09/03 + * Version: @(#)net_ne2000.c 1.0.15 2017/09/24 * * Authors: Fred N. van Kempen, * Peter Grehan, grehan@iprg.nokia.com> @@ -19,10 +19,12 @@ * Based on @(#)ne2k.cc v1.56.2.1 2004/02/02 22:37:22 cbothamy * Portions Copyright (C) 2002 MandrakeSoft S.A. */ -#include #include -#include +#include #include +#include +#include +#include #include #include "../config.h" #include "../ibm.h" @@ -1855,7 +1857,7 @@ nic_rom_init(nic_t *dev, wchar_t *s) } if (dev->bios_addr > 0) { - if ((f = romfopen(s, L"rb")) != NULL) { + if ((f = rom_fopen(s, L"rb")) != NULL) { fseek(f, 0L, SEEK_END); temp = ftell(f); fclose(f); diff --git a/src/network/net_pcap.c b/src/network/net_pcap.c index f7e3ebf9d..8472c6f7f 100644 --- a/src/network/net_pcap.c +++ b/src/network/net_pcap.c @@ -8,14 +8,15 @@ * * Handle WinPcap library processing. * - * Version: @(#)net_pcap.c 1.0.5 2017/06/04 + * Version: @(#)net_pcap.c 1.0.6 2017/09/24 * * Author: Fred N. van Kempen, */ -#include #include -#include +#include #include +#include +#include #include #include "../ibm.h" #include "../config.h" diff --git a/src/network/net_slirp.c b/src/network/net_slirp.c index 571ce204f..9941f03ec 100644 --- a/src/network/net_slirp.c +++ b/src/network/net_slirp.c @@ -8,14 +8,15 @@ * * Handle SLiRP library processing. * - * Version: @(#)net_slirp.c 1.0.4 2017/06/14 + * Version: @(#)net_slirp.c 1.0.5 2017/09/24 * * Author: Fred N. van Kempen, */ -#include #include -#include +#include #include +#include +#include #include "slirp/slirp.h" #include "slirp/queue.h" #include "../ibm.h" diff --git a/src/network/network.c b/src/network/network.c index 03f781c88..487bdc192 100644 --- a/src/network/network.c +++ b/src/network/network.c @@ -12,19 +12,20 @@ * it should be malloc'ed and then linked to the NETCARD def. * Will be done later. * - * Version: @(#)network.c 1.0.10 2017/06/14 + * Version: @(#)network.c 1.0.11 2017/09/24 * * Author: Fred N. van Kempen, */ -#include #include -#include +#include #include +#include +#include #include "../ibm.h" #include "../device.h" +#include "../win/plat_ui.h" #include "network.h" #include "net_ne2000.h" -#include "../win/plat_ui.h" static netcard_t net_cards[] = { diff --git a/src/nmi.c b/src/nmi.c index 59b50fd65..fc6a2698e 100644 --- a/src/nmi.c +++ b/src/nmi.c @@ -1,6 +1,10 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ +#include +#include +#include +#include #include "ibm.h" #include "io.h" #include "nmi.h" diff --git a/src/nvr.c b/src/nvr.c index d83a56ab4..85734995c 100644 --- a/src/nvr.c +++ b/src/nvr.c @@ -8,7 +8,7 @@ * * CMOS NVRAM emulation. * - * Version: @(#)nvr.c 1.0.3 2017/09/19 + * Version: @(#)nvr.c 1.0.4 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, @@ -18,8 +18,9 @@ * Copyright 2016,2017 Mahod. */ #include -#include +#include #include +#include #include #include "ibm.h" #include "config.h" diff --git a/src/nvr_ps2.c b/src/nvr_ps2.c index c56e0f5df..315c65fe8 100644 --- a/src/nvr_ps2.c +++ b/src/nvr_ps2.c @@ -1,8 +1,13 @@ +#include +#include +#include #include +#include #include "ibm.h" #include "device.h" #include "io.h" #include "mem.h" +#include "rom.h" #include "nvr.h" #include "nvr_ps2.h" diff --git a/src/pc.c b/src/pc.c index e6e948d85..6712527bf 100644 --- a/src/pc.c +++ b/src/pc.c @@ -8,7 +8,7 @@ * * Emulation core dispatcher. * - * Version: @(#)pc.c 1.0.10 2017/09/22 + * Version: @(#)pc.c 1.0.12 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, @@ -16,13 +16,16 @@ * Copyright 2016,2017 Miran Grca. */ #include +#include #include +#include #include -#include +#include #include "86box.h" #include "config.h" #include "ibm.h" #include "mem.h" +#include "rom.h" #include "cpu/codegen.h" #include "cpu/cpu.h" #include "dma.h" @@ -57,6 +60,7 @@ #include "pit.h" #ifdef WALTJE # define UNICODE +# include # include "win/plat_dir.h" # undef UNICODE #endif @@ -85,7 +89,6 @@ wchar_t exe_path[1024]; wchar_t cfg_path[1024]; wchar_t nvr_path[1024]; -int path_len; int window_w, window_h, window_x, window_y, window_remember; @@ -423,7 +426,7 @@ void initmodules(void) initvideo(); mem_init(); - loadbios(); + rom_load_bios(romset); mem_add_bios(); codegen_init(); diff --git a/src/pci.c b/src/pci.c index 5bd236856..174ff22f9 100644 --- a/src/pci.c +++ b/src/pci.c @@ -1,4 +1,8 @@ +#include +#include +#include #include +#include #include "ibm.h" #include "io.h" #include "pic.h" diff --git a/src/pci_dummy.c b/src/pci_dummy.c index 128cd187b..da4ec9514 100644 --- a/src/pci_dummy.c +++ b/src/pci_dummy.c @@ -1,4 +1,8 @@ /* This can also serve as a sample PCI device. */ +#include +#include +#include +#include #include "ibm.h" #include "io.h" #include "pci.h" diff --git a/src/pic.c b/src/pic.c index 441947fa4..0c413ebb6 100644 --- a/src/pic.c +++ b/src/pic.c @@ -1,3 +1,7 @@ +#include +#include +#include +#include #include "ibm.h" #include "io.h" #include "pci.h" diff --git a/src/piix.c b/src/piix.c index 4b4548127..039ca5aae 100644 --- a/src/piix.c +++ b/src/piix.c @@ -8,21 +8,21 @@ * * Emulation core dispatcher. * - * Version: @(#)piix.c 1.0.2 2017/08/24 + * PRD format : + * word 0 - base address + * word 1 - bits 1 - 15 = byte count, bit 31 = end of transfer + * + * Version: @(#)piix.c 1.0.3 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ - -/*PRD format : - - word 0 - base address - word 1 - bits 1 - 15 = byte count, bit 31 = end of transfer -*/ +#include +#include #include - +#include #include "ibm.h" #include "dma.h" #include "io.h" diff --git a/src/pit.c b/src/pit.c index 79e918f04..0df826b05 100644 --- a/src/pit.c +++ b/src/pit.c @@ -2,8 +2,10 @@ Write B0 Write aa55 Expects aa55 back*/ - +#include +#include #include +#include #include "ibm.h" #include "cpu/cpu.h" #include "dma.h" diff --git a/src/ppi.c b/src/ppi.c index dfb315e2c..2fb10ec21 100644 --- a/src/ppi.c +++ b/src/ppi.c @@ -7,18 +7,22 @@ CX is loops between bit 4 of $62 changing BX is timer difference between calls */ - +#include +#include +#include +#include #include "ibm.h" #include "pit.h" #include "plat_keyboard.h" #include "plat_mouse.h" + PPI ppi; int ppispeakon; -void ppi_reset() + +void ppi_reset(void) { ppi.pa=0x0; ppi.pb=0x40; } - diff --git a/src/random.c b/src/random.c index 60caf02bb..9d7f1b229 100644 --- a/src/random.c +++ b/src/random.c @@ -9,7 +9,7 @@ * A better random number generation, used for floppy weak bits * and network MAC address generation. * - * Version: @(#)random.c 1.0.2 2017/09/03 + * Version: @(#)random.c 1.0.3 2017/09/24 * * Author: Miran Grca, * Copyright 2016,2017 Miran Grca. diff --git a/src/rom.c b/src/rom.c index 7ab364dd8..f1f10fc3a 100644 --- a/src/rom.c +++ b/src/rom.c @@ -1,166 +1,777 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ -#include +/*MESS ROM notes : + + - pc2386 BIOS is corrupt (JMP at F000:FFF0 points to RAM) + - pc2386 video BIOS is underdumped (16k instead of 24k) + - c386sx16 BIOS fails checksum +*/ #include +#include +#include +#include +#include #include "config.h" #include "ibm.h" #include "mem.h" #include "rom.h" +#include "video/video.h" /* for loadfont() */ -FILE *romfopen(wchar_t *fn, wchar_t *mode) +int romspresent[ROM_MAX]; + + +FILE * +rom_fopen(wchar_t *fn, wchar_t *mode) { - wchar_t s[1024]; + wchar_t temp[1024]; - wcscpy(s, exe_path); - put_backslash_w(s); - wcscat(s, fn); + wcscpy(temp, exe_path); + put_backslash_w(temp); + wcscat(temp, fn); - return _wfopen(s, mode); + return(_wfopen(temp, mode)); } -int rom_getfile(wchar_t *fn, wchar_t *s, int size) +int +rom_getfile(wchar_t *fn, wchar_t *s, int size) { - FILE *f; + FILE *f; - wcscpy(s, exe_path); - put_backslash_w(s); - wcscat(s, fn); - f = _wfopen(s, L"rb"); - if (f) - { - fclose(f); - return 1; - } - return 0; -} + wcscpy(s, exe_path); + put_backslash_w(s); + wcscat(s, fn); -int rom_present(wchar_t *fn) -{ - FILE *f; - wchar_t s[512]; - - wcscpy(s, exe_path); - put_backslash_w(s); - wcscat(s, fn); - f = _wfopen(s, L"rb"); - if (f) - { - fclose(f); - return 1; - } - return 0; + f = _wfopen(s, L"rb"); + if (f != NULL) { + (void)fclose(f); + return(1); + } + + return(0); } -uint8_t rom_read(uint32_t addr, void *p) +int +rom_present(wchar_t *fn) { - rom_t *rom = (rom_t *)p; + FILE *f; + + f = rom_fopen(fn, L"rb"); + if (f != NULL) { + (void)fclose(f); + return(1); + } + + return(0); +} + + +uint8_t +rom_read(uint32_t addr, void *priv) +{ + rom_t *rom = (rom_t *)priv; + #ifdef ROM_TRACE - if (rom->mapping.base==ROM_TRACE) - pclog("ROM: read byte from BIOS at %06lX\n", addr); + if (rom->mapping.base==ROM_TRACE) + pclog("ROM: read byte from BIOS at %06lX\n", addr); #endif - return rom->rom[addr & rom->mask]; + + return(rom->rom[addr & rom->mask]); } -uint16_t rom_readw(uint32_t addr, void *p) +uint16_t +rom_readw(uint32_t addr, void *priv) { - rom_t *rom = (rom_t *)p; + rom_t *rom = (rom_t *)priv; + #ifdef ROM_TRACE - if (rom->mapping.base==ROM_TRACE) - pclog("ROM: read word from BIOS at %06lX\n", addr); + if (rom->mapping.base==ROM_TRACE) + pclog("ROM: read word from BIOS at %06lX\n", addr); #endif - return *(uint16_t *)&rom->rom[addr & rom->mask]; + + return(*(uint16_t *)&rom->rom[addr & rom->mask]); } -uint32_t rom_readl(uint32_t addr, void *p) +uint32_t +rom_readl(uint32_t addr, void *priv) { - rom_t *rom = (rom_t *)p; + rom_t *rom = (rom_t *)priv; + #ifdef ROM_TRACE - if (rom->mapping.base==ROM_TRACE) - pclog("ROM: read long from BIOS at %06lX\n", addr); + if (rom->mapping.base==ROM_TRACE) + pclog("ROM: read long from BIOS at %06lX\n", addr); #endif - return *(uint32_t *)&rom->rom[addr & rom->mask]; + + return(*(uint32_t *)&rom->rom[addr & rom->mask]); } -int rom_init(rom_t *rom, wchar_t *fn, uint32_t address, int size, int mask, int file_offset, uint32_t flags) +int +rom_init(rom_t *rom, wchar_t *fn, uint32_t address, int size, int mask, int file_offset, uint32_t flags) { - FILE *f = romfopen(fn, L"rb"); + FILE *f = rom_fopen(fn, L"rb"); - if (!f) - { - pclog("ROM image not found : %ws\n", fn); - return -1; - } - - rom->rom = malloc(size); - fseek(f, file_offset, SEEK_SET); - fread(rom->rom, size, 1, f); - fclose(f); - - rom->mask = mask; - - mem_mapping_add(&rom->mapping, address, size, rom_read, - rom_readw, - rom_readl, - mem_write_null, - mem_write_nullw, - mem_write_nulll, - rom->rom, - flags, - rom); + if (f == NULL) { + pclog("ROM image not found: %ws\n", fn); + return(-1); + } - return 0; + rom->rom = malloc(size); + (void)fseek(f, file_offset, SEEK_SET); + (void)fread(rom->rom, size, 1, f); + (void)fclose(f); + + rom->mask = mask; + + mem_mapping_add(&rom->mapping, + address, size, + rom_read, rom_readw, rom_readl, + mem_write_null, mem_write_nullw, mem_write_nulll, + rom->rom, flags, rom); + + return(0); } -int rom_init_interleaved(rom_t *rom, wchar_t *fn_low, wchar_t *fn_high, uint32_t address, int size, int mask, int file_offset, uint32_t flags) +int +rom_init_interleaved(rom_t *rom, wchar_t *fn_low, wchar_t *fn_high, uint32_t address, int size, int mask, int file_offset, uint32_t flags) { - FILE *f_low = romfopen(fn_low, L"rb"); - FILE *f_high = romfopen(fn_high, L"rb"); - int c; - - if (!f_low || !f_high) - { - if (!f_low) - pclog("ROM image not found : %ws\n", fn_low); - else - fclose(f_low); - if (!f_high) - pclog("ROM image not found : %ws\n", fn_high); - else - fclose(f_high); - return -1; - } - - rom->rom = malloc(size); - fseek(f_low, file_offset, SEEK_SET); - fseek(f_high, file_offset, SEEK_SET); - for (c = 0; c < size; c += 2) - { - rom->rom[c] = getc(f_low); - rom->rom[c + 1] = getc(f_high); - } - fclose(f_high); - fclose(f_low); - - rom->mask = mask; - - mem_mapping_add(&rom->mapping, address, size, rom_read, - rom_readw, - rom_readl, - mem_write_null, - mem_write_nullw, - mem_write_nulll, - rom->rom, - flags, - rom); + FILE *f_low = rom_fopen(fn_low, L"rb"); + FILE *f_high = rom_fopen(fn_high, L"rb"); + int c; - return 0; + if (f_low == NULL || f_high == NULL) { + if (f_low == NULL) pclog("ROM image not found: %ws\n", fn_low); + else (void)fclose(f_low); + if (f_high == NULL) pclog("ROM image not found: %ws\n", fn_high); + else (void)fclose(f_high); + + return(-1); + } + + rom->rom = malloc(size); + (void)fseek(f_low, file_offset, SEEK_SET); + (void)fseek(f_high, file_offset, SEEK_SET); + for (c=0; crom[c] = fgetc(f_low); + rom->rom[++c] = fgetc(f_high); + } + (void)fclose(f_high); + (void)fclose(f_low); + + rom->mask = mask; + + mem_mapping_add(&rom->mapping, + address, size, + rom_read, rom_readw, rom_readl, + mem_write_null, mem_write_nullw, mem_write_nulll, + rom->rom, flags, rom); + + return(0); +} + + +/* Load a ROM BIOS from its chips, interleaved mode. */ +int +rom_load_linear(wchar_t *fn, uint32_t addr, int sz, int off) +{ + FILE *f = rom_fopen(fn, L"rb"); + + if (f == NULL) { + pclog("ROM image not found: %ws\n", fn); + return(0); + } + + (void)fseek(f, off, SEEK_SET); + (void)fread(rom+addr, sz, 1, f); + (void)fclose(f); + + return(1); +} + + +/* Load a ROM BIOS from its chips, interleaved mode. */ +int +rom_load_interleaved(wchar_t *fnl, wchar_t *fnh, uint32_t addr, int sz, int off) +{ + FILE *fl = rom_fopen(fnl, L"rb"); + FILE *fh = rom_fopen(fnh, L"rb"); + int c; + + if (fl == NULL || fh == NULL) { + if (fl == NULL) pclog("ROM image not found: %ws\n", fnl); + else (void)fclose(fl); + if (fh == NULL) pclog("ROM image not found: %ws\n", fnh); + else (void)fclose(fh); + + return(0); + } + + (void)fseek(fl, off, SEEK_SET); + (void)fseek(fh, off, SEEK_SET); + for (c=0; c #include -#include +#include #include +#include +#include #include #include "nvr.h" #include "rtc.h" + int enable_sync; + struct { int sec; diff --git a/src/scsi/scsi.c b/src/scsi/scsi.c index 48561691e..2781ed45c 100644 --- a/src/scsi/scsi.c +++ b/src/scsi/scsi.c @@ -8,7 +8,7 @@ * * Handling of the SCSI controllers. * - * Version: @(#)scsi.c 1.0.4 2017/09/03 + * Version: @(#)scsi.c 1.0.5 2017/09/24 * * Authors: TheCollector1995, * Miran Grca, @@ -16,8 +16,11 @@ * Copyright 2016,2017 Miran Grca. * Copyright 2017 Fred N. van Kempen. */ -#include +#include +#include #include +#include +#include #include "../86box.h" #include "../ibm.h" #include "../timer.h" diff --git a/src/scsi/scsi_aha154x.c b/src/scsi/scsi_aha154x.c index 18f078d3f..0b39fa5c5 100644 --- a/src/scsi/scsi_aha154x.c +++ b/src/scsi/scsi_aha154x.c @@ -12,17 +12,18 @@ * * NOTE: THIS IS CURRENTLY A MESS, but will be cleaned up as I go. * - * Version: @(#)scsi_aha154x.c 1.0.17 2017/09/19 + * Version: @(#)scsi_aha154x.c 1.0.18 2017/09/24 * * Authors: Fred N. van Kempen, * Original Buslogic version by SA1988 and Miran Grca. * Copyright 2017 Fred N. van Kempen. */ -#include -#include #include +#include #include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mca.h" @@ -1838,7 +1839,7 @@ aha_setbios(aha_t *dev) /* Open the BIOS image file and make sure it exists. */ pclog_w(L"%S: loading BIOS from '%s'\n", dev->name, dev->bios_path); - if ((f = romfopen(dev->bios_path, L"rb")) == NULL) { + if ((f = rom_fopen(dev->bios_path, L"rb")) == NULL) { pclog("%s: BIOS ROM not found!\n", dev->name); return; } diff --git a/src/scsi/scsi_bios_command.c b/src/scsi/scsi_bios_command.c index d085e2532..ea3cdf4e9 100644 --- a/src/scsi/scsi_bios_command.c +++ b/src/scsi/scsi_bios_command.c @@ -8,7 +8,7 @@ * * The shared AHA and Buslogic SCSI BIOS command handler. * - * Version: @(#)scsi_bios_command.c 1.0.1 2017/08/27 + * Version: @(#)scsi_bios_command.c 1.0.2 2017/09/24 * * Authors: TheCollector1995, * Miran Grca, @@ -16,8 +16,12 @@ * Copyright 2017 Miran Grca. * Copyright 2017 Fred N. van Kempen. */ -#include +#include +#include +#include #include +#include +#include #include "../ibm.h" #include "../dma.h" #include "scsi.h" diff --git a/src/scsi/scsi_buslogic.c b/src/scsi/scsi_buslogic.c index a07ee5908..d30e92b6e 100644 --- a/src/scsi/scsi_buslogic.c +++ b/src/scsi/scsi_buslogic.c @@ -10,7 +10,7 @@ * 0 - BT-545C ISA; * 1 - BT-958D PCI (but BT-545C ISA on non-PCI machines) * - * Version: @(#)scsi_buslogic.c 1.0.13 2017/09/19 + * Version: @(#)scsi_buslogic.c 1.0.14 2017/09/24 * * Authors: TheCollector1995, * Miran Grca, @@ -18,11 +18,12 @@ * Copyright 2016,2017 Miran Grca. * Copyright 2017 Fred N. van Kempen. */ -#include #include -#include +#include #include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" @@ -2947,7 +2948,7 @@ BuslogicInit(int chip) if (has_autoscsi_rom) { - f = romfopen(autoscsi_rom_name, L"rb"); + f = rom_fopen(autoscsi_rom_name, L"rb"); if (f) { fread(bl->AutoSCSIROM, 1, autoscsi_rom_size, f); @@ -2958,7 +2959,7 @@ BuslogicInit(int chip) if (has_scam_rom) { - f = romfopen(scam_rom_name, L"rb"); + f = rom_fopen(scam_rom_name, L"rb"); if (f) { fread(bl->SCAMData, 1, scam_rom_size, f); diff --git a/src/scsi/scsi_device.c b/src/scsi/scsi_device.c index 63412dcb8..dadcab4d5 100644 --- a/src/scsi/scsi_device.c +++ b/src/scsi/scsi_device.c @@ -8,13 +8,17 @@ * * The generic SCSI device command handler. * - * Version: @(#)scsi_device.c 1.0.2 2017/09/03 + * Version: @(#)scsi_device.c 1.0.3 2017/09/24 * * Authors: Miran Grca, * Fred N. van Kempen, * Copyright 2016,2017 Miran Grca. * Copyright 2017 Fred N. van Kempen. */ +#include +#include +#include +#include #include "../ibm.h" #include "../cdrom/cdrom.h" #include "scsi.h" diff --git a/src/scsi/scsi_disk.c b/src/scsi/scsi_disk.c index e6cde3904..4985e37f9 100644 --- a/src/scsi/scsi_disk.c +++ b/src/scsi/scsi_disk.c @@ -6,15 +6,17 @@ * * Emulation of SCSI fixed and removable disks. * - * Version: @(#)scsi_disk.c 1.0.7 2017/09/03 + * Version: @(#)scsi_disk.c 1.0.8 2017/09/24 * * Author: Miran Grca, * Copyright 2017 Miran Grca. */ -#include #include +#include +#include #include #include +#include #include "../86box.h" #include "../ibm.h" #include "../timer.h" diff --git a/src/serial.c b/src/serial.c index a195c310e..2ec788530 100644 --- a/src/serial.c +++ b/src/serial.c @@ -1,11 +1,17 @@ +#include +#include +#include #include - +#include #include "ibm.h" #include "io.h" -#include "mouse.h" #include "pic.h" +#include "mem.h" +#include "rom.h" #include "serial.h" #include "timer.h" +#include "mouse.h" + enum { diff --git a/src/sio_detect.c b/src/sio_detect.c index b8f359b47..a51fd9006 100644 --- a/src/sio_detect.c +++ b/src/sio_detect.c @@ -1,3 +1,7 @@ +#include +#include +#include +#include #include "ibm.h" #include "io.h" #include "floppy/floppy.h" diff --git a/src/sio_fdc37c665.c b/src/sio_fdc37c665.c index 7a5716aff..e7e88fa9e 100644 --- a/src/sio_fdc37c665.c +++ b/src/sio_fdc37c665.c @@ -8,13 +8,17 @@ * * Implementation of the SMC FDC37C665 Super I/O Chip. * - * Version: @(#)sio_fdc37c665.c 1.0.4 2017/09/03 + * Version: @(#)sio_fdc37c665.c 1.0.5 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ +#include +#include +#include +#include #include "ibm.h" #include "io.h" #include "lpt.h" diff --git a/src/sio_fdc37c669.c b/src/sio_fdc37c669.c index 3a7cfee81..239d0bbcc 100644 --- a/src/sio_fdc37c669.c +++ b/src/sio_fdc37c669.c @@ -8,11 +8,15 @@ * * Implementation of the SMC FDC37C669 Super I/O Chip. * - * Version: @(#)sio_fdc37c669.c 1.0.2 2017/09/03 + * Version: @(#)sio_fdc37c669.c 1.0.3 2017/09/24 * * Author: Miran Grca, * Copyright 2016,2017 Miran Grca. */ +#include +#include +#include +#include #include "ibm.h" #include "io.h" #include "lpt.h" diff --git a/src/sio_fdc37c932fr.c b/src/sio_fdc37c932fr.c index 8d51eb094..936890b44 100644 --- a/src/sio_fdc37c932fr.c +++ b/src/sio_fdc37c932fr.c @@ -8,11 +8,15 @@ * * Implementation of the SMC FDC37C932FR Super I/O Chip. * - * Version: @(#)sio_fdc37c932fr.c 1.0.3 2017/09/03 + * Version: @(#)sio_fdc37c932fr.c 1.0.4 2017/09/24 * * Author: Miran Grca, * Copyright 2016,2017 Miran Grca. */ +#include +#include +#include +#include #include "ibm.h" #include "io.h" #include "lpt.h" diff --git a/src/sio_pc87306.c b/src/sio_pc87306.c index c960c268c..1e5df2574 100644 --- a/src/sio_pc87306.c +++ b/src/sio_pc87306.c @@ -8,11 +8,15 @@ * * Emulation of the NatSemi PC87306 Super I/O chip. * - * Version: @(#)sio_pc87306.c 1.0.3 2017/09/03 + * Version: @(#)sio_pc87306.c 1.0.4 2017/09/24 * * Author: Miran Grca, * Copyright 2016,2017 Miran Grca. */ +#include +#include +#include +#include #include "ibm.h" #include "io.h" #include "lpt.h" diff --git a/src/sio_um8669f.c b/src/sio_um8669f.c index 4e3215412..f94d3c92e 100644 --- a/src/sio_um8669f.c +++ b/src/sio_um8669f.c @@ -21,6 +21,10 @@ PnP registers : 70 - IRQ 74 - DMA*/ +#include +#include +#include +#include #include "ibm.h" #include "io.h" #include "lpt.h" diff --git a/src/sio_w83877f.c b/src/sio_w83877f.c index 9c48a9c00..d63414cc6 100644 --- a/src/sio_w83877f.c +++ b/src/sio_w83877f.c @@ -11,13 +11,19 @@ * Winbond W83877F Super I/O Chip * Used by the Award 430HX * - * Version: @(#)sio_w83877f.c 1.0.2 2017/09/03 + * Version: @(#)sio_w83877f.c 1.0.3 2017/09/24 * * Author: Miran Grca, * Copyright 2016,2017 Miran Grca. */ +#include +#include +#include +#include #include "ibm.h" #include "io.h" +#include "mem.h" +#include "rom.h" #include "lpt.h" #include "serial.h" #include "floppy/floppy.h" diff --git a/src/sound/dbopl.cpp b/src/sound/dbopl.cpp index e8002b7cf..85228ae10 100644 --- a/src/sound/dbopl.cpp +++ b/src/sound/dbopl.cpp @@ -20,10 +20,9 @@ /* $Id: dbopl.cpp,v 1.10 2009-06-10 19:54:51 harekiet Exp $ */ -#include #include #include -//#include "dosbox.h" +#include #include "dbopl.h" diff --git a/src/sound/midi.c b/src/sound/midi.c index 476283853..1c53875a5 100644 --- a/src/sound/midi.c +++ b/src/sound/midi.c @@ -1,24 +1,26 @@ #include -#include #include #include +#include +#include #include "../device.h" -#include "midi.h" #include "../ibm.h" - #include "../win/plat_midi.h" #include "../win/plat_ticks.h" +#include "midi.h" +#include "midi_system.h" #ifdef USE_FLUIDSYNTH # include "midi_fluidsynth.h" #endif #ifdef USE_MUNT # include "midi_mt32.h" #endif -#include "midi_system.h" + int midi_device_current = 0; static int midi_device_last = 0; + typedef struct { const char *name; diff --git a/src/sound/midi_fluidsynth.c b/src/sound/midi_fluidsynth.c index 101f0dad1..fa83d3d45 100644 --- a/src/sound/midi_fluidsynth.c +++ b/src/sound/midi_fluidsynth.c @@ -1,23 +1,26 @@ /* some code borrowed from scummvm */ #ifdef USE_FLUIDSYNTH - -#include +#include #include #include +#include +#include #include #include "../config.h" #include "../win/plat_dynld.h" #include "../win/plat_thread.h" #include "../win/plat_ui.h" #include "../device.h" -#include "midi_fluidsynth.h" #include "midi.h" +#include "midi_fluidsynth.h" #include "sound.h" + #define RENDER_RATE 100 #define BUFFER_SEGMENTS 10 + extern void givealbuffer_midi(void *buf, uint32_t size); extern void pclog(const char *format, ...); extern void al_set_midi(int freq, int buf_size); diff --git a/src/sound/midi_mt32.c b/src/sound/midi_mt32.c index c3ffe49e3..cbf4c3d4d 100644 --- a/src/sound/midi_mt32.c +++ b/src/sound/midi_mt32.c @@ -1,15 +1,18 @@ +#include #include -#include #include +#include +#include #include "munt/c_interface/c_interface.h" #include "../win/plat_thread.h" #include "../ibm.h" #include "../device.h" #include "../mem.h" #include "../rom.h" -#include "midi_mt32.h" -#include "midi.h" #include "sound.h" +#include "midi.h" +#include "midi_mt32.h" + extern void givealbuffer_midi(void *buf, uint32_t size); extern void pclog(const char *format, ...); diff --git a/src/sound/midi_system.c b/src/sound/midi_system.c index f26c1dcbd..e2f3573d4 100644 --- a/src/sound/midi_system.c +++ b/src/sound/midi_system.c @@ -1,11 +1,13 @@ #include #include -#include #include +#include +#include #include "../device.h" #include "../win/plat_midi.h" -#include "midi_system.h" #include "midi.h" +#include "midi_system.h" + void* system_midi_init() { diff --git a/src/sound/openal.c b/src/sound/openal.c index c2d8d87fa..1c80de8fd 100644 --- a/src/sound/openal.c +++ b/src/sound/openal.c @@ -1,7 +1,9 @@ #define USE_OPENAL #include +#include #include #include +#include #ifdef USE_OPENAL # undef AL_API # undef ALC_API diff --git a/src/sound/snd_ad1848.c b/src/sound/snd_ad1848.c index 10ff8b2b3..a33160d77 100644 --- a/src/sound/snd_ad1848.c +++ b/src/sound/snd_ad1848.c @@ -2,6 +2,10 @@ AD1848 CODEC emulation (Windows Sound System compatible)*/ +#include +#include +#include +#include #include #include "../ibm.h" #include "../dma.h" diff --git a/src/sound/snd_adlib.c b/src/sound/snd_adlib.c index e131d04c3..838d74faa 100644 --- a/src/sound/snd_adlib.c +++ b/src/sound/snd_adlib.c @@ -1,4 +1,8 @@ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mca.h" diff --git a/src/sound/snd_adlibgold.c b/src/sound/snd_adlibgold.c index e99f299f9..5a5d600a4 100644 --- a/src/sound/snd_adlibgold.c +++ b/src/sound/snd_adlibgold.c @@ -1,5 +1,8 @@ -#include +#include +#include #include +#include +#include #include "../ibm.h" #include "../io.h" #include "../dma.h" diff --git a/src/sound/snd_cms.c b/src/sound/snd_cms.c index 1cbf723b2..56d46a764 100644 --- a/src/sound/snd_cms.c +++ b/src/sound/snd_cms.c @@ -1,5 +1,8 @@ #include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../device.h" diff --git a/src/sound/snd_emu8k.c b/src/sound/snd_emu8k.c index cb2983a59..9237dca3e 100644 --- a/src/sound/snd_emu8k.c +++ b/src/sound/snd_emu8k.c @@ -1,14 +1,18 @@ +#include +#include +#include #include +#include #include #include "../ibm.h" #include "../device.h" #include "../io.h" #include "../mem.h" #include "../rom.h" +#include "../timer.h" #include "sound.h" #include "snd_emu8k.h" -#include "../timer.h" -#include + #if !defined FILTER_INITIAL && !defined FILTER_MOOG && !defined FILTER_CONSTANT #define FILTER_MOOG @@ -2088,7 +2092,7 @@ void emu8k_init(emu8k_t *emu8k, int onboard_ram) int c; double out; - f = romfopen(L"roms/sound/awe32.raw", L"rb"); + f = rom_fopen(L"roms/sound/awe32.raw", L"rb"); if (!f) fatal("AWE32.RAW not found\n"); diff --git a/src/sound/snd_gus.c b/src/sound/snd_gus.c index 837f3bfc1..cc85ec430 100644 --- a/src/sound/snd_gus.c +++ b/src/sound/snd_gus.c @@ -1,6 +1,8 @@ #include -#include +#include #include +#include +#include #include "../ibm.h" #include "../io.h" #include "../pic.h" diff --git a/src/sound/snd_lpt_dac.c b/src/sound/snd_lpt_dac.c index de34fc5f2..ed424250d 100644 --- a/src/sound/snd_lpt_dac.c +++ b/src/sound/snd_lpt_dac.c @@ -1,11 +1,15 @@ +#include +#include +#include #include +#include #include "../ibm.h" #include "../cpu/cpu.h" -#include "filters.h" #include "../lpt.h" -#include "snd_lpt_dac.h" -#include "sound.h" #include "../timer.h" +#include "sound.h" +#include "filters.h" +#include "snd_lpt_dac.h" typedef struct lpt_dac_t { diff --git a/src/sound/snd_lpt_dss.c b/src/sound/snd_lpt_dss.c index 245d45548..fec50803d 100644 --- a/src/sound/snd_lpt_dss.c +++ b/src/sound/snd_lpt_dss.c @@ -1,11 +1,15 @@ +#include +#include +#include #include +#include #include "../ibm.h" #include "../cpu/cpu.h" -#include "filters.h" -#include "../lpt.h" -#include "snd_lpt_dss.h" -#include "sound.h" #include "../timer.h" +#include "../lpt.h" +#include "sound.h" +#include "filters.h" +#include "snd_lpt_dss.h" typedef struct dss_t { diff --git a/src/sound/snd_mpu401.c b/src/sound/snd_mpu401.c index 61e2890f7..2b64c1a1f 100644 --- a/src/sound/snd_mpu401.c +++ b/src/sound/snd_mpu401.c @@ -8,29 +8,31 @@ * * Roland MPU-401 emulation. * - * Version: @(#)sound_mpu401.c 1.0.1 2017/06/19 + * Version: @(#)snd_mpu401.c 1.0.2 2017/09/24 * - * Author: Sarah Walker, + * Authors: Sarah Walker, * DOSBox Team, * Miran Grca, * TheCollector1995, * Copyright 2008-2017 Sarah Walker. * Copyright 2008-2017 DOSBox Team. - * Copyright 2016-2017 Miran Grca. - * Copyright 2016-2017 TheCollector1995. + * Copyright 2016,2017 Miran Grca. */ - +#include +#include +#include +#include +#include +#include #include "../ibm.h" #include "../device.h" #include "../io.h" #include "../pic.h" #include "../timer.h" -#include "midi.h" #include "sound.h" #include "snd_mpu401.h" +#include "midi.h" -#include -#include enum { diff --git a/src/sound/snd_opl.c b/src/sound/snd_opl.c index c5ccc6070..fdaeefbfe 100644 --- a/src/sound/snd_opl.c +++ b/src/sound/snd_opl.c @@ -1,8 +1,11 @@ /* Copyright holders: Sarah Walker, SA1988 see COPYING for more details */ +#include #include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../timer.h" @@ -11,7 +14,7 @@ #include "snd_dbopl.h" -/*Interfaces between PCem and the actual OPL emulator*/ +/*Interfaces between 86Box and the actual OPL emulator*/ uint8_t opl2_read(uint16_t a, void *priv) diff --git a/src/sound/snd_pas16.c b/src/sound/snd_pas16.c index e91b7a09a..523bd6e86 100644 --- a/src/sound/snd_pas16.c +++ b/src/sound/snd_pas16.c @@ -1,4 +1,8 @@ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../pic.h" @@ -7,10 +11,10 @@ #include "../timer.h" #include "../device.h" #include "sound.h" +#include "filters.h" #include "snd_opl.h" #include "snd_pas16.h" #include "snd_sb_dsp.h" -#include "filters.h" /* Original PAS uses diff --git a/src/sound/snd_ps1.c b/src/sound/snd_ps1.c index 85334101a..5580d572f 100644 --- a/src/sound/snd_ps1.c +++ b/src/sound/snd_ps1.c @@ -1,4 +1,8 @@ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../pic.h" diff --git a/src/sound/snd_pssj.c b/src/sound/snd_pssj.c index dc52aee46..e9e65774a 100644 --- a/src/sound/snd_pssj.c +++ b/src/sound/snd_pssj.c @@ -1,4 +1,8 @@ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../dma.h" diff --git a/src/sound/snd_sb.c b/src/sound/snd_sb.c index 5e38a22ce..6c164c305 100644 --- a/src/sound/snd_sb.c +++ b/src/sound/snd_sb.c @@ -8,17 +8,19 @@ * * Sound Blaster emulation. * - * Version: @(#)sound_sb.c 1.0.0 2017/05/30 + * Version: @(#)sound_sb.c 1.0.1 2017/09/24 * - * Author: Sarah Walker, + * Authors: Sarah Walker, * Miran Grca, * TheCollector1995, * Copyright 2008-2017 Sarah Walker. - * Copyright 2016-2017 Miran Grca. - * Copyright 2016-2017 TheCollector1995. + * Copyright 2016,2017 Miran Grca. */ - +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mca.h" @@ -26,13 +28,13 @@ #include "../rom.h" #include "../device.h" #include "sound.h" +#include "filters.h" #include "snd_dbopl.h" #include "snd_emu8k.h" #include "snd_mpu401.h" #include "snd_opl.h" #include "snd_sb.h" #include "snd_sb_dsp.h" -#include "filters.h" typedef struct sb_mixer_t diff --git a/src/sound/snd_sb_dsp.c b/src/sound/snd_sb_dsp.c index 8ff2e4efc..65ab96406 100644 --- a/src/sound/snd_sb_dsp.c +++ b/src/sound/snd_sb_dsp.c @@ -3,16 +3,18 @@ 486-33 - 20kHz 486-50 - 32kHz Pentium - 45kHz*/ -#include #include +#include +#include +#include #include "../ibm.h" #include "../io.h" #include "../pic.h" #include "../dma.h" #include "../timer.h" #include "../device.h" -#include "midi.h" #include "sound.h" +#include "midi.h" #include "snd_mpu401.h" #include "snd_sb_dsp.h" diff --git a/src/sound/snd_sn76489.c b/src/sound/snd_sn76489.c index 574769322..e3a9342eb 100644 --- a/src/sound/snd_sn76489.c +++ b/src/sound/snd_sn76489.c @@ -1,4 +1,8 @@ +#include +#include +#include #include +#include #include #include "../ibm.h" #include "../io.h" diff --git a/src/sound/snd_speaker.c b/src/sound/snd_speaker.c index 3ac8298a9..44d576941 100644 --- a/src/sound/snd_speaker.c +++ b/src/sound/snd_speaker.c @@ -1,3 +1,7 @@ +#include +#include +#include +#include #include "../ibm.h" #include "sound.h" #include "snd_speaker.h" diff --git a/src/sound/snd_ssi2001.c b/src/sound/snd_ssi2001.c index d42898b9d..6ff21e8b3 100644 --- a/src/sound/snd_ssi2001.c +++ b/src/sound/snd_ssi2001.c @@ -1,4 +1,8 @@ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../device.h" diff --git a/src/sound/snd_wss.c b/src/sound/snd_wss.c index a58bc0b64..472b1788e 100644 --- a/src/sound/snd_wss.c +++ b/src/sound/snd_wss.c @@ -2,7 +2,11 @@ Windows Sound System emulation*/ +#include +#include +#include #include +#include #include #include "../ibm.h" #include "../io.h" diff --git a/src/sound/snd_ym7128.c b/src/sound/snd_ym7128.c index 4bea44f53..354b8b3b0 100644 --- a/src/sound/snd_ym7128.c +++ b/src/sound/snd_ym7128.c @@ -1,3 +1,7 @@ +#include +#include +#include +#include #include "../ibm.h" #include "snd_ym7128.h" diff --git a/src/sound/sound.c b/src/sound/sound.c index f52ba16c3..2dfadca42 100644 --- a/src/sound/sound.c +++ b/src/sound/sound.c @@ -8,23 +8,25 @@ * * Sound emulation core. * - * Version: @(#)sound.c 1.0.3 2017/09/03 + * Version: @(#)sound.c 1.0.4 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ -#include #include +#include +#include #include +#include #include "../ibm.h" #include "../device.h" #include "../timer.h" #include "../cdrom/cdrom.h" #include "../win/plat_thread.h" -#include "midi.h" #include "sound.h" +#include "midi.h" #include "snd_opl.h" #include "snd_adlib.h" #include "snd_adlibgold.h" diff --git a/src/tandy_eeprom.c b/src/tandy_eeprom.c index 593790afa..03c302a15 100644 --- a/src/tandy_eeprom.c +++ b/src/tandy_eeprom.c @@ -1,10 +1,15 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ +#include +#include +#include #include +#include #include "ibm.h" #include "device.h" #include "mem.h" +#include "rom.h" #include "io.h" #include "nvr.h" #include "tandy_eeprom.h" diff --git a/src/tandy_rom.c b/src/tandy_rom.c index aa6ffb9fb..55f78e2a4 100644 --- a/src/tandy_rom.c +++ b/src/tandy_rom.c @@ -1,7 +1,11 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ +#include +#include +#include #include +#include #include "ibm.h" #include "device.h" #include "io.h" @@ -63,8 +67,8 @@ void *tandy_rom_init(void) tandy_rom = malloc(0x80000); - f = romfopen(L"roms/machines/tandy1000sl2/8079047.hu1", L"rb"); - ff = romfopen(L"roms/machines/tandy1000sl2/8079048.hu2", L"rb"); + f = rom_fopen(L"roms/machines/tandy1000sl2/8079047.hu1", L"rb"); + ff = rom_fopen(L"roms/machines/tandy1000sl2/8079048.hu2", L"rb"); for (c = 0x0000; c < 0x80000; c += 2) { tandy_rom[c] = getc(f); diff --git a/src/timer.c b/src/timer.c index 2f3a92035..252a79274 100644 --- a/src/timer.c +++ b/src/timer.c @@ -1,13 +1,8 @@ +#include +#include +#include +#include #include "ibm.h" -#if 0 -//FIXME: Kotori, do we need to keep this? --FvK -#include "sound_opl.h" -#include "adlibgold.h" -#include "sound_pas16.h" -#include "sound_sb.h" -#include "sound_sb_dsp.h" -#include "sound_wss.h" -#endif #include "timer.h" diff --git a/src/usb.c b/src/usb.c index 58a507216..a1638b2bb 100644 --- a/src/usb.c +++ b/src/usb.c @@ -1,7 +1,10 @@ /* Copyright holders: Melissa Goad see COPYING for more details */ +#include #include +#include +#include #include "ibm.h" #include "io.h" #include "mem.h" diff --git a/src/video/vid_ati18800.c b/src/video/vid_ati18800.c index 8cbb5c9c7..8b35f435b 100644 --- a/src/video/vid_ati18800.c +++ b/src/video/vid_ati18800.c @@ -2,7 +2,11 @@ see COPYING for more details */ /*ATI 18800 emulation (VGA Edge-16)*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_ati28800.c b/src/video/vid_ati28800.c index 078ea47bf..01d43f88b 100644 --- a/src/video/vid_ati28800.c +++ b/src/video/vid_ati28800.c @@ -2,7 +2,11 @@ see COPYING for more details */ /*ATI 28800 emulation (VGA Charger)*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_ati68860_ramdac.c b/src/video/vid_ati68860_ramdac.c index f1d1d6b84..d67c90652 100644 --- a/src/video/vid_ati68860_ramdac.c +++ b/src/video/vid_ati68860_ramdac.c @@ -21,6 +21,10 @@ bit 0 Controls 6/8bit DAC. 0: 8bit DAC/LUT, 1: 6bit DAC/LUT 5-6 Always set ? 7 If set can remove "snow" in some cases (A860_Delay_L ?) ?? */ +#include +#include +#include +#include #include "../ibm.h" #include "../mem.h" #include "video.h" diff --git a/src/video/vid_ati_eeprom.c b/src/video/vid_ati_eeprom.c index e824708cb..1437919e6 100644 --- a/src/video/vid_ati_eeprom.c +++ b/src/video/vid_ati_eeprom.c @@ -1,6 +1,10 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ +#include +#include +#include +#include #include "../ibm.h" #include "../mem.h" #include "../nvr.h" diff --git a/src/video/vid_ati_mach64.c b/src/video/vid_ati_mach64.c index 824b9a11e..93ddd2a9b 100644 --- a/src/video/vid_ati_mach64.c +++ b/src/video/vid_ati_mach64.c @@ -8,14 +8,18 @@ * * ATi Mach64 graphics card emulation. * - * Version: @(#)vid_ati_mach64.c 1.0.1 2017/06/04 + * Version: @(#)vid_ati_mach64.c 1.0.2 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. - * Copyright 2016-2017 Miran Grca. + * Copyright 2016,2017 Miran Grca. */ +#include +#include +#include #include +#include #include "../ibm.h" #include "../device.h" #include "../io.h" diff --git a/src/video/vid_bt485_ramdac.c b/src/video/vid_bt485_ramdac.c index e11f69132..b53ab7bf4 100644 --- a/src/video/vid_bt485_ramdac.c +++ b/src/video/vid_bt485_ramdac.c @@ -4,6 +4,10 @@ /*Brooktree BT485 true colour RAMDAC emulation*/ /*Currently only a dummy stub for logging and passing output to the generic SVGA handler*/ #include "../ibm.h" +#include +#include +#include +#include #include "../mem.h" #include "video.h" #include "vid_svga.h" diff --git a/src/video/vid_cga.c b/src/video/vid_cga.c index 2bb16be22..04bb7837c 100644 --- a/src/video/vid_cga.c +++ b/src/video/vid_cga.c @@ -8,20 +8,23 @@ * * Emulation of the old and new IBM CGA graphics cards. * - * Version: @(#)vid_cga.c 1.0.0 2017/05/30 + * Version: @(#)vid_cga.c 1.0.2 2017/09/24 * - * Author: Sarah Walker, + * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. - * Copyright 2016-2017 Miran Grca. + * Copyright 2016,2017 Miran Grca. */ - -/*CGA emulation*/ +#include +#include +#include #include +#include #include #include "../ibm.h" #include "../io.h" #include "../mem.h" +#include "../rom.h" #include "../timer.h" #include "../device.h" #include "video.h" diff --git a/src/video/vid_cga_comp.c b/src/video/vid_cga_comp.c index 513788bec..de243e019 100644 --- a/src/video/vid_cga_comp.c +++ b/src/video/vid_cga_comp.c @@ -9,18 +9,19 @@ * IBM CGA composite filter, borrowed from reenigne's DOSBox * patch and ported to C. * - * Version: @(#)vid_cga.c 1.0.0 2017/05/30 + * Version: @(#)vid_cga.c 1.0.1 2017/09/24 * - * Author: reenigne, + * Authors: reenigne, * Miran Grca, * Copyright 2015-2017 reenigne. - * Copyright 2015-2017 Miran Grca. + * Copyright 2015,2017 Miran Grca. */ - -#include +#include #include +#include +#include +#include #include - #include "../ibm.h" #include "../device.h" #include "../mem.h" diff --git a/src/video/vid_cl_gd.c b/src/video/vid_cl_gd.c index 1d6932364..c560d213e 100644 --- a/src/video/vid_cl_gd.c +++ b/src/video/vid_cl_gd.c @@ -1,5 +1,8 @@ #include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_cl_gd_blit.c b/src/video/vid_cl_gd_blit.c index 472c1aa84..4e17e94a3 100644 --- a/src/video/vid_cl_gd_blit.c +++ b/src/video/vid_cl_gd_blit.c @@ -1,5 +1,9 @@ /*This is the CL-GD 5446 blitter, directly from QEMU*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_cl_ramdac.c b/src/video/vid_cl_ramdac.c index 340d27c88..4c1ae1801 100644 --- a/src/video/vid_cl_ramdac.c +++ b/src/video/vid_cl_ramdac.c @@ -1,3 +1,7 @@ +#include +#include +#include +#include #include "../ibm.h" #include "../mem.h" #include "../rom.h" diff --git a/src/video/vid_colorplus.c b/src/video/vid_colorplus.c index ab07127f7..0c5595912 100644 --- a/src/video/vid_colorplus.c +++ b/src/video/vid_colorplus.c @@ -1,5 +1,9 @@ /*Plantronics ColorPlus emulation*/ +#include +#include +#include #include +#include #include #include "../ibm.h" #include "../io.h" diff --git a/src/video/vid_ega.c b/src/video/vid_ega.c index 689080026..e9da11bd2 100644 --- a/src/video/vid_ega.c +++ b/src/video/vid_ega.c @@ -9,18 +9,19 @@ * Emulation of the EGA, Chips & Technologies SuperEGA, and * AX JEGA graphics cards. * - * Version: @(#)vid_ega.c 1.0.3 2017/07/21 + * Version: @(#)vid_ega.c 1.0.4 2017/09/24 * - * Author: Sarah Walker, + * Authors: Sarah Walker, * Miran Grca, * akm, * Copyright 2008-2017 Sarah Walker. - * Copyright 2016-2017 Miran Grca. - * Copyright 2017-2017 akm. + * Copyright 2016,2017 Miran Grca. */ - +#include #include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_ega_render.c b/src/video/vid_ega_render.c index 50ef6139e..8ea732ec2 100644 --- a/src/video/vid_ega_render.c +++ b/src/video/vid_ega_render.c @@ -8,15 +8,17 @@ * * EGA renderers. * - * Version: @(#)vid_ega_render.c 1.0.1 2017/06/05 + * Version: @(#)vid_ega_render.c 1.0.2 2017/09/24 * * Author: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. - * Copyright 2016-2017 Miran Grca. + * Copyright 2016,2017 Miran Grca. */ - #include +#include +#include +#include #include "../ibm.h" #include "../device.h" #include "../mem.h" diff --git a/src/video/vid_et4000.c b/src/video/vid_et4000.c index 3ea60d376..867157f75 100644 --- a/src/video/vid_et4000.c +++ b/src/video/vid_et4000.c @@ -2,7 +2,11 @@ see COPYING for more details */ /*ET4000 emulation*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_et4000w32.c b/src/video/vid_et4000w32.c index c01cf1810..6a92a0856 100644 --- a/src/video/vid_et4000w32.c +++ b/src/video/vid_et4000w32.c @@ -3,7 +3,11 @@ - Accelerator doesn't work in planar modes */ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_et4000w32i.c b/src/video/vid_et4000w32i.c index 62988adb9..ccb13adca 100644 --- a/src/video/vid_et4000w32i.c +++ b/src/video/vid_et4000w32i.c @@ -9,6 +9,10 @@ */ #if 0 +#include +#include +#include +#include #include "ibm.h" int et4k_b8000; diff --git a/src/video/vid_genius.c b/src/video/vid_genius.c index 5596d79c0..fc0d882e3 100644 --- a/src/video/vid_genius.c +++ b/src/video/vid_genius.c @@ -1,5 +1,9 @@ /* MDSI Genius VHR emulation*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_hercules.c b/src/video/vid_hercules.c index bbb8b57b6..108527719 100644 --- a/src/video/vid_hercules.c +++ b/src/video/vid_hercules.c @@ -2,9 +2,14 @@ see COPYING for more details */ /*Hercules emulation*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../mem.h" +#include "../rom.h" #include "../io.h" #include "../timer.h" #include "../device.h" diff --git a/src/video/vid_herculesplus.c b/src/video/vid_herculesplus.c index 459107d03..c747ceddd 100644 --- a/src/video/vid_herculesplus.c +++ b/src/video/vid_herculesplus.c @@ -2,11 +2,15 @@ see COPYING for more details */ /*Hercules InColor emulation*/ - +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" +#include "../rom.h" #include "../timer.h" #include "../device.h" #include "video.h" diff --git a/src/video/vid_icd2061.c b/src/video/vid_icd2061.c index 04c2db166..a2ed97f1b 100644 --- a/src/video/vid_icd2061.c +++ b/src/video/vid_icd2061.c @@ -5,6 +5,10 @@ ICD2061 clock generator emulation Used by ET4000w32/p (Diamond Stealth 32)*/ +#include +#include +#include +#include #include "../ibm.h" #include "vid_icd2061.h" diff --git a/src/video/vid_ics2595.c b/src/video/vid_ics2595.c index ffe6f504c..48ddafdb5 100644 --- a/src/video/vid_ics2595.c +++ b/src/video/vid_ics2595.c @@ -3,6 +3,10 @@ */ /*ICS2595 clock chip emulation Used by ATI Mach64*/ +#include +#include +#include +#include #include "../ibm.h" #include "vid_ics2595.h" diff --git a/src/video/vid_incolor.c b/src/video/vid_incolor.c index 636697c1a..0f7834d00 100644 --- a/src/video/vid_incolor.c +++ b/src/video/vid_incolor.c @@ -2,10 +2,15 @@ see COPYING for more details */ /*Hercules InColor emulation*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" +#include "../rom.h" #include "../timer.h" #include "../device.h" #include "video.h" diff --git a/src/video/vid_mda.c b/src/video/vid_mda.c index d9e254b3a..f857779e2 100644 --- a/src/video/vid_mda.c +++ b/src/video/vid_mda.c @@ -2,10 +2,15 @@ see COPYING for more details */ /*MDA emulation*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" +#include "../rom.h" #include "../timer.h" #include "../device.h" #include "video.h" diff --git a/src/video/vid_nv_riva128.c b/src/video/vid_nv_riva128.c index 53301a3ff..3a838154c 100644 --- a/src/video/vid_nv_riva128.c +++ b/src/video/vid_nv_riva128.c @@ -2,7 +2,11 @@ see COPYING for more details */ /*nVidia RIVA 128 emulation*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_olivetti_m24.c b/src/video/vid_olivetti_m24.c index f130c69fb..b031a8161 100644 --- a/src/video/vid_olivetti_m24.c +++ b/src/video/vid_olivetti_m24.c @@ -3,7 +3,11 @@ */ /*Olivetti M24 video emulation Essentially double-res CGA*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_oti067.c b/src/video/vid_oti067.c index 7cfa434ba..5e7edf1f7 100644 --- a/src/video/vid_oti067.c +++ b/src/video/vid_oti067.c @@ -2,7 +2,11 @@ see COPYING for more details */ /*Oak OTI067 emulation*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_paradise.c b/src/video/vid_paradise.c index 799ac8f65..43905a4f3 100644 --- a/src/video/vid_paradise.c +++ b/src/video/vid_paradise.c @@ -6,7 +6,11 @@ PC2086, PC3086 use PVGA1A MegaPC uses W90C11A */ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_pc1512.c b/src/video/vid_pc1512.c index 832bde2ea..566c99743 100644 --- a/src/video/vid_pc1512.c +++ b/src/video/vid_pc1512.c @@ -9,7 +9,11 @@ The Technical Reference Manual lists the video waitstate time as between 12 and 46 cycles. PCem currently always uses the lower number.*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_pc1640.c b/src/video/vid_pc1640.c index 2d6638ed4..b5f63d83c 100644 --- a/src/video/vid_pc1640.c +++ b/src/video/vid_pc1640.c @@ -3,7 +3,11 @@ */ /*PC1640 video emulation. Mostly standard EGA, but with CGA & Hercules emulation*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_pc200.c b/src/video/vid_pc200.c index eef181c33..38c1e5201 100644 --- a/src/video/vid_pc200.c +++ b/src/video/vid_pc200.c @@ -4,7 +4,11 @@ /*PC200 video emulation. CGA with some NMI stuff. But we don't need that as it's only used for TV and LCD displays, and we're emulating a CRT*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_pcjr.c b/src/video/vid_pcjr.c index fe587e1bc..5853cd3ee 100644 --- a/src/video/vid_pcjr.c +++ b/src/video/vid_pcjr.c @@ -1,4 +1,8 @@ +#include +#include +#include #include +#include #include #include "../ibm.h" #include "../io.h" diff --git a/src/video/vid_ps1_svga.c b/src/video/vid_ps1_svga.c index 9bb6acafc..a672503c6 100644 --- a/src/video/vid_ps1_svga.c +++ b/src/video/vid_ps1_svga.c @@ -7,7 +7,11 @@ native drivers for any operating system and there is no VBE implementation, so it's just a VGA for now. */ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_s3.c b/src/video/vid_s3.c index ecb7937b5..8163a3bac 100644 --- a/src/video/vid_s3.c +++ b/src/video/vid_s3.c @@ -1,5 +1,9 @@ /*S3 emulation*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../device.h" #include "../io.h" diff --git a/src/video/vid_s3_virge.c b/src/video/vid_s3_virge.c index 0b66093e3..efb1cc1fe 100644 --- a/src/video/vid_s3_virge.c +++ b/src/video/vid_s3_virge.c @@ -2,7 +2,11 @@ see COPYING for more details */ /*S3 ViRGE emulation*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_sc1502x_ramdac.c b/src/video/vid_sc1502x_ramdac.c index 6e2cc3839..ca080321e 100644 --- a/src/video/vid_sc1502x_ramdac.c +++ b/src/video/vid_sc1502x_ramdac.c @@ -5,6 +5,10 @@ It is possibly a Sierra 1502x It's addressed by the TLIVESA1 driver for ET4000*/ /* Note by Tenshi: Not possibly, this *IS* a Sierra 1502x. */ +#include +#include +#include +#include #include "../ibm.h" #include "../mem.h" #include "video.h" diff --git a/src/video/vid_sdac_ramdac.c b/src/video/vid_sdac_ramdac.c index 3bff85104..28ce0c931 100644 --- a/src/video/vid_sdac_ramdac.c +++ b/src/video/vid_sdac_ramdac.c @@ -3,6 +3,10 @@ */ /*87C716 'SDAC' true colour RAMDAC emulation*/ /*Misidentifies as AT&T 21C504*/ +#include +#include +#include +#include #include "../ibm.h" #include "../mem.h" #include "video.h" diff --git a/src/video/vid_stg_ramdac.c b/src/video/vid_stg_ramdac.c index 2881fff91..4fb1517a1 100644 --- a/src/video/vid_stg_ramdac.c +++ b/src/video/vid_stg_ramdac.c @@ -2,6 +2,10 @@ see COPYING for more details */ /*STG1702 true colour RAMDAC emulation*/ +#include +#include +#include +#include #include "../ibm.h" #include "../mem.h" #include "video.h" diff --git a/src/video/vid_svga.c b/src/video/vid_svga.c index 9131aa48b..bd5b76cc3 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.1 2017/09/19 + * Version: @(#)vid_svga.c 1.0.3 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, @@ -19,14 +19,18 @@ * Copyright 2016,2017 Miran Grca. */ #include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" +#include "../rom.h" +#include "../timer.h" #ifdef ENABLE_VRAM_DUMP # include "../nvr.h" #endif -#include "../timer.h" #include "video.h" #include "vid_svga.h" #include "vid_svga_render.h" diff --git a/src/video/vid_svga_render.c b/src/video/vid_svga_render.c index 7b4c0c136..3f40c7374 100644 --- a/src/video/vid_svga_render.c +++ b/src/video/vid_svga_render.c @@ -8,15 +8,17 @@ * * SVGA renderers. * - * Version: @(#)vid_svga_render.c 1.0.0 2017/05/30 + * Version: @(#)vid_svga_render.c 1.0.1 2017/09/24 * - * Author: Sarah Walker, + * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. - * Copyright 2016-2017 Miran Grca. + * Copyright 2016,2017 Miran Grca. */ - #include +#include +#include +#include #include "../ibm.h" #include "../mem.h" #include "video.h" diff --git a/src/video/vid_tandy.c b/src/video/vid_tandy.c index cf745dbdf..082e4a378 100644 --- a/src/video/vid_tandy.c +++ b/src/video/vid_tandy.c @@ -1,4 +1,8 @@ +#include +#include +#include #include +#include #include #include "../ibm.h" #include "../io.h" diff --git a/src/video/vid_tandysl.c b/src/video/vid_tandysl.c index 0c4225525..4acc53b72 100644 --- a/src/video/vid_tandysl.c +++ b/src/video/vid_tandysl.c @@ -1,7 +1,11 @@ /* Copyright holders: Sarah Walker see COPYING for more details */ +#include +#include +#include #include +#include #include #include "../ibm.h" #include "../io.h" diff --git a/src/video/vid_tgui9440.c b/src/video/vid_tgui9440.c index e13b76fa9..63fe7e749 100644 --- a/src/video/vid_tgui9440.c +++ b/src/video/vid_tgui9440.c @@ -2,7 +2,11 @@ see COPYING for more details */ /*Trident TGUI9440 emulation*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_tkd8001_ramdac.c b/src/video/vid_tkd8001_ramdac.c index 553bc489f..38d3cdde5 100644 --- a/src/video/vid_tkd8001_ramdac.c +++ b/src/video/vid_tkd8001_ramdac.c @@ -2,6 +2,10 @@ see COPYING for more details */ /*Trident TKD8001 RAMDAC emulation*/ +#include +#include +#include +#include #include "../ibm.h" #include "../mem.h" #include "video.h" diff --git a/src/video/vid_tvga.c b/src/video/vid_tvga.c index a277e0229..de78da9af 100644 --- a/src/video/vid_tvga.c +++ b/src/video/vid_tvga.c @@ -2,7 +2,11 @@ see COPYING for more details */ /*Trident TVGA (8900D) emulation*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_vga.c b/src/video/vid_vga.c index 85bf30446..b8c4212d7 100644 --- a/src/video/vid_vga.c +++ b/src/video/vid_vga.c @@ -2,7 +2,11 @@ see COPYING for more details */ /*IBM VGA emulation*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/vid_voodoo.c b/src/video/vid_voodoo.c index 91ae9ef3d..ee2c478a9 100644 --- a/src/video/vid_voodoo.c +++ b/src/video/vid_voodoo.c @@ -1,5 +1,9 @@ +#include +#include +#include +//#include #include -#include +#include #include #include "../ibm.h" #include "../cpu/cpu.h" diff --git a/src/video/vid_wy700.c b/src/video/vid_wy700.c index ef2277280..fa2cd3658 100644 --- a/src/video/vid_wy700.c +++ b/src/video/vid_wy700.c @@ -1,5 +1,9 @@ /* Wyse-700 emulation*/ +#include +#include +#include #include +#include #include "../ibm.h" #include "../io.h" #include "../mem.h" diff --git a/src/video/video.c b/src/video/video.c index f5cf8ea47..dcfff2ebd 100644 --- a/src/video/video.c +++ b/src/video/video.c @@ -1,8 +1,11 @@ /* Copyright holders: Sarah Walker, Tenshi see COPYING for more details */ -#include #include +#include +#include +#include +#include #include #include #include "../ibm.h" @@ -376,7 +379,7 @@ PALETTE cgapal; void loadfont(wchar_t *s, int format) { - FILE *f=romfopen(s,L"rb"); + FILE *f=rom_fopen(s,L"rb"); int c,d; if (!f) { diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 74b7c6c61..bf95429d8 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -8,7 +8,7 @@ * * Windows resource script. * - * Version: @(#)86Box.rc 1.0.9 2017/09/07 + * Version: @(#)86Box.rc 1.0.10 2017/09/23 * * Authors: Miran Grca, * Fred N. van Kempen, @@ -45,8 +45,12 @@ BEGIN POPUP "&Action" BEGIN MENUITEM "&Hard Reset", IDM_ACTION_HRESET + MENUITEM SEPARATOR MENUITEM "&Ctrl+Alt+Del\tCtrl+F12", IDM_ACTION_RESET_CAD - MENUITEM "Ctrl+Alt+&Esc", IDM_ACTION_CTRL_ALT_ESC + MENUITEM SEPARATOR + MENUITEM "Ctrl+Alt+&Esc", IDM_ACTION_CTRL_ALT_ESC + MENUITEM SEPARATOR + MENUITEM "&Pause", IDM_ACTION_PAUSE MENUITEM SEPARATOR MENUITEM "E&xit", IDM_ACTION_EXIT END @@ -57,43 +61,43 @@ BEGIN MENUITEM SEPARATOR POPUP "Re&nderer" BEGIN - MENUITEM "&DirectDraw", IDM_VID_DDRAW - MENUITEM "Direct&3D 9", IDM_VID_D3D + MENUITEM "&DirectDraw", IDM_VID_DDRAW + MENUITEM "Direct&3D 9", IDM_VID_D3D END MENUITEM SEPARATOR POPUP "&Window scale factor" BEGIN - MENUITEM "&0.5x", IDM_VID_SCALE_1X - MENUITEM "&1x", IDM_VID_SCALE_2X - MENUITEM "1.&5x", IDM_VID_SCALE_3X - MENUITEM "&2x", IDM_VID_SCALE_4X + MENUITEM "&0.5x", IDM_VID_SCALE_1X + MENUITEM "&1x", IDM_VID_SCALE_2X + MENUITEM "1.&5x", IDM_VID_SCALE_3X + MENUITEM "&2x", IDM_VID_SCALE_4X END MENUITEM SEPARATOR MENUITEM "&Fullscreen\tCtrl+Alt+PageUP", IDM_VID_FULLSCREEN POPUP "Fullscreen &stretch mode" BEGIN - MENUITEM "&Full screen stretch", IDM_VID_FS_FULL - MENUITEM "&4:3", IDM_VID_FS_43 - MENUITEM "&Square pixels", IDM_VID_FS_SQ - MENUITEM "&Integer scale", IDM_VID_FS_INT + MENUITEM "&Full screen stretch", IDM_VID_FS_FULL + MENUITEM "&4:3", IDM_VID_FS_43 + MENUITEM "&Square pixels", IDM_VID_FS_SQ + MENUITEM "&Integer scale", IDM_VID_FS_INT END POPUP "E&GA/(S)VGA settings" BEGIN - MENUITEM "&Inverted VGA monitor", IDM_VID_INVERT - MENUITEM "E&GA/(S)VGA overscan", IDM_VID_OVERSCAN + MENUITEM "&Inverted VGA monitor", IDM_VID_INVERT + MENUITEM "E&GA/(S)VGA overscan", IDM_VID_OVERSCAN POPUP "VGA screen &type" BEGIN - MENUITEM "RGB &Color", IDM_VID_GRAY_RGB - MENUITEM "&RGB Grayscale", IDM_VID_GRAY_MONO - MENUITEM "&Amber monitor", IDM_VID_GRAY_AMBER - MENUITEM "&Green monitor", IDM_VID_GRAY_GREEN - MENUITEM "&White monitor", IDM_VID_GRAY_WHITE + MENUITEM "RGB &Color", IDM_VID_GRAY_RGB + MENUITEM "&RGB Grayscale", IDM_VID_GRAY_MONO + MENUITEM "&Amber monitor", IDM_VID_GRAY_AMBER + MENUITEM "&Green monitor", IDM_VID_GRAY_GREEN + MENUITEM "&White monitor", IDM_VID_GRAY_WHITE END POPUP "Grayscale &conversion type" BEGIN - MENUITEM "BT&601 (NTSC/PAL)", IDM_VID_GRAYCT_601 - MENUITEM "BT&709 (HDTV)", IDM_VID_GRAYCT_709 - MENUITEM "&Average", IDM_VID_GRAYCT_AVE + MENUITEM "BT&601 (NTSC/PAL)", IDM_VID_GRAYCT_601 + MENUITEM "BT&709 (HDTV)", IDM_VID_GRAYCT_709 + MENUITEM "&Average", IDM_VID_GRAYCT_AVE END END MENUITEM SEPARATOR @@ -193,6 +197,7 @@ BEGIN VK_PRIOR,IDM_VID_FULLSCREEN, VIRTKEY, CONTROL , ALT VK_F11, IDM_ACTION_SCREENSHOT, VIRTKEY, CONTROL VK_F12, IDM_ACTION_RESET_CAD, VIRTKEY, CONTROL + VK_PAUSE,IDM_ACTION_PAUSE END diff --git a/src/win/resource.h b/src/win/resource.h index f0b54be18..54b22209d 100644 --- a/src/win/resource.h +++ b/src/win/resource.h @@ -11,7 +11,7 @@ * NOTE: FIXME: Strings 2176 and 2193 are same. * NOTE: FIXME: string 2095 not in use. * - * Version: @(#)resource.h 1.0.5 2017/08/24 + * Version: @(#)resource.h 1.0.6 2017/09/23 * * Authors: Sarah Walker, * Miran Grca, @@ -417,6 +417,7 @@ #define IDM_ACTION_RESET_CAD 40013 #define IDM_ACTION_EXIT 40014 #define IDM_ACTION_CTRL_ALT_ESC 40015 +#define IDM_ACTION_PAUSE 40016 #define IDM_CONFIG 40020 #define IDM_CONFIG_LOAD 40021 #define IDM_CONFIG_SAVE 40022 diff --git a/src/win/win.c b/src/win/win.c index 63065d2e9..bcb77bb1e 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -8,7 +8,7 @@ * * The Emulator's Windows core. * - * Version: @(#)win.c 1.0.9 2017/09/19 + * Version: @(#)win.c 1.0.11 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, @@ -16,10 +16,19 @@ * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ -#include +#define UNICODE +#define BITMAP WINDOWS_BITMAP +#include +#include +#include +#include +#include +#undef BITMAP #include -#include +#include #include +#include +#include #include "../86box.h" #include "../config.h" #include "../cpu/cpu.h" @@ -60,11 +69,6 @@ #include "win_d3d.h" #include "win_language.h" -#include -#include -#include -#include - #ifndef MAPVK_VK_TO_VSC #define MAPVK_VK_TO_VSC 0 @@ -86,6 +90,7 @@ typedef struct win_event_t HANDLE handle; } win_event_t; +static wchar_t wTitle[512]; LONG_PTR OriginalStatusBarProcedure; HWND ghwnd; HINSTANCE hinstance; @@ -102,7 +107,6 @@ HANDLE slirpMutex; HANDLE mainthreadh; int infocus=1; int drawits=0; -int romspresent[ROM_MAX]; int quited=0; RECT oldclip; int mousecapture=0; @@ -594,9 +598,14 @@ void get_executable_name(wchar_t *s, int size) void set_window_title(wchar_t *s) { - if (video_fullscreen) - return; - SetWindowText(ghwnd, s); + if (! video_fullscreen) { + if (s != NULL) + wcscpy(wTitle, s); + else + s = wTitle; + + SetWindowText(ghwnd, s); + } } uint64_t timer_read(void) @@ -1715,6 +1724,8 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz hwndRender = CreateWindow(L"STATIC", NULL, WS_VISIBLE | WS_CHILD | SS_BITMAP, 0, 0, 1, 1, ghwnd, NULL, hinstance, NULL); + +/* FIXME: Kotori, code below should be moved to pc.c, as its not Win specific. */ initpc(argc, argv); init_cdrom_host_drives(); @@ -1749,34 +1760,32 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz reset_menus(); - d=romset; +/* FIXME: Kotori, code below should be moved to pc.c, its not Win specific. */ + d = 0; for (c=0;c * Miran Grca, * Copyright 2008-2017 Sarah Walker. - * Copyright 2016-2017 Miran Grca. + * Copyright 2016,2017 Miran Grca. */ +#include +#include +#include +#include #include "../ibm.h" #include "../config.h" #include "../device.h" diff --git a/src/win/win_dynld.c b/src/win/win_dynld.c index 42b245fc5..e6b5571ef 100644 --- a/src/win/win_dynld.c +++ b/src/win/win_dynld.c @@ -8,17 +8,18 @@ * * Try to load a support DLL. * - * Version: @(#)win_dynld.c 1.0.2 2017/05/24 + * Version: @(#)win_dynld.c 1.0.3 2017/09/24 * * Author: Fred N. van Kempen, * Copyright 2017 Fred N. van Kempen */ -#include -#include #include -#include +#include #include +#include +#include #include +#include #include "plat_dynld.h" #include "../ibm.h" diff --git a/src/win/win_iodev.c b/src/win/win_iodev.c index 25f6af567..2365bc99d 100644 --- a/src/win/win_iodev.c +++ b/src/win/win_iodev.c @@ -8,7 +8,7 @@ * * Windows IO device menu handler. * - * Version: @(#)win_iodev.c 1.0.2 2017/09/19 + * Version: @(#)win_iodev.c 1.0.3 2017/09/24 * * Author: Miran Grca, * Copyright 2016,2017 Miran Grca. @@ -23,11 +23,12 @@ #include #include #include -#include #include -#include -#include #include +#include +#include +#include +#include #include "../ibm.h" #include "../config.h" #include "../device.h" diff --git a/src/win/win_joystick.cc b/src/win/win_joystick.cc index 91c2138b0..e7525f09a 100644 --- a/src/win/win_joystick.cc +++ b/src/win/win_joystick.cc @@ -8,14 +8,13 @@ * * Joystick interface to host device. * - * Version: @(#)win_joystick.cc 1.0.0 2017/05/30 + * Version: @(#)win_joystick.cc 1.0.1 2017/09/24 * - * Author: Sarah Walker, + * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. - * Copyright 2016-2017 Miran Grca. + * Copyright 2016,2017 Miran Grca. */ - #define DIRECTINPUT_VERSION 0x0800 #include #include diff --git a/src/win/win_joystickconfig.c b/src/win/win_joystickconfig.c index 3cd5a0c68..c39406f15 100644 --- a/src/win/win_joystickconfig.c +++ b/src/win/win_joystickconfig.c @@ -5,7 +5,10 @@ #include #include #undef BITMAP - +#include +#include +#include +#include #include "../ibm.h" #include "../config.h" #include "../device.h" diff --git a/src/win/win_keyboard.c b/src/win/win_keyboard.c index e7b847f7d..4bf2203d6 100644 --- a/src/win/win_keyboard.c +++ b/src/win/win_keyboard.c @@ -8,7 +8,7 @@ * * Windows raw keyboard input handler. * - * Version: @(#)win_d3d.cc 1.0.0 2017/05/30 + * Version: @(#)win_d3d.cc 1.0.1 2017/09/24 * * Author: Miran Grca, * Copyright 2016-2017 Miran Grca. @@ -20,7 +20,6 @@ #include #include #undef BITMAP - #include #include #include @@ -29,12 +28,11 @@ #include #include #include - #include "../device.h" #include "plat_keyboard.h" - #include "win.h" + #ifndef MAPVK_VK_TO_VSC #define MAPVK_VK_TO_VSC 0 #endif @@ -208,4 +206,4 @@ void process_raw_input(LPARAM lParam, int infocus) } free(raw); -} \ No newline at end of file +} diff --git a/src/win/win_language.c b/src/win/win_language.c index 4c0d761b3..37407b5ca 100644 --- a/src/win/win_language.c +++ b/src/win/win_language.c @@ -8,23 +8,25 @@ * * Windows localization core. * - * Version: @(#)win_language.c 1.0.1 2017/08/24 + * Version: @(#)win_language.c 1.0.2 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. * Copyright 2016,2017 Miran Grca. */ -#include +//#include #define UNICODE #define BITMAP WINDOWS_BITMAP #include #include #include #undef BITMAP - #include - +#include +#include +#include +#include #include "../ibm.h" #include "../device.h" #include "plat_ui.h" diff --git a/src/win/win_midi.c b/src/win/win_midi.c index 2c3e3eded..a01d0cd9d 100644 --- a/src/win/win_midi.c +++ b/src/win/win_midi.c @@ -1,5 +1,9 @@ #include #include +#include +#include +#include +#include #include "../ibm.h" #include "../config.h" #include "../sound/midi.h" diff --git a/src/win/win_mouse.cc b/src/win/win_mouse.cc index 0cb82df2f..245fd0d61 100644 --- a/src/win/win_mouse.cc +++ b/src/win/win_mouse.cc @@ -8,12 +8,12 @@ * * Mouse interface to host device. * - * Version: @(#)win_mouse.cc 1.0.1 2017/06/21 + * Version: @(#)win_mouse.cc 1.0.2 2017/09/24 * * Authors: Sarah Walker, * Miran Grca, * Copyright 2008-2017 Sarah Walker. - * Copyright 2016-2017 Miran Grca. + * Copyright 2016,2017 Miran Grca. */ #define DIRECTINPUT_VERSION 0x0800 #include diff --git a/src/win/win_opendir.c b/src/win/win_opendir.c index 00347a365..941a07a9c 100644 --- a/src/win/win_opendir.c +++ b/src/win/win_opendir.c @@ -10,7 +10,7 @@ * * Based on old original code @(#)dir_win32.c 1.2.0 2007/04/19 * - * Version: @(#)win_opendir.c 1.0.1 2017/05/17 + * Version: @(#)win_opendir.c 1.0.2 2017/09/24 * * Author: Fred N. van Kempen, * Copyright 1998-2007 MicroWalt Corporation @@ -19,10 +19,11 @@ #define UNICODE #include #include -#include #include -#include +#include #include +#include +#include #include "../ibm.h" #include "plat_dir.h" diff --git a/src/win/win_settings.c b/src/win/win_settings.c index ba4e367c3..29b775a4a 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -8,7 +8,7 @@ * * Windows 86Box Settings dialog handler. * - * Version: @(#)win_settings.c 1.0.11 2017/09/19 + * Version: @(#)win_settings.c 1.0.13 2017/09/24 * * Author: Miran Grca, * Copyright 2016,2017 Miran Grca. @@ -18,13 +18,17 @@ #include #include #undef BITMAP - #include #include +#include +#include +#include +#include #include "../ibm.h" #include "../config.h" #include "../cpu/cpu.h" #include "../mem.h" +#include "../rom.h" #include "../device.h" #include "../nvr.h" #include "../machine/machine.h" @@ -361,7 +365,7 @@ static void win_settings_save(void) memcpy(cdrom_drives, temp_cdrom_drives, CDROM_NUM * sizeof(cdrom_drive_t)); mem_resize(); - loadbios(); + rom_load_bios(romset); update_status_bar_panes(hwndStatus); diff --git a/src/win/win_status.c b/src/win/win_status.c index 0a0fc659c..d77c0bd6d 100644 --- a/src/win/win_status.c +++ b/src/win/win_status.c @@ -5,7 +5,10 @@ #include #include #undef BITMAP - +#include +#include +#include +#include #include "../ibm.h" #include "../mem.h" #include "../cpu/x86_ops.h"