Previous 15994 Revisions Next

r6034 Sunday 11th October, 2009 at 04:16:52 UTC by Barry Rodewald
[FMTOWNS] Added/documented a couple more ports.
[src/mess/drivers]fmtowns.c

src/mess/drivers/fmtowns.c
r6033r6034
3939 * 0x0028 RW: bit 0 = NMI mask (read/write)
4040 * 0x0030 R : Machine ID (low)
4141 * 0x0031 R : Machine ID (high)
42 * 0x0032 RW: bit 7 = RESET, bit 6 = CLK (serial?)
42 * 0x0032 RW: bit 7 = RESET, bit 6 = CLK, bit 0 = data (serial ROM)
4343 * 0x0040   : 8253 PIT counter 0
4444 * 0x0042   : 8253 PIT counter 1
4545 * 0x0044   : 8253 PIT counter 2
r6033r6034
5050 * 0x00b0-bf: DMA controller 2 (uPD71071)
5151 * 0x0200-0f: Floppy controller (MB8877A)
5252 * 0x0400   : Video / CRTC (unknown)
53 * 0x0404   : Video / CRTC (unknown)
53 * 0x0404   : Enable whole first MB of RAM (disable VRAM, CMOS, BIOS ROM)
5454 * 0x0440-5f: Video / CRTC (unknown)
55 * 0x0480 RW: bit 1 = some sort of RAM switch?
55 * 0x0480 RW: bit 1 = disable BIOS ROM
5656 * 0x04c0-cf: CD-ROM controller (unknown? SCSI?)
5757 * 0x04d5   : Sound mute
5858 * 0x04d8   : YM3438 control port A / status
r6033r6034
7070 * 0x3000 - 0x3fff : CMOS RAM
7171 * 0xfd90-a0: CRTC / Video
7272 * 0xff81: CRTC / Video - returns value in RAM location 0xcff81?
73 *
74 * IRQ list
75 *
76 *       IRQ0 - PIT Timer IRQ
77 *       IRQ1 - Keyboard
78 *       IRQ2 - Serial Port
79 *       IRQ6 - Floppy Disc Drive
80 *       IRQ7 - PIC Cascade IRQ
81 *       IRQ8 - SCSI controller
82 *       IRQ9 - Built-in CD-ROM controller
83 *       IRQ11 - VSync interrupt
84 *       IRQ12 - Printer port
85 *       IRQ13 - Sound (FM?), Mouse
86 *       IRQ15 - PCM
7387 */
7488
7589#include "driver.h"
r6033r6034
113127static UINT8 towns_rtc_data;
114128static UINT8 towns_rtc_reg[16];
115129emu_timer* towns_rtc_timer;
130static UINT8 towns_timer_mask;
131static UINT8 towns_crtc_mix;
116132
133
117134static void towns_update_video_banks(const address_space* space);
135static PIC8259_SET_INT_LINE( towns_pic_irq );
118136
119137static void towns_init_serial_rom(void)
120138{
r6033r6034
498516   logerror("KB: wrote 0x%02x to offset %02x\n",data,offset);
499517}
500518
519/*
520 *  Port 0x60 - PIT Timer control
521 *  On read:   bit 0: Timer 0 output level
522 *             bit 1: Timer 1 output level
523 *             bits 4-2: Timer masks (timer 2 = sound)
524 *  On write:   bits 2-0: Timer mask set
525 *             bit 7: Timer 0 output reset
526 */
501527static READ8_HANDLER(towns_port60_r)
502528{
503529   UINT8 val = 0x00;
504   if ( pit8253_get_output(devtag_get_device(space->machine, "pit"), 2 ) )
505      val |= 0x20;
506   else
507      val &= ~0x20;
530   
531   if ( pit8253_get_output(devtag_get_device(space->machine, "pit"), 0 ) )
532      val |= 0x01;
533   if ( pit8253_get_output(devtag_get_device(space->machine, "pit"), 1 ) )
534      val |= 0x02;
508535
536   val |= (towns_timer_mask & 0x07) << 2;
537   
509538   logerror("PIT: port 0x60 read, returning 0x%02x\n",val);
510539   return val;
511540}
512541
513542static WRITE8_HANDLER(towns_port60_w)
514543{
515   pit8253_gate_w(devtag_get_device(space->machine, "pit"), 2, data & 1);
544   const device_config* dev = devtag_get_device(space->machine,"pic8259_master");
545
546   if(data & 0x80)
547   {
548      towns_pic_irq(dev,0);
549   }
550   towns_timer_mask = data & 0x07;
551   // bit 2 = sound (beeper?)
516552   logerror("PIT: wrote 0x%02x to port 0x60\n",data);
517553}
518554
r6033r6034
627663
628664   switch(offset)
629665   {
666      case 0x00:  // mix register
667         return towns_crtc_mix;
630668      case 0x01:  // read/write plane select (bit 0-3 write, bit 6-7 read)
631669         return ((towns_vram_rplane << 6) & 0xc0) | towns_vram_wplane;
632670      case 0x16:  // Kanji character data
r6033r6034
655693
656694   switch(offset)
657695   {
696      case 0x00:  // mix register
697         towns_crtc_mix = data;
698         break;
658699      case 0x01:  // read/write plane select (bit 0-3 write, bit 6-7 read)
659700         towns_vram_wplane = data & 0x0f;
660701         towns_vram_rplane = (data & 0xc0) >> 6;
r6033r6034
898939   return 0x08;
899940}
900941
942static READ8_HANDLER(towns_41ff_r)
943{
944   logerror("I/O port 0x41ff read\n");
945   return 0x01;
946}
947
901948static IRQ_CALLBACK( towns_irq_callback )
902949{
903950   const device_config* pic1 = devtag_get_device(device->machine,"pic8259_master");
r6033r6034
915962
916963static PIC8259_SET_INT_LINE( towns_pic_irq )
917964{
918   cputag_set_input_line(device->machine,"maincpu",0,interrupt ? ASSERT_LINE : CLEAR_LINE);
965   cputag_set_input_line(device->machine,"maincpu",0,interrupt ? HOLD_LINE : CLEAR_LINE);
966   logerror("PIC#1: set IRQ line to %i\n",interrupt);
919967}
920968
921969static PIC8259_SET_INT_LINE( towns_slave_pic_irq )
922970{
923   cputag_set_input_line(device->machine,"maincpu",7,interrupt ? ASSERT_LINE : CLEAR_LINE);
971   const device_config* dev = devtag_get_device(device->machine,"pic8259_master");
972
973   pic8259_set_irq_line(dev,7,interrupt);
974   logerror("PIC#2: set IRQ line to %i\n",interrupt);
924975}
925976
926977static PIT8253_OUTPUT_CHANGED( towns_pit_out0_changed )
927978{
928979   const device_config* dev = devtag_get_device(device->machine,"pic8259_master");
929   pic8259_set_irq_line(dev,0,state);
980   
981   if(towns_timer_mask & 0x01)
982   {
983      pic8259_set_irq_line(dev,0,state);
984   }
930985}
931986
987static PIT8253_OUTPUT_CHANGED( towns_pit_out1_changed )
988{
989   const device_config* dev = devtag_get_device(device->machine,"pic8259_master");
990   
991   if(towns_timer_mask & 0x02)
992   {
993      pic8259_set_irq_line(dev,0,state);
994   }
995}
996
932997static ADDRESS_MAP_START(towns_mem, ADDRESS_SPACE_PROGRAM, 32)
933998  // memory map based on FM-Towns/Bochs (Bochs modified to emulate the FM-Towns)
934999  // may not be (and probably is not) correct
r6033r6034
10051070  AM_RANGE(0x0c30,0x0c33) AM_READ8(towns_unknown_r,0x00ff0000)
10061071  // CMOS
10071072  AM_RANGE(0x3000,0x3fff) AM_READWRITE8(towns_cmos8_r, towns_cmos8_w,0x00ff00ff)
1073  // Something (MS-DOS wants this 0x41ff be 1
1074  AM_RANGE(0x41fc,0x41ff) AM_READ8(towns_41ff_r,0xff000000)
10081075  // CRTC / Video (again)
10091076  AM_RANGE(0xfd90,0xfda3) AM_READWRITE8(towns_video_fd90_r, towns_video_fd90_w, 0xffffffff)
10101077  AM_RANGE(0xff80,0xff83) AM_READWRITE8(towns_video_ff81_r, towns_video_ff81_w, 0x0000ff00)
r6033r6034
10851152      },
10861153      {
10871154         307200,
1088         NULL
1155         towns_pit_out1_changed
10891156      },
10901157      {
10911158         307200,

Previous 15994 Revisions Next


© 1998-2018 The MESS Team