Another major cleanup - folders for cdrom and floppy, renamed disc to floppy, renamed SuperIO stuff, others as needed.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# Modified Makefile for Win32 (MinGW32) environment.
|
||||
#
|
||||
# Version: @(#)Makefile.mingw 1.0.42 2017/09/02
|
||||
# Version: @(#)Makefile.mingw 1.0.43 2017/09/03
|
||||
#
|
||||
# Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
# Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -83,8 +83,8 @@ endif
|
||||
#########################################################################
|
||||
# Nothing should need changing from here on.. #
|
||||
#########################################################################
|
||||
VPATH = . cpu \
|
||||
hdd machine \
|
||||
VPATH = $(EXPATH) . cpu \
|
||||
cdrom floppy hdd machine \
|
||||
sound \
|
||||
sound/munt sound/munt/c_interface sound/munt/sha1 \
|
||||
sound/munt/srchelper \
|
||||
@@ -101,6 +101,9 @@ endif
|
||||
WINDRES = windres.exe
|
||||
|
||||
OPTS = -DWIN32 -I$(PLAT) $(EXTRAS) $(STUFF)
|
||||
ifdef EXFLAGS
|
||||
OPTS += $(EXFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(X64), y)
|
||||
ifeq ($(OPTIM), y)
|
||||
@@ -157,16 +160,17 @@ CFLAGS += -DUSE_NETWORK
|
||||
RFLAGS += -DUSE_NETWORK
|
||||
endif
|
||||
ifeq ($(X64), y)
|
||||
PLATCG = codegen_x86-64.o
|
||||
CGOPS = codegen_ops_x86-64.h
|
||||
VCG = vid_voodoo_codegen_x86-64.h
|
||||
PLATCG = codegen_x86-64.o
|
||||
CGOPS = codegen_ops_x86-64.h
|
||||
VCG = vid_voodoo_codegen_x86-64.h
|
||||
else
|
||||
PLATCG = codegen_x86.o
|
||||
CGOPS = codegen_ops_x86.h
|
||||
VCG = vid_voodoo_codegen_x86.h
|
||||
PLATCG = codegen_x86.o
|
||||
CGOPS = codegen_ops_x86.h
|
||||
VCG = vid_voodoo_codegen_x86.h
|
||||
endif
|
||||
|
||||
|
||||
# Options for the DEV branch.
|
||||
ifeq ($(DEV_BRANCH), y)
|
||||
CFLAGS += -DDEV_BRANCH
|
||||
ifeq ($(CIRRUS), y)
|
||||
@@ -180,19 +184,20 @@ CFLAGS += -DUSE_PAS16
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(WALTJE), y)
|
||||
OPENDIR = win_opendir.o
|
||||
SERIAL = serial.o
|
||||
WSERIAL = win_serial.o
|
||||
WFLAGS = -DWALTJE
|
||||
else
|
||||
SERIAL = serial_old.o
|
||||
# Options for works-in-progress.
|
||||
ifndef SERIAL
|
||||
SERIAL = serial.o
|
||||
endif
|
||||
ifndef EUROPC
|
||||
EUROPC = machine_europc.o
|
||||
endif
|
||||
|
||||
|
||||
MAINOBJ = pc.o config.o device.o timer.o dma.o io.o nmi.o pic.o \
|
||||
mca.o mcr.o pit.o ppi.o pci.o sio.o intel.o rom.o mem.o \
|
||||
memregs.o intel_flash.o rtc.o nvr.o ps2_nvr.o
|
||||
MAINOBJ = pc.o config.o random.o timer.o io.o dma.o nmi.o pic.o pit.o \
|
||||
ppi.o pci.o mca.o mcr.o mem.o memregs.o rom.o \
|
||||
device.o rtc.o nvr.o nvr_ps2.o \
|
||||
intel.o intel_flash.o intel_sio.o
|
||||
|
||||
CPUOBJ = cpu.o 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o \
|
||||
codegen.o \
|
||||
codegen_ops.o \
|
||||
@@ -200,10 +205,10 @@ CPUOBJ = cpu.o 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o \
|
||||
codegen_timing_686.o codegen_timing_pentium.o \
|
||||
codegen_timing_winchip.o $(PLATCG) \
|
||||
x86seg.o x87.o
|
||||
|
||||
MACHINEOBJ = machine.o \
|
||||
machine_common.o \
|
||||
machine_amstrad.o \
|
||||
machine_europc.o \
|
||||
machine_amstrad.o $(EUROPC) \
|
||||
machine_olivetti_m24.o \
|
||||
machine_pcjr.o \
|
||||
machine_tandy.o \
|
||||
@@ -219,23 +224,27 @@ MACHINEOBJ = machine.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 \
|
||||
fdc37c665.o fdc37c669.o fdc37c932fr.o \
|
||||
pc87306.o w83877f.o um8669f.o \
|
||||
sio_detect.o \
|
||||
sio_fdc37c665.o sio_fdc37c669.o sio_fdc37c932fr.o \
|
||||
sio_pc87306.o sio_w83877f.o sio_um8669f.o \
|
||||
keyboard.o \
|
||||
keyboard_xt.o keyboard_at.o keyboard_pcjr.o \
|
||||
keyboard_amstrad.o keyboard_olim24.o \
|
||||
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 \
|
||||
fdd.o fdc.o fdi2raw.o \
|
||||
disc.o \
|
||||
disc_86f.o disc_fdi.o disc_imd.o disc_img.o \
|
||||
disc_random.o disc_td0.o \
|
||||
cdrom.o \
|
||||
mouse.o mouse_serial.o mouse_ps2.o mouse_bus.o
|
||||
|
||||
FDDOBJ = fdd.o fdc.o fdi2raw.o \
|
||||
floppy.o \
|
||||
floppy_86f.o floppy_fdi.o floppy_imd.o floppy_img.o floppy_td0.o
|
||||
|
||||
CDROMOBJ= cdrom.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
|
||||
@@ -326,9 +335,13 @@ RIVAOBJ = vid_nv_riva128.o
|
||||
endif
|
||||
DEVBRANCHOBJ = $(CIRRUSOBJ) $(RIVAOBJ)
|
||||
endif
|
||||
OBJ = $(MAINOBJ) $(CPUOBJ) $(MACHINEOBJ) $(HDDOBJ) $(DEVOBJ) \
|
||||
OBJ = $(MAINOBJ) $(CPUOBJ) $(MACHINEOBJ) $(DEVOBJ) \
|
||||
$(FDDOBJ) $(CDROMOBJ) $(HDDOBJ) \
|
||||
$(USBOBJ) $(NETOBJ) $(SCSIOBJ) $(SNDOBJ) $(VIDOBJ) \
|
||||
$(WINOBJ) $(DEVBRANCHOBJ)
|
||||
ifdef EXOBJ
|
||||
OBJ += $(EXOBJ)
|
||||
endif
|
||||
|
||||
LZFOBJ = lzf_c.o lzf_d.o
|
||||
|
||||
@@ -389,175 +402,9 @@ pcap_if.res: pcap_if.rc
|
||||
|
||||
|
||||
# Module dependencies.
|
||||
bugger.o: ibm.h io.h bugger.h
|
||||
386.o: ibm.h cpu/cpu.h cpu/x86.h cpu/x87.h mem.h floppy.h fdc.h pic.h timer.h cpu/386_common.h
|
||||
|
||||
cdrom.o: 86box.h cdrom.h ibm.h hdd/hdd_ide_at.h piix.h scsi/scsi.h timer.h \
|
||||
win/plat_iodev.h
|
||||
|
||||
cdrom_dosbox.o: cdrom_dosbox.h
|
||||
|
||||
cdrom_image.o: config.h cdrom_dosbox.h cdrom.h cdrom_image.h cdrom_null.h
|
||||
|
||||
cdrom_ioctl.o: ibm.h cdrom.h cdrom_ioctl.h scsi/scsi.h
|
||||
|
||||
cdrom_null.o: ibm.h cdrom.h cdrom_ioctl.h
|
||||
|
||||
config.o: cdrom.h config.h device.h disc.h fdc.h fdd.h ibm.h \
|
||||
cpu/cpu.h gameport.h hdd/hdd_ide_at.h hdd/hdd.h machine/machine.h \
|
||||
mouse.h network/network.h nvr.h scsi/scsi.h win/plat_joystick.h \
|
||||
win/plat_midi.h sound/snd_dbopl.h sound/snd_mpu401.h \
|
||||
sound/snd_opl.h sound/sound.h video/video.h win/win.h \
|
||||
win/resource.h win/win_language.h
|
||||
|
||||
device.o: ibm.h cpu/cpu.h config.h device.h machine/machine.h sound/sound.h
|
||||
|
||||
disc.o: ibm.h config.h disc.h disc_fdi.h disc_img.h disc_86f.h \
|
||||
disc_td0.h disc_imd.h fdc.h fdd.h timer.h
|
||||
|
||||
disc_86f.o: lzf/lzf.h config.h dma.h disc.h disc_86f.h disc_random.h \
|
||||
fdc.h fdd.h ibm.h
|
||||
|
||||
disc_fdi.o: ibm.h disc.h disc_img.h disc_fdi.h fdc.h fdd.h fdi2raw.h \
|
||||
disc.h disc_imd.h fdc.h fdd.h config.h disc.h disc_img.h \
|
||||
fdc.h fdd.h
|
||||
|
||||
disc_random.o: disc_random.h
|
||||
|
||||
disc_td0.o: ibm.h disc.h disc_td0.h fdc.h fdd.h
|
||||
|
||||
dma.o: ibm.h cpu/x86.h mem.h io.h dma.h
|
||||
|
||||
fdc.o: ibm.h disc.h dma.h fdc.h fdd.h io.h pic.h timer.h
|
||||
|
||||
fdc37c665.o: ibm.h disc.h fdc.h fdd.h hdd/hdd_ide_at.h io.h lpt.h serial.h \
|
||||
fdc37c665.h disc.h fdc.h fdd.h io.h hdd/hdd_ide_at.h \
|
||||
lpt.h serial.h fdc37c669.h
|
||||
|
||||
fdc37c932fr.o: ibm.h disc.h fdc.h fdd.h hdd/hdd_ide_at.h io.h lpt.h \
|
||||
serial.h fdc37c932fr.h
|
||||
|
||||
fdd.o: ibm.h disc.h fdc.h fdd.h
|
||||
|
||||
fdi2raw.o: fdi2raw.h ibm.h
|
||||
|
||||
gameport.o: ibm.h cpu/cpu.h device.h io.h timer.h gameport.h \
|
||||
joystick_ch_flightstick_pro.h joystick_standard.h \
|
||||
joystick_sw_pad.h joystick_tm_fcs.h plat_joystick.h
|
||||
|
||||
intel.o: ibm.h cpu/cpu.h io.h mem.h pit.h timer.h intel.h
|
||||
|
||||
intel_flash.o: ibm.h cpu/cpu.h device.h mem.h machine/machine.h rom.h
|
||||
|
||||
io.o: ibm.h io.h
|
||||
|
||||
joystick_ch_flightstick_pro.o: ibm.h device.h timer.h gameport.h \
|
||||
joystick_standard.h plat_joystick.h
|
||||
|
||||
joystick_standard.o: ibm.h device.h timer.h gameport.h \
|
||||
joystick_standard.h plat_joystick.h
|
||||
|
||||
joystick_sw_pad.o: ibm.h device.h timer.h gameport.h \
|
||||
joystick_sw_pad.h plat_joystick.h
|
||||
|
||||
joystick_tm_fcs.o: ibm.h device.h timer.h gameport.h \
|
||||
joystick_standard.h plat_joystick.h
|
||||
|
||||
keyboard.o: ibm.h plat_keyboard.h keyboard.h
|
||||
|
||||
keyboard_amstrad.o: ibm.h io.h mem.h pic.h pit.h timer.h sound/sound.h \
|
||||
sound/snd_speaker.h keyboard.h keyboard_amstrad.h
|
||||
|
||||
keyboard_at.o: ibm.h io.h mem.h pic.h pit.h timer.h disc.h fdc.h \
|
||||
sound/sound.h sound/snd_speaker.h keyboard.h keyboard_at.h
|
||||
|
||||
keyboard_olim24.o: ibm.h io.h mem.h pic.h pit.h timer.h mouse.h \
|
||||
sound/sound.h sound/snd_speaker.h keyboard.h keyboard_olim24.h
|
||||
|
||||
keyboard_pcjr.o: ibm.h io.h mem.h nmi.h pic.h pit.h timer.h \
|
||||
device.h sound/sound.h sound/snd_speaker.h \
|
||||
sound/snd_sn76489.h keyboard.h keyboard_pcjr.h
|
||||
|
||||
keyboard_xt.o: ibm.h io.h mem.h pic.h pit.h timer.h device.h tandy_eeprom.h \
|
||||
sound/sound.h sound/snd_speaker.h keyboard.h keyboard_xt.h
|
||||
|
||||
lpt.o: ibm.h io.h lpt.h sound/snd_lpt_dac.h sound/snd_lpt_dss.h
|
||||
|
||||
mca.o: ibm.h io.h mem.h mca.h
|
||||
|
||||
mcr.o: ibm.h
|
||||
|
||||
mem.o: ibm.h cpu/cpu.h cpu/x86_ops.h cpu/x86.h config.h \
|
||||
io.h mem.h rom.h cpu/codegen.h video/video.h
|
||||
|
||||
memregs.o: ibm.h io.h memregs.h
|
||||
|
||||
mouse.o: ibm.h cpu/cpu.h device.h machine/machine.h mouse.h \
|
||||
keyboard_olim24.h
|
||||
|
||||
mouse_bus.o: ibm.h io.h pic.h timer.h mouse.h
|
||||
|
||||
mouse_ps2.o: ibm.h keyboard_at.h mouse.h plat_mouse.h
|
||||
|
||||
mouse_serial.o: ibm.h timer.h serial.h mouse.h
|
||||
|
||||
nmi.o: ibm.h io.h nmi.h
|
||||
|
||||
nvr.o: ibm.h cpu/cpu.h device.h io.h mem.h machine/machine.h \
|
||||
machine/machine_europc.h nvr.h pic.h rom.h timer.h rtc.h
|
||||
|
||||
pc.o: 86box.h ibm.h mem.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 \
|
||||
disc.h disc_86f.h disc_fdi.h disc_imd.h disc_img.h disc_td0.h \
|
||||
disc_random.h config.h fdc.h fdd.h gameport.h plat_joystick.h \
|
||||
plat_midi.h hdd/hdd.h hdd/hdd_ide_at.h cdrom.h cdrom_ioctl.h \
|
||||
cdrom_image.h cdrom_null.h scsi/scsi.h keyboard.h plat_keyboard.h \
|
||||
keyboard_at.h mouse.h plat_mouse.h network/network.h serial.h \
|
||||
sound/sound.h sound/snd_cms.h sound/snd_dbopl.h \
|
||||
sound/snd_mpu401.h sound/snd_opl.h sound/snd_gus.h \
|
||||
sound/snd_sb.h sound/snd_speaker.h sound/snd_ssi2001.h \
|
||||
video/video.h video/vid_voodoo.h win/plat_ui.h
|
||||
|
||||
pc87306.o: ibm.h disc.h fdc.h fdd.h hdd/hdd_ide_at.h io.h lpt.h serial.h \
|
||||
pc87306.h
|
||||
|
||||
pci.o: ibm.h cdrom.h disc.h fdc.h hdd/hdd_ide_at.h io.h keyboard_at.h mem.h pic.h pci.h
|
||||
|
||||
pic.o: ibm.h io.h pic.h pit.h
|
||||
|
||||
piix.o: ibm.h dma.h hdd/hdd_ide_at.h io.h mem.h pci.h piix.h
|
||||
|
||||
pit.o: ibm.h cpu/cpu.h dma.h io.h pic.h pit.h device.h timer.h \
|
||||
machine/machine.h sound/snd_speaker.h video/video.h
|
||||
|
||||
ppi.o: ibm.h pit.h plat_keyboard.h plat_mouse.h
|
||||
|
||||
ps2_nvr.o: ibm.h device.h io.h mem.h rom.h ps2_nvr.h
|
||||
|
||||
rom.o: config.h ibm.h mem.h rom.h
|
||||
|
||||
rtc.o: nvr.h rtc.h
|
||||
|
||||
serial.o: ibm.h io.h pic.h timer.h serial.h plat_serial.h
|
||||
|
||||
serial_old.o: ibm.h io.h mouse.h pic.h serial.h timer.h
|
||||
|
||||
sio.o: ibm.h dma.h mem.h pci.h sio.h
|
||||
|
||||
superio_detect.o: ibm.h io.h disc.h fdd.h fdc.h superio_detect.h
|
||||
|
||||
tandy_eeprom.o: ibm.h device.h mem.h io.h rom.h tandy_eeprom.h
|
||||
|
||||
tandy_rom.o: ibm.h device.h io.h mem.h rom.h tandy_rom.h
|
||||
|
||||
timer.o: ibm.h timer.h
|
||||
|
||||
usb.o: ibm.h io.h mem.h usb.h
|
||||
|
||||
w83877f.o: ibm.h disc.h fdc.h fdd.h io.h lpt.h serial.h w83877f.h
|
||||
|
||||
386.o: ibm.h cpu/cpu.h cpu/x86.h cpu/x87.h mem.h disc.h fdc.h pic.h timer.h cpu/386_common.h
|
||||
|
||||
386_dynarec.o: ibm.h cpu/cpu.h cpu/x86.h cpu/x86_ops.h cpu/x87.h mem.h cpu/codegen.h disc.h fdc.h pic.h timer.h cpu/386_common.h \
|
||||
386_dynarec.o: ibm.h cpu/cpu.h cpu/x86.h cpu/x86_ops.h cpu/x87.h mem.h cpu/codegen.h floppy.h fdc.h pic.h timer.h cpu/386_common.h \
|
||||
cpu/x86_ops.h cpu/x86seg.h cpu/x86_ops_arith.h cpu/x86_ops_atomic.h cpu/x86_ops_bcd.h cpu/x86_ops_bit.h \
|
||||
cpu/x86_ops_bitscan.h cpu/x86_ops_call.h cpu/x86_ops_flag.h cpu/x86_ops_fpu.h cpu/x86_ops_inc_dec.h cpu/x86_ops_int.h \
|
||||
cpu/x86_ops_io.h cpu/x86_ops_jump.h cpu/x86_ops_misc.h \
|
||||
@@ -611,9 +458,54 @@ x86seg.o: ibm.h mem.h nvr.h cpu/x86.h cpu/386.h cpu/386_common.h cpu/cpu.h
|
||||
|
||||
x87.o: ibm.h pic.h cpu/x86.h cpu/x86_flags.h cpu/x86_ops.h cpu/x87.h cpu/386_common.h
|
||||
|
||||
bugger.o: ibm.h io.h bugger.h
|
||||
|
||||
cdrom.o: 86box.h cdrom.h ibm.h hdd/hdd_ide_at.h piix.h scsi/scsi.h timer.h \
|
||||
win/plat_iodev.h
|
||||
|
||||
cdrom_dosbox.o: cdrom_dosbox.h
|
||||
|
||||
cdrom_image.o: config.h cdrom_dosbox.h cdrom.h cdrom_image.h cdrom_null.h
|
||||
|
||||
cdrom_ioctl.o: ibm.h cdrom.h cdrom_ioctl.h scsi/scsi.h
|
||||
|
||||
cdrom_null.o: ibm.h cdrom.h cdrom_ioctl.h
|
||||
|
||||
config.o: cdrom.h config.h device.h floppy/floppy.h floppy/fdc.h floppy/fdd.h ibm.h \
|
||||
cpu/cpu.h gameport.h hdd/hdd_ide_at.h hdd/hdd.h machine/machine.h \
|
||||
mouse.h network/network.h nvr.h scsi/scsi.h win/plat_joystick.h \
|
||||
win/plat_midi.h sound/snd_dbopl.h sound/snd_mpu401.h \
|
||||
sound/snd_opl.h sound/sound.h video/video.h win/win.h \
|
||||
win/resource.h win/win_language.h
|
||||
|
||||
device.o: ibm.h cpu/cpu.h config.h device.h machine/machine.h sound/sound.h
|
||||
|
||||
dma.o: ibm.h cpu/x86.h mem.h io.h dma.h
|
||||
|
||||
floppy.o: ibm.h config.h floppy.h floppy_fdi.h fdc.h fdd.h timer.h \
|
||||
floppy_img.h floppy_86f.h floppy_td0.h floppy_imd.h
|
||||
|
||||
floppy_86f.o: lzf/lzf.h config.h dma.h random.h floppy.h floppy_86f.h \
|
||||
fdc.h fdd.h ibm.h
|
||||
|
||||
floppy_fdi.o: ibm.h floppy.h floppy_img.h floppy_fdi.h fdc.h fdd.h fdi2raw.h \
|
||||
floppy.h floppy_imd.h fdc.h fdd.h config.h floppy_img.h
|
||||
|
||||
floppy_td0.o: ibm.h floppy.h floppy_td0.h fdc.h fdd.h
|
||||
|
||||
fdc.o: ibm.h io.h dma.h pic.h timer.h floppy.h fdc.h fdd.h
|
||||
|
||||
fdd.o: ibm.h floppy.h fdc.h fdd.h
|
||||
|
||||
fdi2raw.o: fdi2raw.h ibm.h
|
||||
|
||||
gameport.o: ibm.h cpu/cpu.h device.h io.h timer.h gameport.h \
|
||||
joystick_ch_flightstick_pro.h joystick_standard.h \
|
||||
joystick_sw_pad.h joystick_tm_fcs.h plat_joystick.h
|
||||
|
||||
hdd.o: ibm.h cpu/cpu.h device.h hdd/hdd.h machine/machine.h \
|
||||
hdd/hdd_esdi_at.h hdd/hdd_esdi_mca.h hdd/hdd_mfm_at.h hdd/hdd_mfm_xebec.h \
|
||||
hdd/hdd_ide_xt.h
|
||||
hdd/hdd_esdi_at.h hdd/hdd_esdi_mca.h hdd/hdd_mfm_at.h \
|
||||
hdd/hdd_mfm_xebec.h hdd/hdd_ide_xt.h
|
||||
|
||||
hdd_image.o: ibm.h hdd/hdd_ide_at.h hdd/hdd_image.h
|
||||
|
||||
@@ -633,7 +525,48 @@ hdd_mfm_at.o: ibm.h device.h hdd/hdd_image.h io.h pic.h timer.h hdd/hdd_mfm_at.h
|
||||
hdd_mfm_xebec.o: ibm.h device.h dma.h hdd/hdd_image.h io.h mem.h pic.h rom.h \
|
||||
timer.h hdd/hdd_mfm_xebec.h
|
||||
|
||||
machine.o: ibm.h cpu/cpu.h device.h disc.h fdc.h fdd.h io.h machine/machine.h machine/machine_common.h machine/machine_amstrad.h \
|
||||
intel.o: ibm.h cpu/cpu.h io.h mem.h pit.h timer.h intel.h
|
||||
|
||||
intel_flash.o: ibm.h cpu/cpu.h device.h mem.h machine/machine.h rom.h
|
||||
|
||||
intel_sio.o: ibm.h dma.h mem.h pci.h intel_sio.h
|
||||
|
||||
io.o: ibm.h io.h
|
||||
|
||||
joystick_ch_flightstick_pro.o: ibm.h device.h timer.h gameport.h \
|
||||
joystick_standard.h plat_joystick.h
|
||||
|
||||
joystick_standard.o: ibm.h device.h timer.h gameport.h \
|
||||
joystick_standard.h plat_joystick.h
|
||||
|
||||
joystick_sw_pad.o: ibm.h device.h timer.h gameport.h \
|
||||
joystick_sw_pad.h plat_joystick.h
|
||||
|
||||
joystick_tm_fcs.o: ibm.h device.h timer.h gameport.h \
|
||||
joystick_standard.h plat_joystick.h
|
||||
|
||||
keyboard.o: ibm.h plat_keyboard.h keyboard.h
|
||||
|
||||
keyboard_amstrad.o: ibm.h io.h mem.h pic.h pit.h timer.h sound/sound.h \
|
||||
sound/snd_speaker.h keyboard.h keyboard_amstrad.h
|
||||
|
||||
keyboard_at.o: ibm.h io.h mem.h pic.h pit.h timer.h floppy.h fdc.h \
|
||||
sound/sound.h sound/snd_speaker.h keyboard.h keyboard_at.h
|
||||
|
||||
keyboard_olim24.o: ibm.h io.h mem.h pic.h pit.h timer.h mouse.h \
|
||||
sound/sound.h sound/snd_speaker.h keyboard.h keyboard_olim24.h
|
||||
|
||||
keyboard_pcjr.o: ibm.h io.h mem.h nmi.h pic.h pit.h timer.h \
|
||||
device.h sound/sound.h sound/snd_speaker.h \
|
||||
sound/snd_sn76489.h keyboard.h keyboard_pcjr.h
|
||||
|
||||
keyboard_xt.o: ibm.h io.h mem.h pic.h pit.h timer.h device.h tandy_eeprom.h \
|
||||
sound/sound.h sound/snd_speaker.h keyboard.h keyboard_xt.h
|
||||
|
||||
lpt.o: ibm.h io.h lpt.h sound/snd_lpt_dac.h sound/snd_lpt_dss.h
|
||||
|
||||
machine.o: ibm.h cpu/cpu.h device.h floppy.h fdc.h fdd.h io.h \
|
||||
machine/machine.h machine/machine_common.h machine/machine_amstrad.h \
|
||||
machine/machine_europc.h machine/machine_olivetti_m24.h machine/machine_pcjr.h machine/machine_tandy.h \
|
||||
machine/machine_xt.h machine/machine_xt_laserxt.h machine/machine_at.h machine/machine_at_ali1429.h \
|
||||
machine/machine_at_commodore.h machine/machine_at_headland.h machine/machine_at_neat.h machine/machine_at_opti495.h \
|
||||
@@ -642,25 +575,25 @@ machine.o: ibm.h cpu/cpu.h device.h disc.h fdc.h fdd.h io.h machine/machine.h ma
|
||||
machine/machine_at_430lx_nx.h machine/machine_at_430fx.h machine/machine_at_430hx.h machine/machine_at_430vx.h \
|
||||
machine/machine_at_440fx.h video/vid_pcjr.h video/vid_tandy.h video/vid_tandysl.h
|
||||
|
||||
machine_amstrad.o: ibm.h cpu/cpu.h device.h disc.h fdd.h fdc.h gameport.h io.h keyboard.h keyboard_amstrad.h lpt.h mem.h mouse.h \
|
||||
machine_amstrad.o: ibm.h cpu/cpu.h device.h floppy.h fdd.h fdc.h gameport.h io.h keyboard.h keyboard_amstrad.h lpt.h mem.h mouse.h \
|
||||
nmi.h nvr.h machine/machine_common.h
|
||||
|
||||
machine_at.o: ibm.h bugger.h device.h dma.h gameport.h hdd/hdd_ide_at.h keyboard_at.h lpt.h mem.h nvr.h pic.h pit.h \
|
||||
machine/machine_common.h machine/machine_at.h
|
||||
|
||||
machine_at_430fx.o: ibm.h cpu/cpu.h device.h fdc37c665.h intel_flash.h mem.h memregs.h pc87306.h pci.h piix.h w83877f.h \
|
||||
machine_at_430fx.o: ibm.h cpu/cpu.h device.h sio.h intel_flash.h mem.h memregs.h pci.h piix.h \
|
||||
machine/machine_at.h machine/machine_at_430fx.h
|
||||
|
||||
machine_at_430hx.o: ibm.h cpu/cpu.h device.h fdc37c669.h fdc37c932fr.h io.h intel_flash.h mem.h memregs.h pc87306.h pci.h \
|
||||
piix.h w83877f.h machine/machine_at.h machine/machine_at_430hx.h
|
||||
machine_at_430hx.o: ibm.h cpu/cpu.h device.h sio.h io.h intel_flash.h mem.h memregs.h pci.h \
|
||||
piix.h sio.h machine/machine_at.h machine/machine_at_430hx.h
|
||||
|
||||
machine_at_430lx_nx.o: ibm.h cpu/cpu.h device.h fdc37c665.h intel.h intel_flash.h mem.h memregs.h pci.h sio.h machine/machine_at.h \
|
||||
machine_at_430lx_nx.o: ibm.h cpu/cpu.h device.h sio.h intel.h intel_flash.h mem.h memregs.h pci.h intel_sio.h machine/machine_at.h \
|
||||
machine/machine_at_430lx_nx.h
|
||||
|
||||
machine_at_430vx.o: ibm.h cpu/cpu.h device.h fdc37c932fr.h io.h mem.h memregs.h intel_flash.h pci.h piix.h um8669f.h w83877f.h \
|
||||
machine_at_430vx.o: ibm.h cpu/cpu.h device.h sio.h io.h mem.h memregs.h intel_flash.h pci.h piix.h \
|
||||
machine/machine_at.h machine/machine_at_430vx.h
|
||||
|
||||
machine_at_440fx.o: ibm.h cpu/cpu.h device.h fdc37c665.h intel_flash.h io.h mem.h memregs.h pci.h piix.h machine/machine_at.h \
|
||||
machine_at_440fx.o: ibm.h cpu/cpu.h device.h sio.h intel_flash.h io.h mem.h memregs.h pci.h piix.h machine/machine_at.h \
|
||||
machine/machine_at_440fx.h
|
||||
|
||||
machine_at_ali1429.o: ibm.h cpu/cpu.h hdd/hdd_ide_at.h io.h mem.h machine/machine_at.h machine/machine_at_ali1429.h
|
||||
@@ -679,32 +612,33 @@ machine_at_scat.o: ibm.h cpu/cpu.h io.h mem.h cpu/x86.h machine/machine_at.h mac
|
||||
|
||||
machine_at_sis_85c50x.o: ibm.h io.h mem.h pci.h machine/machine_at.h machine/machine_at_sis_5c50x.h
|
||||
|
||||
machine_at_sis_85c471.o: ibm.h disc.h fdc.h fdd.h hdd/hdd_ide_at.h io.h lpt.h memregs.h serial.h machine/machine_at.h \
|
||||
machine_at_sis_85c471.o: ibm.h floppy.h fdc.h fdd.h hdd/hdd_ide_at.h io.h lpt.h memregs.h serial.h machine/machine_at.h \
|
||||
machine/machine_at_sis_85c471.h
|
||||
|
||||
machine_at_sis_85c496.o: ibm.h cpu/cpu.h fdc37c665.h io.h mem.h memregs.h pci.h machine/machine_at.h machine/machine_at_sis_85c496.h
|
||||
machine_at_sis_85c496.o: ibm.h cpu/cpu.h sio.h io.h mem.h memregs.h pci.h machine/machine_at.h machine/machine_at_sis_85c496.h
|
||||
|
||||
machine_at_wd76c10.o: ibm.h disc.h fdc.h io.h mem.h serial.h machine/machine_at.h machine/machine_at_wd76c10.h
|
||||
machine_at_wd76c10.o: ibm.h floppy.h fdc.h io.h mem.h serial.h machine/machine_at.h machine/machine_at_wd76c10.h
|
||||
|
||||
machine_common.o: ibm.h dma.h disc.h fdd.h fdc.h lpt.h pic.h pit.h serial.h machine/machine_common.h
|
||||
machine_common.o: ibm.h dma.h floppy.h fdd.h fdc.h lpt.h pic.h pit.h serial.h machine/machine_common.h
|
||||
|
||||
machine_europc.o: ibm.h cpu/cpu.h io.h device.h gameport.h keyboard_xt.h lpt.h mem.h nmi.h rom.h machine/machine_common.h \
|
||||
machine/machine_europc.h
|
||||
europc_hdd.o: ibm.h io.h dma.h pic.h device.h timer.h hdd/hdd_image.h europc.h
|
||||
|
||||
machine_olivetti_m24.o: ibm.h cpu/cpu.h device.h gameport.h keyboard_olim24.h mem.h nmi.h nvr.h io.h machine/machine_common.h \
|
||||
machine/machine_olivetti_m24.h
|
||||
|
||||
machine_pcjr.o: ibm.h device.h disc.h fdc.h fdd.h keyboard_pcjr.h mem.h nmi.h pic.h pit.h serial.h sound/snd_sn76489.h \
|
||||
machine_pcjr.o: ibm.h device.h floppy.h fdc.h fdd.h keyboard_pcjr.h mem.h nmi.h pic.h pit.h serial.h sound/snd_sn76489.h \
|
||||
machine/machine_pcjr.h
|
||||
|
||||
machine_ps1.o: ibm.h cpu/cpu.h device.h disc.h dma.h gameport.h hdd/hdd_ide_at.h fdd.h fdc.h io.h keyboard_at.h lpt.h \
|
||||
machine_ps1.o: ibm.h cpu/cpu.h device.h floppy.h dma.h gameport.h hdd/hdd_ide_at.h fdd.h fdc.h io.h keyboard_at.h lpt.h \
|
||||
mem.h nvr.h pic.h pit.h rom.h serial.h sound/snd_ps1.h machine/machine_common.h machine/machine_ps1.h
|
||||
|
||||
machine_ps2_isa.o: ibm.h cpu/cpu.h device.h disc.h dma.h fdd.h fdc.h io.h keyboard.h keyboard_at.h lpt.h mem.h nvr.h pic.h \
|
||||
machine_ps2_isa.o: ibm.h cpu/cpu.h device.h floppy.h dma.h fdd.h fdc.h io.h keyboard.h keyboard_at.h lpt.h mem.h nvr.h pic.h \
|
||||
pit.h rom.h serial.h machine/machine_common.h machine/machine_ps2_isa.h
|
||||
|
||||
machine_ps2_mca.o: ibm.h cpu/cpu.h cpu/x86.h device.h dma.h io.h keyboard_at.h lpt.h mca.h mem.h mouse.h nvr.h pic.h \
|
||||
pit.h rom.h ps2_nvr.h serial.h machine/machine_common.h machine/machine_ps2_mca.h
|
||||
pit.h rom.h nvr_ps2.h serial.h machine/machine_common.h machine/machine_ps2_mca.h
|
||||
|
||||
machine_tandy.o: ibm.h device.h gameport.h keyboard_xt.h mem.h nmi.h tandy_eeprom.h tandy_rom.h sound/snd_pssj.h \
|
||||
sound/snd_sn76489.h
|
||||
@@ -714,13 +648,68 @@ machine_xt.o: ibm.h bugger.h device.h gameport.h keyboard_xt.h mem.h nmi.h pit
|
||||
|
||||
machine_xt_laserxt.o: ibm.h cpu/cpu.h io.h mem.h machine/machine_xt.h machine/machine_xt_laserxt.h
|
||||
|
||||
net_ne2000.o: ibm.h io.h mem.h rom.h pci.h pic.h device.h config.h disc_random.h network/network.h network/net_ne2000.h network/bswap.h
|
||||
mca.o: ibm.h io.h mem.h mca.h
|
||||
|
||||
mcr.o: ibm.h
|
||||
|
||||
mem.o: ibm.h cpu/cpu.h cpu/x86_ops.h cpu/x86.h config.h \
|
||||
io.h mem.h rom.h cpu/codegen.h video/video.h
|
||||
|
||||
memregs.o: ibm.h io.h memregs.h
|
||||
|
||||
mouse.o: ibm.h cpu/cpu.h device.h machine/machine.h mouse.h \
|
||||
keyboard_olim24.h
|
||||
|
||||
mouse_bus.o: ibm.h io.h pic.h timer.h mouse.h
|
||||
|
||||
mouse_ps2.o: ibm.h keyboard_at.h mouse.h plat_mouse.h
|
||||
|
||||
mouse_serial.o: ibm.h timer.h serial.h mouse.h
|
||||
|
||||
nmi.o: ibm.h io.h nmi.h
|
||||
|
||||
network.o: ibm.h device.h network/network.h network/net_ne2000.h win/plat_ui.h
|
||||
|
||||
net_pcap.o: ibm.h config.h device.h network/network.h win/plat_dynld.h win/plat_thread.h
|
||||
|
||||
net_slirp.o: network/slirp/slirp.h network/slirp/queue.h ibm.h config.h device.h network/network.h win/plat_thread.h
|
||||
|
||||
network.o: ibm.h device.h network/network.h network/net_ne2000.h win/plat_ui.h
|
||||
net_ne2000.o: ibm.h io.h mem.h rom.h pci.h pic.h device.h config.h random.h network/network.h network/net_ne2000.h network/bswap.h
|
||||
|
||||
nvr.o: ibm.h cpu/cpu.h device.h io.h mem.h machine/machine.h \
|
||||
machine/machine_europc.h nvr.h pic.h rom.h timer.h rtc.h
|
||||
|
||||
nvr_ps2.o: ibm.h device.h io.h mem.h rom.h nvr_ps2.h
|
||||
|
||||
pc.o: 86box.h config.h random.h ibm.h mem.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 \
|
||||
random.h config.h fdc.h fdd.h gameport.h plat_joystick.h \
|
||||
plat_midi.h hdd/hdd.h hdd/hdd_ide_at.h cdrom.h cdrom_ioctl.h \
|
||||
cdrom_image.h cdrom_null.h scsi/scsi.h keyboard.h plat_keyboard.h \
|
||||
keyboard_at.h mouse.h plat_mouse.h network/network.h serial.h \
|
||||
sound/sound.h sound/snd_cms.h sound/snd_dbopl.h \
|
||||
sound/snd_mpu401.h sound/snd_opl.h sound/snd_gus.h \
|
||||
sound/snd_sb.h sound/snd_speaker.h sound/snd_ssi2001.h \
|
||||
video/video.h video/vid_voodoo.h win/plat_ui.h
|
||||
|
||||
pci.o: ibm.h cdrom.h floppy.h fdc.h hdd/hdd_ide_at.h io.h keyboard_at.h mem.h pic.h pci.h
|
||||
|
||||
pic.o: ibm.h io.h pic.h pit.h
|
||||
|
||||
piix.o: ibm.h dma.h hdd/hdd_ide_at.h io.h mem.h pci.h piix.h
|
||||
|
||||
pit.o: ibm.h cpu/cpu.h dma.h io.h pic.h pit.h device.h timer.h \
|
||||
machine/machine.h sound/snd_speaker.h video/video.h
|
||||
|
||||
ppi.o: ibm.h pit.h plat_keyboard.h plat_mouse.h
|
||||
|
||||
random.o: random.h
|
||||
|
||||
rom.o: config.h ibm.h mem.h rom.h
|
||||
|
||||
rtc.o: nvr.h rtc.h
|
||||
|
||||
scsi.o: 86box.h ibm.h timer.h device.h cdrom.h scsi/scsi.h \
|
||||
scsi/scsi_aha154x.h scsi/scsi_buslogic.h
|
||||
@@ -739,6 +728,21 @@ scsi_buslogic.o: ibm.h io.h mem.h rom.h dma.h pic.h pci.h timer.h \
|
||||
scsi_disk.o: 86box.h cdrom.h hdd/hdd_image.h ibm.h hdd/hdd_ide_at.h piix.h scsi/scsi.h \
|
||||
scsi/scsi_disk.h timer.h win/plat_iodev.h
|
||||
|
||||
serial.o: ibm.h io.h pic.h timer.h serial.h plat_serial.h
|
||||
|
||||
sio_detect.o: ibm.h io.h floppy.h fdd.h fdc.h sio.h
|
||||
|
||||
sio_fdc37c665.o: ibm.h floppy.h fdc.h fdd.h hdd/hdd_ide_at.h io.h lpt.h serial.h \
|
||||
sio.h floppy.h fdc.h fdd.h io.h hdd/hdd_ide_at.h lpt.h serial.h
|
||||
|
||||
sio_fdc37c932fr.o: ibm.h floppy.h fdc.h fdd.h hdd/hdd_ide_at.h io.h lpt.h \
|
||||
serial.h sio.h
|
||||
|
||||
sio_pc87306.o: ibm.h floppy.h fdc.h fdd.h hdd/hdd_ide_at.h io.h lpt.h serial.h \
|
||||
sio.h
|
||||
|
||||
sio_w83877f.o: ibm.h floppy.h fdc.h fdd.h io.h lpt.h serial.h sio.h
|
||||
|
||||
dbopl.o: sound/dbopl.h
|
||||
|
||||
midi.o: device.h sound/midi.h ibm.h win/plat_midi.h win/plat_ticks.h sound/midi_fluidsynth.h sound/midi_mt32.h sound/midi_system.h
|
||||
@@ -803,6 +807,14 @@ snd_ym7128.o: ibm.h sound/snd_ym7128.h
|
||||
sound.o: ibm.h device.h timer.h cdrom.h win/plat_thread.h sound/midi.h sound/sound.h sound/snd_opl.h sound/snd_adlib.h \
|
||||
sound/snd_pas16.h sound/snd_sb.h sound/snd_sb_dsp.h sound/snd_wss.h sound/filters.h
|
||||
|
||||
tandy_eeprom.o: ibm.h device.h mem.h io.h rom.h tandy_eeprom.h
|
||||
|
||||
tandy_rom.o: ibm.h device.h io.h mem.h rom.h tandy_rom.h
|
||||
|
||||
timer.o: ibm.h timer.h
|
||||
|
||||
usb.o: ibm.h io.h mem.h usb.h
|
||||
|
||||
vid_ati_eeprom.o: ibm.h mem.h rom.h video/vid_ati_eeprom.h
|
||||
|
||||
vid_ati_mach64.o: ibm.h device.h io.h mem.h pci.h rom.h win/plat_thread.h video/video.h video/vid_svga.h video/vid_svga_render.h \
|
||||
@@ -918,7 +930,7 @@ video.o: ibm.h cpu/cpu.h io.h mem.h rom.h config.h device.h timer.h win/plat_th
|
||||
video/vid_pc200.h video/vid_pcjr.h video/vid_ps1_svga.h video/vid_s3.h video/vid_s3_virge.h video/vid_tandy.h \
|
||||
video/vid_tandysl.h video/vid_tgui9440.h video/vid_tvga.h video/vid_vga.h video/vid_wy700.h
|
||||
|
||||
win.o: 86box.h device.h disc.h fdd.h hdd.h ibm.h cpu/cpu.h mem.h rom.h nvr.h config.h machine/machine.h hdd/hdd_ide_at.h cdrom.h cdrom_null.h \
|
||||
win.o: 86box.h device.h floppy.h fdd.h hdd.h ibm.h cpu/cpu.h mem.h rom.h nvr.h config.h machine/machine.h hdd/hdd_ide_at.h cdrom.h cdrom_null.h \
|
||||
cdrom_ioctl.h cdrom_image.h scsi/scsi.h scsi_disk.h video/video.h video/vid_ega.h mouse.h sound/sound.h sound/snd_dbopl.h \
|
||||
win/plat_keyboard.h win/plat_iodev.h win/plat_mouse.h win/plat_midi.h win/plat_thread.h win/plat_ticks.h win/plat_ui.h \
|
||||
win/resource.h win/win.h win/win_cgapal.h win/win_ddraw.h win/win_d3d.h win/win_language.h
|
||||
@@ -955,7 +967,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 disc.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 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
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Implementation of the CD-ROM drive with SCSI(-like)
|
||||
* commands, for both ATAPI and SCSI usage.
|
||||
*
|
||||
* Version: @(#)cdrom.c 1.0.3 2017/08/24
|
||||
* Version: @(#)cdrom.c 1.0.4 2017/09/03
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
@@ -19,14 +19,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "86box.h"
|
||||
#include "../86box.h"
|
||||
#include "../ibm.h"
|
||||
#include "../piix.h"
|
||||
#include "../scsi/scsi.h"
|
||||
#include "../timer.h"
|
||||
#include "../hdd/hdd_ide_at.h"
|
||||
#include "../win/plat_iodev.h"
|
||||
#include "cdrom.h"
|
||||
#include "ibm.h"
|
||||
#include "piix.h"
|
||||
#include "scsi/scsi.h"
|
||||
#include "timer.h"
|
||||
#include "hdd/hdd_ide_at.h"
|
||||
#include "win/plat_iodev.h"
|
||||
|
||||
|
||||
/* Bits of 'status' */
|
||||
#define ERR_STAT 0x01
|
||||
@@ -3,20 +3,17 @@
|
||||
*/
|
||||
/*CD-ROM image support*/
|
||||
|
||||
#define __USE_LARGEFILE64
|
||||
#define _LARGEFILE_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "../config.h"
|
||||
#include "cdrom_dosbox.h"
|
||||
#include "cdrom.h"
|
||||
#include "cdrom_image.h"
|
||||
#include "cdrom_null.h"
|
||||
|
||||
#define __USE_LARGEFILE64
|
||||
#define _LARGEFILE_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
|
||||
#include <wchar.h>
|
||||
|
||||
#define CD_STATUS_EMPTY 0
|
||||
#define CD_STATUS_DATA_ONLY 1
|
||||
#define CD_STATUS_PLAYING 2
|
||||
@@ -9,7 +9,7 @@
|
||||
* Implementation of the CD-ROM host drive IOCTL interface for
|
||||
* Windows using SCSI Passthrough Direct.
|
||||
*
|
||||
* Version: @(#)cdrom_ioctl.c 1.0.2 2017/06/03
|
||||
* Version: @(#)cdrom_ioctl.c 1.0.3 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -21,15 +21,18 @@
|
||||
#include <io.h>
|
||||
#include "ntddcdrm.h"
|
||||
#include "ntddscsi.h"
|
||||
#include "ibm.h"
|
||||
#include "../ibm.h"
|
||||
#include "../scsi/scsi.h"
|
||||
#include "cdrom.h"
|
||||
#include "cdrom_ioctl.h"
|
||||
#include "scsi/scsi.h"
|
||||
|
||||
|
||||
#define MSFtoLBA(m,s,f) ((((m*60)+s)*75)+f)
|
||||
|
||||
|
||||
static CDROM ioctl_cdrom;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HANDLE hIOCTL;
|
||||
@@ -12,7 +12,7 @@
|
||||
* This file lists the functions provided by various platform-
|
||||
* specific cdrom-ioctl files.
|
||||
*
|
||||
* Version: @(#)cdrom_ioctl.h 1.0.2 2017/08/23
|
||||
* Version: @(#)cdrom_ioctl.h 1.0.3 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -9,14 +9,14 @@
|
||||
* Implementation of the CD-ROM null interface for unmounted
|
||||
* guest CD-ROM drives.
|
||||
*
|
||||
* Version: @(#)cdrom_null.c 1.0.1 2017/06/03
|
||||
* Version: @(#)cdrom_null.c 1.0.2 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2016 Sarah Walker.
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
*/
|
||||
#include "ibm.h"
|
||||
#include "../ibm.h"
|
||||
#include "cdrom.h"
|
||||
#include "cdrom_ioctl.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Implementation of the CD-ROM null interface for unmounted
|
||||
* guest CD-ROM drives.
|
||||
*
|
||||
* Version: @(#)cdrom_null.h 1.0.2 2017/08/23
|
||||
* Version: @(#)cdrom_null.h 1.0.3 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
30
src/config.c
30
src/config.c
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Configuration file handler.
|
||||
*
|
||||
* Version: @(#)config.c 1.0.3 2017/09/02
|
||||
* Version: @(#)config.c 1.0.4 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker,
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -27,17 +27,17 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "cdrom.h"
|
||||
#include "config.h"
|
||||
#include "device.h"
|
||||
#include "disc.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
#include "lpt.h"
|
||||
#include "ibm.h"
|
||||
#include "cpu/cpu.h"
|
||||
#include "config.h"
|
||||
#include "device.h"
|
||||
#include "gameport.h"
|
||||
#include "lpt.h"
|
||||
#include "nvr.h"
|
||||
#include "cdrom/cdrom.h"
|
||||
#include "floppy/floppy.h"
|
||||
#include "floppy/fdc.h"
|
||||
#include "floppy/fdd.h"
|
||||
#include "hdd/hdd.h"
|
||||
#include "hdd/hdd_ide_at.h"
|
||||
#include "machine/machine.h"
|
||||
@@ -45,7 +45,6 @@
|
||||
#ifdef USE_NETWORK
|
||||
#include "network/network.h"
|
||||
#endif
|
||||
#include "nvr.h"
|
||||
#include "scsi/scsi.h"
|
||||
#include "win/plat_joystick.h"
|
||||
#include "win/plat_midi.h"
|
||||
@@ -55,7 +54,6 @@
|
||||
#include "sound/snd_opl.h"
|
||||
#include "sound/sound.h"
|
||||
#include "video/video.h"
|
||||
|
||||
#include "win/win.h"
|
||||
#include "win/win_language.h"
|
||||
|
||||
@@ -1570,8 +1568,8 @@ static void loadconfig_removable_devices(void)
|
||||
|
||||
sprintf(temps, "fdd_%02i_fn", c + 1);
|
||||
wp = config_get_wstring(cat, temps, L"");
|
||||
memcpy(discfns[c], wp, (wcslen(wp) << 1) + 2);
|
||||
printf("Floppy: %ws\n", discfns[c]);
|
||||
memcpy(floppyfns[c], wp, (wcslen(wp) << 1) + 2);
|
||||
printf("Floppy: %ws\n", floppyfns[c]);
|
||||
sprintf(temps, "fdd_%02i_writeprot", c + 1);
|
||||
ui_writeprot[c] = !!config_get_int(cat, temps, 0);
|
||||
sprintf(temps, "fdd_%02i_turbo", c + 1);
|
||||
@@ -1586,7 +1584,7 @@ static void loadconfig_removable_devices(void)
|
||||
config_delete_var(cat, temps);
|
||||
}
|
||||
|
||||
if (wcslen(discfns[c]) == 0)
|
||||
if (wcslen(floppyfns[c]) == 0)
|
||||
{
|
||||
sprintf(temps, "fdd_%02i_fn", c + 1);
|
||||
config_delete_var(cat, temps);
|
||||
@@ -2485,7 +2483,7 @@ static void saveconfig_removable_devices(void)
|
||||
}
|
||||
|
||||
sprintf(temps, "fdd_%02i_fn", c + 1);
|
||||
if (wcslen(discfns[c]) == 0)
|
||||
if (wcslen(floppyfns[c]) == 0)
|
||||
{
|
||||
config_delete_var(cat, temps);
|
||||
|
||||
@@ -2496,7 +2494,7 @@ static void saveconfig_removable_devices(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
config_set_wstring(cat, temps, discfns[c]);
|
||||
config_set_wstring(cat, temps, floppyfns[c]);
|
||||
}
|
||||
|
||||
sprintf(temps, "fdd_%02i_writeprot", c + 1);
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
#include "x86.h"
|
||||
#include "x87.h"
|
||||
#include "../mem.h"
|
||||
#include "../disc.h"
|
||||
#include "../fdc.h"
|
||||
#include "../pic.h"
|
||||
#include "../timer.h"
|
||||
|
||||
#include "../floppy/floppy.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "386_common.h"
|
||||
|
||||
|
||||
#define CPU_BLOCK_END()
|
||||
|
||||
extern int codegen_flags_changed;
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
#include "x86_ops.h"
|
||||
#include "x87.h"
|
||||
#include "../mem.h"
|
||||
#include "codegen.h"
|
||||
#include "../disc.h"
|
||||
#include "../fdc.h"
|
||||
#include "../pic.h"
|
||||
#include "../timer.h"
|
||||
|
||||
#include "../floppy/floppy.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "codegen.h"
|
||||
#include "386_common.h"
|
||||
|
||||
|
||||
#define CPU_BLOCK_END() cpu_block_end = 1
|
||||
|
||||
uint32_t cpu_cur_status = 0;
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* 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 the SMC FDC37C669 Super I/O Chip.
|
||||
*
|
||||
* Version: @(#)fdc37c669.h 1.0.1 2017/08/23
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
|
||||
extern void fdc37c669_init(void);
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* 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 the SMC FDC37C932FR Super I/O Chip.
|
||||
*
|
||||
* Version: @(#)fdc37c932fr.h 1.0.1 2017/08/23
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
|
||||
extern void fdc37c932fr_init(void);
|
||||
@@ -9,68 +9,70 @@
|
||||
* Implementation of the NEC uPD-765 and compatible floppy disk
|
||||
* controller.
|
||||
*
|
||||
* Version: @(#)fdc.c 1.0.1 2017/08/23
|
||||
* Version: @(#)fdc.c 1.0.2 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "ibm.h"
|
||||
|
||||
#include "disc.h"
|
||||
#include "dma.h"
|
||||
#include "../ibm.h"
|
||||
#include "../io.h"
|
||||
#include "../dma.h"
|
||||
#include "../pic.h"
|
||||
#include "../timer.h"
|
||||
#include "floppy.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
#include "io.h"
|
||||
#include "pic.h"
|
||||
#include "timer.h"
|
||||
|
||||
|
||||
extern int motoron[FDD_NUM];
|
||||
|
||||
|
||||
int ui_writeprot[FDD_NUM] = {0, 0, 0, 0};
|
||||
|
||||
int command_has_drivesel[256] = { 0, 0,
|
||||
1, /* READ TRACK */
|
||||
0,
|
||||
1, /* SENSE DRIVE STATUS */
|
||||
1, /* WRITE DATA */
|
||||
1, /* READ DATA */
|
||||
1, /* RECALIBRATE */
|
||||
0,
|
||||
1, /* WRITE DELETED DATA */
|
||||
1, /* READ ID */
|
||||
0,
|
||||
1, /* READ DELETED DATA */
|
||||
1, /* FORMAT TRACK */
|
||||
0,
|
||||
1, /* SEEK, RELATIVE SEEK */
|
||||
0,
|
||||
1, /* SCAN EQUAL */
|
||||
0, 0, 0, 0,
|
||||
1, /* VERIFY */
|
||||
0, 0, 0,
|
||||
1, /* SCAN LOW OR EQUAL */
|
||||
0, 0, 0,
|
||||
1, /* SCAN HIGH OR EQUAL */
|
||||
0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
int command_has_drivesel[256] = {
|
||||
0, 0,
|
||||
1, /* READ TRACK */
|
||||
0,
|
||||
1, /* SENSE DRIVE STATUS */
|
||||
1, /* WRITE DATA */
|
||||
1, /* READ DATA */
|
||||
1, /* RECALIBRATE */
|
||||
0,
|
||||
1, /* WRITE DELETED DATA */
|
||||
1, /* READ ID */
|
||||
0,
|
||||
1, /* READ DELETED DATA */
|
||||
1, /* FORMAT TRACK */
|
||||
0,
|
||||
1, /* SEEK, RELATIVE SEEK */
|
||||
0,
|
||||
1, /* SCAN EQUAL */
|
||||
0, 0, 0, 0,
|
||||
1, /* VERIFY */
|
||||
0, 0, 0,
|
||||
1, /* SCAN LOW OR EQUAL */
|
||||
0, 0, 0,
|
||||
1, /* SCAN HIGH OR EQUAL */
|
||||
0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static int fdc_reset_stat = 0;
|
||||
/*FDC*/
|
||||
@@ -145,19 +147,19 @@ typedef struct FDC
|
||||
uint16_t base_address;
|
||||
} FDC;
|
||||
|
||||
int disctime;
|
||||
int floppytime;
|
||||
|
||||
static FDC fdc;
|
||||
|
||||
void fdc_callback(void *priv);
|
||||
int timetolive;
|
||||
int lastbyte=0;
|
||||
uint8_t disc_3f7;
|
||||
uint8_t floppy_3f7;
|
||||
|
||||
int discmodified[4];
|
||||
int discrate[4];
|
||||
int floppymodified[4];
|
||||
int floppyrate[4];
|
||||
|
||||
int discint;
|
||||
int floppyint;
|
||||
|
||||
int fdc_do_log = 0;
|
||||
|
||||
@@ -208,7 +210,7 @@ int fdc_ps1_525()
|
||||
|
||||
int fdc_get_compare_condition()
|
||||
{
|
||||
switch (discint)
|
||||
switch (floppyint)
|
||||
{
|
||||
case 0x11:
|
||||
default:
|
||||
@@ -608,7 +610,7 @@ static int fdc_get_densel(int drive)
|
||||
static void fdc_rate(int drive)
|
||||
{
|
||||
fdc_update_rate(drive);
|
||||
disc_set_rate(drive, fdc.drvrate[drive], fdc.rate);
|
||||
floppy_set_rate(drive, fdc.drvrate[drive], fdc.rate);
|
||||
fdc_log("FDD %c: Setting rate: %i, %i, %i (%i, %i)\n", 0x41 + drive, fdc.drvrate[drive], fdc.rate, fdc_get_densel(drive), fdc.rwc[drive], fdc.densel_force);
|
||||
fdd_set_densel(fdc_get_densel(drive));
|
||||
}
|
||||
@@ -668,9 +670,9 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv)
|
||||
if ((val & 0x80) && !(fdc.dor & 0x80))
|
||||
{
|
||||
timer_process();
|
||||
disctime = 128 * (1 << TIMER_SHIFT);
|
||||
floppytime = 128 * (1 << TIMER_SHIFT);
|
||||
timer_update_outstanding();
|
||||
discint=-1;
|
||||
floppyint=-1;
|
||||
fdc_reset();
|
||||
}
|
||||
if (!fdd_get_flags(0))
|
||||
@@ -688,7 +690,7 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv)
|
||||
}
|
||||
if (!(val&4))
|
||||
{
|
||||
disc_stop(real_drive(val & 3));
|
||||
floppy_stop(real_drive(val & 3));
|
||||
fdc.stat=0x00;
|
||||
fdc.pnum=fdc.ptot=0;
|
||||
}
|
||||
@@ -700,9 +702,9 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv)
|
||||
if ((val&4) && !(fdc.dor&4))
|
||||
{
|
||||
timer_process();
|
||||
disctime = 128 * (1 << TIMER_SHIFT);
|
||||
floppytime = 128 * (1 << TIMER_SHIFT);
|
||||
timer_update_outstanding();
|
||||
discint=-1;
|
||||
floppyint=-1;
|
||||
fdc.perp &= 0xfc;
|
||||
fdc_reset();
|
||||
}
|
||||
@@ -737,9 +739,9 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv)
|
||||
if (val & 0x80)
|
||||
{
|
||||
timer_process();
|
||||
disctime = 128 * (1 << TIMER_SHIFT);
|
||||
floppytime = 128 * (1 << TIMER_SHIFT);
|
||||
timer_update_outstanding();
|
||||
discint=-1;
|
||||
floppyint=-1;
|
||||
fdc.perp &= 0xfc;
|
||||
fdc_reset();
|
||||
}
|
||||
@@ -845,7 +847,7 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv)
|
||||
case 8: /*Sense interrupt status*/
|
||||
if (!fdc.fintr && !fdc_reset_stat) goto bad_command;
|
||||
fdc.lastdrive = fdc.drive;
|
||||
discint = 8;
|
||||
floppyint = 8;
|
||||
fdc.pos = 0;
|
||||
fdc_callback(NULL);
|
||||
break;
|
||||
@@ -871,13 +873,13 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv)
|
||||
break;
|
||||
case 0x0e: /*Dump registers*/
|
||||
fdc.lastdrive = fdc.drive;
|
||||
discint = 0x0e;
|
||||
floppyint = 0x0e;
|
||||
fdc.pos = 0;
|
||||
fdc_callback(NULL);
|
||||
break;
|
||||
case 0x10: /*Get version*/
|
||||
fdc.lastdrive = fdc.drive;
|
||||
discint = 0x10;
|
||||
floppyint = 0x10;
|
||||
fdc.pos = 0;
|
||||
fdc_callback(NULL);
|
||||
break;
|
||||
@@ -897,7 +899,7 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv)
|
||||
case 0x14: /*Unlock*/
|
||||
case 0x94: /*Lock*/
|
||||
fdc.lastdrive = fdc.drive;
|
||||
discint = fdc.command;
|
||||
floppyint = fdc.command;
|
||||
fdc.pos = 0;
|
||||
fdc_callback(NULL);
|
||||
break;
|
||||
@@ -905,20 +907,20 @@ void fdc_write(uint16_t addr, uint8_t val, void *priv)
|
||||
case 0x18:
|
||||
if (!fdc.is_nsc) goto bad_command;
|
||||
fdc.lastdrive = fdc.drive;
|
||||
discint = 0x10;
|
||||
floppyint = 0x10;
|
||||
fdc.pos = 0;
|
||||
fdc_callback(NULL);
|
||||
/* fdc.stat = 0x10;
|
||||
discint = 0xfc;
|
||||
floppyint = 0xfc;
|
||||
fdc_callback(NULL); */
|
||||
break;
|
||||
|
||||
default:
|
||||
bad_command:
|
||||
fdc.stat |= 0x10;
|
||||
discint=0xfc;
|
||||
floppyint=0xfc;
|
||||
timer_process();
|
||||
disctime = 200 * (1 << TIMER_SHIFT);
|
||||
floppytime = 200 * (1 << TIMER_SHIFT);
|
||||
timer_update_outstanding();
|
||||
break;
|
||||
}
|
||||
@@ -942,12 +944,12 @@ bad_command:
|
||||
if (fdc.pnum==fdc.ptot)
|
||||
{
|
||||
fdc_log("Got all params %02X\n", fdc.command);
|
||||
discint=fdc.command&0x1F;
|
||||
floppyint=fdc.command&0x1F;
|
||||
timer_process();
|
||||
disctime = 1024 * (1 << TIMER_SHIFT);
|
||||
floppytime = 1024 * (1 << TIMER_SHIFT);
|
||||
timer_update_outstanding();
|
||||
fdc_reset_stat = 0;
|
||||
switch (discint & 0x1F)
|
||||
switch (floppyint & 0x1F)
|
||||
{
|
||||
case 2: /*Read a track*/
|
||||
fdc_reset_fifo_buf();
|
||||
@@ -964,7 +966,7 @@ bad_command:
|
||||
fdc.read_track_sector.id.n = fdc.params[4];
|
||||
fdc_implied_seek();
|
||||
fdc.rw_track = fdc.params[1];
|
||||
disc_readsector(fdc.drive, SECTOR_FIRST, fdc.params[1], fdc.head, fdc.rate, fdc.params[4]);
|
||||
floppy_readsector(fdc.drive, SECTOR_FIRST, fdc.params[1], fdc.head, fdc.rate, fdc.params[4]);
|
||||
if (fdc.pcjr || !fdc.dma)
|
||||
{
|
||||
fdc.stat = 0x70;
|
||||
@@ -973,7 +975,7 @@ bad_command:
|
||||
{
|
||||
fdc.stat = 0x50;
|
||||
}
|
||||
disctime = 0;
|
||||
floppytime = 0;
|
||||
update_status_bar_icon(SB_FLOPPY | fdc.drive, 1);
|
||||
fdc.inread = 1;
|
||||
break;
|
||||
@@ -983,7 +985,7 @@ bad_command:
|
||||
fdc.specify[0] = fdc.params[0];
|
||||
fdc.specify[1] = fdc.params[1];
|
||||
fdc.dma = (fdc.specify[1] & 1) ^ 1;
|
||||
disctime = 0;
|
||||
floppytime = 0;
|
||||
break;
|
||||
|
||||
case 0x12:
|
||||
@@ -997,7 +999,7 @@ bad_command:
|
||||
fdc.perp &= 0xfc;
|
||||
fdc.perp |= (fdc.params[0] & 0x03);
|
||||
}
|
||||
disctime = 0;
|
||||
floppytime = 0;
|
||||
return;
|
||||
|
||||
case 4:
|
||||
@@ -1016,8 +1018,8 @@ bad_command:
|
||||
fdc.dtl = fdc.params[7];
|
||||
fdc_implied_seek();
|
||||
fdc.rw_track = fdc.params[1];
|
||||
disc_writesector(fdc.drive, fdc.sector, fdc.params[1], fdc.head, fdc.rate, fdc.params[4]);
|
||||
disctime = 0;
|
||||
floppy_writesector(fdc.drive, fdc.sector, fdc.params[1], fdc.head, fdc.rate, fdc.params[4]);
|
||||
floppytime = 0;
|
||||
fdc.written = 0;
|
||||
update_status_bar_icon(SB_FLOPPY | fdc.drive, 1);
|
||||
fdc.pos = 0;
|
||||
@@ -1049,8 +1051,8 @@ bad_command:
|
||||
fdc.dtl = fdc.params[7];
|
||||
fdc_implied_seek();
|
||||
fdc.rw_track = fdc.params[1];
|
||||
disc_comparesector(fdc.drive, fdc.sector, fdc.params[1], fdc.head, fdc.rate, fdc.params[4]);
|
||||
disctime = 0;
|
||||
floppy_comparesector(fdc.drive, fdc.sector, fdc.params[1], fdc.head, fdc.rate, fdc.params[4]);
|
||||
floppytime = 0;
|
||||
fdc.written = 0;
|
||||
update_status_bar_icon(SB_FLOPPY | fdc.drive, 1);
|
||||
fdc.pos = 0;
|
||||
@@ -1086,7 +1088,7 @@ bad_command:
|
||||
fdc.tc = 1;
|
||||
fdc.deleted |= 2;
|
||||
}
|
||||
disc_readsector(fdc.drive, fdc.sector, fdc.params[1], fdc.head, fdc.rate, fdc.params[4]);
|
||||
floppy_readsector(fdc.drive, fdc.sector, fdc.params[1], fdc.head, fdc.rate, fdc.params[4]);
|
||||
if (fdc.pcjr || !fdc.dma)
|
||||
{
|
||||
fdc.stat = 0x70;
|
||||
@@ -1095,7 +1097,7 @@ bad_command:
|
||||
{
|
||||
fdc.stat = 0x50;
|
||||
}
|
||||
disctime = 0;
|
||||
floppytime = 0;
|
||||
update_status_bar_icon(SB_FLOPPY | fdc.drive, 1);
|
||||
fdc.inread = 1;
|
||||
break;
|
||||
@@ -1103,7 +1105,7 @@ bad_command:
|
||||
case 7: /*Recalibrate*/
|
||||
seek_time_base = fdd_doublestep_40(real_drive(fdc.drive)) ? 10 : 5;
|
||||
fdc.stat = (1 << real_drive(fdc.drive)) | 0x80;
|
||||
disctime = 0;
|
||||
floppytime = 0;
|
||||
|
||||
drive_num = real_drive(fdc.drive);
|
||||
|
||||
@@ -1119,10 +1121,10 @@ bad_command:
|
||||
fdc.st0 = 0x20 | (fdc.params[0] & 3);
|
||||
}
|
||||
fdc.pcn[fdc.params[0] & 3] = 0;
|
||||
disctime = 0;
|
||||
discint=-3;
|
||||
floppytime = 0;
|
||||
floppyint=-3;
|
||||
timer_process();
|
||||
disctime = 2048 * (1 << TIMER_SHIFT);
|
||||
floppytime = 2048 * (1 << TIMER_SHIFT);
|
||||
timer_update_outstanding();
|
||||
break;
|
||||
}
|
||||
@@ -1131,7 +1133,7 @@ bad_command:
|
||||
{
|
||||
fdc_seek(fdc.drive, -fdc.max_track);
|
||||
}
|
||||
disctime = fdc.max_track * seek_time_base * TIMER_USEC;
|
||||
floppytime = fdc.max_track * seek_time_base * TIMER_USEC;
|
||||
break;
|
||||
|
||||
case 0x0d: /*Format*/
|
||||
@@ -1151,7 +1153,7 @@ bad_command:
|
||||
fdc.stat = (1 << fdc.drive) | 0x80;
|
||||
fdc.head = (fdc.params[0] & 4) ? 1 : 0;
|
||||
fdd_set_head(fdc.drive, (fdc.params[0] & 4) ? 1 : 0);
|
||||
disctime = 0;
|
||||
floppytime = 0;
|
||||
|
||||
drive_num = real_drive(fdc.drive);
|
||||
seek_time_base = fdd_doublestep_40(drive_num) ? 10 : 5;
|
||||
@@ -1176,10 +1178,10 @@ bad_command:
|
||||
{
|
||||
fdc.pcn[fdc.params[0] & 3] = fdc.params[1];
|
||||
}
|
||||
disctime = 0;
|
||||
discint=-3;
|
||||
floppytime = 0;
|
||||
floppyint=-3;
|
||||
timer_process();
|
||||
disctime = 2048 * (1 << TIMER_SHIFT);
|
||||
floppytime = 2048 * (1 << TIMER_SHIFT);
|
||||
timer_update_outstanding();
|
||||
break;
|
||||
}
|
||||
@@ -1200,17 +1202,17 @@ bad_command:
|
||||
fdc_seek(fdc.drive, -fdc.params[1]);
|
||||
fdc.pcn[fdc.params[0] & 3] -= fdc.params[1];
|
||||
}
|
||||
disctime = ((int) fdc.params[1]) * seek_time_base * TIMER_USEC;
|
||||
floppytime = ((int) fdc.params[1]) * seek_time_base * TIMER_USEC;
|
||||
}
|
||||
else
|
||||
{
|
||||
disctime = seek_time_base * TIMER_USEC;
|
||||
floppytime = seek_time_base * TIMER_USEC;
|
||||
|
||||
fdc.st0 = 0x20 | (fdc.params[0] & 7);
|
||||
disctime = 0;
|
||||
discint=-3;
|
||||
floppytime = 0;
|
||||
floppyint=-3;
|
||||
timer_process();
|
||||
disctime = 2048 * (1 << TIMER_SHIFT);
|
||||
floppytime = 2048 * (1 << TIMER_SHIFT);
|
||||
timer_update_outstanding();
|
||||
break;
|
||||
}
|
||||
@@ -1223,10 +1225,10 @@ bad_command:
|
||||
if ((fdc.params[1] - fdc.pcn[fdc.params[0] & 3]) == 0)
|
||||
{
|
||||
fdc.st0 = 0x20 | (fdc.params[0] & 7);
|
||||
disctime = 0;
|
||||
discint=-3;
|
||||
floppytime = 0;
|
||||
floppyint=-3;
|
||||
timer_process();
|
||||
disctime = 2048 * (1 << TIMER_SHIFT);
|
||||
floppytime = 2048 * (1 << TIMER_SHIFT);
|
||||
timer_update_outstanding();
|
||||
break;
|
||||
}
|
||||
@@ -1234,18 +1236,18 @@ bad_command:
|
||||
fdc_seek(fdc.drive, fdc.params[1] - fdc.pcn[fdc.params[0] & 3]);
|
||||
fdc.pcn[fdc.params[0] & 3] = fdc.params[1];
|
||||
if (seek_time < 0) seek_time = -seek_time;
|
||||
disctime = seek_time;
|
||||
floppytime = seek_time;
|
||||
}
|
||||
break;
|
||||
|
||||
case 10: /*Read sector ID*/
|
||||
fdc_rate(fdc.drive);
|
||||
disctime = 0;
|
||||
floppytime = 0;
|
||||
fdc.head = (fdc.params[0] & 4) ? 1 : 0;
|
||||
fdd_set_head(fdc.drive, (fdc.params[0] & 4) ? 1 : 0);
|
||||
if ((real_drive(fdc.drive) != 1) || fdc.drv2en)
|
||||
{
|
||||
disc_readaddress(fdc.drive, fdc.head, fdc.rate);
|
||||
floppy_readaddress(fdc.drive, fdc.head, fdc.rate);
|
||||
if (fdc.pcjr || !fdc.dma)
|
||||
{
|
||||
fdc.stat = 0x70;
|
||||
@@ -1270,7 +1272,7 @@ bad_command:
|
||||
if (!AT) return;
|
||||
fdc.rate=val&3;
|
||||
|
||||
disc_3f7=val;
|
||||
floppy_3f7=val;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1373,10 +1375,10 @@ uint8_t fdc_read(uint16_t addr, void *priv)
|
||||
fdc.data_ready = 0;
|
||||
}
|
||||
/* What the heck is this even doing?! */
|
||||
/* if (discint==0xA)
|
||||
/* if (floppyint==0xA)
|
||||
{
|
||||
timer_process();
|
||||
disctime = 1024 * (1 << TIMER_SHIFT);
|
||||
floppytime = 1024 * (1 << TIMER_SHIFT);
|
||||
timer_update_outstanding();
|
||||
} */
|
||||
fdc.stat &= 0xf0;
|
||||
@@ -1384,7 +1386,7 @@ uint8_t fdc_read(uint16_t addr, void *priv)
|
||||
case 7: /*Disk change*/
|
||||
drive = real_drive(fdc.dor & 3);
|
||||
if (fdc.dor & (0x10 << drive))
|
||||
temp = (disc_changed[drive] || drive_empty[drive])?0x80:0;
|
||||
temp = (floppy_changed[drive] || drive_empty[drive])?0x80:0;
|
||||
else
|
||||
temp = 0;
|
||||
if (fdc.dskchg_activelow) /*PC2086/3086 seem to reverse this bit*/
|
||||
@@ -1460,14 +1462,14 @@ void fdc_poll_common_finish(int compare, int st5)
|
||||
void fdc_poll_readwrite_finish(int compare)
|
||||
{
|
||||
fdc.inread = 0;
|
||||
discint=-2;
|
||||
floppyint=-2;
|
||||
|
||||
fdc_poll_common_finish(compare, 0);
|
||||
}
|
||||
|
||||
void fdc_no_dma_end(int compare)
|
||||
{
|
||||
disctime = 0;
|
||||
floppytime = 0;
|
||||
|
||||
fdc_poll_common_finish(compare, 0x80);
|
||||
}
|
||||
@@ -1477,8 +1479,8 @@ void fdc_callback(void *priv)
|
||||
int compare = 0;
|
||||
int drive_num = 0;
|
||||
int old_sector = 0;
|
||||
disctime = 0;
|
||||
switch (discint)
|
||||
floppytime = 0;
|
||||
switch (floppyint)
|
||||
{
|
||||
case -3: /*End of command with interrupt*/
|
||||
fdc_int();
|
||||
@@ -1509,7 +1511,7 @@ void fdc_callback(void *priv)
|
||||
}
|
||||
else
|
||||
{
|
||||
disc_readsector(fdc.drive, SECTOR_NEXT, fdc.rw_track, fdc.head, fdc.rate, fdc.params[4]);
|
||||
floppy_readsector(fdc.drive, SECTOR_NEXT, fdc.rw_track, fdc.head, fdc.rate, fdc.params[4]);
|
||||
if (fdc.pcjr || !fdc.dma)
|
||||
{
|
||||
fdc.stat = 0x70;
|
||||
@@ -1534,8 +1536,8 @@ void fdc_callback(void *priv)
|
||||
|
||||
fdc.stat = (fdc.stat & 0xf) | 0xd0;
|
||||
paramstogo = 1;
|
||||
discint = 0;
|
||||
disctime = 0;
|
||||
floppyint = 0;
|
||||
floppytime = 0;
|
||||
return;
|
||||
case 5: /*Write data*/
|
||||
case 9: /*Write deleted data*/
|
||||
@@ -1545,7 +1547,7 @@ void fdc_callback(void *priv)
|
||||
case 0x19: /*Scan low or equal*/
|
||||
case 0x1C: /*Verify*/
|
||||
case 0x1D: /*Scan high or equal*/
|
||||
if ((discint == 0x11) || (discint == 0x19) || (discint == 0x1D))
|
||||
if ((floppyint == 0x11) || (floppyint == 0x19) || (floppyint == 0x1D))
|
||||
{
|
||||
compare = 1;
|
||||
}
|
||||
@@ -1553,7 +1555,7 @@ void fdc_callback(void *priv)
|
||||
{
|
||||
compare = 0;
|
||||
}
|
||||
if ((discint == 6) || (discint == 0xC))
|
||||
if ((floppyint == 6) || (floppyint == 0xC))
|
||||
{
|
||||
if (fdc.wrong_am && !(fdc.deleted & 0x20))
|
||||
{
|
||||
@@ -1592,7 +1594,7 @@ void fdc_callback(void *priv)
|
||||
fdc_poll_readwrite_finish(compare);
|
||||
return;
|
||||
}
|
||||
if ((discint == 0x16) && (fdc.params[0] & 0x80))
|
||||
if ((floppyint == 0x16) && (fdc.params[0] & 0x80))
|
||||
{
|
||||
/* VERIFY command, EC set */
|
||||
fdc.sc--;
|
||||
@@ -1604,7 +1606,7 @@ void fdc_callback(void *priv)
|
||||
}
|
||||
/* The rest is processed normally per MT flag and EOT. */
|
||||
}
|
||||
else if ((discint == 0x16) && !(fdc.params[0] & 0x80))
|
||||
else if ((floppyint == 0x16) && !(fdc.params[0] & 0x80))
|
||||
{
|
||||
/* VERIFY command, EC clear */
|
||||
if ((fdc.sector == old_sector) && (fdc.head == (fdc.command & 0x80) ? 1 : 0))
|
||||
@@ -1660,11 +1662,11 @@ void fdc_callback(void *priv)
|
||||
fdc.sector++;
|
||||
}
|
||||
update_status_bar_icon(SB_FLOPPY | fdc.drive, 1);
|
||||
switch (discint)
|
||||
switch (floppyint)
|
||||
{
|
||||
case 5:
|
||||
case 9:
|
||||
disc_writesector(fdc.drive, fdc.sector, fdc.rw_track, fdc.head, fdc.rate, fdc.params[4]);
|
||||
floppy_writesector(fdc.drive, fdc.sector, fdc.rw_track, fdc.head, fdc.rate, fdc.params[4]);
|
||||
if (fdc.pcjr || !fdc.dma)
|
||||
{
|
||||
fdc.stat = 0xb0;
|
||||
@@ -1677,7 +1679,7 @@ void fdc_callback(void *priv)
|
||||
case 6:
|
||||
case 0xC:
|
||||
case 0x16:
|
||||
disc_readsector(fdc.drive, fdc.sector, fdc.rw_track, fdc.head, fdc.rate, fdc.params[4]);
|
||||
floppy_readsector(fdc.drive, fdc.sector, fdc.rw_track, fdc.head, fdc.rate, fdc.params[4]);
|
||||
if (fdc.pcjr || !fdc.dma)
|
||||
{
|
||||
fdc.stat = 0x70;
|
||||
@@ -1690,7 +1692,7 @@ void fdc_callback(void *priv)
|
||||
case 0x11:
|
||||
case 0x19:
|
||||
case 0x1D:
|
||||
disc_comparesector(fdc.drive, fdc.sector, fdc.rw_track, fdc.head, fdc.rate, fdc.params[4]);
|
||||
floppy_comparesector(fdc.drive, fdc.sector, fdc.rw_track, fdc.head, fdc.rate, fdc.params[4]);
|
||||
if (fdc.pcjr || !fdc.dma)
|
||||
{
|
||||
fdc.stat = 0xb0;
|
||||
@@ -1712,9 +1714,9 @@ void fdc_callback(void *priv)
|
||||
{
|
||||
fdc.st0 |= 0x50;
|
||||
}
|
||||
discint=-3;
|
||||
floppyint=-3;
|
||||
timer_process();
|
||||
disctime = 2048 * (1 << TIMER_SHIFT);
|
||||
floppytime = 2048 * (1 << TIMER_SHIFT);
|
||||
timer_update_outstanding();
|
||||
fdc.stat = 0x80 | (1 << fdc.drive);
|
||||
return;
|
||||
@@ -1735,7 +1737,7 @@ void fdc_callback(void *priv)
|
||||
drive_num = real_drive(4 - fdc_reset_stat);
|
||||
if ((!fdd_get_flags(drive_num)) || (drive_num >= FDD_NUM))
|
||||
{
|
||||
disc_stop(drive_num);
|
||||
floppy_stop(drive_num);
|
||||
fdd_set_head(drive_num, 0);
|
||||
fdc.res[9] = 0xc0 | (4 - fdc_reset_stat) | (fdd_get_head(drive_num) ? 4 : 0);
|
||||
}
|
||||
@@ -1751,8 +1753,8 @@ void fdc_callback(void *priv)
|
||||
fdc.res[10] = fdc.pcn[fdc.res[9] & 3];
|
||||
|
||||
paramstogo = 2;
|
||||
discint = 0;
|
||||
disctime = 0;
|
||||
floppyint = 0;
|
||||
floppytime = 0;
|
||||
return;
|
||||
|
||||
case 0x0d: /*Format track*/
|
||||
@@ -1760,17 +1762,17 @@ void fdc_callback(void *priv)
|
||||
{
|
||||
fdc.format_state = 2;
|
||||
timer_process();
|
||||
disctime = 128 * (1 << TIMER_SHIFT);
|
||||
floppytime = 128 * (1 << TIMER_SHIFT);
|
||||
timer_update_outstanding();
|
||||
}
|
||||
else if (fdc.format_state == 2)
|
||||
{
|
||||
disc_format(fdc.drive, fdc.head, fdc.rate, fdc.params[4]);
|
||||
floppy_format(fdc.drive, fdc.head, fdc.rate, fdc.params[4]);
|
||||
fdc.format_state = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
discint=-2;
|
||||
floppyint=-2;
|
||||
fdc_int();
|
||||
fdc.fintr = 0;
|
||||
fdc.stat=0xD0;
|
||||
@@ -1789,9 +1791,9 @@ void fdc_callback(void *priv)
|
||||
case 15: /*Seek*/
|
||||
drive_num = real_drive(fdc.rw_drive);
|
||||
fdc.st0 = 0x20 | (fdc.params[0] & 7);
|
||||
discint=-3;
|
||||
floppyint=-3;
|
||||
timer_process();
|
||||
disctime = 2048 * (1 << TIMER_SHIFT);
|
||||
floppytime = 2048 * (1 << TIMER_SHIFT);
|
||||
timer_update_outstanding();
|
||||
fdc.stat = 0x80 | (1 << fdc.drive);
|
||||
return;
|
||||
@@ -1808,16 +1810,16 @@ void fdc_callback(void *priv)
|
||||
fdc.res[9] = fdc.config;
|
||||
fdc.res[10] = fdc.pretrk;
|
||||
paramstogo = 10;
|
||||
discint=0;
|
||||
disctime = 0;
|
||||
floppyint=0;
|
||||
floppytime = 0;
|
||||
return;
|
||||
|
||||
case 0x10: /*Version*/
|
||||
fdc.stat = (fdc.stat & 0xf) | 0xd0;
|
||||
fdc.res[10] = 0x90;
|
||||
paramstogo=1;
|
||||
discint=0;
|
||||
disctime = 0;
|
||||
floppyint=0;
|
||||
floppytime = 0;
|
||||
return;
|
||||
|
||||
case 0x13: /*Configure*/
|
||||
@@ -1826,31 +1828,31 @@ void fdc_callback(void *priv)
|
||||
fdc.fifo = (fdc.params[1] & 0x20) ? 0 : 1;
|
||||
fdc.tfifo = (fdc.params[1] & 0xF);
|
||||
fdc.stat = 0x80;
|
||||
disctime = 0;
|
||||
floppytime = 0;
|
||||
return;
|
||||
case 0x14: /*Unlock*/
|
||||
fdc.lock = 0;
|
||||
fdc.stat = (fdc.stat & 0xf) | 0xd0;
|
||||
fdc.res[10] = 0;
|
||||
paramstogo=1;
|
||||
discint=0;
|
||||
disctime = 0;
|
||||
floppyint=0;
|
||||
floppytime = 0;
|
||||
return;
|
||||
case 0x94: /*Lock*/
|
||||
fdc.lock = 1;
|
||||
fdc.stat = (fdc.stat & 0xf) | 0xd0;
|
||||
fdc.res[10] = 0x10;
|
||||
paramstogo=1;
|
||||
discint=0;
|
||||
disctime = 0;
|
||||
floppyint=0;
|
||||
floppytime = 0;
|
||||
return;
|
||||
|
||||
case 0x18: /*NSC*/
|
||||
fdc.stat = (fdc.stat & 0xf) | 0xd0;
|
||||
fdc.res[10] = 0x73;
|
||||
paramstogo=1;
|
||||
discint=0;
|
||||
disctime = 0;
|
||||
floppyint=0;
|
||||
floppytime = 0;
|
||||
return;
|
||||
|
||||
case 0xfc: /*Invalid*/
|
||||
@@ -1858,15 +1860,15 @@ void fdc_callback(void *priv)
|
||||
fdc.stat = (fdc.stat & 0xf) | 0xd0;
|
||||
fdc.res[10] = fdc.st0;
|
||||
paramstogo=1;
|
||||
discint=0;
|
||||
disctime = 0;
|
||||
floppyint=0;
|
||||
floppytime = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void fdc_error(int st5, int st6)
|
||||
{
|
||||
disctime = 0;
|
||||
floppytime = 0;
|
||||
|
||||
fdc_int();
|
||||
fdc.fintr = 0;
|
||||
@@ -1875,7 +1877,7 @@ void fdc_error(int st5, int st6)
|
||||
fdc.res[5]=st5;
|
||||
fdc.res[6]=st6;
|
||||
fdc_log("FDC Error: %02X %02X %02X\n", fdc.res[4], fdc.res[5], fdc.res[6]);
|
||||
switch(discint)
|
||||
switch(floppyint)
|
||||
{
|
||||
case 0x02:
|
||||
case 0x05:
|
||||
@@ -1905,7 +1907,7 @@ void fdc_error(int st5, int st6)
|
||||
|
||||
void fdc_overrun()
|
||||
{
|
||||
disc_stop(fdc.drive);
|
||||
floppy_stop(fdc.drive);
|
||||
|
||||
fdc_error(0x10, 0);
|
||||
}
|
||||
@@ -2186,7 +2188,7 @@ void fdc_init()
|
||||
{
|
||||
fdc_hard_reset();
|
||||
|
||||
timer_add(fdc_callback, &disctime, &disctime, NULL);
|
||||
timer_add(fdc_callback, &floppytime, &floppytime, NULL);
|
||||
}
|
||||
|
||||
void fdc_add()
|
||||
@@ -2238,10 +2240,10 @@ void fdc_remove()
|
||||
io_removehandler(fdc.base_address + 7, 0x0001, fdc_read, NULL, NULL, fdc_write, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void fdc_discchange_clear(int drive)
|
||||
void fdc_floppychange_clear(int drive)
|
||||
{
|
||||
if (drive < FDD_NUM)
|
||||
disc_changed[drive] = 0;
|
||||
floppy_changed[drive] = 0;
|
||||
}
|
||||
|
||||
void fdc_set_dskchg_activelow()
|
||||
@@ -9,7 +9,7 @@
|
||||
* Implementation of the NEC uPD-765 and compatible floppy disk
|
||||
* controller.
|
||||
*
|
||||
* Version: @(#)fdc.h 1.0.1 2017/08/23
|
||||
* Version: @(#)fdc.h 1.0.2 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -29,7 +29,7 @@ extern void fdc_remove(void);
|
||||
extern void fdc_reset(void);
|
||||
extern void fdc_poll(void);
|
||||
extern void fdc_abort(void);
|
||||
extern void fdc_discchange_clear(int drive);
|
||||
extern void fdc_floppychange_clear(int drive);
|
||||
extern void fdc_set_dskchg_activelow(void);
|
||||
extern void fdc_3f1_enable(int enable);
|
||||
extern void fdc_set_ps1(void);
|
||||
@@ -8,15 +8,15 @@
|
||||
*
|
||||
* Implementation of the floppy drive emulation.
|
||||
*
|
||||
* Version: @(#)fdd.c 1.0.1 2017/08/23
|
||||
* Version: @(#)fdd.c 1.0.2 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#include "ibm.h"
|
||||
#include "disc.h"
|
||||
#include "../ibm.h"
|
||||
#include "floppy.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
|
||||
@@ -154,8 +154,8 @@ void fdd_forced_seek(int drive, int track_diff)
|
||||
if (fdd[drive].track > drive_types[fdd[drive].type].max_track)
|
||||
fdd[drive].track = drive_types[fdd[drive].type].max_track;
|
||||
|
||||
disc_seek(drive, fdd[drive].track);
|
||||
disctime = 5000;
|
||||
floppy_seek(drive, fdd[drive].track);
|
||||
floppytime = 5000;
|
||||
}
|
||||
|
||||
void fdd_seek(int drive, int track_diff)
|
||||
@@ -164,7 +164,7 @@ void fdd_seek(int drive, int track_diff)
|
||||
|
||||
if (!track_diff)
|
||||
{
|
||||
disctime = 5000;
|
||||
floppytime = 5000;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -176,9 +176,9 @@ void fdd_seek(int drive, int track_diff)
|
||||
if (fdd[drive].track > drive_types[fdd[drive].type].max_track)
|
||||
fdd[drive].track = drive_types[fdd[drive].type].max_track;
|
||||
|
||||
fdc_discchange_clear(drive);
|
||||
disc_seek(drive, fdd[drive].track);
|
||||
disctime = 5000;
|
||||
fdc_floppychange_clear(drive);
|
||||
floppy_seek(drive, fdd[drive].track);
|
||||
floppytime = 5000;
|
||||
}
|
||||
|
||||
int fdd_track0(int drive)
|
||||
@@ -215,7 +215,7 @@ void fdd_set_densel(int densel)
|
||||
|
||||
int fdd_getrpm(int drive)
|
||||
{
|
||||
int hole = disc_hole(drive);
|
||||
int hole = floppy_hole(drive);
|
||||
|
||||
int densel = 0;
|
||||
|
||||
@@ -237,7 +237,7 @@ int fdd_getrpm(int drive)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* disc_hole(drive) returns 0 for double density media, 1 for high density, and 2 for extended density. */
|
||||
/* floppy_hole(drive) returns 0 for double density media, 1 for high density, and 2 for extended density. */
|
||||
if (hole == 1)
|
||||
{
|
||||
return densel ? 300 : 360;
|
||||
@@ -256,7 +256,7 @@ void fdd_setswap(int swap)
|
||||
|
||||
int fdd_can_read_medium(int drive)
|
||||
{
|
||||
int hole = disc_hole(drive);
|
||||
int hole = floppy_hole(drive);
|
||||
|
||||
drive = real_drive(drive);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the floppy drive emulation.
|
||||
*
|
||||
* Version: @(#)fdd.h 1.0.1 2017/08/23
|
||||
* Version: @(#)fdd.h 1.0.2 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -29,9 +29,9 @@
|
||||
#include "zfile.h"*/
|
||||
/* ELSE */
|
||||
#define xmalloc malloc
|
||||
#include "../ibm.h"
|
||||
#include "fdi2raw.h"
|
||||
|
||||
#include "ibm.h"
|
||||
|
||||
#undef DEBUG
|
||||
#define VERBOSE
|
||||
@@ -9,35 +9,35 @@
|
||||
* Generic floppy disk interface that communicates with the
|
||||
* other handlers.
|
||||
*
|
||||
* Version: @(#)disc.c 1.0.1 2017/06/03
|
||||
* Version: @(#)floppy.c 1.0.2 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#define UNICODE
|
||||
#include <windows.h>
|
||||
|
||||
#include "ibm.h"
|
||||
#include "config.h"
|
||||
#include "disc.h"
|
||||
#include "disc_fdi.h"
|
||||
#include "disc_img.h"
|
||||
#include "disc_86f.h"
|
||||
#include "disc_td0.h"
|
||||
#include "disc_imd.h"
|
||||
#include "../ibm.h"
|
||||
#include "../config.h"
|
||||
#include "../timer.h"
|
||||
#include "floppy.h"
|
||||
#include "floppy_fdi.h"
|
||||
#include "floppy_img.h"
|
||||
#include "floppy_86f.h"
|
||||
#include "floppy_td0.h"
|
||||
#include "floppy_imd.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
#include "timer.h"
|
||||
|
||||
|
||||
wchar_t discfns[4][512];
|
||||
extern int driveempty[4];
|
||||
|
||||
int disc_poll_time[FDD_NUM] = { 16, 16, 16, 16 };
|
||||
wchar_t floppyfns[4][512];
|
||||
|
||||
int disc_track[FDD_NUM];
|
||||
int floppy_poll_time[FDD_NUM] = { 16, 16, 16, 16 };
|
||||
|
||||
int floppy_track[FDD_NUM];
|
||||
int writeprot[FDD_NUM], fwriteprot[FDD_NUM];
|
||||
|
||||
DRIVE drives[FDD_NUM];
|
||||
@@ -51,19 +51,20 @@ int disable_write = 0;
|
||||
int defaultwriteprot = 0;
|
||||
|
||||
int fdc_time;
|
||||
int disc_time;
|
||||
int floppy_time;
|
||||
|
||||
int fdc_ready;
|
||||
|
||||
int drive_empty[FDD_NUM] = {1, 1, 1, 1};
|
||||
int disc_changed[FDD_NUM];
|
||||
int floppy_changed[FDD_NUM];
|
||||
|
||||
int motorspin;
|
||||
int motoron[FDD_NUM];
|
||||
|
||||
int fdc_indexcount = 52;
|
||||
|
||||
/*void (*fdc_callback)();
|
||||
#if 0 //FIXME:
|
||||
void (*fdc_callback)();
|
||||
void (*fdc_data)(uint8_t dat);
|
||||
void (*fdc_spindown)();
|
||||
void (*fdc_finishread)();
|
||||
@@ -73,7 +74,8 @@ void (*fdc_headercrcerror)();
|
||||
void (*fdc_writeprotect)();
|
||||
int (*fdc_getdata)(int last);
|
||||
void (*fdc_sectorid)(uint8_t track, uint8_t side, uint8_t sector, uint8_t size, uint8_t crc1, uint8_t crc2);
|
||||
void (*fdc_indexpulse)();*/
|
||||
void (*fdc_indexpulse)();
|
||||
#endif
|
||||
|
||||
|
||||
static struct
|
||||
@@ -118,7 +120,7 @@ static struct
|
||||
|
||||
static int driveloaders[4];
|
||||
|
||||
void disc_load(int drive, wchar_t *fn)
|
||||
void floppy_load(int drive, wchar_t *fn)
|
||||
{
|
||||
int c = 0, size;
|
||||
wchar_t *p;
|
||||
@@ -138,9 +140,9 @@ void disc_load(int drive, wchar_t *fn)
|
||||
driveloaders[drive] = c;
|
||||
loaders[c].load(drive, fn);
|
||||
drive_empty[drive] = 0;
|
||||
memcpy(discfns[drive], fn, (wcslen(fn) << 1) + 2);
|
||||
memcpy(floppyfns[drive], fn, (wcslen(fn) << 1) + 2);
|
||||
fdd_forced_seek(real_drive(drive), 0);
|
||||
disc_changed[drive] = 1;
|
||||
floppy_changed[drive] = 1;
|
||||
return;
|
||||
}
|
||||
c++;
|
||||
@@ -148,16 +150,16 @@ void disc_load(int drive, wchar_t *fn)
|
||||
pclog_w(L"Couldn't load %s %s\n",fn,p);
|
||||
drive_empty[drive] = 1;
|
||||
fdd_set_head(real_drive(drive), 0);
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
update_status_bar_icon_state(drive, 1);
|
||||
}
|
||||
|
||||
void disc_close(int drive)
|
||||
void floppy_close(int drive)
|
||||
{
|
||||
if (loaders[driveloaders[drive]].close) loaders[driveloaders[drive]].close(drive);
|
||||
drive_empty[drive] = 1;
|
||||
fdd_set_head(real_drive(drive), 0);
|
||||
discfns[drive][0] = 0;
|
||||
floppyfns[drive][0] = 0;
|
||||
drives[drive].hole = NULL;
|
||||
drives[drive].poll = NULL;
|
||||
drives[drive].seek = NULL;
|
||||
@@ -171,10 +173,10 @@ void disc_close(int drive)
|
||||
update_status_bar_icon_state(drive, 1);
|
||||
}
|
||||
|
||||
int disc_notfound=0;
|
||||
static int disc_period = 32;
|
||||
int floppy_notfound=0;
|
||||
static int floppy_period = 32;
|
||||
|
||||
int disc_hole(int drive)
|
||||
int floppy_hole(int drive)
|
||||
{
|
||||
drive = real_drive(drive);
|
||||
|
||||
@@ -188,7 +190,7 @@ int disc_hole(int drive)
|
||||
}
|
||||
}
|
||||
|
||||
double disc_byteperiod(int drive)
|
||||
double floppy_byteperiod(int drive)
|
||||
{
|
||||
drive = real_drive(drive);
|
||||
|
||||
@@ -202,12 +204,12 @@ double disc_byteperiod(int drive)
|
||||
}
|
||||
}
|
||||
|
||||
double disc_real_period(int drive)
|
||||
double floppy_real_period(int drive)
|
||||
{
|
||||
double ddbp;
|
||||
double dusec;
|
||||
|
||||
ddbp = disc_byteperiod(real_drive(drive));
|
||||
ddbp = floppy_byteperiod(real_drive(drive));
|
||||
|
||||
dusec = (double) TIMER_USEC;
|
||||
|
||||
@@ -227,47 +229,47 @@ double disc_real_period(int drive)
|
||||
}
|
||||
}
|
||||
|
||||
void disc_poll(int drive)
|
||||
void floppy_poll(int drive)
|
||||
{
|
||||
if (drive >= FDD_NUM)
|
||||
{
|
||||
fatal("Attempting to poll floppy drive %i that is not supposed to be there\n", drive);
|
||||
}
|
||||
|
||||
disc_poll_time[drive] += (int) disc_real_period(drive);
|
||||
floppy_poll_time[drive] += (int) floppy_real_period(drive);
|
||||
|
||||
if (drives[drive].poll)
|
||||
drives[drive].poll(drive);
|
||||
|
||||
if (disc_notfound)
|
||||
if (floppy_notfound)
|
||||
{
|
||||
disc_notfound--;
|
||||
if (!disc_notfound)
|
||||
floppy_notfound--;
|
||||
if (!floppy_notfound)
|
||||
fdc_noidam();
|
||||
}
|
||||
}
|
||||
|
||||
void disc_poll_0(void *priv)
|
||||
void floppy_poll_0(void *priv)
|
||||
{
|
||||
disc_poll(0);
|
||||
floppy_poll(0);
|
||||
}
|
||||
|
||||
void disc_poll_1(void *priv)
|
||||
void floppy_poll_1(void *priv)
|
||||
{
|
||||
disc_poll(1);
|
||||
floppy_poll(1);
|
||||
}
|
||||
|
||||
void disc_poll_2(void *priv)
|
||||
void floppy_poll_2(void *priv)
|
||||
{
|
||||
disc_poll(2);
|
||||
floppy_poll(2);
|
||||
}
|
||||
|
||||
void disc_poll_3(void *priv)
|
||||
void floppy_poll_3(void *priv)
|
||||
{
|
||||
disc_poll(3);
|
||||
floppy_poll(3);
|
||||
}
|
||||
|
||||
int disc_get_bitcell_period(int rate)
|
||||
int floppy_get_bitcell_period(int rate)
|
||||
{
|
||||
int bit_rate = 250;
|
||||
|
||||
@@ -291,91 +293,91 @@ int disc_get_bitcell_period(int rate)
|
||||
}
|
||||
|
||||
|
||||
void disc_set_rate(int drive, int drvden, int rate)
|
||||
void floppy_set_rate(int drive, int drvden, int rate)
|
||||
{
|
||||
switch (rate)
|
||||
{
|
||||
case 0: /*High density*/
|
||||
disc_period = 16;
|
||||
floppy_period = 16;
|
||||
break;
|
||||
case 1:
|
||||
switch(drvden)
|
||||
{
|
||||
case 0: /*Double density (360 rpm)*/
|
||||
disc_period = 26;
|
||||
floppy_period = 26;
|
||||
break;
|
||||
case 1: /*High density (360 rpm)*/
|
||||
disc_period = 16;
|
||||
floppy_period = 16;
|
||||
break;
|
||||
case 2:
|
||||
disc_period = 4;
|
||||
floppy_period = 4;
|
||||
break;
|
||||
}
|
||||
case 2: /*Double density*/
|
||||
disc_period = 32;
|
||||
floppy_period = 32;
|
||||
break;
|
||||
case 3: /*Extended density*/
|
||||
disc_period = 8;
|
||||
floppy_period = 8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void disc_reset()
|
||||
void floppy_reset()
|
||||
{
|
||||
curdrive = 0;
|
||||
disc_period = 32;
|
||||
timer_add(disc_poll_0, &(disc_poll_time[0]), &(motoron[0]), NULL);
|
||||
timer_add(disc_poll_1, &(disc_poll_time[1]), &(motoron[1]), NULL);
|
||||
timer_add(disc_poll_2, &(disc_poll_time[2]), &(motoron[2]), NULL);
|
||||
timer_add(disc_poll_3, &(disc_poll_time[3]), &(motoron[3]), NULL);
|
||||
floppy_period = 32;
|
||||
timer_add(floppy_poll_0, &(floppy_poll_time[0]), &(motoron[0]), NULL);
|
||||
timer_add(floppy_poll_1, &(floppy_poll_time[1]), &(motoron[1]), NULL);
|
||||
timer_add(floppy_poll_2, &(floppy_poll_time[2]), &(motoron[2]), NULL);
|
||||
timer_add(floppy_poll_3, &(floppy_poll_time[3]), &(motoron[3]), NULL);
|
||||
}
|
||||
|
||||
void disc_init()
|
||||
void floppy_init()
|
||||
{
|
||||
drives[0].poll = drives[1].poll = drives[2].poll = drives[3].poll = 0;
|
||||
drives[0].seek = drives[1].seek = drives[2].seek = drives[3].seek = 0;
|
||||
drives[0].readsector = drives[1].readsector = drives[2].readsector = drives[3].readsector = 0;
|
||||
disc_reset();
|
||||
floppy_reset();
|
||||
}
|
||||
|
||||
int oldtrack[FDD_NUM] = {0, 0, 0, 0};
|
||||
void disc_seek(int drive, int track)
|
||||
void floppy_seek(int drive, int track)
|
||||
{
|
||||
if (drives[drive].seek)
|
||||
drives[drive].seek(drive, track);
|
||||
}
|
||||
|
||||
void disc_readsector(int drive, int sector, int track, int side, int density, int sector_size)
|
||||
void floppy_readsector(int drive, int sector, int track, int side, int density, int sector_size)
|
||||
{
|
||||
drive = real_drive(drive);
|
||||
|
||||
if (drives[drive].readsector)
|
||||
drives[drive].readsector(drive, sector, track, side, density, sector_size);
|
||||
else
|
||||
disc_notfound = 1000;
|
||||
floppy_notfound = 1000;
|
||||
}
|
||||
|
||||
void disc_writesector(int drive, int sector, int track, int side, int density, int sector_size)
|
||||
void floppy_writesector(int drive, int sector, int track, int side, int density, int sector_size)
|
||||
{
|
||||
drive = real_drive(drive);
|
||||
|
||||
if (drives[drive].writesector)
|
||||
drives[drive].writesector(drive, sector, track, side, density, sector_size);
|
||||
else
|
||||
disc_notfound = 1000;
|
||||
floppy_notfound = 1000;
|
||||
}
|
||||
|
||||
void disc_comparesector(int drive, int sector, int track, int side, int density, int sector_size)
|
||||
void floppy_comparesector(int drive, int sector, int track, int side, int density, int sector_size)
|
||||
{
|
||||
drive = real_drive(drive);
|
||||
|
||||
if (drives[drive].comparesector)
|
||||
drives[drive].comparesector(drive, sector, track, side, density, sector_size);
|
||||
else
|
||||
disc_notfound = 1000;
|
||||
floppy_notfound = 1000;
|
||||
}
|
||||
|
||||
void disc_readaddress(int drive, int side, int density)
|
||||
void floppy_readaddress(int drive, int side, int density)
|
||||
{
|
||||
drive = real_drive(drive);
|
||||
|
||||
@@ -383,17 +385,17 @@ void disc_readaddress(int drive, int side, int density)
|
||||
drives[drive].readaddress(drive, side, density);
|
||||
}
|
||||
|
||||
void disc_format(int drive, int side, int density, uint8_t fill)
|
||||
void floppy_format(int drive, int side, int density, uint8_t fill)
|
||||
{
|
||||
drive = real_drive(drive);
|
||||
|
||||
if (drives[drive].format)
|
||||
drives[drive].format(drive, side, density, fill);
|
||||
else
|
||||
disc_notfound = 1000;
|
||||
floppy_notfound = 1000;
|
||||
}
|
||||
|
||||
void disc_stop(int drive)
|
||||
void floppy_stop(int drive)
|
||||
{
|
||||
drive = real_drive(drive);
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
* Generic floppy disk interface that communicates with the
|
||||
* other handlers.
|
||||
*
|
||||
* Version: @(#)disc.h 1.0.2 2017/08/23
|
||||
* Version: @(#)floppy.h 1.0.3 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#ifndef EMU_DISC_H
|
||||
# define EMU_DISC_H
|
||||
#ifndef EMU_FLOPPY_H
|
||||
# define EMU_FLOPPY_H
|
||||
|
||||
|
||||
#define FDD_NUM 4
|
||||
@@ -41,34 +41,34 @@ typedef struct
|
||||
extern DRIVE drives[FDD_NUM];
|
||||
extern int curdrive;
|
||||
|
||||
extern int disc_time;
|
||||
extern int disc_poll_time[FDD_NUM];
|
||||
extern int floppy_time;
|
||||
extern int floppy_poll_time[FDD_NUM];
|
||||
|
||||
|
||||
extern void disc_load(int drive, wchar_t *fn);
|
||||
extern void disc_new(int drive, char *fn);
|
||||
extern void disc_close(int drive);
|
||||
extern void disc_init(void);
|
||||
extern void disc_reset(void);
|
||||
extern void disc_poll(int drive);
|
||||
extern void disc_poll_0(void* priv);
|
||||
extern void disc_poll_1(void* priv);
|
||||
extern void disc_poll_2(void* priv);
|
||||
extern void disc_poll_3(void* priv);
|
||||
extern void disc_seek(int drive, int track);
|
||||
extern void disc_readsector(int drive, int sector, int track,
|
||||
extern void floppy_load(int drive, wchar_t *fn);
|
||||
extern void floppy_new(int drive, char *fn);
|
||||
extern void floppy_close(int drive);
|
||||
extern void floppy_init(void);
|
||||
extern void floppy_reset(void);
|
||||
extern void floppy_poll(int drive);
|
||||
extern void floppy_poll_0(void* priv);
|
||||
extern void floppy_poll_1(void* priv);
|
||||
extern void floppy_poll_2(void* priv);
|
||||
extern void floppy_poll_3(void* priv);
|
||||
extern void floppy_seek(int drive, int track);
|
||||
extern void floppy_readsector(int drive, int sector, int track,
|
||||
int side, int density, int sector_size);
|
||||
extern void disc_writesector(int drive, int sector, int track,
|
||||
extern void floppy_writesector(int drive, int sector, int track,
|
||||
int side, int density, int sector_size);
|
||||
extern void disc_comparesector(int drive, int sector, int track,
|
||||
extern void floppy_comparesector(int drive, int sector, int track,
|
||||
int side, int density, int sector_size);
|
||||
extern void disc_readaddress(int drive, int side, int density);
|
||||
extern void disc_format(int drive, int side, int density, uint8_t fill);
|
||||
extern int disc_hole(int drive);
|
||||
extern double disc_byteperiod(int drive);
|
||||
extern void disc_stop(int drive);
|
||||
extern int disc_empty(int drive);
|
||||
extern void disc_set_rate(int drive, int drvden, int rate);
|
||||
extern void floppy_readaddress(int drive, int side, int density);
|
||||
extern void floppy_format(int drive, int side, int density, uint8_t fill);
|
||||
extern int floppy_hole(int drive);
|
||||
extern double floppy_byteperiod(int drive);
|
||||
extern void floppy_stop(int drive);
|
||||
extern int floppy_empty(int drive);
|
||||
extern void floppy_set_rate(int drive, int drvden, int rate);
|
||||
|
||||
extern void fdc_callback(void *priv);
|
||||
extern int fdc_data(uint8_t dat);
|
||||
@@ -95,12 +95,12 @@ extern int disable_write;
|
||||
extern int defaultwriteprot;
|
||||
|
||||
extern int writeprot[FDD_NUM], fwriteprot[FDD_NUM];
|
||||
extern int disc_track[FDD_NUM];
|
||||
extern int disc_changed[FDD_NUM];
|
||||
extern int floppy_track[FDD_NUM];
|
||||
extern int floppy_changed[FDD_NUM];
|
||||
extern int drive_empty[FDD_NUM];
|
||||
extern int drive_type[FDD_NUM];
|
||||
|
||||
/*Used in the Read A Track command. Only valid for disc_readsector(). */
|
||||
/*Used in the Read A Track command. Only valid for floppy_readsector(). */
|
||||
#define SECTOR_FIRST -2
|
||||
#define SECTOR_NEXT -1
|
||||
|
||||
@@ -145,7 +145,7 @@ typedef union {
|
||||
uint8_t bytes[2];
|
||||
} crc_t;
|
||||
|
||||
void disc_calccrc(uint8_t byte, crc_t *crc_var);
|
||||
void floppy_calccrc(uint8_t byte, crc_t *crc_var);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -237,4 +237,4 @@ void d86f_initialize_last_sector_id(int drive, int c, int h, int r, int n);
|
||||
void d86f_zero_bit_field(int drive, int side);
|
||||
|
||||
|
||||
#endif /*EMU_DISC_H*/
|
||||
#endif /*EMU_FLOPPY_H*/
|
||||
@@ -10,12 +10,11 @@
|
||||
* data in the form of FM/MFM-encoded transitions) which also
|
||||
* forms the core of the emulator's floppy disk emulation.
|
||||
*
|
||||
* Version: @(#)disc_86f.c 1.0.1 2017/08/23
|
||||
* Version: @(#)floppy_86f.c 1.0.2 2017/09/03
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
@@ -23,20 +22,20 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include "lzf/lzf.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "dma.h"
|
||||
#include "disc.h"
|
||||
#include "disc_86f.h"
|
||||
#include "disc_random.h"
|
||||
#include "../lzf/lzf.h"
|
||||
#include "../ibm.h"
|
||||
#include "../config.h"
|
||||
#include "../dma.h"
|
||||
#include "../random.h"
|
||||
#include "floppy.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
#include "ibm.h"
|
||||
#include "floppy_86f.h"
|
||||
|
||||
|
||||
#define CHUNK 16384
|
||||
|
||||
|
||||
uint64_t poly = 0x42F0E1EBA9EA3693ll; /* ECMA normal */
|
||||
|
||||
uint64_t table[256];
|
||||
@@ -981,7 +980,7 @@ void d86f_get_bit(int drive, int side)
|
||||
if (current_bit)
|
||||
{
|
||||
/* Bit is 1 and is set to fuzzy, we randomly generate it. */
|
||||
d86f[drive].last_word[side] |= (disc_random_generate() & 1);
|
||||
d86f[drive].last_word[side] |= (random_generate() & 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1108,14 +1107,14 @@ static uint8_t decodefm(int drive, uint16_t dat)
|
||||
return temp;
|
||||
}
|
||||
|
||||
void disc_calccrc(uint8_t byte, crc_t *crc_var)
|
||||
void floppy_calccrc(uint8_t byte, crc_t *crc_var)
|
||||
{
|
||||
crc_var->word = (crc_var->word << 8) ^ CRCTable[(crc_var->word >> 8)^byte];
|
||||
}
|
||||
|
||||
static void d86f_calccrc(int drive, uint8_t byte)
|
||||
{
|
||||
disc_calccrc(byte, &(d86f[drive].calc_crc));
|
||||
floppy_calccrc(byte, &(d86f[drive].calc_crc));
|
||||
}
|
||||
|
||||
int d86f_word_is_aligned(int drive, int side, uint32_t base_pos)
|
||||
@@ -1151,7 +1150,7 @@ void d86f_find_address_mark_fm(int drive, int side, find_t *find, uint16_t req_a
|
||||
if (d86f[drive].last_word[side] == req_am)
|
||||
{
|
||||
d86f[drive].calc_crc.word = 0xFFFF;
|
||||
disc_calccrc(decodefm(drive, d86f[drive].last_word[side]), &(d86f[drive].calc_crc));
|
||||
floppy_calccrc(decodefm(drive, d86f[drive].last_word[side]), &(d86f[drive].calc_crc));
|
||||
find->sync_marks = find->bits_obtained = find->bytes_obtained = 0;
|
||||
find->sync_pos = 0xFFFFFFFF;
|
||||
d86f[drive].preceding_bit[side] = d86f[drive].last_word[side] & 1;
|
||||
@@ -1162,7 +1161,7 @@ void d86f_find_address_mark_fm(int drive, int side, find_t *find, uint16_t req_a
|
||||
if ((ignore_other_am & 2) && (d86f[drive].last_word[side] == other_am))
|
||||
{
|
||||
d86f[drive].calc_crc.word = 0xFFFF;
|
||||
disc_calccrc(decodefm(drive, d86f[drive].last_word[side]), &(d86f[drive].calc_crc));
|
||||
floppy_calccrc(decodefm(drive, d86f[drive].last_word[side]), &(d86f[drive].calc_crc));
|
||||
find->sync_marks = find->bits_obtained = find->bytes_obtained = 0;
|
||||
find->sync_pos = 0xFFFFFFFF;
|
||||
if (ignore_other_am & 1)
|
||||
@@ -1224,7 +1223,7 @@ void d86f_find_address_mark_mfm(int drive, int side, find_t *find, uint16_t req_
|
||||
if (d86f_word_is_aligned(drive, side, find->sync_pos))
|
||||
{
|
||||
d86f[drive].calc_crc.word = 0xCDB4;
|
||||
disc_calccrc(decodefm(drive, d86f[drive].last_word[side]), &(d86f[drive].calc_crc));
|
||||
floppy_calccrc(decodefm(drive, d86f[drive].last_word[side]), &(d86f[drive].calc_crc));
|
||||
find->sync_marks = find->bits_obtained = find->bytes_obtained = 0;
|
||||
find->sync_pos = 0xFFFFFFFF;
|
||||
d86f[drive].preceding_bit[side] = d86f[drive].last_word[side] & 1;
|
||||
@@ -1238,7 +1237,7 @@ void d86f_find_address_mark_mfm(int drive, int side, find_t *find, uint16_t req_
|
||||
if (d86f_word_is_aligned(drive, side, find->sync_pos))
|
||||
{
|
||||
d86f[drive].calc_crc.word = 0xCDB4;
|
||||
disc_calccrc(decodefm(drive, d86f[drive].last_word[side]), &(d86f[drive].calc_crc));
|
||||
floppy_calccrc(decodefm(drive, d86f[drive].last_word[side]), &(d86f[drive].calc_crc));
|
||||
find->sync_marks = find->bits_obtained = find->bytes_obtained = 0;
|
||||
find->sync_pos = 0xFFFFFFFF;
|
||||
if (ignore_other_am & 1)
|
||||
@@ -1308,7 +1307,7 @@ void d86f_read_sector_id(int drive, int side, int match)
|
||||
if (d86f[drive].id_find.bytes_obtained < 4)
|
||||
{
|
||||
d86f[drive].last_sector.byte_array[d86f[drive].id_find.bytes_obtained] = decodefm(drive, d86f[drive].last_word[side]);
|
||||
disc_calccrc(d86f[drive].last_sector.byte_array[d86f[drive].id_find.bytes_obtained], &(d86f[drive].calc_crc));
|
||||
floppy_calccrc(d86f[drive].last_sector.byte_array[d86f[drive].id_find.bytes_obtained], &(d86f[drive].calc_crc));
|
||||
}
|
||||
else if ((d86f[drive].id_find.bytes_obtained >= 4) && (d86f[drive].id_find.bytes_obtained < 6))
|
||||
{
|
||||
@@ -1487,7 +1486,7 @@ void d86f_read_sector_data(int drive, int side)
|
||||
}
|
||||
}
|
||||
}
|
||||
disc_calccrc(data, &(d86f[drive].calc_crc));
|
||||
floppy_calccrc(data, &(d86f[drive].calc_crc));
|
||||
}
|
||||
else if (d86f[drive].data_find.bytes_obtained < crc_pos)
|
||||
{
|
||||
@@ -1608,11 +1607,11 @@ void d86f_write_sector_data(int drive, int side, int mfm, uint16_t am)
|
||||
/* This is a data byte, so CRC it. */
|
||||
if (!d86f[drive].data_find.bytes_obtained)
|
||||
{
|
||||
disc_calccrc(decodefm(drive, am), &(d86f[drive].calc_crc));
|
||||
floppy_calccrc(decodefm(drive, am), &(d86f[drive].calc_crc));
|
||||
}
|
||||
else
|
||||
{
|
||||
disc_calccrc(d86f[drive].current_byte[side], &(d86f[drive].calc_crc));
|
||||
floppy_calccrc(d86f[drive].current_byte[side], &(d86f[drive].calc_crc));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3369,7 +3368,7 @@ void d86f_load(int drive, wchar_t *fn)
|
||||
d86f[drive].f = _wfopen(fn, L"rb");
|
||||
if (!d86f[drive].f)
|
||||
{
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
writeprot[drive] = 1;
|
||||
@@ -3391,7 +3390,7 @@ void d86f_load(int drive, wchar_t *fn)
|
||||
/* File is WAY too small, abort. */
|
||||
fclose(d86f[drive].f);
|
||||
d86f[drive].f = NULL;
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3401,7 +3400,7 @@ void d86f_load(int drive, wchar_t *fn)
|
||||
d86f_log("86F: Unrecognized magic bytes: %08X\n", magic);
|
||||
fclose(d86f[drive].f);
|
||||
d86f[drive].f = NULL;
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3441,7 +3440,7 @@ void d86f_load(int drive, wchar_t *fn)
|
||||
/* File too small, abort. */
|
||||
fclose(d86f[drive].f);
|
||||
d86f[drive].f = NULL;
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3464,7 +3463,7 @@ void d86f_load(int drive, wchar_t *fn)
|
||||
d86f_log("86F: CRC64 error\n");
|
||||
fclose(d86f[drive].f);
|
||||
d86f[drive].f = NULL;
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -3481,7 +3480,7 @@ void d86f_load(int drive, wchar_t *fn)
|
||||
if (!d86f[drive].f)
|
||||
{
|
||||
d86f_log("86F: Unable to create temporary decompressed file\n");
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3512,7 +3511,7 @@ void d86f_load(int drive, wchar_t *fn)
|
||||
{
|
||||
d86f_log("86F: Error decompressing file\n");
|
||||
_wremove(temp_file_name);
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3529,7 +3528,7 @@ void d86f_load(int drive, wchar_t *fn)
|
||||
{
|
||||
_wremove(temp_file_name);
|
||||
}
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3543,7 +3542,7 @@ void d86f_load(int drive, wchar_t *fn)
|
||||
{
|
||||
_wremove(temp_file_name);
|
||||
}
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3578,7 +3577,7 @@ void d86f_load(int drive, wchar_t *fn)
|
||||
d86f_log("86F: No Track 0 side 0\n");
|
||||
fclose(d86f[drive].f);
|
||||
d86f[drive].f = NULL;
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3588,7 +3587,7 @@ void d86f_load(int drive, wchar_t *fn)
|
||||
d86f_log("86F: No Track 0 side 1\n");
|
||||
fclose(d86f[drive].f);
|
||||
d86f[drive].f = NULL;
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
* data in the form of FM/MFM-encoded transitions) which also
|
||||
* forms the core of the emulator's floppy disk emulation.
|
||||
*
|
||||
* Version: @(#)disc_86f.h 1.0.1 2017/08/23
|
||||
* Version: @(#)floppy_86f.h 1.0.2 2017/09/03
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
*/
|
||||
#ifndef EMU_DISC_86F_H
|
||||
# define EMU_DISC_86F_H
|
||||
#ifndef EMU_FLOPPY_86F_H
|
||||
# define EMU_FLOPPY_86F_H
|
||||
|
||||
|
||||
extern void d86f_init(void);
|
||||
@@ -70,4 +70,4 @@ extern void d86f_initialize_last_sector_id(int drive, int c, int h, int r, int n
|
||||
extern void d86f_zero_bit_field(int drive, int side);
|
||||
|
||||
|
||||
#endif /*EMU_DISC_86F_H*/
|
||||
#endif /*EMU_FLOPPY_86F_H*/
|
||||
@@ -9,26 +9,26 @@
|
||||
* Implementation of the FDI floppy stream image format
|
||||
* interface to the FDI2RAW module.
|
||||
*
|
||||
* Version: @(#)disc_fdi.c 1.0.0 2017/05/30
|
||||
* Version: @(#)floppy_fdi.c 1.0.1 2017/09/03
|
||||
*
|
||||
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <wchar.h>
|
||||
#include "ibm.h"
|
||||
#include "disc.h"
|
||||
#include "disc_86f.h"
|
||||
#include "disc_img.h"
|
||||
#include "disc_fdi.h"
|
||||
#include "../ibm.h"
|
||||
#include "floppy.h"
|
||||
#include "floppy_86f.h"
|
||||
#include "floppy_img.h"
|
||||
#include "floppy_fdi.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
#include "fdi2raw.h"
|
||||
|
||||
|
||||
static struct
|
||||
{
|
||||
FILE *f;
|
||||
@@ -266,7 +266,7 @@ void fdi_load(int drive, wchar_t *fn)
|
||||
fdi[drive].f = _wfopen(fn, L"rb");
|
||||
if (!fdi[drive].f)
|
||||
{
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
* Implementation of the FDI floppy stream image format
|
||||
* interface to the FDI2RAW module.
|
||||
*
|
||||
* Version: @(#)disc_fdi.h 1.0.1 2017/08/23
|
||||
* Version: @(#)floppy_fdi.h 1.0.2 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#ifndef EMU_DISC_FDI_H
|
||||
# define EMU_DISC_FDI_H
|
||||
#ifndef EMU_FLOPPY_FDI_H
|
||||
# define EMU_FLOPPY_FDI_H
|
||||
|
||||
|
||||
extern void fdi_init(void);
|
||||
@@ -35,4 +35,4 @@ extern void fdi_stop(void);
|
||||
extern void fdi_poll(void);
|
||||
|
||||
|
||||
#endif /*EMU_DISC_FDI_H*/
|
||||
#endif /*EMU_FLOPPY_FDI_H*/
|
||||
@@ -8,20 +8,19 @@
|
||||
*
|
||||
* Implementation of the IMD floppy image format.
|
||||
*
|
||||
* Version: @(#)disc_imd.c 1.0.0 2017/05/30
|
||||
* Version: @(#)floppy_imd.c 1.0.1 2017/09/03
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
*/
|
||||
|
||||
#include "ibm.h"
|
||||
#include "disc.h"
|
||||
#include "disc_imd.h"
|
||||
#include <malloc.h>
|
||||
#include <wchar.h>
|
||||
#include "../ibm.h"
|
||||
#include "floppy.h"
|
||||
#include "floppy_imd.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
|
||||
#include <malloc.h>
|
||||
#include <wchar.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -93,7 +92,7 @@ void imd_load(int drive, wchar_t *fn)
|
||||
imd[drive].f = _wfopen(fn, L"rb");
|
||||
if (!imd[drive].f)
|
||||
{
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
writeprot[drive] = 1;
|
||||
@@ -111,7 +110,7 @@ void imd_load(int drive, wchar_t *fn)
|
||||
pclog("IMD: Not a valid ImageDisk image\n");
|
||||
fclose(imd[drive].f);
|
||||
imd[drive].f = NULL;
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -133,7 +132,7 @@ void imd_load(int drive, wchar_t *fn)
|
||||
pclog("IMD: No ASCII EOF character\n");
|
||||
fclose(imd[drive].f);
|
||||
imd[drive].f = NULL;
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -147,7 +146,7 @@ void imd_load(int drive, wchar_t *fn)
|
||||
pclog("IMD: File ends after ASCII EOF character\n");
|
||||
fclose(imd[drive].f);
|
||||
imd[drive].f = NULL;
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -267,7 +266,7 @@ void imd_load(int drive, wchar_t *fn)
|
||||
pclog("IMD: Unable to fit the %i sectors in a track\n", track_spt);
|
||||
fclose(imd[drive].f);
|
||||
imd[drive].f = NULL;
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -8,13 +8,13 @@
|
||||
*
|
||||
* Implementation of the IMD floppy image format.
|
||||
*
|
||||
* Version: @(#)disc_imd.h 1.0.1 2017/08/23
|
||||
* Version: @(#)floppy_imd.h 1.0.2 2017/09/03
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#ifndef EMU_DISK_IMD_H
|
||||
# define EMU_DISK_IMD_H
|
||||
#ifndef EMU_FLOPPY_IMD_H
|
||||
# define EMU_FLOPPY_IMD_H
|
||||
|
||||
|
||||
extern void imd_init(void);
|
||||
@@ -23,4 +23,4 @@ extern void imd_close(int drive);
|
||||
extern void imd_seek(int drive, int track);
|
||||
|
||||
|
||||
#endif /*EMU_DISK_IMD_H*/
|
||||
#endif /*EMU_FLOPPY_IMD_H*/
|
||||
@@ -9,24 +9,23 @@
|
||||
* Implementation of the raw sector-based floppy image format,
|
||||
* as well as the Japanese FDI, CopyQM, and FDF formats.
|
||||
*
|
||||
* Version: @(#)disc_img.c 1.0.0 2017/05/30
|
||||
* Version: @(#)floppy_img.c 1.0.1 2017/09/03
|
||||
*
|
||||
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include "ibm.h"
|
||||
#include "config.h"
|
||||
#include "disc.h"
|
||||
#include "disc_img.h"
|
||||
#include "../ibm.h"
|
||||
#include "../config.h"
|
||||
#include "floppy.h"
|
||||
#include "floppy_img.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
|
||||
|
||||
static struct
|
||||
{
|
||||
FILE *f;
|
||||
@@ -353,7 +352,7 @@ void img_load(int drive, wchar_t *fn)
|
||||
img[drive].f = _wfopen(fn, L"rb");
|
||||
if (!img[drive].f)
|
||||
{
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
writeprot[drive] = 1;
|
||||
@@ -759,7 +758,7 @@ jump_if_fdf:
|
||||
pclog("Image is bigger than can fit on an ED floppy, ejecting...\n");
|
||||
fclose(img[drive].f);
|
||||
img[drive].f = NULL;
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -826,7 +825,7 @@ jump_if_fdf:
|
||||
pclog("Image is bigger than can fit on an ED floppy, ejecting...\n");
|
||||
fclose(img[drive].f);
|
||||
img[drive].f = NULL;
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -844,7 +843,7 @@ jump_if_fdf:
|
||||
pclog("ERROR: Floppy image of unknown format was inserted into drive %c:!\n", drive + 0x41);
|
||||
fclose(img[drive].f);
|
||||
img[drive].f = NULL;
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
* Implementation of the raw sector-based floppy image format,
|
||||
* as well as the Japanese FDI, CopyQM, and FDF formats.
|
||||
*
|
||||
* Version: @(#)disc_img.h 1.0.1 2017/08/23
|
||||
* Version: @(#)floppy_img.h 1.0.2 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#ifndef EMU_DISC_IMG_H
|
||||
# define EMU_DISC_IMG_H
|
||||
#ifndef EMU_FLOPPY_IMG_H
|
||||
# define EMU_FLOPPY_IMG_H
|
||||
|
||||
|
||||
extern void img_init(void);
|
||||
@@ -26,4 +26,4 @@ extern void img_close(int drive);
|
||||
extern void img_seek(int drive, int track);
|
||||
|
||||
|
||||
#endif /*EMU_DISC_IMG_H*/
|
||||
#endif /*EMU_FLOPPY_IMG_H*/
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the Teledisk floppy image format.
|
||||
*
|
||||
* Version: @(#)disc_td0.c 1.0.1 2017/08/23
|
||||
* Version: @(#)floppy_td0.c 1.0.2 2017/09/-3
|
||||
*
|
||||
* Authors: Milodrag Milanovic,
|
||||
* Haruhiko OKUMURA,
|
||||
@@ -37,16 +37,14 @@
|
||||
* Adaptive Huffman Coding coded by Haruyasu YOSHIZAKI
|
||||
* Edited and translated to English by Kenji RIKITAKE
|
||||
*/
|
||||
|
||||
#include <wchar.h>
|
||||
|
||||
#include "ibm.h"
|
||||
#include "disc.h"
|
||||
#include "disc_td0.h"
|
||||
#include <stdlib.h>
|
||||
#include "../ibm.h"
|
||||
#include "floppy.h"
|
||||
#include "floppy_td0.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define BUFSZ 512 /* new input buffer */
|
||||
|
||||
@@ -535,7 +533,7 @@ void td0_load(int drive, wchar_t *fn)
|
||||
td0[drive].f = _wfopen(fn, L"rb");
|
||||
if (!td0[drive].f)
|
||||
{
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
fwriteprot[drive] = writeprot[drive];
|
||||
@@ -546,7 +544,7 @@ void td0_load(int drive, wchar_t *fn)
|
||||
pclog("TD0: Not a valid Teledisk image\n");
|
||||
fclose(td0[drive].f);
|
||||
td0[drive].f = NULL;
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -562,7 +560,7 @@ void td0_load(int drive, wchar_t *fn)
|
||||
pclog("TD0: Failed to initialize\n");
|
||||
fclose(td0[drive].f);
|
||||
td0[drive].f = NULL;
|
||||
memset(discfns[drive], 0, sizeof(discfns[drive]));
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the Teledisk floppy image format.
|
||||
*
|
||||
* Version: @(#)disc_td0.h 1.0.1 2017/08/23
|
||||
* Version: @(#)floppy_td0.h 1.0.2 2017/09/03
|
||||
*
|
||||
* Authors: Milodrag Milanovic,
|
||||
* Haruhiko OKUMURA,
|
||||
@@ -21,8 +21,8 @@
|
||||
* Copyright 2013-2017 Milodrag Milanovic.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#ifndef EMU_DISC_TD0_H
|
||||
# define EMU_DISC_TD0_H
|
||||
#ifndef EMU_FLOPPY_TD0_H
|
||||
# define EMU_FLOPPY_TD0_H
|
||||
|
||||
|
||||
extern void td0_init(void);
|
||||
@@ -31,4 +31,4 @@ extern void td0_close(int drive);
|
||||
extern void td0_seek(int drive, int track);
|
||||
|
||||
|
||||
#endif /*EMU_DISC_TD0_H*/
|
||||
#endif /*EMU_FLOPPY_TD0_H*/
|
||||
23
src/h
23
src/h
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Handling of the emulated machines.
|
||||
*
|
||||
* Version: @(#)xxx.h 1.0.1 2017/06/21
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
*/
|
||||
#ifndef EMU_xxx_H
|
||||
# define EMU_xxx_H
|
||||
|
||||
|
||||
#endif /*EMU_xxx_H*/
|
||||
@@ -9,7 +9,7 @@
|
||||
* Implementation of the IDE emulation for hard disks and ATAPI
|
||||
* CD-ROM devices.
|
||||
*
|
||||
* Version: @(#)hdd_ide_at.c 1.0.5 2017/08/24
|
||||
* Version: @(#)hdd_ide_at.c 1.0.6 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -21,19 +21,18 @@
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include "../86box.h"
|
||||
#include "../cdrom.h"
|
||||
#include "../ibm.h"
|
||||
#include "hdd_image.h"
|
||||
#include "../io.h"
|
||||
#include "../pic.h"
|
||||
#include "../pci.h"
|
||||
#include "../timer.h"
|
||||
#include "../cdrom.h"
|
||||
#include "../cdrom/cdrom.h"
|
||||
#include "../scsi/scsi.h"
|
||||
#include "hdd_image.h"
|
||||
#include "hdd_ide_at.h"
|
||||
|
||||
|
||||
/* Bits of 'atastat' */
|
||||
#define ERR_STAT 0x01
|
||||
#define DRQ_STAT 0x08 /* Data request */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* General include file.
|
||||
*
|
||||
* Version: @(#)ibm.h 1.0.2 2017/08/24
|
||||
* Version: @(#)ibm.h 1.0.3 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -373,8 +373,8 @@ extern PIC pic, pic2;
|
||||
extern int pic_intpending;
|
||||
|
||||
|
||||
extern int disctime;
|
||||
extern wchar_t discfns[4][512];
|
||||
extern int floppytime;
|
||||
extern wchar_t floppyfns[4][512];
|
||||
extern int driveempty[4];
|
||||
|
||||
#define MDA ((gfxcard==GFX_MDA || gfxcard==GFX_HERCULES || gfxcard==GFX_HERCULESPLUS || gfxcard==GFX_INCOLOR || gfxcard==GFX_GENIUS) && (romset<ROM_TANDY || romset>=ROM_IBMAT))
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* Emulation of Intel System I/O PCI chip.
|
||||
*
|
||||
* Version: @(#)sio.c 1.0.4 2017/09/02
|
||||
* Version: @(#)intel_sio.c 1.0.5 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -15,17 +15,17 @@
|
||||
*/
|
||||
#include <string.h>
|
||||
#include "ibm.h"
|
||||
#include "dma.h"
|
||||
#include "io.h"
|
||||
#include "dma.h"
|
||||
#include "mem.h"
|
||||
#include "pci.h"
|
||||
#include "sio.h"
|
||||
#include "intel_sio.h"
|
||||
|
||||
|
||||
static uint8_t card_sio[256];
|
||||
|
||||
|
||||
void sio_write(int func, int addr, uint8_t val, void *priv)
|
||||
static void sio_write(int func, int addr, uint8_t val, void *priv)
|
||||
{
|
||||
if (func > 0)
|
||||
return;
|
||||
@@ -115,7 +115,7 @@ void sio_write(int func, int addr, uint8_t val, void *priv)
|
||||
}
|
||||
|
||||
|
||||
uint8_t sio_read(int func, int addr, void *priv)
|
||||
static uint8_t sio_read(int func, int addr, void *priv)
|
||||
{
|
||||
if (func > 0)
|
||||
return 0xff;
|
||||
@@ -124,7 +124,7 @@ uint8_t sio_read(int func, int addr, void *priv)
|
||||
}
|
||||
|
||||
|
||||
void sio_reset(void)
|
||||
static void sio_reset(void)
|
||||
{
|
||||
memset(card_sio, 0, 256);
|
||||
card_sio[0x00] = 0x86; card_sio[0x01] = 0x80; /*Intel*/
|
||||
@@ -4,16 +4,14 @@
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
* Emulation of Intel System I/O PCI chip.
|
||||
*
|
||||
* Implementation of the SMC FDC37C665 Super I/O Chip.
|
||||
* Version: @(#)sio.h 1.0.2 2017/08/23
|
||||
*
|
||||
* Version: @(#)fdc37c665.h 1.0.1 2017/08/23
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
|
||||
extern void fdc37c665_init(void);
|
||||
void sio_init(int card);
|
||||
@@ -8,22 +8,22 @@
|
||||
*
|
||||
* Intel 8042 (AT keyboard controller) emulation.
|
||||
*
|
||||
* Version: @(#)keyboard_at.c 1.0.1 2017/08/23
|
||||
* Version: @(#)keyboard_at.c 1.0.2 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include "ibm.h"
|
||||
#include "io.h"
|
||||
#include "mem.h"
|
||||
#include "pic.h"
|
||||
#include "pit.h"
|
||||
#include "mem.h"
|
||||
#include "timer.h"
|
||||
#include "disc.h"
|
||||
#include "fdc.h"
|
||||
#include "floppy/floppy.h"
|
||||
#include "floppy/fdc.h"
|
||||
#include "sound/sound.h"
|
||||
#include "sound/snd_speaker.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handling of the emulated machines.
|
||||
*
|
||||
* Version: @(#)machine.c 1.0.9 2017/09/02
|
||||
* Version: @(#)machine.c 1.0.11 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -17,16 +17,13 @@
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../device.h"
|
||||
#include "../disc.h"
|
||||
#include "../fdc.h"
|
||||
#include "../fdd.h"
|
||||
#include "../io.h"
|
||||
|
||||
#include "../device.h"
|
||||
#include "../floppy/floppy.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "machine.h"
|
||||
#include "machine_common.h"
|
||||
|
||||
@@ -62,7 +59,6 @@
|
||||
#include "machine_at_440fx.h"
|
||||
|
||||
#include "../video/vid_pcjr.h"
|
||||
|
||||
#include "../video/vid_tandy.h"
|
||||
#include "../video/vid_tandysl.h"
|
||||
|
||||
@@ -85,7 +81,7 @@ machine_t machines[] =
|
||||
{"[8088] Generic XT clone", ROM_GENXT, "genxt", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, 0, 64, 640, 64, 0, machine_xt_init, NULL },
|
||||
{"[8088] Juko XT clone", ROM_JUKOPC, "jukopc", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, 0, 64, 640, 64, 0, machine_xt_init, NULL },
|
||||
{"[8088] Phoenix XT clone", ROM_PXXT, "pxxt", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, 0, 64, 640, 64, 0, machine_xt_init, NULL },
|
||||
{"[8088] Schneider EuroPC", ROM_EUROPC, "europc", {{"", cpus_europc}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, 0, 512, 640, 128, 0, machine_europc_init, NULL },
|
||||
{"[8088] Schneider EuroPC", ROM_EUROPC, "europc", {{"Siemens", cpus_europc}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, 0, 512, 640, 128, 0, machine_europc_init, NULL },
|
||||
{"[8088] Tandy 1000", ROM_TANDY, "tandy", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, 0, 128, 640, 128, 0, machine_tandy1k_init, tandy1000_get_device },
|
||||
{"[8088] Tandy 1000 HX", ROM_TANDY1000HX, "tandy1000hx", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, 0, 256, 640, 128, 0, machine_tandy1k_init, tandy1000hx_get_device },
|
||||
{"[8088] VTech Laser Turbo XT", ROM_LTXT, "ltxt", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, 0, 64, 1152, 64, 0, machine_xt_laserxt_init, NULL },
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
#include <stdlib.h>
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../device.h"
|
||||
#include "../disc.h"
|
||||
#include "../fdd.h"
|
||||
#include "../fdc.h"
|
||||
#include "../gameport.h"
|
||||
#include "../io.h"
|
||||
#include "../nmi.h"
|
||||
#include "../mem.h"
|
||||
#include "../device.h"
|
||||
#include "../nvr.h"
|
||||
#include "../gameport.h"
|
||||
#include "../keyboard.h"
|
||||
#include "../keyboard_amstrad.h"
|
||||
#include "../lpt.h"
|
||||
#include "../mem.h"
|
||||
#include "../mouse.h"
|
||||
#include "../nmi.h"
|
||||
#include "../nvr.h"
|
||||
|
||||
#include "../lpt.h"
|
||||
#include "../floppy/floppy.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "machine_common.h"
|
||||
|
||||
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../bugger.h"
|
||||
#include "../device.h"
|
||||
#include "../dma.h"
|
||||
#include "../gameport.h"
|
||||
#include "../hdd/hdd_ide_at.h"
|
||||
#include "../keyboard_at.h"
|
||||
#include "../lpt.h"
|
||||
#include "../mem.h"
|
||||
#include "../nvr.h"
|
||||
#include "../pic.h"
|
||||
#include "../pit.h"
|
||||
|
||||
#include "../dma.h"
|
||||
#include "../mem.h"
|
||||
#include "../device.h"
|
||||
#include "../nvr.h"
|
||||
#include "../bugger.h"
|
||||
#include "../gameport.h"
|
||||
#include "../keyboard_at.h"
|
||||
#include "../lpt.h"
|
||||
#include "../hdd/hdd_ide_at.h"
|
||||
#include "machine_common.h"
|
||||
#include "machine_at.h"
|
||||
|
||||
|
||||
void machine_at_init(void)
|
||||
{
|
||||
AT = 1;
|
||||
|
||||
@@ -8,28 +8,23 @@
|
||||
*
|
||||
* Implementation of the Intel 430FX PCISet chip.
|
||||
*
|
||||
* Version: @(#)machine_at_430fx.c 1.0.3 2017/09/02
|
||||
* Version: @(#)machine_at_430fx.c 1.0.4 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#include <string.h>
|
||||
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../device.h"
|
||||
#include "../fdc37c665.h"
|
||||
#include "../intel_flash.h"
|
||||
#include "../mem.h"
|
||||
#include "../memregs.h"
|
||||
#include "../pc87306.h"
|
||||
#include "../pci.h"
|
||||
#include "../device.h"
|
||||
#include "../piix.h"
|
||||
#include "../w83877f.h"
|
||||
|
||||
#include "../intel_flash.h"
|
||||
#include "../sio.h"
|
||||
#include "machine_at.h"
|
||||
#include "machine_at_430fx.h"
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the Intel 430HX PCISet chip.
|
||||
*
|
||||
* Version: @(#)machine_at_430hx.c 1.0.3 2017/09/02
|
||||
* Version: @(#)machine_at_430hx.c 1.0.4 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -16,22 +16,16 @@
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
*/
|
||||
#include <string.h>
|
||||
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../device.h"
|
||||
#include "../fdc37c669.h"
|
||||
#include "../fdc37c932fr.h"
|
||||
#include "../io.h"
|
||||
#include "../intel_flash.h"
|
||||
#include "../mem.h"
|
||||
#include "../memregs.h"
|
||||
#include "../pc87306.h"
|
||||
#include "../pci.h"
|
||||
#include "../device.h"
|
||||
#include "../piix.h"
|
||||
#include "../w83877f.h"
|
||||
|
||||
#include "../intel_flash.h"
|
||||
#include "../sio.h"
|
||||
#include "machine_at.h"
|
||||
#include "machine_at_430hx.h"
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the Intel 430LX and 430NX PCISet chips.
|
||||
*
|
||||
* Version: @(#)machine_at_430lx_nx.c 1.0.3 2017/09/02
|
||||
* Version: @(#)machine_at_430lx_nx.c 1.0.4 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -16,19 +16,16 @@
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
*/
|
||||
#include <string.h>
|
||||
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../device.h"
|
||||
#include "../fdc37c665.h"
|
||||
#include "../intel.h"
|
||||
#include "../intel_flash.h"
|
||||
#include "../mem.h"
|
||||
#include "../memregs.h"
|
||||
#include "../pci.h"
|
||||
#include "../device.h"
|
||||
#include "../intel.h"
|
||||
#include "../intel_flash.h"
|
||||
#include "../intel_sio.h"
|
||||
#include "../sio.h"
|
||||
|
||||
#include "machine_at.h"
|
||||
#include "machine_at_430lx_nx.h"
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the Intel 430VX PCISet chip.
|
||||
*
|
||||
* Version: @(#)machine_at_430vx.c 1.0.4 2017/09/02
|
||||
* Version: @(#)machine_at_430vx.c 1.0.5 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -16,21 +16,16 @@
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
*/
|
||||
#include <string.h>
|
||||
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../device.h"
|
||||
#include "../fdc37c932fr.h"
|
||||
#include "../io.h"
|
||||
#include "../pci.h"
|
||||
#include "../mem.h"
|
||||
#include "../memregs.h"
|
||||
#include "../intel_flash.h"
|
||||
#include "../pci.h"
|
||||
#include "../device.h"
|
||||
#include "../piix.h"
|
||||
#include "../um8669f.h"
|
||||
#include "../w83877f.h"
|
||||
|
||||
#include "../intel_flash.h"
|
||||
#include "../sio.h"
|
||||
#include "machine_at.h"
|
||||
#include "machine_at_430vx.h"
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the Intel 440FX PCISet chip.
|
||||
*
|
||||
* Version: @(#)machine_at_440fx.c 1.0.3 2017/09/02
|
||||
* Version: @(#)machine_at_440fx.c 1.0.4 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -16,19 +16,16 @@
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
*/
|
||||
#include <string.h>
|
||||
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../device.h"
|
||||
#include "../fdc37c665.h"
|
||||
#include "../intel_flash.h"
|
||||
#include "../io.h"
|
||||
#include "../pci.h"
|
||||
#include "../mem.h"
|
||||
#include "../memregs.h"
|
||||
#include "../pci.h"
|
||||
#include "../device.h"
|
||||
#include "../piix.h"
|
||||
|
||||
#include "../intel_flash.h"
|
||||
#include "../sio.h"
|
||||
#include "machine_at.h"
|
||||
#include "machine_at_440fx.h"
|
||||
|
||||
|
||||
@@ -2,14 +2,11 @@
|
||||
see COPYING for more details
|
||||
*/
|
||||
#include <string.h>
|
||||
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../hdd/hdd_ide_at.h"
|
||||
#include "../io.h"
|
||||
#include "../mem.h"
|
||||
|
||||
#include "../hdd/hdd_ide_at.h"
|
||||
#include "machine_at.h"
|
||||
#include "machine_at_ali1429.h"
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../io.h"
|
||||
#include "../lpt.h"
|
||||
#include "../serial.h"
|
||||
|
||||
#include "machine_at.h"
|
||||
#include "machine_at_commodore.h"
|
||||
|
||||
|
||||
static void cbm_io_write(uint16_t port, uint8_t val, void *p)
|
||||
{
|
||||
lpt1_remove();
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
see COPYING for more details
|
||||
*/
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../mem.h"
|
||||
|
||||
#include "machine_at.h"
|
||||
#include "machine_at_compaq.h"
|
||||
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
see COPYING for more details
|
||||
*/
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../io.h"
|
||||
#include "../mem.h"
|
||||
|
||||
#include "machine_at.h"
|
||||
#include "machine_at_headland.h"
|
||||
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
*/
|
||||
/*This is the chipset used in the AMI 286 clone model*/
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../io.h"
|
||||
|
||||
#include "machine_at.h"
|
||||
#include "machine_at_neat.h"
|
||||
|
||||
|
||||
@@ -252,11 +252,9 @@ Note: the block address is forced to be a multiple of the block size by
|
||||
SeeAlso: #P0178,#P0187
|
||||
*/
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../io.h"
|
||||
#include "../mem.h"
|
||||
|
||||
#include "machine_at.h"
|
||||
#include "machine_at_opti495.h"
|
||||
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
/*This is the chipset used in the Award 286 clone model*/
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../cpu/x86.h"
|
||||
#include "../io.h"
|
||||
#include "../mem.h"
|
||||
#include "../cpu/x86.h"
|
||||
|
||||
#include "machine_at.h"
|
||||
#include "machine_at_scat.h"
|
||||
|
||||
|
||||
#define SCAT_DMA_WAIT_STATE_CONTROL 0x01
|
||||
#define SCAT_VERSION 0x40
|
||||
#define SCAT_CLOCK_CONTROL 0x41
|
||||
|
||||
@@ -9,22 +9,20 @@
|
||||
* SiS sis85c471 Super I/O Chip
|
||||
* Used by DTK PKM-0038S E-2
|
||||
*
|
||||
* Version: @(#)sis85c471.c 1.0.3 2017/09/02
|
||||
* Version: @(#)sis85c471.c 1.0.4 2017/09/03
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2017 Miran Grca.
|
||||
*/
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../disc.h"
|
||||
#include "../fdc.h"
|
||||
#include "../fdd.h"
|
||||
#include "../hdd/hdd_ide_at.h"
|
||||
#include "../io.h"
|
||||
#include "../lpt.h"
|
||||
#include "../memregs.h"
|
||||
#include "../lpt.h"
|
||||
#include "../serial.h"
|
||||
|
||||
#include "../floppy/floppy.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../hdd/hdd_ide_at.h"
|
||||
#include "machine_at.h"
|
||||
#include "machine_at_sis_85c471.h"
|
||||
|
||||
|
||||
@@ -2,16 +2,13 @@
|
||||
see COPYING for more details
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../fdc37c665.h"
|
||||
#include "../io.h"
|
||||
#include "../pci.h"
|
||||
#include "../mem.h"
|
||||
#include "../memregs.h"
|
||||
#include "../pci.h"
|
||||
|
||||
#include "../sio.h"
|
||||
#include "machine_at.h"
|
||||
#include "machine_at_sis_85c496.h"
|
||||
|
||||
|
||||
@@ -12,13 +12,10 @@
|
||||
* Copyright 2017 Miran Grca.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../io.h"
|
||||
#include "../mem.h"
|
||||
#include "../pci.h"
|
||||
|
||||
#include "../mem.h"
|
||||
#include "machine_at.h"
|
||||
#include "machine_at_sis_85c50x.h"
|
||||
|
||||
|
||||
@@ -2,13 +2,11 @@
|
||||
see COPYING for more details
|
||||
*/
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../disc.h"
|
||||
#include "../fdc.h"
|
||||
#include "../io.h"
|
||||
#include "../mem.h"
|
||||
#include "../serial.h"
|
||||
|
||||
#include "../floppy/floppy.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "machine_at.h"
|
||||
#include "machine_at_wd76c10.h"
|
||||
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../dma.h"
|
||||
#include "../disc.h"
|
||||
#include "../fdd.h"
|
||||
#include "../fdc.h"
|
||||
#include "../lpt.h"
|
||||
#include "../pic.h"
|
||||
#include "../pit.h"
|
||||
#include "../lpt.h"
|
||||
#include "../serial.h"
|
||||
|
||||
#include "../floppy/floppy.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "machine_common.h"
|
||||
|
||||
|
||||
void machine_common_init(void)
|
||||
{
|
||||
/* System devices first. */
|
||||
|
||||
@@ -3,25 +3,23 @@
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../io.h"
|
||||
#include "../nmi.h"
|
||||
#include "../mem.h"
|
||||
#include "../rom.h"
|
||||
#include "../device.h"
|
||||
#include "../gameport.h"
|
||||
#include "../keyboard_xt.h"
|
||||
#include "../lpt.h"
|
||||
#include "../mem.h"
|
||||
#include "../nmi.h"
|
||||
#include "../rom.h"
|
||||
|
||||
#include "machine_common.h"
|
||||
#include "machine_europc.h"
|
||||
|
||||
|
||||
uint8_t europcdat[16];
|
||||
|
||||
|
||||
struct
|
||||
{
|
||||
uint8_t dat[16];
|
||||
@@ -47,7 +45,7 @@ static uint8_t jim_load_nvr(void)
|
||||
}
|
||||
|
||||
|
||||
void jim_save_nvr(void)
|
||||
void europc_save_nvr(void)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
void jim_save_nvr(void);
|
||||
void europc_save_nvr(void);
|
||||
|
||||
void machine_europc_init(void);
|
||||
|
||||
@@ -2,16 +2,14 @@
|
||||
see COPYING for more details
|
||||
*/
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../io.h"
|
||||
#include "../nmi.h"
|
||||
#include "../mem.h"
|
||||
#include "../device.h"
|
||||
#include "../nvr.h"
|
||||
#include "../gameport.h"
|
||||
#include "../keyboard_olim24.h"
|
||||
#include "../mem.h"
|
||||
#include "../nmi.h"
|
||||
#include "../nvr.h"
|
||||
#include "../io.h"
|
||||
|
||||
#include "machine_common.h"
|
||||
#include "machine_olivetti_m24.h"
|
||||
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../device.h"
|
||||
#include "../disc.h"
|
||||
#include "../fdc.h"
|
||||
#include "../fdd.h"
|
||||
#include "../keyboard_pcjr.h"
|
||||
#include "../mem.h"
|
||||
#include "../nmi.h"
|
||||
#include "../pic.h"
|
||||
#include "../pit.h"
|
||||
#include "../mem.h"
|
||||
#include "../device.h"
|
||||
#include "../serial.h"
|
||||
#include "../keyboard_pcjr.h"
|
||||
#include "../floppy/floppy.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../sound/snd_sn76489.h"
|
||||
|
||||
#include "machine_pcjr.h"
|
||||
|
||||
|
||||
void machine_pcjr_init(void)
|
||||
{
|
||||
mem_add_bios();
|
||||
|
||||
@@ -2,26 +2,24 @@
|
||||
see COPYING for more details
|
||||
*/
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../device.h"
|
||||
#include "../disc.h"
|
||||
#include "../dma.h"
|
||||
#include "../gameport.h"
|
||||
#include "../hdd/hdd_ide_at.h"
|
||||
#include "../fdd.h"
|
||||
#include "../fdc.h"
|
||||
#include "../io.h"
|
||||
#include "../keyboard_at.h"
|
||||
#include "../lpt.h"
|
||||
#include "../mem.h"
|
||||
#include "../nvr.h"
|
||||
#include "../dma.h"
|
||||
#include "../pic.h"
|
||||
#include "../pit.h"
|
||||
#include "../mem.h"
|
||||
#include "../rom.h"
|
||||
#include "../device.h"
|
||||
#include "../nvr.h"
|
||||
#include "../gameport.h"
|
||||
#include "../lpt.h"
|
||||
#include "../serial.h"
|
||||
#include "../keyboard_at.h"
|
||||
#include "../floppy/floppy.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../hdd/hdd_ide_at.h"
|
||||
#include "../sound/snd_ps1.h"
|
||||
|
||||
#include "machine_common.h"
|
||||
#include "machine_ps1.h"
|
||||
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../device.h"
|
||||
#include "../disc.h"
|
||||
#include "../dma.h"
|
||||
#include "../fdd.h"
|
||||
#include "../fdc.h"
|
||||
#include "../io.h"
|
||||
#include "../dma.h"
|
||||
#include "../pic.h"
|
||||
#include "../pit.h"
|
||||
#include "../mem.h"
|
||||
#include "../rom.h"
|
||||
#include "../device.h"
|
||||
#include "../nvr.h"
|
||||
#include "../keyboard.h"
|
||||
#include "../keyboard_at.h"
|
||||
#include "../lpt.h"
|
||||
#include "../mem.h"
|
||||
#include "../nvr.h"
|
||||
#include "../pic.h"
|
||||
#include "../pit.h"
|
||||
#include "../rom.h"
|
||||
#include "../serial.h"
|
||||
|
||||
#include "../floppy/floppy.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "machine_common.h"
|
||||
#include "machine_ps2_isa.h"
|
||||
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../cpu/x86.h"
|
||||
#include "../device.h"
|
||||
#include "../dma.h"
|
||||
#include "../io.h"
|
||||
#include "../keyboard_at.h"
|
||||
#include "../lpt.h"
|
||||
#include "../mca.h"
|
||||
#include "../mem.h"
|
||||
#include "../mouse.h"
|
||||
#include "../nvr.h"
|
||||
#include "../dma.h"
|
||||
#include "../pic.h"
|
||||
#include "../pit.h"
|
||||
#include "../mca.h"
|
||||
#include "../mem.h"
|
||||
#include "../rom.h"
|
||||
#include "../ps2_nvr.h"
|
||||
#include "../device.h"
|
||||
#include "../nvr.h"
|
||||
#include "../nvr_ps2.h"
|
||||
#include "../keyboard_at.h"
|
||||
#include "../lpt.h"
|
||||
#include "../mouse.h"
|
||||
#include "../serial.h"
|
||||
|
||||
#include "machine_common.h"
|
||||
#include "machine_ps2_mca.h"
|
||||
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../nmi.h"
|
||||
#include "../mem.h"
|
||||
#include "../device.h"
|
||||
#include "../gameport.h"
|
||||
#include "../keyboard_xt.h"
|
||||
#include "../mem.h"
|
||||
#include "../nmi.h"
|
||||
#include "../tandy_eeprom.h"
|
||||
#include "../tandy_rom.h"
|
||||
#include "../sound/snd_pssj.h"
|
||||
#include "../sound/snd_sn76489.h"
|
||||
|
||||
#include "machine_common.h"
|
||||
|
||||
|
||||
void machine_tandy1k_init(void)
|
||||
{
|
||||
TANDY = 1;
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../bugger.h"
|
||||
#include "../device.h"
|
||||
#include "../gameport.h"
|
||||
#include "../keyboard_xt.h"
|
||||
#include "../mem.h"
|
||||
#include "../nmi.h"
|
||||
#include "../pit.h"
|
||||
|
||||
#include "../mem.h"
|
||||
#include "../device.h"
|
||||
#include "../bugger.h"
|
||||
#include "../gameport.h"
|
||||
#include "../keyboard_xt.h"
|
||||
#include "machine_common.h"
|
||||
#include "machine_xt.h"
|
||||
|
||||
|
||||
void machine_xt_init(void)
|
||||
{
|
||||
machine_common_init();
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
/*This is the chipset used in the LaserXT series model*/
|
||||
#include "../ibm.h"
|
||||
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../io.h"
|
||||
#include "../mem.h"
|
||||
|
||||
#include "machine_xt.h"
|
||||
#include "machine_xt_laserxt.h"
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
* NOTE: The file will also implement an NE1000 for 8-bit ISA systems.
|
||||
*
|
||||
* Version: @(#)net_ne2000.c 1.0.13 2017/08/23
|
||||
* Version: @(#)net_ne2000.c 1.0.14 2017/09/03
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Peter Grehan, grehan@iprg.nokia.com>
|
||||
@@ -24,15 +24,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "../config.h"
|
||||
#include "../ibm.h"
|
||||
#include "../io.h"
|
||||
#include "../mem.h"
|
||||
#include "../rom.h"
|
||||
#include "../pci.h"
|
||||
#include "../pic.h"
|
||||
#include "../random.h"
|
||||
#include "../device.h"
|
||||
#include "../config.h"
|
||||
#include "../disc_random.h"
|
||||
#include "network.h"
|
||||
#include "net_ne2000.h"
|
||||
#include "bswap.h"
|
||||
@@ -2017,9 +2017,9 @@ nic_init(int board)
|
||||
/* Set up our BIA. */
|
||||
if (mac & 0xff000000) {
|
||||
/* Generate new local MAC. */
|
||||
dev->maclocal[3] = disc_random_generate();
|
||||
dev->maclocal[4] = disc_random_generate();
|
||||
dev->maclocal[5] = disc_random_generate();
|
||||
dev->maclocal[3] = random_generate();
|
||||
dev->maclocal[4] = random_generate();
|
||||
dev->maclocal[5] = random_generate();
|
||||
mac = (((int) dev->maclocal[3]) << 16);
|
||||
mac |= (((int) dev->maclocal[4]) << 8);
|
||||
mac |= ((int) dev->maclocal[5]);
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
*
|
||||
* CMOS NVRAM emulation.
|
||||
*
|
||||
* Version: @(#)nvr.c 1.0.1 2017/06/03
|
||||
* Version: @(#)nvr.c 1.0.2 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Mahod,
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
* Copyright 2016-2017 Mahod.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
* Copyright 2016,2017 Mahod.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -282,7 +282,7 @@ void savenvr(void)
|
||||
|
||||
if (romset == ROM_EUROPC)
|
||||
{
|
||||
jim_save_nvr();
|
||||
europc_save_nvr();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "io.h"
|
||||
#include "mem.h"
|
||||
#include "rom.h"
|
||||
#include "ps2_nvr.h"
|
||||
#include "nvr_ps2.h"
|
||||
|
||||
|
||||
typedef struct ps2_nvr_t
|
||||
48
src/pc.c
48
src/pc.c
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Emulation core dispatcher.
|
||||
*
|
||||
* Version: @(#)pc.c 1.0.7 2017/08/24
|
||||
* Version: @(#)pc.c 1.0.8 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -18,30 +18,28 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "86box.h"
|
||||
#include "config.h"
|
||||
#include "ibm.h"
|
||||
|
||||
#include "mem.h"
|
||||
#include "cpu/codegen.h"
|
||||
#include "cpu/cpu.h"
|
||||
#include "dma.h"
|
||||
#include "random.h"
|
||||
#include "device.h"
|
||||
#include "disc.h"
|
||||
#include "disc_86f.h"
|
||||
#include "disc_fdi.h"
|
||||
#include "disc_imd.h"
|
||||
#include "disc_img.h"
|
||||
#include "disc_td0.h"
|
||||
#include "disc_random.h"
|
||||
#include "cdrom.h"
|
||||
#include "cdrom_image.h"
|
||||
#include "cdrom_ioctl.h"
|
||||
#include "cdrom_null.h"
|
||||
#include "config.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
#include "gameport.h"
|
||||
#include "floppy/floppy.h"
|
||||
#include "floppy/floppy_86f.h"
|
||||
#include "floppy/floppy_fdi.h"
|
||||
#include "floppy/floppy_imd.h"
|
||||
#include "floppy/floppy_img.h"
|
||||
#include "floppy/floppy_td0.h"
|
||||
#include "floppy/fdc.h"
|
||||
#include "floppy/fdd.h"
|
||||
#include "cdrom/cdrom.h"
|
||||
#include "cdrom/cdrom_image.h"
|
||||
#include "cdrom/cdrom_ioctl.h"
|
||||
#include "cdrom/cdrom_null.h"
|
||||
#include "hdd/hdd.h"
|
||||
#include "hdd/hdd_ide_at.h"
|
||||
#include "keyboard.h"
|
||||
@@ -371,7 +369,7 @@ void initmodules(void)
|
||||
#ifdef WALTJE
|
||||
serial_init();
|
||||
#endif
|
||||
disc_random_init();
|
||||
random_init();
|
||||
|
||||
joystick_init();
|
||||
|
||||
@@ -412,17 +410,17 @@ void initmodules(void)
|
||||
|
||||
sound_reset();
|
||||
fdc_init();
|
||||
disc_init();
|
||||
floppy_init();
|
||||
fdi_init();
|
||||
img_init();
|
||||
d86f_init();
|
||||
td0_init();
|
||||
imd_init();
|
||||
|
||||
disc_load(0, discfns[0]);
|
||||
disc_load(1, discfns[1]);
|
||||
disc_load(2, discfns[2]);
|
||||
disc_load(3, discfns[3]);
|
||||
floppy_load(0, floppyfns[0]);
|
||||
floppy_load(1, floppyfns[1]);
|
||||
floppy_load(2, floppyfns[2]);
|
||||
floppy_load(3, floppyfns[3]);
|
||||
|
||||
loadnvr();
|
||||
sound_init();
|
||||
@@ -514,7 +512,7 @@ void resetpchard_init(void)
|
||||
sound_reset();
|
||||
mem_resize();
|
||||
fdc_init();
|
||||
disc_reset();
|
||||
floppy_reset();
|
||||
|
||||
#ifndef WALTJE
|
||||
serial_init();
|
||||
@@ -718,7 +716,7 @@ void closepc(void)
|
||||
dumppic();
|
||||
for (i = 0; i < FDD_NUM; i++)
|
||||
{
|
||||
disc_close(i);
|
||||
floppy_close(i);
|
||||
}
|
||||
dumpregs(0);
|
||||
closevideo();
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Emulation of the National Semiconductors PC87306 Super I/O
|
||||
* chip.
|
||||
*
|
||||
* Version: @(#)pc87306.h 1.0.1 2017/08/23
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
|
||||
extern void pc87306_init(void);
|
||||
14
src/pci.c
14
src/pci.c
@@ -1,16 +1,14 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "ibm.h"
|
||||
|
||||
#include "cdrom.h"
|
||||
#include "disc.h"
|
||||
#include "fdc.h"
|
||||
#include "hdd/hdd_ide_at.h"
|
||||
#include "io.h"
|
||||
#include "keyboard_at.h"
|
||||
#include "mem.h"
|
||||
#include "pic.h"
|
||||
#include "mem.h"
|
||||
#include "pci.h"
|
||||
#include "keyboard_at.h"
|
||||
#include "floppy/floppy.h"
|
||||
#include "floppy/fdc.h"
|
||||
#include "hdd/hdd_ide_at.h"
|
||||
#include "cdrom/cdrom.h"
|
||||
|
||||
|
||||
static uint64_t pci_irq_hold[16];
|
||||
|
||||
@@ -9,35 +9,35 @@
|
||||
* A better random number generation, used for floppy weak bits
|
||||
* and network MAC address generation.
|
||||
*
|
||||
* Version: @(#)disc_random.c 1.0.0 2017/05/30
|
||||
* Version: @(#)random.c 1.0.2 2017/09/03
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include "random.h"
|
||||
|
||||
#include "disc_random.h"
|
||||
|
||||
uint32_t preconst = 0x6ED9EBA1;
|
||||
|
||||
|
||||
static __inline__ uint32_t rotl32c (uint32_t x, uint32_t n)
|
||||
{
|
||||
#if 0
|
||||
assert (n<32);
|
||||
#endif
|
||||
return (x<<n) | (x>>(-n&31));
|
||||
}
|
||||
|
||||
static __inline__ uint32_t rotr32c (uint32_t x, uint32_t n)
|
||||
{
|
||||
#if 0
|
||||
assert (n<32);
|
||||
#endif
|
||||
return (x>>n) | (x<<(-n&31));
|
||||
}
|
||||
|
||||
@@ -65,7 +65,8 @@ static uint32_t RDTSC(void)
|
||||
return (uint32_t) (rdtsc());
|
||||
}
|
||||
|
||||
static void disc_random_twist(uint32_t *val)
|
||||
|
||||
static void random_twist(uint32_t *val)
|
||||
{
|
||||
*val = ROTATE_LEFT(*val, rand() % 32);
|
||||
*val ^= 0x5A827999;
|
||||
@@ -73,15 +74,17 @@ static void disc_random_twist(uint32_t *val)
|
||||
*val ^= 0x4ED32706;
|
||||
}
|
||||
|
||||
uint8_t disc_random_generate()
|
||||
|
||||
uint8_t random_generate(void)
|
||||
{
|
||||
uint16_t r = 0;
|
||||
r = (rand() ^ ROTATE_LEFT(preconst, rand() % 32)) % 256;
|
||||
disc_random_twist(&preconst);
|
||||
random_twist(&preconst);
|
||||
return (r & 0xff);
|
||||
}
|
||||
|
||||
void disc_random_init()
|
||||
|
||||
void random_init(void)
|
||||
{
|
||||
uint32_t seed = RDTSC();
|
||||
srand(seed);
|
||||
@@ -9,17 +9,17 @@
|
||||
* A better random number generation, used for floppy weak bits
|
||||
* and network MAC address generation.
|
||||
*
|
||||
* Version: @(#)disc_random.h 1.0.1 2017/08/23
|
||||
* Version: @(#)random.h 1.0.2 2017/09/03
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#ifndef EMU_DISC_RANDOM_H
|
||||
# define EMU_DISC_RANDOM_H
|
||||
#ifndef EMU_RANDOM_H
|
||||
# define EMU_RANDOM_H
|
||||
|
||||
|
||||
extern uint8_t disc_random_generate(void);
|
||||
extern void disc_random_init(void);
|
||||
extern uint8_t random_generate(void);
|
||||
extern void random_init(void);
|
||||
|
||||
|
||||
#endif /*EMU_DISC_RANDOM_H*/
|
||||
#endif /*EMU_RANDOM_H*/
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handling of the SCSI controllers.
|
||||
*
|
||||
* Version: @(#)scsi.c 1.0.3 2017/08/27
|
||||
* Version: @(#)scsi.c 1.0.4 2017/09/03
|
||||
*
|
||||
* Authors: TheCollector1995, <mariogplayer@gmail.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "../ibm.h"
|
||||
#include "../timer.h"
|
||||
#include "../device.h"
|
||||
#include "../cdrom.h"
|
||||
#include "../cdrom/cdrom.h"
|
||||
#include "scsi.h"
|
||||
#include "scsi_aha154x.h"
|
||||
#include "scsi_buslogic.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* The generic SCSI device command handler.
|
||||
*
|
||||
* Version: @(#)scsi_device.c 1.0.1 2017/08/23
|
||||
* Version: @(#)scsi_device.c 1.0.2 2017/09/03
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -16,9 +16,9 @@
|
||||
* Copyright 2017 Fred N. van Kempen.
|
||||
*/
|
||||
#include "../ibm.h"
|
||||
#include "../cdrom/cdrom.h"
|
||||
#include "scsi.h"
|
||||
#include "scsi_disk.h"
|
||||
#include "../cdrom.h"
|
||||
|
||||
|
||||
static uint8_t scsi_null_device_sense[14] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
|
||||
|
||||
@@ -6,26 +6,25 @@
|
||||
*
|
||||
* Emulation of SCSI fixed and removable disks.
|
||||
*
|
||||
* Version: @(#)scsi_disk.c 1.0.6 2017/08/24
|
||||
* Version: @(#)scsi_disk.c 1.0.7 2017/09/03
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2017 Miran Grca.
|
||||
*/
|
||||
#include <malloc.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "../86box.h"
|
||||
#include "../cdrom.h"
|
||||
#include "../ibm.h"
|
||||
#include "../timer.h"
|
||||
#include "../piix.h"
|
||||
#include "../cdrom/cdrom.h"
|
||||
#include "../hdd/hdd_image.h"
|
||||
#include "../hdd/hdd_ide_at.h"
|
||||
#include "../piix.h"
|
||||
#include "../win/plat_iodev.h"
|
||||
#include "scsi.h"
|
||||
#include "scsi_disk.h"
|
||||
#include "../timer.h"
|
||||
#include "../win/plat_iodev.h"
|
||||
|
||||
|
||||
/* Bits of 'status' */
|
||||
|
||||
913
src/serial.c
913
src/serial.c
@@ -1,656 +1,349 @@
|
||||
/*
|
||||
* 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 NS8250-series UART devices.
|
||||
*
|
||||
* The original IBM-PC design did not have any serial ports of
|
||||
* any kind. Rather, these were offered as add-on devices, most
|
||||
* likely because a) most people did not need one at the time,
|
||||
* and, b) this way, IBM could make more money off them.
|
||||
*
|
||||
* So, for the PC, the offerings were for an IBM Asynchronous
|
||||
* Communications Adapter, and, later, a model for synchronous
|
||||
* communications.
|
||||
*
|
||||
* The "Async Adapter" was based on the NS8250 UART chip, and
|
||||
* is what we now call the "serial" or "com" port of the PC.
|
||||
*
|
||||
* Of course, many system builders came up with similar boards,
|
||||
* and even more boards were designed where several I/O functions
|
||||
* were combined into a single board: the Multi-I/O adapters.
|
||||
* Initially, these had all the chips as-is, but later many of
|
||||
* these functions were integrated into a single MIO chip.
|
||||
*
|
||||
* This file implements the standard NS8250 series of chips, with
|
||||
* support for the later (16450 and 16550) FIFO additions. On the
|
||||
* lower half of the driver, we interface to the host system's
|
||||
* serial ports for real-world access.
|
||||
*
|
||||
* **NOTE** TEMPORARY VERSION, DO NOT UPDATE/CHANGE !!
|
||||
*
|
||||
* Based on the 86Box serial port driver as a framework.
|
||||
*
|
||||
* Version: @(#)serial.c 1.0.8 2017/06/18
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Copyright 2017 Fred N. van Kempen.
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ibm.h"
|
||||
#include "io.h"
|
||||
#include "mouse.h"
|
||||
#include "pic.h"
|
||||
#include "timer.h"
|
||||
#include "serial.h"
|
||||
#include "plat_serial.h"
|
||||
#include "timer.h"
|
||||
|
||||
|
||||
#define NUM_SERIAL 2 /* we support 2 ports */
|
||||
|
||||
|
||||
enum {
|
||||
SERINT_LSR = 1,
|
||||
SERINT_RECEIVE = 2,
|
||||
SERINT_TRANSMIT = 4,
|
||||
SERINT_MSR = 8
|
||||
enum
|
||||
{
|
||||
SERIAL_INT_LSR = 1,
|
||||
SERIAL_INT_RECEIVE = 2,
|
||||
SERIAL_INT_TRANSMIT = 4,
|
||||
SERIAL_INT_MSR = 8
|
||||
};
|
||||
|
||||
|
||||
/* IER register bits. */
|
||||
#define IER_RDAIE (0x01)
|
||||
#define IER_THREIE (0x02)
|
||||
#define IER_RXLSIE (0x04)
|
||||
#define IER_MSIE (0x08)
|
||||
#define IER_SLEEP (0x10) /* NS16750 */
|
||||
#define IER_LOWPOWER (0x20) /* NS16750 */
|
||||
#define IER_MASK (0x0f) /* not including SLEEP|LOWP */
|
||||
|
||||
/* IIR register bits. */
|
||||
#define IIR_IP (0x01)
|
||||
#define IIR_IID (0x0e)
|
||||
# define IID_IDMDM (0x00)
|
||||
# define IID_IDTX (0x02)
|
||||
# define IID_IDRX (0x04)
|
||||
# define IID_IDERR (0x06)
|
||||
# define IID_IDTMO (0x0c)
|
||||
#define IIR_IIRFE (0xc0)
|
||||
# define IIR_FIFO64 (0x20)
|
||||
# define IIR_FIFOBAD (0x80) /* 16550 */
|
||||
# define IIR_FIFOENB (0xc0)
|
||||
|
||||
/* FCR register bits. */
|
||||
#define FCR_FCRFE (0x01)
|
||||
#define FCR_RFR (0x02)
|
||||
#define FCR_TFR (0x04)
|
||||
#define FCR_SELDMA1 (0x08)
|
||||
#define FCR_FENB64 (0x20) /* 16750 */
|
||||
#define FCR_RTLS (0xc0)
|
||||
# define FCR_RTLS1 (0x00)
|
||||
# define FCR_RTLS4 (0x40)
|
||||
# define FCR_RTLS8 (0x80)
|
||||
# define FCR_RTLS14 (0xc0)
|
||||
|
||||
/* LCR register bits. */
|
||||
#define LCR_WLS (0x03)
|
||||
# define WLS_BITS5 (0x00)
|
||||
# define WLS_BITS6 (0x01)
|
||||
# define WLS_BITS7 (0x02)
|
||||
# define WLS_BITS8 (0x03)
|
||||
#define LCR_SBS (0x04)
|
||||
#define LCR_PE (0x08)
|
||||
#define LCR_EP (0x10)
|
||||
#define LCR_PS (0x20)
|
||||
# define PAR_NONE (0x00)
|
||||
# define PAR_EVEN (LCR_PE | LCR_EP)
|
||||
# define PAR_ODD (LCR_PE)
|
||||
# define PAR_MARK (LCR_PE | LCR_PS)
|
||||
# define PAR_SPACE (LCR_PE | LCR_PS | LCR_EP)
|
||||
#define LCR_BC (0x40)
|
||||
#define LCR_DLAB (0x80)
|
||||
|
||||
/* MCR register bits. */
|
||||
#define MCR_DTR (0x01)
|
||||
#define MCR_RTS (0x02)
|
||||
#define MCR_OUT1 (0x04) /* 8250 */
|
||||
#define MCR_OUT2 (0x08) /* 8250, INTEN on IBM-PC */
|
||||
#define MCR_LMS (0x10)
|
||||
#define MCR_AUTOFLOW (0x20) /* 16750 */
|
||||
|
||||
/* LSR register bits. */
|
||||
#define LSR_DR (0x01)
|
||||
#define LSR_OE (0x02)
|
||||
#define LSR_PE (0x04)
|
||||
#define LSR_FE (0x08)
|
||||
#define LSR_BI (0x10)
|
||||
#define LSR_THRE (0x20)
|
||||
#define LSR_TEMT (0x40)
|
||||
#define LSR_RXFE (0x80)
|
||||
|
||||
/* MSR register bits. */
|
||||
#define MSR_DCTS (0x01)
|
||||
#define MSR_DDSR (0x02)
|
||||
#define MSR_TERI (0x04)
|
||||
#define MSR_DDCD (0x08)
|
||||
#define MSR_CTS (0x10)
|
||||
#define MSR_DSR (0x20)
|
||||
#define MSR_RI (0x40)
|
||||
#define MSR_DCD (0x80)
|
||||
#define MSR_MASK (0x0f)
|
||||
SERIAL serial1, serial2;
|
||||
|
||||
|
||||
static SERIAL ports[NUM_SERIAL]; /* serial port data */
|
||||
int serial_do_log;
|
||||
|
||||
|
||||
static void
|
||||
serial_log(int lvl, const char *fmt, ...)
|
||||
void serial_reset()
|
||||
{
|
||||
#ifdef ENABLE_SERIAL_LOG
|
||||
va_list ap;
|
||||
|
||||
if (serial_do_log >= lvl) {
|
||||
va_start(ap, fmt);
|
||||
vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
fflush(stdout);
|
||||
}
|
||||
#endif
|
||||
serial1.iir = serial1.ier = serial1.lcr = 0;
|
||||
serial2.iir = serial2.ier = serial2.lcr = 0;
|
||||
serial1.fifo_read = serial1.fifo_write = 0;
|
||||
serial2.fifo_read = serial2.fifo_write = 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
update_ints(SERIAL *sp)
|
||||
void serial_update_ints(SERIAL *serial)
|
||||
{
|
||||
int stat = 0;
|
||||
int stat = 0;
|
||||
|
||||
sp->iir = IIR_IP;
|
||||
if ((sp->ier & IER_RXLSIE) && (sp->int_status & SERINT_LSR)) {
|
||||
/* Line Status interrupt. */
|
||||
stat = 1;
|
||||
sp->iir = IID_IDERR;
|
||||
} else if ((sp->ier & IER_RDAIE) && (sp->int_status & SERINT_RECEIVE)) {
|
||||
/* Received Data available. */
|
||||
stat = 1;
|
||||
sp->iir = IID_IDRX;
|
||||
} else if ((sp->ier & IER_THREIE) && (sp->int_status & SERINT_TRANSMIT)) {
|
||||
/* Transmit Data empty. */
|
||||
stat = 1;
|
||||
sp->iir = IID_IDTX;
|
||||
} else if ((sp->ier & IER_MSIE) && (sp->int_status & SERINT_MSR)) {
|
||||
/* Modem Status interrupt. */
|
||||
stat = 1;
|
||||
sp->iir = IID_IDMDM;
|
||||
}
|
||||
serial->iir = 1;
|
||||
|
||||
/* If IRQ line not enabled, done. */
|
||||
if (!(sp->mctrl & MCR_OUT2) && !PCJR) return;
|
||||
if ((serial->ier & 4) && (serial->int_status & SERIAL_INT_LSR)) /*Line status interrupt*/
|
||||
{
|
||||
stat = 1;
|
||||
serial->iir = 6;
|
||||
}
|
||||
else if ((serial->ier & 1) && (serial->int_status & SERIAL_INT_RECEIVE)) /*Recieved data available*/
|
||||
{
|
||||
stat = 1;
|
||||
serial->iir = 4;
|
||||
}
|
||||
else if ((serial->ier & 2) && (serial->int_status & SERIAL_INT_TRANSMIT)) /*Transmit data empty*/
|
||||
{
|
||||
stat = 1;
|
||||
serial->iir = 2;
|
||||
}
|
||||
else if ((serial->ier & 8) && (serial->int_status & SERIAL_INT_MSR)) /*Modem status interrupt*/
|
||||
{
|
||||
stat = 1;
|
||||
serial->iir = 0;
|
||||
}
|
||||
|
||||
/* Raise or clear the level-based IRQ. */
|
||||
if (stat)
|
||||
picintlevel(1 << sp->irq);
|
||||
else
|
||||
picintc(1 << sp->irq);
|
||||
if (stat && ((serial->mctrl & 8) || PCJR))
|
||||
picintlevel(1 << serial->irq);
|
||||
else
|
||||
picintc(1 << serial->irq);
|
||||
}
|
||||
|
||||
|
||||
/* Fake interrupt generator, needed for Serial Mouse. */
|
||||
static void
|
||||
serial_timer(void *priv)
|
||||
void serial_write_fifo(SERIAL *serial, uint8_t dat)
|
||||
{
|
||||
SERIAL *sp = (SERIAL *)priv;
|
||||
|
||||
sp->receive_delay = 0;
|
||||
|
||||
if (sp->fifo_read != sp->fifo_write) {
|
||||
sp->lsr |= LSR_DR;
|
||||
sp->int_status |= SERINT_RECEIVE;
|
||||
update_ints(sp);
|
||||
}
|
||||
serial->fifo[serial->fifo_write] = dat;
|
||||
serial->fifo_write = (serial->fifo_write + 1) & 0xFF;
|
||||
if (!(serial->lsr & 1))
|
||||
{
|
||||
serial->lsr |= 1;
|
||||
serial->int_status |= SERIAL_INT_RECEIVE;
|
||||
serial_update_ints(serial);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Write data to the (input) FIFO. Used by MOUSE driver. */
|
||||
void
|
||||
serial_write_fifo(SERIAL *sp, uint8_t dat, int flag)
|
||||
uint8_t serial_read_fifo(SERIAL *serial)
|
||||
{
|
||||
/* Stuff data into FIFO. */
|
||||
sp->fifo[sp->fifo_write] = dat;
|
||||
sp->fifo_write = (sp->fifo_write + 1) & 0xFF;
|
||||
|
||||
if (! (sp->lsr & LSR_DR)) {
|
||||
sp->lsr |= LSR_DR;
|
||||
sp->int_status |= SERINT_RECEIVE;
|
||||
update_ints(sp);
|
||||
}
|
||||
if (serial->fifo_read != serial->fifo_write)
|
||||
{
|
||||
serial->dat = serial->fifo[serial->fifo_read];
|
||||
serial->fifo_read = (serial->fifo_read + 1) & 0xFF;
|
||||
}
|
||||
return serial->dat;
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
read_fifo(SERIAL *sp)
|
||||
void serial_write(uint16_t addr, uint8_t val, void *p)
|
||||
{
|
||||
if (sp->fifo_read != sp->fifo_write) {
|
||||
sp->dat = sp->fifo[sp->fifo_read];
|
||||
sp->fifo_read = (sp->fifo_read + 1) & 0xFF;
|
||||
}
|
||||
|
||||
return(sp->dat);
|
||||
SERIAL *serial = (SERIAL *)p;
|
||||
switch (addr&7)
|
||||
{
|
||||
case 0:
|
||||
if (serial->lcr & 0x80)
|
||||
{
|
||||
serial->dlab1 = val;
|
||||
return;
|
||||
}
|
||||
serial->thr = val;
|
||||
serial->lsr |= 0x20;
|
||||
serial->int_status |= SERIAL_INT_TRANSMIT;
|
||||
serial_update_ints(serial);
|
||||
if (serial->mctrl & 0x10)
|
||||
{
|
||||
serial_write_fifo(serial, val);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (serial->lcr & 0x80)
|
||||
{
|
||||
serial->dlab2 = val;
|
||||
return;
|
||||
}
|
||||
serial->ier = val & 0xf;
|
||||
serial_update_ints(serial);
|
||||
break;
|
||||
case 2:
|
||||
serial->fcr = val;
|
||||
break;
|
||||
case 3:
|
||||
serial->lcr = val;
|
||||
break;
|
||||
case 4:
|
||||
if ((val & 2) && !(serial->mctrl & 2))
|
||||
{
|
||||
if (serial->rcr_callback)
|
||||
serial->rcr_callback((struct SERIAL *)serial, serial->rcr_callback_p);
|
||||
}
|
||||
serial->mctrl = val;
|
||||
if (val & 0x10)
|
||||
{
|
||||
uint8_t new_msr;
|
||||
|
||||
new_msr = (val & 0x0c) << 4;
|
||||
new_msr |= (val & 0x02) ? 0x10: 0;
|
||||
new_msr |= (val & 0x01) ? 0x20: 0;
|
||||
|
||||
if ((serial->msr ^ new_msr) & 0x10)
|
||||
new_msr |= 0x01;
|
||||
if ((serial->msr ^ new_msr) & 0x20)
|
||||
new_msr |= 0x02;
|
||||
if ((serial->msr ^ new_msr) & 0x80)
|
||||
new_msr |= 0x08;
|
||||
if ((serial->msr & 0x40) && !(new_msr & 0x40))
|
||||
new_msr |= 0x04;
|
||||
|
||||
serial->msr = new_msr;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
serial->lsr = val;
|
||||
if (serial->lsr & 0x01)
|
||||
serial->int_status |= SERIAL_INT_RECEIVE;
|
||||
if (serial->lsr & 0x1e)
|
||||
serial->int_status |= SERIAL_INT_LSR;
|
||||
if (serial->lsr & 0x20)
|
||||
serial->int_status |= SERIAL_INT_TRANSMIT;
|
||||
serial_update_ints(serial);
|
||||
break;
|
||||
case 6:
|
||||
serial->msr = val;
|
||||
if (serial->msr & 0x0f)
|
||||
serial->int_status |= SERIAL_INT_MSR;
|
||||
serial_update_ints(serial);
|
||||
break;
|
||||
case 7:
|
||||
serial->scratch = val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Handle a WRITE operation to one of our registers. */
|
||||
static void
|
||||
serial_write(uint16_t addr, uint8_t val, void *priv)
|
||||
uint8_t serial_read(uint16_t addr, void *p)
|
||||
{
|
||||
SERIAL *sp = (SERIAL *)priv;
|
||||
uint8_t wl, sb, pa;
|
||||
uint16_t baud;
|
||||
long speed;
|
||||
SERIAL *serial = (SERIAL *)p;
|
||||
uint8_t temp = 0;
|
||||
switch (addr&7)
|
||||
{
|
||||
case 0:
|
||||
if (serial->lcr & 0x80)
|
||||
{
|
||||
temp = serial->dlab1;
|
||||
break;
|
||||
}
|
||||
|
||||
#if ENABLE_SERIAL_LOG
|
||||
serial_log(2, "Serial%d: write(%04x, %02x)\n", sp->port, addr, val);
|
||||
#endif
|
||||
switch (addr & 0x07) {
|
||||
case 0: /* DATA / DLAB1 */
|
||||
if (sp->lcr & LCR_DLAB) {
|
||||
sp->dlab1 = val;
|
||||
return;
|
||||
}
|
||||
sp->thr = val;
|
||||
if (sp->bh != NULL) {
|
||||
/* We are linked, so send to BH layer. */
|
||||
bhtty_write((BHTTY *)sp->bh, sp->thr);
|
||||
|
||||
/* The WRITE completed, we are ready for more. */
|
||||
sp->lsr |= LSR_THRE;
|
||||
sp->int_status |= SERINT_TRANSMIT;
|
||||
update_ints(sp);
|
||||
} else {
|
||||
/* Not linked. Just fake LOOPBACK mode. */
|
||||
if (! (sp->mctrl & MCR_LMS))
|
||||
serial_write_fifo(sp, val, 1);
|
||||
}
|
||||
|
||||
if (sp->mctrl & MCR_LMS) {
|
||||
/* Echo data back to RX. */
|
||||
serial_write_fifo(sp, val, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: /* IER / DLAB2 */
|
||||
if (sp->lcr & LCR_DLAB) {
|
||||
sp->dlab2 = val;
|
||||
return;
|
||||
}
|
||||
sp->ier = (val & IER_MASK);
|
||||
update_ints(sp);
|
||||
break;
|
||||
|
||||
case 2: /* FCR */
|
||||
sp->fcr = val;
|
||||
break;
|
||||
|
||||
case 3: /* LCR */
|
||||
if (! (val & LCR_DLAB)) {
|
||||
/* DLAB clear. Was it set? */
|
||||
if (sp->lcr & LCR_DLAB) {
|
||||
/* We dropped DLAB, so handle baudrate. */
|
||||
baud = ((sp->dlab2<<8) | sp->dlab1);
|
||||
if (baud > 0) {
|
||||
speed = 115200UL/baud;
|
||||
serial_log(2, "Serial%d: divisor %u, baudrate %ld\n",
|
||||
sp->port, baud, speed);
|
||||
if ((sp->bh != NULL) && (speed > 0))
|
||||
bhtty_speed((BHTTY *)sp->bh, speed);
|
||||
} else {
|
||||
serial_log(1, "Serial%d: divisor %u invalid!\n",
|
||||
sp->port, baud);
|
||||
}
|
||||
} else {
|
||||
wl = (val & LCR_WLS) + 5; /* databits */
|
||||
sb = (val & LCR_SBS) ? 2 : 1; /* stopbits */
|
||||
pa = (val & (LCR_PE|LCR_EP|LCR_PS)) >> 3;
|
||||
serial_log(2, "Serial%d: WL=%d SB=%d PA=%d\n", sp->port, wl, sb, pa);
|
||||
if (sp->bh != NULL)
|
||||
bhtty_params((BHTTY *)sp->bh, wl, pa, sb);
|
||||
}
|
||||
}
|
||||
sp->lcr = val;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if ((val & MCR_RTS) && !(sp->mctrl & MCR_RTS)) {
|
||||
/*
|
||||
* This is old code for use by the Serial Mouse
|
||||
* driver. If the user toggles RTS, serial mice
|
||||
* are expected to send an ID, to inform any
|
||||
* enumerator there 'is' something.
|
||||
*/
|
||||
if (sp->rts_callback) {
|
||||
sp->rts_callback(sp->rts_callback_p);
|
||||
serial_log(1, "RTS raised; sending ID\n");
|
||||
}
|
||||
}
|
||||
|
||||
if ((val & MCR_OUT2) && !(sp->mctrl & MCR_OUT2)) {
|
||||
if (sp->bh != NULL) {
|
||||
/* Linked, start host port. */
|
||||
(void)bhtty_active(sp->bh, 1);
|
||||
} else {
|
||||
/* Not linked, start RX timer. */
|
||||
timer_add(serial_timer,
|
||||
&sp->receive_delay,
|
||||
&sp->receive_delay, sp);
|
||||
|
||||
#if 0
|
||||
/* Fake CTS, DSR and DCD (for now.) */
|
||||
sp->msr = (MSR_CTS | MSR_DCTS |
|
||||
MSR_DSR | MSR_DDSR |
|
||||
MSR_DCD | MSR_DDCD);
|
||||
sp->int_status |= SERINT_MSR;
|
||||
update_ints(sp);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
sp->mctrl = val;
|
||||
if (val & MCR_LMS) { /* loopback mode */
|
||||
uint8_t new_msr;
|
||||
|
||||
/*FIXME: WTF does this do?? --FvK */
|
||||
new_msr = (val & 0x0c) << 4;
|
||||
new_msr |= (val & MCR_RTS) ? MCR_LMS : 0;
|
||||
new_msr |= (val & MCR_DTR) ? MCR_AUTOFLOW : 0;
|
||||
|
||||
if ((sp->msr ^ new_msr) & 0x10)
|
||||
new_msr |= MCR_DTR;
|
||||
if ((sp->msr ^ new_msr) & 0x20)
|
||||
new_msr |= MCR_RTS;
|
||||
if ((sp->msr ^ new_msr) & 0x80)
|
||||
new_msr |= 0x08;
|
||||
if ((sp->msr & 0x40) && !(new_msr & 0x40))
|
||||
new_msr |= 0x04;
|
||||
|
||||
sp->msr = new_msr;
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
sp->lsr = val;
|
||||
if (sp->lsr & LSR_DR)
|
||||
sp->int_status |= SERINT_RECEIVE;
|
||||
if (sp->lsr & 0x1e)
|
||||
sp->int_status |= SERINT_LSR;
|
||||
if (sp->lsr & LSR_THRE)
|
||||
sp->int_status |= SERINT_TRANSMIT;
|
||||
update_ints(sp);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
sp->msr = val;
|
||||
if (sp->msr & MSR_MASK)
|
||||
sp->int_status |= SERINT_MSR;
|
||||
update_ints(sp);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
sp->scratch = val;
|
||||
break;
|
||||
}
|
||||
serial->lsr &= ~1;
|
||||
serial->int_status &= ~SERIAL_INT_RECEIVE;
|
||||
serial_update_ints(serial);
|
||||
temp = serial_read_fifo(serial);
|
||||
if (serial->fifo_read != serial->fifo_write)
|
||||
serial->recieve_delay = 1000 * TIMER_USEC;
|
||||
break;
|
||||
case 1:
|
||||
if (serial->lcr & 0x80)
|
||||
temp = serial->dlab2;
|
||||
else
|
||||
temp = serial->ier;
|
||||
break;
|
||||
case 2:
|
||||
temp = serial->iir;
|
||||
if ((temp & 0xe) == 2)
|
||||
{
|
||||
serial->int_status &= ~SERIAL_INT_TRANSMIT;
|
||||
serial_update_ints(serial);
|
||||
}
|
||||
if (serial->fcr & 1)
|
||||
temp |= 0xc0;
|
||||
break;
|
||||
case 3:
|
||||
temp = serial->lcr;
|
||||
break;
|
||||
case 4:
|
||||
temp = serial->mctrl;
|
||||
break;
|
||||
case 5:
|
||||
if (serial->lsr & 0x20)
|
||||
serial->lsr |= 0x40;
|
||||
serial->lsr |= 0x20;
|
||||
temp = serial->lsr;
|
||||
if (serial->lsr & 0x1f)
|
||||
serial->lsr &= ~0x1e;
|
||||
serial->int_status &= ~SERIAL_INT_LSR;
|
||||
serial_update_ints(serial);
|
||||
break;
|
||||
case 6:
|
||||
temp = serial->msr;
|
||||
serial->msr &= ~0x0f;
|
||||
serial->int_status &= ~SERIAL_INT_MSR;
|
||||
serial_update_ints(serial);
|
||||
break;
|
||||
case 7:
|
||||
temp = serial->scratch;
|
||||
break;
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
/* BHTTY READ COMPLETE handler. */
|
||||
static void
|
||||
serial_rd_done(void *arg, int num)
|
||||
void serial_recieve_callback(void *p)
|
||||
{
|
||||
SERIAL *sp = (SERIAL *)arg;
|
||||
|
||||
/* We can do at least 'num' bytes.. */
|
||||
while (num-- > 0) {
|
||||
/* Get a byte from them. */
|
||||
if (bhtty_read(sp->bh, &sp->hold, 1) < 0) break;
|
||||
|
||||
/* Stuff it into the FIFO and set intr. */
|
||||
serial_write_fifo(sp, sp->hold, 1);
|
||||
}
|
||||
SERIAL *serial = (SERIAL *)p;
|
||||
|
||||
serial->recieve_delay = 0;
|
||||
|
||||
if (serial->fifo_read != serial->fifo_write)
|
||||
{
|
||||
serial->lsr |= 1;
|
||||
serial->int_status |= SERIAL_INT_RECEIVE;
|
||||
serial_update_ints(serial);
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t base_address[2] = { 0x0000, 0x0000 };
|
||||
|
||||
/* Handle a READ operation from one of our registers. */
|
||||
static uint8_t
|
||||
serial_read(uint16_t addr, void *priv)
|
||||
void serial_remove(int port)
|
||||
{
|
||||
SERIAL *sp = (SERIAL *)priv;
|
||||
uint8_t ret = 0x00;
|
||||
|
||||
switch (addr&0x07) {
|
||||
case 0: /* DATA / DLAB1 */
|
||||
if (sp->lcr & LCR_DLAB) {
|
||||
ret = sp->dlab1;
|
||||
} else {
|
||||
sp->lsr &= ~LSR_DR;
|
||||
sp->int_status &= ~SERINT_RECEIVE;
|
||||
#if 0
|
||||
update_ints(sp);
|
||||
#endif
|
||||
ret = read_fifo(sp);
|
||||
if ((sp->bh == NULL) &&
|
||||
(sp->fifo_read != sp->fifo_write))
|
||||
sp->receive_delay = 1000 * TIMER_USEC;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: /* LCR / DLAB2 */
|
||||
ret = (sp->lcr & LCR_DLAB) ? sp->dlab2 : sp->ier;
|
||||
break;
|
||||
|
||||
case 2: /* IIR */
|
||||
ret = sp->iir;
|
||||
if ((ret & IIR_IID) == IID_IDTX) {
|
||||
sp->int_status &= ~SERINT_TRANSMIT;
|
||||
update_ints(sp);
|
||||
}
|
||||
if (sp->fcr & 0x01)
|
||||
ret |= 0xc0;
|
||||
break;
|
||||
|
||||
case 3: /* LCR */
|
||||
ret = sp->lcr;
|
||||
break;
|
||||
|
||||
case 4: /* MCR */
|
||||
ret = sp->mctrl;
|
||||
break;
|
||||
|
||||
case 5: /* LSR */
|
||||
if (sp->lsr & LSR_THRE)
|
||||
sp->lsr |= LSR_TEMT;
|
||||
sp->lsr |= LSR_THRE;
|
||||
ret = sp->lsr;
|
||||
if (sp->lsr & 0x1f)
|
||||
sp->lsr &= ~0x1e;
|
||||
#if 0
|
||||
sp->lsr |= (LSR_THRE | LSR_TEMT);
|
||||
#endif
|
||||
sp->int_status &= ~SERINT_LSR;
|
||||
update_ints(sp);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
ret = sp->msr;
|
||||
sp->msr &= ~0x0f;
|
||||
sp->int_status &= ~SERINT_MSR;
|
||||
update_ints(sp);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
ret = sp->scratch;
|
||||
break;
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
/* Set up a serial port for use. */
|
||||
void
|
||||
serial_setup(int port, uint16_t addr, int irq)
|
||||
{
|
||||
SERIAL *sp;
|
||||
|
||||
serial_log(0, "Serial%d: I/O=%04x, IRQ=%d\n", port, addr, irq);
|
||||
|
||||
/* Grab the desired port block. */
|
||||
sp = &ports[port-1];
|
||||
|
||||
/* Set up the basic info. */
|
||||
if (sp->addr != 0x0000) {
|
||||
/* Unlink the previous handler. Just in case. */
|
||||
io_removehandler(sp->addr, 8,
|
||||
serial_read, NULL, NULL, serial_write, NULL, NULL, sp);
|
||||
}
|
||||
sp->addr = addr;
|
||||
sp->irq = irq;
|
||||
|
||||
/* Request an I/O range. */
|
||||
io_sethandler(sp->addr, 8,
|
||||
serial_read, NULL, NULL, serial_write, NULL, NULL, sp);
|
||||
}
|
||||
|
||||
|
||||
/* Release all resources held by a serial port. */
|
||||
void
|
||||
serial_remove(int port)
|
||||
{
|
||||
SERIAL *sp;
|
||||
|
||||
/* Grab the desired port block. */
|
||||
sp = &ports[port-1];
|
||||
|
||||
// FIXME: stop timer, if enabled!
|
||||
|
||||
/* Close the host device. */
|
||||
if (sp->bh != NULL)
|
||||
(void)serial_link(port, NULL);
|
||||
|
||||
/* Release our I/O range. */
|
||||
if (sp->addr != 0x0000) {
|
||||
io_removehandler(sp->addr, 8,
|
||||
serial_read, NULL, NULL, serial_write, NULL, NULL, sp);
|
||||
}
|
||||
sp->addr = 0x0000;
|
||||
sp->irq = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Initialize the serial ports. */
|
||||
void
|
||||
serial_init(void)
|
||||
{
|
||||
SERIAL *sp;
|
||||
int i;
|
||||
|
||||
#if ENABLE_SERIAL_LOG
|
||||
serial_do_log = ENABLE_SERIAL_LOG;
|
||||
#endif
|
||||
|
||||
/* FIXME: we should probably initialize the platform module here. */
|
||||
|
||||
/* Initialize each port. */
|
||||
for (i=0; i<NUM_SERIAL; i++) {
|
||||
sp = &ports[i];
|
||||
memset(sp, 0x00, sizeof(SERIAL));
|
||||
sp->port = (i+1);
|
||||
|
||||
if (i == 0)
|
||||
serial_setup(sp->port, SERIAL1_ADDR, SERIAL1_IRQ);
|
||||
else
|
||||
serial_setup(sp->port, SERIAL2_ADDR, SERIAL2_IRQ);
|
||||
}
|
||||
|
||||
#ifdef WALTJE
|
||||
/* Link to host port. */
|
||||
serial_link(2, "COM2");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Reset the serial ports.
|
||||
*
|
||||
* This should be a per-port function.
|
||||
*/
|
||||
void
|
||||
serial_reset(void)
|
||||
{
|
||||
SERIAL *sp;
|
||||
int i;
|
||||
|
||||
for (i=0; i<NUM_SERIAL; i++) {
|
||||
sp = &ports[i];
|
||||
|
||||
sp->iir = sp->ier = sp->lcr = sp->mctrl = 0x00;
|
||||
sp->fifo_read = sp->fifo_write = 0x00;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Link a serial port to a host (serial) port. */
|
||||
int
|
||||
serial_link(int port, char *arg)
|
||||
{
|
||||
SERIAL *sp;
|
||||
BHTTY *bh;
|
||||
|
||||
/* Grab the desired port block. */
|
||||
sp = &ports[port-1];
|
||||
|
||||
if (arg != NULL) {
|
||||
/* Make sure we're not already linked. */
|
||||
if (sp->bh != NULL) {
|
||||
serial_log(0, "Serial%d already linked!\n", port);
|
||||
return(-1);
|
||||
if ((port < 1) || (port > 2))
|
||||
{
|
||||
fatal("serial_remove(): Invalid serial port: %i\n", port);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/* Request a port from the host system. */
|
||||
bh = bhtty_open(arg, 0);
|
||||
if (bh == NULL) {
|
||||
serial_log(0, "Serial%d unable to link to '%s' !\n", port, arg);
|
||||
return(-1);
|
||||
}
|
||||
sp->bh = bh;
|
||||
|
||||
/* Set up bottom-half I/O callback info. */
|
||||
bh->rd_done = serial_rd_done;
|
||||
bh->rd_arg = sp;
|
||||
} else {
|
||||
/* If we are linked, unlink it. */
|
||||
if (sp->bh != NULL) {
|
||||
bhtty_close((BHTTY *)sp->bh);
|
||||
sp->bh = NULL;
|
||||
if (!serial_enabled[port - 1])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
if (!base_address[port - 1])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
return(0);
|
||||
/* pclog("Removing serial port %i at %04X...\n", port, base_address[port - 1]); */
|
||||
|
||||
switch(port)
|
||||
{
|
||||
case 1:
|
||||
io_removehandler(base_address[0], 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial1);
|
||||
base_address[0] = 0x0000;
|
||||
break;
|
||||
case 2:
|
||||
io_removehandler(base_address[1], 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial2);
|
||||
base_address[1] = 0x0000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Attach another device (MOUSE) to a serial port. */
|
||||
SERIAL *
|
||||
serial_attach(int port, void *func, void *arg)
|
||||
void serial_setup(int port, uint16_t addr, int irq)
|
||||
{
|
||||
SERIAL *sp;
|
||||
/* pclog("Adding serial port %i at %04X...\n", port, addr); */
|
||||
|
||||
/* Grab the desired port block. */
|
||||
sp = &ports[port-1];
|
||||
|
||||
/* Set up callback info. */
|
||||
sp->rts_callback = func;
|
||||
sp->rts_callback_p = arg;
|
||||
|
||||
return(sp);
|
||||
switch(port)
|
||||
{
|
||||
case 1:
|
||||
if (!serial_enabled[0])
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (base_address[0] != 0x0000)
|
||||
{
|
||||
serial_remove(port);
|
||||
}
|
||||
if (addr != 0x0000)
|
||||
{
|
||||
base_address[0] = addr;
|
||||
io_sethandler(addr, 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial1);
|
||||
}
|
||||
serial1.irq = irq;
|
||||
break;
|
||||
case 2:
|
||||
if (!serial_enabled[1])
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (base_address[1] != 0x0000)
|
||||
{
|
||||
serial_remove(port);
|
||||
}
|
||||
if (addr != 0x0000)
|
||||
{
|
||||
base_address[1] = addr;
|
||||
io_sethandler(addr, 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial2);
|
||||
}
|
||||
serial2.irq = irq;
|
||||
break;
|
||||
default:
|
||||
fatal("serial_setup(): Invalid serial port: %i\n", port);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void serial_init(void)
|
||||
{
|
||||
base_address[0] = 0x03f8;
|
||||
base_address[1] = 0x02f8;
|
||||
|
||||
if (serial_enabled[0])
|
||||
{
|
||||
/* pclog("Adding serial port 1...\n"); */
|
||||
memset(&serial1, 0, sizeof(serial1));
|
||||
io_sethandler(0x3f8, 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial1);
|
||||
serial1.irq = 4;
|
||||
serial1.rcr_callback = NULL;
|
||||
timer_add(serial_recieve_callback, &serial1.recieve_delay, &serial1.recieve_delay, &serial1);
|
||||
}
|
||||
if (serial_enabled[1])
|
||||
{
|
||||
/* pclog("Adding serial port 2...\n"); */
|
||||
memset(&serial2, 0, sizeof(serial2));
|
||||
io_sethandler(0x2f8, 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial2);
|
||||
serial2.irq = 3;
|
||||
serial2.rcr_callback = NULL;
|
||||
timer_add(serial_recieve_callback, &serial2.recieve_delay, &serial2.recieve_delay, &serial2);
|
||||
}
|
||||
}
|
||||
|
||||
349
src/serial_old.c
349
src/serial_old.c
@@ -1,349 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ibm.h"
|
||||
#include "io.h"
|
||||
#include "mouse.h"
|
||||
#include "pic.h"
|
||||
#include "serial.h"
|
||||
#include "timer.h"
|
||||
|
||||
enum
|
||||
{
|
||||
SERIAL_INT_LSR = 1,
|
||||
SERIAL_INT_RECEIVE = 2,
|
||||
SERIAL_INT_TRANSMIT = 4,
|
||||
SERIAL_INT_MSR = 8
|
||||
};
|
||||
|
||||
SERIAL serial1, serial2;
|
||||
|
||||
|
||||
void serial_reset()
|
||||
{
|
||||
serial1.iir = serial1.ier = serial1.lcr = 0;
|
||||
serial2.iir = serial2.ier = serial2.lcr = 0;
|
||||
serial1.fifo_read = serial1.fifo_write = 0;
|
||||
serial2.fifo_read = serial2.fifo_write = 0;
|
||||
}
|
||||
|
||||
void serial_update_ints(SERIAL *serial)
|
||||
{
|
||||
int stat = 0;
|
||||
|
||||
serial->iir = 1;
|
||||
|
||||
if ((serial->ier & 4) && (serial->int_status & SERIAL_INT_LSR)) /*Line status interrupt*/
|
||||
{
|
||||
stat = 1;
|
||||
serial->iir = 6;
|
||||
}
|
||||
else if ((serial->ier & 1) && (serial->int_status & SERIAL_INT_RECEIVE)) /*Recieved data available*/
|
||||
{
|
||||
stat = 1;
|
||||
serial->iir = 4;
|
||||
}
|
||||
else if ((serial->ier & 2) && (serial->int_status & SERIAL_INT_TRANSMIT)) /*Transmit data empty*/
|
||||
{
|
||||
stat = 1;
|
||||
serial->iir = 2;
|
||||
}
|
||||
else if ((serial->ier & 8) && (serial->int_status & SERIAL_INT_MSR)) /*Modem status interrupt*/
|
||||
{
|
||||
stat = 1;
|
||||
serial->iir = 0;
|
||||
}
|
||||
|
||||
if (stat && ((serial->mctrl & 8) || PCJR))
|
||||
picintlevel(1 << serial->irq);
|
||||
else
|
||||
picintc(1 << serial->irq);
|
||||
}
|
||||
|
||||
void serial_write_fifo(SERIAL *serial, uint8_t dat)
|
||||
{
|
||||
serial->fifo[serial->fifo_write] = dat;
|
||||
serial->fifo_write = (serial->fifo_write + 1) & 0xFF;
|
||||
if (!(serial->lsr & 1))
|
||||
{
|
||||
serial->lsr |= 1;
|
||||
serial->int_status |= SERIAL_INT_RECEIVE;
|
||||
serial_update_ints(serial);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t serial_read_fifo(SERIAL *serial)
|
||||
{
|
||||
if (serial->fifo_read != serial->fifo_write)
|
||||
{
|
||||
serial->dat = serial->fifo[serial->fifo_read];
|
||||
serial->fifo_read = (serial->fifo_read + 1) & 0xFF;
|
||||
}
|
||||
return serial->dat;
|
||||
}
|
||||
|
||||
void serial_write(uint16_t addr, uint8_t val, void *p)
|
||||
{
|
||||
SERIAL *serial = (SERIAL *)p;
|
||||
switch (addr&7)
|
||||
{
|
||||
case 0:
|
||||
if (serial->lcr & 0x80)
|
||||
{
|
||||
serial->dlab1 = val;
|
||||
return;
|
||||
}
|
||||
serial->thr = val;
|
||||
serial->lsr |= 0x20;
|
||||
serial->int_status |= SERIAL_INT_TRANSMIT;
|
||||
serial_update_ints(serial);
|
||||
if (serial->mctrl & 0x10)
|
||||
{
|
||||
serial_write_fifo(serial, val);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (serial->lcr & 0x80)
|
||||
{
|
||||
serial->dlab2 = val;
|
||||
return;
|
||||
}
|
||||
serial->ier = val & 0xf;
|
||||
serial_update_ints(serial);
|
||||
break;
|
||||
case 2:
|
||||
serial->fcr = val;
|
||||
break;
|
||||
case 3:
|
||||
serial->lcr = val;
|
||||
break;
|
||||
case 4:
|
||||
if ((val & 2) && !(serial->mctrl & 2))
|
||||
{
|
||||
if (serial->rcr_callback)
|
||||
serial->rcr_callback((struct SERIAL *)serial, serial->rcr_callback_p);
|
||||
}
|
||||
serial->mctrl = val;
|
||||
if (val & 0x10)
|
||||
{
|
||||
uint8_t new_msr;
|
||||
|
||||
new_msr = (val & 0x0c) << 4;
|
||||
new_msr |= (val & 0x02) ? 0x10: 0;
|
||||
new_msr |= (val & 0x01) ? 0x20: 0;
|
||||
|
||||
if ((serial->msr ^ new_msr) & 0x10)
|
||||
new_msr |= 0x01;
|
||||
if ((serial->msr ^ new_msr) & 0x20)
|
||||
new_msr |= 0x02;
|
||||
if ((serial->msr ^ new_msr) & 0x80)
|
||||
new_msr |= 0x08;
|
||||
if ((serial->msr & 0x40) && !(new_msr & 0x40))
|
||||
new_msr |= 0x04;
|
||||
|
||||
serial->msr = new_msr;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
serial->lsr = val;
|
||||
if (serial->lsr & 0x01)
|
||||
serial->int_status |= SERIAL_INT_RECEIVE;
|
||||
if (serial->lsr & 0x1e)
|
||||
serial->int_status |= SERIAL_INT_LSR;
|
||||
if (serial->lsr & 0x20)
|
||||
serial->int_status |= SERIAL_INT_TRANSMIT;
|
||||
serial_update_ints(serial);
|
||||
break;
|
||||
case 6:
|
||||
serial->msr = val;
|
||||
if (serial->msr & 0x0f)
|
||||
serial->int_status |= SERIAL_INT_MSR;
|
||||
serial_update_ints(serial);
|
||||
break;
|
||||
case 7:
|
||||
serial->scratch = val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t serial_read(uint16_t addr, void *p)
|
||||
{
|
||||
SERIAL *serial = (SERIAL *)p;
|
||||
uint8_t temp = 0;
|
||||
switch (addr&7)
|
||||
{
|
||||
case 0:
|
||||
if (serial->lcr & 0x80)
|
||||
{
|
||||
temp = serial->dlab1;
|
||||
break;
|
||||
}
|
||||
|
||||
serial->lsr &= ~1;
|
||||
serial->int_status &= ~SERIAL_INT_RECEIVE;
|
||||
serial_update_ints(serial);
|
||||
temp = serial_read_fifo(serial);
|
||||
if (serial->fifo_read != serial->fifo_write)
|
||||
serial->recieve_delay = 1000 * TIMER_USEC;
|
||||
break;
|
||||
case 1:
|
||||
if (serial->lcr & 0x80)
|
||||
temp = serial->dlab2;
|
||||
else
|
||||
temp = serial->ier;
|
||||
break;
|
||||
case 2:
|
||||
temp = serial->iir;
|
||||
if ((temp & 0xe) == 2)
|
||||
{
|
||||
serial->int_status &= ~SERIAL_INT_TRANSMIT;
|
||||
serial_update_ints(serial);
|
||||
}
|
||||
if (serial->fcr & 1)
|
||||
temp |= 0xc0;
|
||||
break;
|
||||
case 3:
|
||||
temp = serial->lcr;
|
||||
break;
|
||||
case 4:
|
||||
temp = serial->mctrl;
|
||||
break;
|
||||
case 5:
|
||||
if (serial->lsr & 0x20)
|
||||
serial->lsr |= 0x40;
|
||||
serial->lsr |= 0x20;
|
||||
temp = serial->lsr;
|
||||
if (serial->lsr & 0x1f)
|
||||
serial->lsr &= ~0x1e;
|
||||
serial->int_status &= ~SERIAL_INT_LSR;
|
||||
serial_update_ints(serial);
|
||||
break;
|
||||
case 6:
|
||||
temp = serial->msr;
|
||||
serial->msr &= ~0x0f;
|
||||
serial->int_status &= ~SERIAL_INT_MSR;
|
||||
serial_update_ints(serial);
|
||||
break;
|
||||
case 7:
|
||||
temp = serial->scratch;
|
||||
break;
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
void serial_recieve_callback(void *p)
|
||||
{
|
||||
SERIAL *serial = (SERIAL *)p;
|
||||
|
||||
serial->recieve_delay = 0;
|
||||
|
||||
if (serial->fifo_read != serial->fifo_write)
|
||||
{
|
||||
serial->lsr |= 1;
|
||||
serial->int_status |= SERIAL_INT_RECEIVE;
|
||||
serial_update_ints(serial);
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t base_address[2] = { 0x0000, 0x0000 };
|
||||
|
||||
void serial_remove(int port)
|
||||
{
|
||||
if ((port < 1) || (port > 2))
|
||||
{
|
||||
fatal("serial_remove(): Invalid serial port: %i\n", port);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (!serial_enabled[port - 1])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!base_address[port - 1])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* pclog("Removing serial port %i at %04X...\n", port, base_address[port - 1]); */
|
||||
|
||||
switch(port)
|
||||
{
|
||||
case 1:
|
||||
io_removehandler(base_address[0], 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial1);
|
||||
base_address[0] = 0x0000;
|
||||
break;
|
||||
case 2:
|
||||
io_removehandler(base_address[1], 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial2);
|
||||
base_address[1] = 0x0000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void serial_setup(int port, uint16_t addr, int irq)
|
||||
{
|
||||
/* pclog("Adding serial port %i at %04X...\n", port, addr); */
|
||||
|
||||
switch(port)
|
||||
{
|
||||
case 1:
|
||||
if (!serial_enabled[0])
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (base_address[0] != 0x0000)
|
||||
{
|
||||
serial_remove(port);
|
||||
}
|
||||
if (addr != 0x0000)
|
||||
{
|
||||
base_address[0] = addr;
|
||||
io_sethandler(addr, 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial1);
|
||||
}
|
||||
serial1.irq = irq;
|
||||
break;
|
||||
case 2:
|
||||
if (!serial_enabled[1])
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (base_address[1] != 0x0000)
|
||||
{
|
||||
serial_remove(port);
|
||||
}
|
||||
if (addr != 0x0000)
|
||||
{
|
||||
base_address[1] = addr;
|
||||
io_sethandler(addr, 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial2);
|
||||
}
|
||||
serial2.irq = irq;
|
||||
break;
|
||||
default:
|
||||
fatal("serial_setup(): Invalid serial port: %i\n", port);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void serial_init(void)
|
||||
{
|
||||
base_address[0] = 0x03f8;
|
||||
base_address[1] = 0x02f8;
|
||||
|
||||
if (serial_enabled[0])
|
||||
{
|
||||
/* pclog("Adding serial port 1...\n"); */
|
||||
memset(&serial1, 0, sizeof(serial1));
|
||||
io_sethandler(0x3f8, 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial1);
|
||||
serial1.irq = 4;
|
||||
serial1.rcr_callback = NULL;
|
||||
timer_add(serial_recieve_callback, &serial1.recieve_delay, &serial1.recieve_delay, &serial1);
|
||||
}
|
||||
if (serial_enabled[1])
|
||||
{
|
||||
/* pclog("Adding serial port 2...\n"); */
|
||||
memset(&serial2, 0, sizeof(serial2));
|
||||
io_sethandler(0x2f8, 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial2);
|
||||
serial2.irq = 3;
|
||||
serial2.rcr_callback = NULL;
|
||||
timer_add(serial_recieve_callback, &serial2.recieve_delay, &serial2.recieve_delay, &serial2);
|
||||
}
|
||||
}
|
||||
26
src/sio.h
26
src/sio.h
@@ -4,14 +4,26 @@
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* Emulation of Intel System I/O PCI chip.
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Version: @(#)sio.h 1.0.2 2017/08/23
|
||||
* Definitions for the Super I/O chips.
|
||||
*
|
||||
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
* Version: @(#)sio.h 1.0.1 2017/09/03
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Copyright 2017 Fred N. van Kempen.
|
||||
*/
|
||||
#ifndef EMU_SIO_H
|
||||
# define EMU_SIO_H
|
||||
|
||||
void sio_init(int card);
|
||||
|
||||
extern void superio_detect_init(void);
|
||||
extern void fdc37c665_init(void);
|
||||
extern void fdc37c669_init(void);
|
||||
extern void fdc37c932fr_init(void);
|
||||
extern void pc87306_init(void);
|
||||
extern void um8669f_init(void);
|
||||
extern void w83877f_init(void);
|
||||
|
||||
|
||||
#endif /*EMU_SIO_H*/
|
||||
|
||||
@@ -1,34 +1,24 @@
|
||||
/*
|
||||
SMSC SMC FDC37C665 Super I/O Chip
|
||||
Used by Batman's Revenge
|
||||
*/
|
||||
#include "ibm.h"
|
||||
#include "io.h"
|
||||
#include "disc.h"
|
||||
#include "fdd.h"
|
||||
#include "fdc.h"
|
||||
#include "superio_detect.h"
|
||||
#include "floppy/floppy.h"
|
||||
#include "floppy/fdc.h"
|
||||
#include "sio.h"
|
||||
|
||||
|
||||
static int fdc37c665_locked;
|
||||
static int fdc37c665_curreg = 0;
|
||||
static uint8_t detect_regs[2];
|
||||
static uint8_t tries;
|
||||
|
||||
|
||||
void superio_detect_write(uint16_t port, uint8_t val, void *priv)
|
||||
static void superio_detect_write(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
uint8_t index = (port & 1) ? 0 : 1;
|
||||
uint8_t valxor = 0;
|
||||
int temp;
|
||||
pclog("superio_detect_write : port=%04x = %02X\n", port, val);
|
||||
|
||||
detect_regs[port & 1] = val;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
uint8_t superio_detect_read(uint16_t port, void *priv)
|
||||
static uint8_t superio_detect_read(uint16_t port, void *priv)
|
||||
{
|
||||
pclog("superio_detect_read : port=%04x = %02X\n", port, detect_regs[port & 1]);
|
||||
|
||||
303
src/sio_fdc37c665.c
Normal file
303
src/sio_fdc37c665.c
Normal file
@@ -0,0 +1,303 @@
|
||||
/*
|
||||
* 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 the SMC FDC37C665 Super I/O Chip.
|
||||
*
|
||||
* Version: @(#)sio_fdc37c665.c 1.0.3 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#include "ibm.h"
|
||||
#include "io.h"
|
||||
#include "lpt.h"
|
||||
#include "serial.h"
|
||||
#include "floppy/floppy.h"
|
||||
#include "floppy/fdc.h"
|
||||
#include "floppy/fdd.h"
|
||||
#include "hdd/hdd_ide_at.h"
|
||||
#include "sio.h"
|
||||
|
||||
|
||||
static uint8_t fdc37c665_lock[2];
|
||||
static int fdc37c665_curreg;
|
||||
static uint8_t fdc37c665_regs[16];
|
||||
static int com3_addr, com4_addr;
|
||||
|
||||
|
||||
static void write_lock(uint8_t val)
|
||||
{
|
||||
if (val == 0x55 && fdc37c665_lock[1] == 0x55)
|
||||
fdc_3f1_enable(0);
|
||||
if (fdc37c665_lock[0] == 0x55 && fdc37c665_lock[1] == 0x55 && val != 0x55)
|
||||
fdc_3f1_enable(1);
|
||||
|
||||
fdc37c665_lock[0] = fdc37c665_lock[1];
|
||||
fdc37c665_lock[1] = val;
|
||||
}
|
||||
|
||||
static void ide_handler()
|
||||
{
|
||||
#if 0
|
||||
uint16_t or_value = 0;
|
||||
if ((romset == ROM_440FX) || (romset == ROM_R418) || (romset == ROM_MB500N))
|
||||
{
|
||||
return;
|
||||
}
|
||||
ide_pri_disable();
|
||||
if (fdc37c665_regs[0] & 1)
|
||||
{
|
||||
if (fdc37c665_regs[5] & 2)
|
||||
{
|
||||
or_value = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
or_value = 0x800;
|
||||
}
|
||||
ide_set_base(0, 0x170 | or_value);
|
||||
ide_set_side(0, 0x376 | or_value);
|
||||
ide_pri_enable_ex();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void set_com34_addr()
|
||||
{
|
||||
switch (fdc37c665_regs[1] & 0x60)
|
||||
{
|
||||
case 0x00:
|
||||
com3_addr = 0x338;
|
||||
com4_addr = 0x238;
|
||||
break;
|
||||
case 0x20:
|
||||
com3_addr = 0x3e8;
|
||||
com4_addr = 0x2e8;
|
||||
break;
|
||||
case 0x40:
|
||||
com3_addr = 0x3e8;
|
||||
com4_addr = 0x2e0;
|
||||
break;
|
||||
case 0x60:
|
||||
com3_addr = 0x220;
|
||||
com4_addr = 0x228;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void set_serial1_addr()
|
||||
{
|
||||
if (fdc37c665_regs[2] & 4)
|
||||
{
|
||||
switch (fdc37c665_regs[2] & 3)
|
||||
{
|
||||
case 0:
|
||||
serial_setup(1, SERIAL1_ADDR, SERIAL1_IRQ);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
serial_setup(1, SERIAL2_ADDR, SERIAL2_IRQ);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
serial_setup(1, com3_addr, 4);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
serial_setup(1, com4_addr, 3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void set_serial2_addr()
|
||||
{
|
||||
if (fdc37c665_regs[2] & 0x40)
|
||||
{
|
||||
switch (fdc37c665_regs[2] & 0x30)
|
||||
{
|
||||
case 0:
|
||||
serial_setup(2, SERIAL1_ADDR, SERIAL1_IRQ);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
serial_setup(2, SERIAL2_ADDR, SERIAL2_IRQ);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
serial_setup(2, com3_addr, 4);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
serial_setup(2, com4_addr, 3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void lpt1_handler()
|
||||
{
|
||||
lpt1_remove();
|
||||
switch (fdc37c665_regs[1] & 3)
|
||||
{
|
||||
case 1:
|
||||
lpt1_init(0x3bc);
|
||||
break;
|
||||
case 2:
|
||||
lpt1_init(0x378);
|
||||
break;
|
||||
case 3:
|
||||
lpt1_init(0x278);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void fdc37c665_write(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
uint8_t valxor = 0;
|
||||
if (fdc37c665_lock[0] == 0x55 && fdc37c665_lock[1] == 0x55)
|
||||
{
|
||||
if (port == 0x3f0)
|
||||
{
|
||||
if (val == 0xaa)
|
||||
write_lock(val);
|
||||
else
|
||||
if (fdc37c665_curreg != 0)
|
||||
{
|
||||
fdc37c665_curreg = val & 0xf;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Hardcode the IDE to AT type. */
|
||||
fdc37c665_curreg = (val & 0xf) | 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
valxor = val ^ fdc37c665_regs[fdc37c665_curreg];
|
||||
fdc37c665_regs[fdc37c665_curreg] = val;
|
||||
|
||||
switch(fdc37c665_curreg)
|
||||
{
|
||||
case 0:
|
||||
if (valxor & 1)
|
||||
{
|
||||
ide_handler();
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (valxor & 3)
|
||||
{
|
||||
lpt1_handler();
|
||||
}
|
||||
if (valxor & 0x60)
|
||||
{
|
||||
serial_remove(1);
|
||||
set_com34_addr();
|
||||
set_serial1_addr();
|
||||
set_serial2_addr();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (valxor & 7)
|
||||
{
|
||||
serial_remove(1);
|
||||
set_serial1_addr();
|
||||
}
|
||||
if (valxor & 0x70)
|
||||
{
|
||||
serial_remove(2);
|
||||
set_serial2_addr();
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (valxor & 2)
|
||||
{
|
||||
fdc_update_enh_mode((fdc37c665_regs[3] & 2) ? 1 : 0);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (valxor & 2)
|
||||
{
|
||||
ide_handler();
|
||||
}
|
||||
if (valxor & 0x18)
|
||||
{
|
||||
fdc_update_densel_force((fdc37c665_regs[5] & 0x18) >> 3);
|
||||
}
|
||||
if (valxor & 0x20)
|
||||
{
|
||||
fdd_swap = ((fdc37c665_regs[5] & 0x20) >> 5);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (port == 0x3f0)
|
||||
write_lock(val);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t fdc37c665_read(uint16_t port, void *priv)
|
||||
{
|
||||
if (fdc37c665_lock[0] == 0x55 && fdc37c665_lock[1] == 0x55)
|
||||
{
|
||||
if (port == 0x3f1)
|
||||
return fdc37c665_regs[fdc37c665_curreg];
|
||||
}
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
void fdc37c665_reset(void)
|
||||
{
|
||||
com3_addr = 0x338;
|
||||
com4_addr = 0x238;
|
||||
|
||||
fdc_remove();
|
||||
fdc_add_for_superio();
|
||||
|
||||
fdc_update_is_nsc(0);
|
||||
|
||||
serial_remove(1);
|
||||
serial_setup(1, SERIAL1_ADDR, SERIAL1_IRQ);
|
||||
|
||||
serial_remove(2);
|
||||
serial_setup(2, SERIAL2_ADDR, SERIAL2_IRQ);
|
||||
|
||||
lpt2_remove();
|
||||
|
||||
lpt1_remove();
|
||||
lpt1_init(0x378);
|
||||
|
||||
memset(fdc37c665_lock, 0, 2);
|
||||
memset(fdc37c665_regs, 0, 16);
|
||||
fdc37c665_regs[0x0] = 0x3b;
|
||||
fdc37c665_regs[0x1] = 0x9f;
|
||||
fdc37c665_regs[0x2] = 0xdc;
|
||||
fdc37c665_regs[0x3] = 0x78;
|
||||
fdc37c665_regs[0x6] = 0xff;
|
||||
fdc37c665_regs[0xd] = 0x65;
|
||||
fdc37c665_regs[0xe] = 0x01;
|
||||
|
||||
fdc_update_densel_polarity(1);
|
||||
fdc_update_densel_force(0);
|
||||
fdd_swap = 0;
|
||||
}
|
||||
|
||||
void fdc37c665_init()
|
||||
{
|
||||
io_sethandler(0x03f0, 0x0002, fdc37c665_read, NULL, NULL, fdc37c665_write, NULL, NULL, NULL);
|
||||
|
||||
fdc37c665_reset();
|
||||
|
||||
pci_reset_handler.super_io_reset = fdc37c665_reset;
|
||||
}
|
||||
@@ -8,20 +8,21 @@
|
||||
*
|
||||
* Implementation of the SMC FDC37C669 Super I/O Chip.
|
||||
*
|
||||
* Version: @(#)fdc37c669.c 1.0.1 2017/08/24
|
||||
* Version: @(#)sio_fdc37c669.c 1.0.2 2017/09/03
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#include "ibm.h"
|
||||
#include "disc.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
#include "io.h"
|
||||
#include "lpt.h"
|
||||
#include "serial.h"
|
||||
#include "floppy/floppy.h"
|
||||
#include "floppy/fdc.h"
|
||||
#include "floppy/fdd.h"
|
||||
#include "hdd/hdd_ide_at.h"
|
||||
#include "fdc37c669.h"
|
||||
#include "sio.h"
|
||||
|
||||
|
||||
static int fdc37c669_locked;
|
||||
static int fdc37c669_rw_locked = 0;
|
||||
509
src/sio_fdc37c932fr.c
Normal file
509
src/sio_fdc37c932fr.c
Normal file
@@ -0,0 +1,509 @@
|
||||
/*
|
||||
* 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 the SMC FDC37C932FR Super I/O Chip.
|
||||
*
|
||||
* Version: @(#)sio_fdc37c932fr.c 1.0.2 2017/09/03
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#include "ibm.h"
|
||||
#include "io.h"
|
||||
#include "lpt.h"
|
||||
#include "serial.h"
|
||||
#include "floppy/floppy.h"
|
||||
#include "floppy/fdc.h"
|
||||
#include "floppy/fdd.h"
|
||||
#include "hdd/hdd_ide_at.h"
|
||||
#include "sio.h"
|
||||
|
||||
|
||||
static int fdc37c932fr_locked;
|
||||
static int fdc37c932fr_curreg = 0;
|
||||
static int fdc37c932fr_gpio_curreg = 0;
|
||||
static uint8_t fdc37c932fr_regs[48];
|
||||
static uint8_t fdc37c932fr_ld_regs[10][256];
|
||||
static uint8_t fdc37c932fr_gpio_regs[16] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
|
||||
|
||||
static uint8_t tries;
|
||||
|
||||
static uint16_t ld0_valid_ports[2] = {0x3F0, 0x370};
|
||||
static uint16_t ld1_valid_ports[2] = {0x1F0, 0x170};
|
||||
static uint16_t ld1_valid_ports2[2] = {0x3F6, 0x376};
|
||||
static uint16_t ld2_valid_ports[2] = {0x170, 0x1F0};
|
||||
static uint16_t ld2_valid_ports2[2] = {0x376, 0x3F6};
|
||||
static uint16_t ld3_valid_ports[3] = {0x3BC, 0x378, 0x278};
|
||||
static uint16_t ld4_valid_ports[9] = {0x3F8, 0x2F8, 0x338, 0x3E8, 0x2E8, 0x220, 0x238, 0x2E0, 0x228};
|
||||
static uint16_t ld5_valid_ports[9] = {0x3F8, 0x2F8, 0x338, 0x3E8, 0x2E8, 0x220, 0x238, 0x2E0, 0x228};
|
||||
static uint16_t ld5_valid_ports2[9] = {0x3F8, 0x2F8, 0x338, 0x3E8, 0x2E8, 0x220, 0x238, 0x2E0, 0x228};
|
||||
|
||||
static uint8_t is_in_array(uint16_t *port_array, uint8_t max, uint16_t port)
|
||||
{
|
||||
uint8_t i = 0;
|
||||
|
||||
for (i = 0; i < max; i++)
|
||||
{
|
||||
if (port_array[i] == port) return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint16_t make_port(uint8_t ld)
|
||||
{
|
||||
uint16_t r0 = fdc37c932fr_ld_regs[ld][0x60];
|
||||
uint16_t r1 = fdc37c932fr_ld_regs[ld][0x61];
|
||||
|
||||
uint16_t p = (r0 << 8) + r1;
|
||||
|
||||
switch(ld)
|
||||
{
|
||||
case 0:
|
||||
p &= 0xFF8;
|
||||
if ((p < 0x100) || (p > 0xFF8)) p = 0x3F0;
|
||||
if (!(is_in_array(ld0_valid_ports, 2, p))) p = 0x3F0;
|
||||
break;
|
||||
case 1:
|
||||
p &= 0xFF8;
|
||||
if ((p < 0x100) || (p > 0xFF8)) p = 0x1F0;
|
||||
if (!(is_in_array(ld1_valid_ports, 2, p))) p = 0x1F0;
|
||||
break;
|
||||
case 2:
|
||||
p &= 0xFF8;
|
||||
if ((p < 0x100) || (p > 0xFF8)) p = 0x170;
|
||||
if (!(is_in_array(ld2_valid_ports, 2, p))) p = 0x170;
|
||||
break;
|
||||
case 3:
|
||||
p &= 0xFF8;
|
||||
if ((p < 0x100) || (p > 0xFF8)) p = 0x378;
|
||||
if (!(is_in_array(ld3_valid_ports, 3, p))) p = 0x378;
|
||||
break;
|
||||
case 4:
|
||||
p &= 0xFF8;
|
||||
if ((p < 0x100) || (p > 0xFF8)) p = 0x3F8;
|
||||
if (!(is_in_array(ld4_valid_ports, 9, p))) p = 0x3F8;
|
||||
break;
|
||||
case 5:
|
||||
p &= 0xFF8;
|
||||
if ((p < 0x100) || (p > 0xFF8)) p = 0x2F8;
|
||||
if (!(is_in_array(ld5_valid_ports, 9, p))) p = 0x2F8;
|
||||
break;
|
||||
}
|
||||
|
||||
fdc37c932fr_ld_regs[ld][0x60] = (p >> 8);
|
||||
fdc37c932fr_ld_regs[ld][0x61] = (p & 0xFF);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
uint16_t make_port2(uint8_t ld)
|
||||
{
|
||||
uint16_t r0 = fdc37c932fr_ld_regs[ld][0x62];
|
||||
uint16_t r1 = fdc37c932fr_ld_regs[ld][0x63];
|
||||
|
||||
uint16_t p = (r0 << 8) + r1;
|
||||
|
||||
switch(ld)
|
||||
{
|
||||
case 1:
|
||||
p &= 0xFFF;
|
||||
if ((p < 0x100) || (p > 0xFF8)) p = 0x3F6;
|
||||
if (!(is_in_array(ld1_valid_ports2, 2, p))) p = 0x3F6;
|
||||
break;
|
||||
case 2:
|
||||
p &= 0xFFF;
|
||||
if ((p < 0x100) || (p > 0xFF8)) p = 0x376;
|
||||
if (!(is_in_array(ld2_valid_ports2, 2, p))) p = 0x376;
|
||||
break;
|
||||
case 5:
|
||||
p &= 0xFF8;
|
||||
if ((p < 0x100) || (p > 0xFF8)) p = 0x3E8;
|
||||
if (!(is_in_array(ld5_valid_ports2, 9, p))) p = 0x3E8;
|
||||
break;
|
||||
}
|
||||
|
||||
fdc37c932fr_ld_regs[ld][0x62] = (p >> 8);
|
||||
fdc37c932fr_ld_regs[ld][0x63] = (p & 0xFF);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void fdc37c932fr_gpio_write(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
if (port & 1)
|
||||
{
|
||||
if (fdc37c932fr_gpio_curreg && (fdc37c932fr_gpio_curreg <= 0xF))
|
||||
fdc37c932fr_gpio_regs[fdc37c932fr_gpio_curreg] = val;
|
||||
}
|
||||
else
|
||||
{
|
||||
fdc37c932fr_gpio_curreg = val;
|
||||
}
|
||||
}
|
||||
|
||||
void fdc37c932fr_write(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
uint8_t index = (port & 1) ? 0 : 1;
|
||||
uint8_t valxor = 0;
|
||||
uint16_t ld_port = 0;
|
||||
|
||||
if (index)
|
||||
{
|
||||
if ((val == 0x55) && !fdc37c932fr_locked)
|
||||
{
|
||||
if (tries)
|
||||
{
|
||||
fdc37c932fr_locked = 1;
|
||||
fdc_3f1_enable(0);
|
||||
tries = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
tries++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fdc37c932fr_locked)
|
||||
{
|
||||
if (val == 0xaa)
|
||||
{
|
||||
fdc37c932fr_locked = 0;
|
||||
fdc_3f1_enable(1);
|
||||
return;
|
||||
}
|
||||
fdc37c932fr_curreg = val;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tries)
|
||||
tries = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fdc37c932fr_locked)
|
||||
{
|
||||
if (fdc37c932fr_curreg < 48)
|
||||
{
|
||||
valxor = val ^ fdc37c932fr_regs[fdc37c932fr_curreg];
|
||||
fdc37c932fr_regs[fdc37c932fr_curreg] = val;
|
||||
}
|
||||
else
|
||||
{
|
||||
valxor = val ^ fdc37c932fr_ld_regs[fdc37c932fr_regs[7]][fdc37c932fr_curreg];
|
||||
if (((fdc37c932fr_curreg & 0xF0) == 0x70) && (fdc37c932fr_regs[7] < 4)) return;
|
||||
/* Block writes to IDE configuration. */
|
||||
if (fdc37c932fr_regs[7] == 1) return;
|
||||
if (fdc37c932fr_regs[7] == 2) return;
|
||||
if (fdc37c932fr_regs[7] > 5) return;
|
||||
fdc37c932fr_ld_regs[fdc37c932fr_regs[7]][fdc37c932fr_curreg] = val;
|
||||
goto process_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
process_value:
|
||||
switch(fdc37c932fr_regs[7])
|
||||
{
|
||||
case 0:
|
||||
/* FDD */
|
||||
switch(fdc37c932fr_curreg)
|
||||
{
|
||||
case 0x30:
|
||||
/* Activate */
|
||||
if (valxor)
|
||||
{
|
||||
if (!val)
|
||||
fdc_remove();
|
||||
else
|
||||
{
|
||||
fdc_add();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x60:
|
||||
case 0x61:
|
||||
if (valxor && fdc37c932fr_ld_regs[0][0x30])
|
||||
{
|
||||
fdc_remove();
|
||||
ld_port = make_port(0);
|
||||
fdc37c932fr_ld_regs[0][0x60] = make_port(0) >> 8;
|
||||
fdc37c932fr_ld_regs[0][0x61] = make_port(0) & 0xFF;
|
||||
fdc_add();
|
||||
}
|
||||
break;
|
||||
case 0xF0:
|
||||
if (valxor & 0x01) fdc_update_enh_mode(val & 0x01);
|
||||
if (valxor & 0x10) fdd_swap = ((val & 0x10) >> 4);
|
||||
break;
|
||||
case 0xF1:
|
||||
if (valxor & 0xC) fdc_update_densel_force((val & 0xC) >> 2);
|
||||
break;
|
||||
case 0xF2:
|
||||
if (valxor & 0xC0) fdc_update_rwc(3, (valxor & 0xC0) >> 6);
|
||||
if (valxor & 0x30) fdc_update_rwc(2, (valxor & 0x30) >> 4);
|
||||
if (valxor & 0x0C) fdc_update_rwc(1, (valxor & 0x0C) >> 2);
|
||||
if (valxor & 0x03) fdc_update_rwc(0, (valxor & 0x03));
|
||||
break;
|
||||
case 0xF4:
|
||||
if (valxor & 0x18) fdc_update_drvrate(0, (val & 0x18) >> 3);
|
||||
break;
|
||||
case 0xF5:
|
||||
if (valxor & 0x18) fdc_update_drvrate(1, (val & 0x18) >> 3);
|
||||
break;
|
||||
case 0xF6:
|
||||
if (valxor & 0x18) fdc_update_drvrate(2, (val & 0x18) >> 3);
|
||||
break;
|
||||
case 0xF7:
|
||||
if (valxor & 0x18) fdc_update_drvrate(3, (val & 0x18) >> 3);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
/* Parallel port */
|
||||
switch(fdc37c932fr_curreg)
|
||||
{
|
||||
case 0x30:
|
||||
/* Activate */
|
||||
if (valxor)
|
||||
{
|
||||
if (!val)
|
||||
lpt1_remove();
|
||||
else
|
||||
{
|
||||
ld_port = make_port(3);
|
||||
lpt1_init(ld_port);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x60:
|
||||
case 0x61:
|
||||
if (valxor && fdc37c932fr_ld_regs[3][0x30])
|
||||
{
|
||||
lpt1_remove();
|
||||
ld_port = make_port(3);
|
||||
lpt1_init(ld_port);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
/* Serial port 1 */
|
||||
switch(fdc37c932fr_curreg)
|
||||
{
|
||||
case 0x30:
|
||||
/* Activate */
|
||||
if (valxor)
|
||||
{
|
||||
if (!val)
|
||||
serial_remove(1);
|
||||
else
|
||||
{
|
||||
ld_port = make_port(4);
|
||||
serial_setup(1, ld_port, fdc37c932fr_ld_regs[4][0x70]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x60:
|
||||
case 0x61:
|
||||
case 0x70:
|
||||
if (valxor && fdc37c932fr_ld_regs[4][0x30])
|
||||
{
|
||||
ld_port = make_port(4);
|
||||
serial_setup(1, ld_port, fdc37c932fr_ld_regs[4][0x70]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
/* Serial port 2 */
|
||||
switch(fdc37c932fr_curreg)
|
||||
{
|
||||
case 0x30:
|
||||
/* Activate */
|
||||
if (valxor)
|
||||
{
|
||||
if (!val)
|
||||
serial_remove(2);
|
||||
else
|
||||
{
|
||||
ld_port = make_port(5);
|
||||
serial_setup(2, ld_port, fdc37c932fr_ld_regs[5][0x70]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x60:
|
||||
case 0x61:
|
||||
case 0x70:
|
||||
if (valxor && fdc37c932fr_ld_regs[5][0x30])
|
||||
{
|
||||
ld_port = make_port(5);
|
||||
serial_setup(2, ld_port, fdc37c932fr_ld_regs[5][0x70]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t fdc37c932fr_gpio_read(uint16_t port, void *priv)
|
||||
{
|
||||
if (port & 1)
|
||||
{
|
||||
if (fdc37c932fr_gpio_curreg && (fdc37c932fr_gpio_curreg <= 0xF))
|
||||
return fdc37c932fr_gpio_regs[fdc37c932fr_gpio_curreg];
|
||||
else
|
||||
return 0xff;
|
||||
}
|
||||
else
|
||||
{
|
||||
return fdc37c932fr_gpio_curreg;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t fdc37c932fr_read(uint16_t port, void *priv)
|
||||
{
|
||||
uint8_t index = (port & 1) ? 0 : 1;
|
||||
|
||||
if (!fdc37c932fr_locked)
|
||||
{
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
if (index)
|
||||
return fdc37c932fr_curreg;
|
||||
else
|
||||
{
|
||||
if (fdc37c932fr_curreg < 0x30)
|
||||
{
|
||||
return fdc37c932fr_regs[fdc37c932fr_curreg];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((fdc37c932fr_regs[7] == 0) && (fdc37c932fr_curreg == 0xF2)) return (fdc_get_rwc(0) | (fdc_get_rwc(1) << 2));
|
||||
return fdc37c932fr_ld_regs[fdc37c932fr_regs[7]][fdc37c932fr_curreg];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void fdc37c932fr_reset(void)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
fdc37c932fr_regs[3] = 3;
|
||||
fdc37c932fr_regs[0x20] = 3;
|
||||
fdc37c932fr_regs[0x21] = 1;
|
||||
fdc37c932fr_regs[0x24] = 4;
|
||||
fdc37c932fr_regs[0x26] = 0xF0;
|
||||
fdc37c932fr_regs[0x27] = 3;
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
memset(fdc37c932fr_ld_regs[i], 0, 256);
|
||||
}
|
||||
|
||||
/* Logical device 0: FDD */
|
||||
fdc37c932fr_ld_regs[0][0x30] = 1;
|
||||
fdc37c932fr_ld_regs[0][0x60] = 3;
|
||||
fdc37c932fr_ld_regs[0][0x61] = 0xF0;
|
||||
fdc37c932fr_ld_regs[0][0x70] = 6;
|
||||
fdc37c932fr_ld_regs[0][0x74] = 2;
|
||||
fdc37c932fr_ld_regs[0][0xF0] = 0xE;
|
||||
fdc37c932fr_ld_regs[0][0xF2] = 0xFF;
|
||||
|
||||
/* Logical device 1: IDE1 */
|
||||
fdc37c932fr_ld_regs[1][0x30] = 1;
|
||||
fdc37c932fr_ld_regs[1][0x60] = 1;
|
||||
fdc37c932fr_ld_regs[1][0x61] = 0xF0;
|
||||
fdc37c932fr_ld_regs[1][0x62] = 3;
|
||||
fdc37c932fr_ld_regs[1][0x63] = 0xF6;
|
||||
fdc37c932fr_ld_regs[1][0x70] = 0xE;
|
||||
fdc37c932fr_ld_regs[1][0xF0] = 0xC;
|
||||
|
||||
/* Logical device 2: IDE2 */
|
||||
fdc37c932fr_ld_regs[2][0x30] = 1;
|
||||
fdc37c932fr_ld_regs[2][0x60] = 1;
|
||||
fdc37c932fr_ld_regs[2][0x61] = 0x70;
|
||||
fdc37c932fr_ld_regs[2][0x62] = 3;
|
||||
fdc37c932fr_ld_regs[2][0x63] = 0x76;
|
||||
fdc37c932fr_ld_regs[2][0x70] = 0xF;
|
||||
|
||||
/* Logical device 3: Parallel Port */
|
||||
fdc37c932fr_ld_regs[3][0x30] = 1;
|
||||
fdc37c932fr_ld_regs[3][0x60] = 3;
|
||||
fdc37c932fr_ld_regs[3][0x61] = 0x78;
|
||||
fdc37c932fr_ld_regs[3][0x70] = 7;
|
||||
fdc37c932fr_ld_regs[3][0x74] = 4;
|
||||
fdc37c932fr_ld_regs[3][0xF0] = 0x3C;
|
||||
|
||||
/* Logical device 4: Serial Port 1 */
|
||||
fdc37c932fr_ld_regs[4][0x30] = 1;
|
||||
fdc37c932fr_ld_regs[4][0x60] = 3;
|
||||
fdc37c932fr_ld_regs[4][0x61] = 0xf8;
|
||||
fdc37c932fr_ld_regs[4][0x70] = 4;
|
||||
fdc37c932fr_ld_regs[4][0xF0] = 3;
|
||||
serial_setup(1, 0x3f8, fdc37c932fr_ld_regs[4][0x70]);
|
||||
|
||||
/* Logical device 5: Serial Port 2 */
|
||||
fdc37c932fr_ld_regs[5][0x30] = 1;
|
||||
fdc37c932fr_ld_regs[5][0x60] = 2;
|
||||
fdc37c932fr_ld_regs[5][0x61] = 0xf8;
|
||||
fdc37c932fr_ld_regs[5][0x70] = 3;
|
||||
fdc37c932fr_ld_regs[5][0x74] = 4;
|
||||
fdc37c932fr_ld_regs[5][0xF1] = 2;
|
||||
fdc37c932fr_ld_regs[5][0xF2] = 3;
|
||||
serial_setup(2, 0x2f8, fdc37c932fr_ld_regs[5][0x70]);
|
||||
|
||||
/* Logical device 6: RTC */
|
||||
fdc37c932fr_ld_regs[6][0x63] = 0x70;
|
||||
fdc37c932fr_ld_regs[6][0xF4] = 3;
|
||||
|
||||
/* Logical device 7: Keyboard */
|
||||
fdc37c932fr_ld_regs[7][0x30] = 1;
|
||||
fdc37c932fr_ld_regs[7][0x61] = 0x60;
|
||||
fdc37c932fr_ld_regs[7][0x70] = 1;
|
||||
|
||||
/* Logical device 8: AUX I/O */
|
||||
|
||||
/* Logical device 9: ACCESS.bus */
|
||||
|
||||
fdc_update_densel_force(0);
|
||||
fdd_swap = 0;
|
||||
fdc_update_rwc(0, 0);
|
||||
fdc_update_rwc(1, 0);
|
||||
fdc_update_rwc(2, 0);
|
||||
fdc_update_rwc(3, 0);
|
||||
fdc_update_drvrate(0, 0);
|
||||
fdc_update_drvrate(1, 0);
|
||||
fdc_update_drvrate(2, 0);
|
||||
fdc_update_drvrate(3, 0);
|
||||
fdc_update_max_track(79);
|
||||
|
||||
memset(fdc37c932fr_gpio_regs, 0, sizeof(fdc37c932fr_gpio_regs));
|
||||
fdc37c932fr_gpio_regs[2] = 0xfd;
|
||||
|
||||
fdc37c932fr_locked = 0;
|
||||
}
|
||||
|
||||
void fdc37c932fr_init()
|
||||
{
|
||||
lpt2_remove();
|
||||
|
||||
fdc37c932fr_reset();
|
||||
|
||||
io_sethandler(0xe0, 0x0006, fdc37c932fr_gpio_read, NULL, NULL, fdc37c932fr_gpio_write, NULL, NULL, NULL);
|
||||
io_sethandler(0xe2, 0x0006, fdc37c932fr_gpio_read, NULL, NULL, fdc37c932fr_gpio_write, NULL, NULL, NULL);
|
||||
io_sethandler(0xe4, 0x0006, fdc37c932fr_gpio_read, NULL, NULL, fdc37c932fr_gpio_write, NULL, NULL, NULL);
|
||||
io_sethandler(0xea, 0x0002, fdc37c932fr_gpio_read, NULL, NULL, fdc37c932fr_gpio_write, NULL, NULL, NULL);
|
||||
io_sethandler(0x3f0, 0x0002, fdc37c932fr_read, NULL, NULL, fdc37c932fr_write, NULL, NULL, NULL);
|
||||
|
||||
pci_reset_handler.super_io_reset = fdc37c932fr_reset;
|
||||
}
|
||||
479
src/sio_pc87306.c
Normal file
479
src/sio_pc87306.c
Normal file
@@ -0,0 +1,479 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Emulation of the National Semiconductors PC87306 Super I/O
|
||||
* chip.
|
||||
*
|
||||
* Version: @(#)sio_pc87306.c 1.0.2 2017/09/03
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#include "ibm.h"
|
||||
#include "io.h"
|
||||
#include "lpt.h"
|
||||
#include "serial.h"
|
||||
#include "floppy/floppy.h"
|
||||
#include "floppy/fdc.h"
|
||||
#include "floppy/fdd.h"
|
||||
#include "hdd/hdd_ide_at.h"
|
||||
#include "sio.h"
|
||||
|
||||
|
||||
static int pc87306_curreg;
|
||||
static uint8_t pc87306_regs[29];
|
||||
static uint8_t pc87306_gpio[2] = {0xFF, 0xFB};
|
||||
static uint8_t tries;
|
||||
static uint16_t lpt_port;
|
||||
|
||||
void pc87306_gpio_remove();
|
||||
void pc87306_gpio_init();
|
||||
|
||||
void pc87306_gpio_write(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
pc87306_gpio[port & 1] = val;
|
||||
}
|
||||
|
||||
uint8_t uart_int1()
|
||||
{
|
||||
/* 0: IRQ3, 1: IRQ4 */
|
||||
return ((pc87306_regs[0x1C] >> 2) & 1) ? 4 : 3;
|
||||
}
|
||||
|
||||
uint8_t uart_int2()
|
||||
{
|
||||
/* 0: IRQ3, 1: IRQ4 */
|
||||
return ((pc87306_regs[0x1C] >> 6) & 1) ? 4 : 3;
|
||||
}
|
||||
|
||||
uint8_t uart1_int()
|
||||
{
|
||||
uint8_t temp;
|
||||
temp = ((pc87306_regs[1] >> 2) & 1) ? 3 : 4; /* 0 = COM1 (IRQ 4), 1 = COM2 (IRQ 3), 2 = COM3 (IRQ 4), 3 = COM4 (IRQ 3) */
|
||||
return (pc87306_regs[0x1C] & 1) ? uart_int1() : temp;
|
||||
}
|
||||
|
||||
uint8_t uart2_int()
|
||||
{
|
||||
uint8_t temp;
|
||||
temp = ((pc87306_regs[1] >> 4) & 1) ? 3 : 4; /* 0 = COM1 (IRQ 4), 1 = COM2 (IRQ 3), 2 = COM3 (IRQ 4), 3 = COM4 (IRQ 3) */
|
||||
return (pc87306_regs[0x1C] & 1) ? uart_int2() : temp;
|
||||
}
|
||||
|
||||
void lpt1_handler()
|
||||
{
|
||||
int temp;
|
||||
temp = pc87306_regs[0x01] & 3;
|
||||
switch (temp)
|
||||
{
|
||||
case 0:
|
||||
lpt_port = 0x378;
|
||||
break;
|
||||
case 1:
|
||||
if (pc87306_regs[0x1B] & 0x40)
|
||||
{
|
||||
lpt_port = ((uint16_t) pc87306_regs[0x19]) << 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
lpt_port = 0x3bc;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
lpt_port = 0x278;
|
||||
break;
|
||||
}
|
||||
lpt1_init(lpt_port);
|
||||
}
|
||||
|
||||
void serial1_handler()
|
||||
{
|
||||
int temp;
|
||||
temp = (pc87306_regs[1] >> 2) & 3;
|
||||
switch (temp)
|
||||
{
|
||||
case 0: serial_setup(1, SERIAL1_ADDR, uart1_int()); break;
|
||||
case 1: serial_setup(1, SERIAL2_ADDR, uart1_int()); break;
|
||||
case 2:
|
||||
switch ((pc87306_regs[1] >> 6) & 3)
|
||||
{
|
||||
case 0: serial_setup(1, 0x3e8, uart1_int()); break;
|
||||
case 1: serial_setup(1, 0x338, uart1_int()); break;
|
||||
case 2: serial_setup(1, 0x2e8, uart1_int()); break;
|
||||
case 3: serial_setup(1, 0x220, uart1_int()); break;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch ((pc87306_regs[1] >> 6) & 3)
|
||||
{
|
||||
case 0: serial_setup(1, 0x2e8, uart1_int()); break;
|
||||
case 1: serial_setup(1, 0x238, uart1_int()); break;
|
||||
case 2: serial_setup(1, 0x2e0, uart1_int()); break;
|
||||
case 3: serial_setup(1, 0x228, uart1_int()); break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void serial2_handler()
|
||||
{
|
||||
int temp;
|
||||
temp = (pc87306_regs[1] >> 4) & 3;
|
||||
switch (temp)
|
||||
{
|
||||
case 0: serial_setup(2, SERIAL1_ADDR, uart2_int()); break;
|
||||
case 1: serial_setup(2, SERIAL2_ADDR, uart2_int()); break;
|
||||
case 2:
|
||||
switch ((pc87306_regs[1] >> 6) & 3)
|
||||
{
|
||||
case 0: serial_setup(2, 0x3e8, uart2_int()); break;
|
||||
case 1: serial_setup(2, 0x338, uart2_int()); break;
|
||||
case 2: serial_setup(2, 0x2e8, uart2_int()); break;
|
||||
case 3: serial_setup(2, 0x220, uart2_int()); break;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch ((pc87306_regs[1] >> 6) & 3)
|
||||
{
|
||||
case 0: serial_setup(2, 0x2e8, uart2_int()); break;
|
||||
case 1: serial_setup(2, 0x238, uart2_int()); break;
|
||||
case 2: serial_setup(2, 0x2e0, uart2_int()); break;
|
||||
case 3: serial_setup(2, 0x228, uart2_int()); break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void pc87306_write(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
uint8_t index;
|
||||
uint8_t valxor;
|
||||
#if 0
|
||||
uint16_t or_value;
|
||||
#endif
|
||||
|
||||
index = (port & 1) ? 0 : 1;
|
||||
|
||||
if (index)
|
||||
{
|
||||
pc87306_curreg = val & 0x1f;
|
||||
tries = 0;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tries)
|
||||
{
|
||||
if ((pc87306_curreg == 0) && (val == 8))
|
||||
{
|
||||
val = 0x4b;
|
||||
}
|
||||
if (pc87306_curreg <= 28) valxor = val ^ pc87306_regs[pc87306_curreg];
|
||||
tries = 0;
|
||||
if ((pc87306_curreg == 0x19) && !(pc87306_regs[0x1B] & 0x40))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ((pc87306_curreg <= 28) && (pc87306_curreg != 8)/* && (pc87306_curreg != 0x18)*/)
|
||||
{
|
||||
if (pc87306_curreg == 0)
|
||||
{
|
||||
val &= 0x5f;
|
||||
}
|
||||
if (((pc87306_curreg == 0x0F) || (pc87306_curreg == 0x12)) && valxor)
|
||||
{
|
||||
pc87306_gpio_remove();
|
||||
}
|
||||
pc87306_regs[pc87306_curreg] = val;
|
||||
goto process_value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tries++;
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
process_value:
|
||||
switch(pc87306_curreg)
|
||||
{
|
||||
case 0:
|
||||
if (valxor & 1)
|
||||
{
|
||||
lpt1_remove();
|
||||
if (val & 1)
|
||||
{
|
||||
lpt1_handler();
|
||||
}
|
||||
}
|
||||
|
||||
if (valxor & 2)
|
||||
{
|
||||
serial_remove(1);
|
||||
if (val & 2)
|
||||
{
|
||||
serial1_handler();
|
||||
}
|
||||
}
|
||||
if (valxor & 4)
|
||||
{
|
||||
serial_remove(2);
|
||||
if (val & 4)
|
||||
{
|
||||
serial2_handler();
|
||||
}
|
||||
}
|
||||
if (valxor & 0x28)
|
||||
{
|
||||
fdc_remove();
|
||||
if (val & 8)
|
||||
{
|
||||
fdc_set_base((val & 0x20) ? 0x370 : 0x3f0, 0);
|
||||
}
|
||||
}
|
||||
if (valxor & 0xc0)
|
||||
{
|
||||
#if 0
|
||||
ide_pri_disable();
|
||||
if (val & 0x80)
|
||||
{
|
||||
or_value = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
or_value = 0x80;
|
||||
}
|
||||
ide_set_base(0, 0x170 | or_value);
|
||||
ide_set_side(0, 0x376 | or_value);
|
||||
if (val & 0x40)
|
||||
{
|
||||
ide_pri_enable_ex();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
break;
|
||||
case 1:
|
||||
if (valxor & 3)
|
||||
{
|
||||
lpt1_remove();
|
||||
if (pc87306_regs[0] & 1)
|
||||
{
|
||||
lpt1_handler();
|
||||
}
|
||||
}
|
||||
|
||||
if (valxor & 0xcc)
|
||||
{
|
||||
if (pc87306_regs[0] & 2)
|
||||
{
|
||||
serial1_handler();
|
||||
}
|
||||
else
|
||||
{
|
||||
serial_remove(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (valxor & 0xf0)
|
||||
{
|
||||
if (pc87306_regs[0] & 4)
|
||||
{
|
||||
serial2_handler();
|
||||
}
|
||||
else
|
||||
{
|
||||
serial_remove(2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (valxor & 1)
|
||||
{
|
||||
if (val & 1)
|
||||
{
|
||||
lpt1_remove();
|
||||
serial_remove(1);
|
||||
serial_remove(2);
|
||||
fdc_remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pc87306_regs[0] & 1)
|
||||
{
|
||||
lpt1_handler();
|
||||
}
|
||||
if (pc87306_regs[0] & 2)
|
||||
{
|
||||
serial1_handler();
|
||||
}
|
||||
if (pc87306_regs[0] & 4)
|
||||
{
|
||||
serial2_handler();
|
||||
}
|
||||
if (pc87306_regs[0] & 8)
|
||||
{
|
||||
fdc_set_base((pc87306_regs[0] & 0x20) ? 0x370 : 0x3f0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
if (valxor & 0x44)
|
||||
{
|
||||
fdc_update_enh_mode((val & 4) ? 1 : 0);
|
||||
fdc_update_densel_polarity((val & 0x40) ? 1 : 0);
|
||||
}
|
||||
break;
|
||||
case 0xF:
|
||||
if (valxor)
|
||||
{
|
||||
pc87306_gpio_init();
|
||||
}
|
||||
break;
|
||||
case 0x12:
|
||||
if (valxor & 0x30)
|
||||
{
|
||||
pc87306_gpio_init();
|
||||
}
|
||||
break;
|
||||
case 0x19:
|
||||
if (valxor)
|
||||
{
|
||||
lpt1_remove();
|
||||
if (pc87306_regs[0] & 1)
|
||||
{
|
||||
lpt1_handler();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x1B:
|
||||
if (valxor & 0x40)
|
||||
{
|
||||
lpt1_remove();
|
||||
if (!(val & 0x40))
|
||||
{
|
||||
pc87306_regs[0x19] = 0xEF;
|
||||
}
|
||||
if (pc87306_regs[0] & 1)
|
||||
{
|
||||
lpt1_handler();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x1C:
|
||||
if (valxor)
|
||||
{
|
||||
if (pc87306_regs[0] & 2)
|
||||
{
|
||||
serial1_handler();
|
||||
}
|
||||
if (pc87306_regs[0] & 4)
|
||||
{
|
||||
serial2_handler();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t pc87306_gpio_read(uint16_t port, void *priv)
|
||||
{
|
||||
return pc87306_gpio[port & 1];
|
||||
}
|
||||
|
||||
uint8_t pc87306_read(uint16_t port, void *priv)
|
||||
{
|
||||
uint8_t index;
|
||||
index = (port & 1) ? 0 : 1;
|
||||
|
||||
tries = 0;
|
||||
|
||||
if (index)
|
||||
{
|
||||
return pc87306_curreg & 0x1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pc87306_curreg >= 28)
|
||||
{
|
||||
return 0xff;
|
||||
}
|
||||
else if (pc87306_curreg == 8)
|
||||
{
|
||||
return 0x70;
|
||||
}
|
||||
else
|
||||
{
|
||||
return pc87306_regs[pc87306_curreg];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void pc87306_gpio_remove()
|
||||
{
|
||||
io_removehandler(pc87306_regs[0xF] << 2, 0x0002, pc87306_gpio_read, NULL, NULL, pc87306_gpio_write, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void pc87306_gpio_init()
|
||||
{
|
||||
if ((pc87306_regs[0x12]) & 0x10)
|
||||
{
|
||||
io_sethandler(pc87306_regs[0xF] << 2, 0x0001, pc87306_gpio_read, NULL, NULL, pc87306_gpio_write, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
if ((pc87306_regs[0x12]) & 0x20)
|
||||
{
|
||||
io_sethandler((pc87306_regs[0xF] << 2) + 1, 0x0001, pc87306_gpio_read, NULL, NULL, pc87306_gpio_write, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void pc87306_reset(void)
|
||||
{
|
||||
memset(pc87306_regs, 0, 29);
|
||||
|
||||
pc87306_regs[0] = 0x4B;
|
||||
pc87306_regs[1] = 0x01;
|
||||
pc87306_regs[3] = 0x01;
|
||||
pc87306_regs[5] = 0x0D;
|
||||
pc87306_regs[8] = 0x70;
|
||||
pc87306_regs[9] = 0xC0;
|
||||
pc87306_regs[0xB] = 0x80;
|
||||
pc87306_regs[0xF] = 0x1E;
|
||||
pc87306_regs[0x12] = 0x30;
|
||||
pc87306_regs[0x19] = 0xEF;
|
||||
/*
|
||||
0 = 360 rpm @ 500 kbps for 3.5"
|
||||
1 = Default, 300 rpm @ 500,300,250,1000 kbps for 3.5"
|
||||
*/
|
||||
fdc_update_is_nsc(1);
|
||||
fdc_update_enh_mode(0);
|
||||
fdc_update_densel_polarity(1);
|
||||
fdc_update_max_track(85);
|
||||
fdc_remove();
|
||||
fdc_set_base(0x3f0, 0);
|
||||
fdd_swap = 0;
|
||||
serial_remove(1);
|
||||
serial_remove(2);
|
||||
serial1_handler();
|
||||
serial2_handler();
|
||||
pc87306_gpio_init();
|
||||
}
|
||||
|
||||
void pc87306_init()
|
||||
{
|
||||
lpt2_remove();
|
||||
|
||||
pc87306_reset();
|
||||
|
||||
io_sethandler(0x02e, 0x0002, pc87306_read, NULL, NULL, pc87306_write, NULL, NULL, NULL);
|
||||
|
||||
pci_reset_handler.super_io_reset = pc87306_reset;
|
||||
}
|
||||
@@ -22,14 +22,13 @@ PnP registers :
|
||||
74 - DMA*/
|
||||
|
||||
#include "ibm.h"
|
||||
|
||||
#include "disc.h"
|
||||
#include "fdd.h"
|
||||
#include "fdc.h"
|
||||
#include "io.h"
|
||||
#include "lpt.h"
|
||||
#include "serial.h"
|
||||
#include "um8669f.h"
|
||||
#include "floppy/floppy.h"
|
||||
#include "floppy/fdd.h"
|
||||
#include "floppy/fdc.h"
|
||||
#include "sio.h"
|
||||
|
||||
|
||||
typedef struct um8669f_t
|
||||
@@ -11,19 +11,19 @@
|
||||
* Winbond W83877F Super I/O Chip
|
||||
* Used by the Award 430HX
|
||||
*
|
||||
* Version: @(#)w83877f.c 1.0.1 2017/08/23
|
||||
* Version: @(#)sio_w83877f.c 1.0.2 2017/09/03
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#include "ibm.h"
|
||||
#include "disc.h"
|
||||
#include "fdc.h"
|
||||
#include "fdd.h"
|
||||
#include "io.h"
|
||||
#include "lpt.h"
|
||||
#include "serial.h"
|
||||
#include "w83877f.h"
|
||||
#include "floppy/floppy.h"
|
||||
#include "floppy/fdc.h"
|
||||
#include "floppy/fdd.h"
|
||||
#include "sio.h"
|
||||
|
||||
|
||||
static int w83877f_locked;
|
||||
@@ -8,12 +8,12 @@
|
||||
*
|
||||
* Sound emulation core.
|
||||
*
|
||||
* Version: @(#)sound.c 1.0.2 2017/06/14
|
||||
* Version: @(#)sound.c 1.0.3 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "../ibm.h"
|
||||
#include "../device.h"
|
||||
#include "../timer.h"
|
||||
#include "../cdrom.h"
|
||||
#include "../cdrom/cdrom.h"
|
||||
#include "../win/plat_thread.h"
|
||||
#include "midi.h"
|
||||
#include "sound.h"
|
||||
@@ -29,9 +29,9 @@
|
||||
#include "snd_adlib.h"
|
||||
#include "snd_adlibgold.h"
|
||||
#ifdef DEV_BRANCH
|
||||
#ifdef USE_PAS16
|
||||
#include "snd_pas16.h"
|
||||
#endif
|
||||
# ifdef USE_PAS16
|
||||
# include "snd_pas16.h"
|
||||
# endif
|
||||
#endif
|
||||
#include "snd_sb.h"
|
||||
#include "snd_sb_dsp.h"
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
extern void superio_detect_init(void);
|
||||
@@ -1 +0,0 @@
|
||||
extern void um8669f_init(void);
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Emulation of the Winbond W83877F Super I/O Chip.
|
||||
*
|
||||
* Version: @(#)w83877f.h 1.0.1 2017/08/23
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
*/
|
||||
|
||||
extern void w83877f_init(void);
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* The Emulator's Windows core.
|
||||
*
|
||||
* Version: @(#)win.c 1.0.7 2017/08/26
|
||||
* Version: @(#)win.c 1.0.8 2017/09/03
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -21,30 +21,30 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "../86box.h"
|
||||
#include "../device.h"
|
||||
#include "../disc.h"
|
||||
#include "../fdd.h"
|
||||
#include "../hdd/hdd.h"
|
||||
#include "../config.h"
|
||||
#include "../ibm.h"
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../mem.h"
|
||||
#ifdef USE_NETWORK
|
||||
#include "../network/network.h"
|
||||
#endif
|
||||
#include "../rom.h"
|
||||
#include "../device.h"
|
||||
#include "../nvr.h"
|
||||
#include "../config.h"
|
||||
#include "../mouse.h"
|
||||
#include "../machine/machine.h"
|
||||
#include "../cdrom/cdrom.h"
|
||||
#include "../cdrom/cdrom_ioctl.h"
|
||||
#include "../cdrom/cdrom_image.h"
|
||||
#include "../cdrom/cdrom_null.h"
|
||||
#include "../floppy/floppy.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../hdd/hdd.h"
|
||||
#include "../hdd/hdd_ide_at.h"
|
||||
#include "../cdrom.h"
|
||||
#include "../cdrom_null.h"
|
||||
#include "../cdrom_ioctl.h"
|
||||
#include "../cdrom_image.h"
|
||||
#include "../scsi/scsi.h"
|
||||
#include "../scsi/scsi_disk.h"
|
||||
#ifdef USE_NETWORK
|
||||
# include "../network/network.h"
|
||||
#endif
|
||||
#include "../video/video.h"
|
||||
#include "../video/vid_ega.h"
|
||||
#include "../mouse.h"
|
||||
#include "../sound/sound.h"
|
||||
#include "../sound/snd_dbopl.h"
|
||||
#include "plat_keyboard.h"
|
||||
@@ -54,7 +54,6 @@
|
||||
#include "plat_thread.h"
|
||||
#include "plat_ticks.h"
|
||||
#include "plat_ui.h"
|
||||
|
||||
#include "win.h"
|
||||
#include "win_cgapal.h"
|
||||
#include "win_ddraw.h"
|
||||
@@ -784,13 +783,13 @@ void create_floppy_tip(int part)
|
||||
int drive = sb_part_meanings[part] & 0xf;
|
||||
|
||||
mbstowcs(wtext, fdd_getname(fdd_get_type(drive)), strlen(fdd_getname(fdd_get_type(drive))) + 1);
|
||||
if (wcslen(discfns[drive]) == 0)
|
||||
if (wcslen(floppyfns[drive]) == 0)
|
||||
{
|
||||
_swprintf(tempTip, win_language_get_string_from_id(IDS_2158), drive + 1, wtext, win_language_get_string_from_id(IDS_2057));
|
||||
}
|
||||
else
|
||||
{
|
||||
_swprintf(tempTip, win_language_get_string_from_id(IDS_2158), drive + 1, wtext, discfns[drive]);
|
||||
_swprintf(tempTip, win_language_get_string_from_id(IDS_2158), drive + 1, wtext, floppyfns[drive]);
|
||||
}
|
||||
|
||||
if (sbTips[part] != NULL)
|
||||
@@ -1312,7 +1311,7 @@ void update_status_bar_panes(HWND hwnds)
|
||||
{
|
||||
case SB_FLOPPY:
|
||||
/* Floppy */
|
||||
sb_icon_flags[i] = (wcslen(discfns[sb_part_meanings[i] & 0xf]) == 0) ? 256 : 0;
|
||||
sb_icon_flags[i] = (wcslen(floppyfns[sb_part_meanings[i] & 0xf]) == 0) ? 256 : 0;
|
||||
sb_part_icons[i] = fdd_type_to_icon(fdd_get_type(sb_part_meanings[i] & 0xf)) | sb_icon_flags[i];
|
||||
sb_menu_handles[i] = create_popup_menu(i);
|
||||
create_floppy_submenu(sb_menu_handles[i], sb_part_meanings[i] & 0xf);
|
||||
@@ -2244,7 +2243,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||
config_save(config_file_default);
|
||||
for (i = 0; i < FDD_NUM; i++)
|
||||
{
|
||||
disc_close(i);
|
||||
floppy_close(i);
|
||||
}
|
||||
for (i = 0; i < CDROM_NUM; i++)
|
||||
{
|
||||
@@ -2285,10 +2284,10 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||
}
|
||||
}
|
||||
|
||||
disc_load(0, discfns[0]);
|
||||
disc_load(1, discfns[1]);
|
||||
disc_load(2, discfns[2]);
|
||||
disc_load(3, discfns[3]);
|
||||
floppy_load(0, floppyfns[0]);
|
||||
floppy_load(1, floppyfns[1]);
|
||||
floppy_load(2, floppyfns[2]);
|
||||
floppy_load(3, floppyfns[3]);
|
||||
|
||||
/* pclog_w(L"NVR path: %s\n", nvr_path); */
|
||||
mem_resize();
|
||||
@@ -2540,14 +2539,14 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
|
||||
break;
|
||||
}
|
||||
|
||||
ret = file_dlg_w_st(hwnd, IDS_2159, discfns[id], 0);
|
||||
ret = file_dlg_w_st(hwnd, IDS_2159, floppyfns[id], 0);
|
||||
if (!ret)
|
||||
{
|
||||
disc_close(id);
|
||||
floppy_close(id);
|
||||
ui_writeprot[id] = (item_id == IDM_FLOPPY_IMAGE_EXISTING_WP) ? 1 : 0;
|
||||
disc_load(id, wopenfilestring);
|
||||
update_status_bar_icon_state(SB_FLOPPY | id, wcslen(discfns[id]) ? 0 : 1);
|
||||
EnableMenuItem(sb_menu_handles[part], IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | (wcslen(discfns[id]) ? MF_ENABLED : MF_GRAYED));
|
||||
floppy_load(id, wopenfilestring);
|
||||
update_status_bar_icon_state(SB_FLOPPY | id, wcslen(floppyfns[id]) ? 0 : 1);
|
||||
EnableMenuItem(sb_menu_handles[part], IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | (wcslen(floppyfns[id]) ? MF_ENABLED : MF_GRAYED));
|
||||
update_tip(SB_FLOPPY | id);
|
||||
saveconfig();
|
||||
}
|
||||
@@ -2561,7 +2560,7 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
|
||||
break;
|
||||
}
|
||||
|
||||
disc_close(id);
|
||||
floppy_close(id);
|
||||
update_status_bar_icon_state(SB_FLOPPY | id, 1);
|
||||
EnableMenuItem(sb_menu_handles[part], IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
|
||||
update_tip(SB_FLOPPY | id);
|
||||
@@ -2613,7 +2612,7 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
|
||||
cdrom_drives[id].handler->exit(id);
|
||||
cdrom_close(id);
|
||||
image_open(id, temp_image_path);
|
||||
/* Signal disc change to the emulated machine. */
|
||||
/* Signal media change to the emulated machine. */
|
||||
cdrom_insert(id);
|
||||
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED);
|
||||
if ((cdrom_drives[id].host_drive >= 'A') && (cdrom_drives[id].host_drive <= 'Z'))
|
||||
@@ -2657,7 +2656,7 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
|
||||
cdrom_drives[id].handler->exit(id);
|
||||
cdrom_close(id);
|
||||
ioctl_open(id, new_cdrom_drive);
|
||||
/* Signal disc change to the emulated machine. */
|
||||
/* Signal media change to the emulated machine. */
|
||||
cdrom_insert(id);
|
||||
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED);
|
||||
if ((cdrom_drives[id].host_drive >= 'A') && (cdrom_drives[id].host_drive <= 'Z'))
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
*
|
||||
* Windows IO device menu handler.
|
||||
*
|
||||
* Version: @(#)win_iodev.c 1.0.0 2017/05/30
|
||||
* Version: @(#)win_iodev.c 1.0.1 2017/09/03
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#define UNICODE
|
||||
#define _WIN32_WINNT 0x0501
|
||||
@@ -28,13 +28,12 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../ibm.h"
|
||||
#include "../device.h"
|
||||
#include "../cdrom.h"
|
||||
#include "../cdrom_image.h"
|
||||
#include "../cdrom_ioctl.h"
|
||||
#include "../cdrom_null.h"
|
||||
#include "../cdrom/cdrom.h"
|
||||
#include "../cdrom/cdrom_image.h"
|
||||
#include "../cdrom/cdrom_ioctl.h"
|
||||
#include "../cdrom/cdrom_null.h"
|
||||
#include "../scsi/scsi_disk.h"
|
||||
#include "plat_iodev.h"
|
||||
#include "win.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Windows 86Box Settings dialog handler.
|
||||
*
|
||||
* Version: @(#)win_settings.c 1.0.9 2017/08/26
|
||||
* Version: @(#)win_settings.c 1.0.10 2017/09/03
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
@@ -22,15 +22,17 @@
|
||||
#include <commctrl.h>
|
||||
#include <inttypes.h>
|
||||
#include "../ibm.h"
|
||||
#include "../mem.h"
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../nvr.h"
|
||||
#include "../mem.h"
|
||||
#include "../device.h"
|
||||
#include "../nvr.h"
|
||||
#include "../machine/machine.h"
|
||||
#include "../cdrom.h"
|
||||
#include "../disc.h"
|
||||
#include "../fdd.h"
|
||||
#include "../gameport.h"
|
||||
#include "../lpt.h"
|
||||
#include "../mouse.h"
|
||||
#include "../cdrom/cdrom.h"
|
||||
#include "../floppy/floppy.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../hdd/hdd.h"
|
||||
#include "../hdd/hdd_ide_at.h"
|
||||
#include "../scsi/scsi.h"
|
||||
@@ -43,8 +45,6 @@
|
||||
#include "../sound/snd_mpu401.h"
|
||||
#include "../video/video.h"
|
||||
#include "../video/vid_voodoo.h"
|
||||
#include "../gameport.h"
|
||||
#include "../mouse.h"
|
||||
#include "plat_midi.h"
|
||||
#include "win.h"
|
||||
#include "win_language.h"
|
||||
|
||||
Reference in New Issue
Block a user