From 9f09e9c370214f4b9bed4d261c0a9f4b9308c6f5 Mon Sep 17 00:00:00 2001 From: TomW Date: Sun, 21 Jun 2015 16:03:33 +0100 Subject: [PATCH] Added PS/1 model 2011 emulation. --- ibmps1_2011.nvr | Bin 0 -> 128 bytes src/Makefile.mingw | 2 +- src/fdc.c | 17 ++++- src/fdc.h | 1 + src/ibm.h | 1 + src/mem.c | 25 ++++++++ src/model.c | 74 +++++++++++++--------- src/nvr.c | 82 ++++++++++++------------ src/ps1.c | 152 +++++++++++++++++++++++++++++++++++++++++++++ src/ps1.h | 1 + src/vid_vga.c | 31 +++++++++ src/vid_vga.h | 1 + src/video.c | 4 ++ 13 files changed, 320 insertions(+), 71 deletions(-) create mode 100644 ibmps1_2011.nvr create mode 100644 src/ps1.c create mode 100644 src/ps1.h diff --git a/ibmps1_2011.nvr b/ibmps1_2011.nvr new file mode 100644 index 0000000000000000000000000000000000000000..2029c7bf3088e975f104d454b17c43532bd871d7 GIT binary patch literal 128 zcmXq>$uv`JCW9iIs2W2+0|SE#0|O&N0}}%a13F*> 5) & 3) + { + case 0: + lpt1_init(0x3bc); + break; + case 1: + lpt1_init(0x378); + break; + case 2: + lpt1_init(0x278); + break; + } + } + ps1_102 = val; + break; + case 0x103: + ps1_103 = val; + break; + case 0x104: + ps1_104 = val; + break; + case 0x105: + ps1_105 = val; + break; + case 0x190: + ps1_190 = val; + break; + + case 0x322: + ps1_hd.ctrl = val; + if (val & 0x80) + ps1_hd.status |= 0x02; + break; + case 0x324: + ps1_hd.attention = val & 0xf0; + if (ps1_hd.attention) + ps1_hd.status = 0x14; + break; + } +} + +void ps1mb_init() +{ + io_sethandler(0x0091, 0x0001, ps1_read, NULL, NULL, ps1_write, NULL, NULL, NULL); + io_sethandler(0x0092, 0x0001, ps1_read, NULL, NULL, ps1_write, NULL, NULL, NULL); + io_sethandler(0x0094, 0x0001, ps1_read, NULL, NULL, ps1_write, NULL, NULL, NULL); + io_sethandler(0x0102, 0x0004, ps1_read, NULL, NULL, ps1_write, NULL, NULL, NULL); + io_sethandler(0x0190, 0x0001, ps1_read, NULL, NULL, ps1_write, NULL, NULL, NULL); + io_sethandler(0x0320, 0x0001, ps1_read, NULL, NULL, ps1_write, NULL, NULL, NULL); + io_sethandler(0x0322, 0x0001, ps1_read, NULL, NULL, ps1_write, NULL, NULL, NULL); + io_sethandler(0x0324, 0x0001, ps1_read, NULL, NULL, ps1_write, NULL, NULL, NULL); + + rom_init(&ps1_high_rom, + "roms/ibmps1es/f80000.bin", + 0xf80000, + 0x80000, + 0x7ffff, + 0, + MEM_MAPPING_EXTERNAL); +/* rom_init_interleaved(&ps1_high_rom, + "roms/ibmps1es/ibm_1057757_24-05-90.bin", + "roms/ibmps1es/ibm_1057757_29-15-90.bin", + 0xfc0000, + 0x40000, + 0x3ffff, + 0, + MEM_MAPPING_EXTERNAL);*/ + ps1_190 = 0; + + lpt1_remove(); + lpt2_remove(); + lpt1_init(0x3bc); + + serial1_remove(); + serial2_remove(); + + memset(&ps1_hd, 0, sizeof(ps1_hd)); +} diff --git a/src/ps1.h b/src/ps1.h new file mode 100644 index 0000000..bfe0deb --- /dev/null +++ b/src/ps1.h @@ -0,0 +1 @@ +void ps1mb_init(); diff --git a/src/vid_vga.c b/src/vid_vga.c index 11f69b8..6f4d639 100644 --- a/src/vid_vga.c +++ b/src/vid_vga.c @@ -100,6 +100,26 @@ void *vga_init() return vga; } +/*PS/1 uses a standard VGA controller, but with no option ROM*/ +void *ps1vga_init() +{ + vga_t *vga = malloc(sizeof(vga_t)); + memset(vga, 0, sizeof(vga_t)); + + svga_init(&vga->svga, vga, 1 << 18, /*256kb*/ + NULL, + vga_in, vga_out, + NULL, + NULL); + + io_sethandler(0x03c0, 0x0020, vga_in, NULL, NULL, vga_out, NULL, NULL, vga); + + vga->svga.bpp = 8; + vga->svga.miscout = 1; + + return vga; +} + static int vga_available() { return rom_present("roms/ibm_vga.bin"); @@ -146,3 +166,14 @@ device_t vga_device = vga_force_redraw, vga_add_status_info }; +device_t ps1vga_device = +{ + "PS/1 VGA", + 0, + ps1vga_init, + vga_close, + vga_available, + vga_speed_changed, + vga_force_redraw, + vga_add_status_info +}; diff --git a/src/vid_vga.h b/src/vid_vga.h index 12a65f9..3bf9459 100644 --- a/src/vid_vga.h +++ b/src/vid_vga.h @@ -1 +1,2 @@ extern device_t vga_device; +extern device_t ps1vga_device; diff --git a/src/video.c b/src/video.c index 19bf00c..c089c34 100644 --- a/src/video.c +++ b/src/video.c @@ -257,6 +257,10 @@ void video_init() case ROM_ACER386: device_add(&oti067_device); return; + + case ROM_IBMPS1_2011: + device_add(&ps1vga_device); + return; } device_add(video_cards[video_old_to_new(gfxcard)].device); }