Previous 15994 Revisions Next

r9920 Wednesday 5th January, 2011 at 10:47:44 UTC by Robbbert
[DIM68K] Added TODO and notes. Added support for some video controls (screen on/off, 7/8 dots per char, dot clock adjustment). Fixed buffer overflow situation in machine reset.
[src/mess/drivers]dim68k.c

src/mess/drivers/dim68k.c
r9919r9920
44
55        28/12/2011 Skeleton driver.
66
7        This computer had the facility for plug-in cards to emulate popular
8        computers of the time such as apple, trs80, kaypro, etc. The floppy
9        disk parameters could be set to be able to read the disks of the
10        various systems, or you create any other format you wished.
11
12        There is no schematic available, and no native software exists (afaik).
13        So, without a boot disk, cannot proceed very far.
14
15        ToDo:
16
17        - Floppy controller
18        - Floppy formats (not sure if MESS supports user-defined formats)
19        - Banking
20        - Graphics display (including colour and video_control options)
21        - DUART
22        - RTC
23        - RS232 interface
24        - Keyboard
25        - Centronics printer
26        - Video-high
27        - Video-reset
28        - Game switches, paddles and timers
29        - The plug-in boards
30        - Emulator trap function
31
732****************************************************************************/
833#define ADDRESS_MAP_MODERN
934
r9919r9920
91116
92117WRITE16_MEMBER( dim68k_state::dim68k_video_control_w )
93118{
94/* D7 0 = Hires/Graphics; 1= Lores/Text
95   D6 0 = 8 dots per character; 1 = 7 dots
96   D5 0 = CRTC and CPU run Asynchronously; 1 = Synchronously
97   D4,D3 Dot clock 00=14MHz; 01=3.58MHz; 10=7MHz; 11=1.79MHz
98   D2 0 = Screen On; 1 = Off
99   D1 0 = Standard Chars & LoRes; 1 = Alternate Chars & HiRes
100   D0 0 = Non-Mixed (all text or all Graphics); 1 = Mixed (Colour Graphics and Monochrome Text)
119/* D7 0 = Hires/Graphics; 1= Lores/Text [not emulated yet]
120   D6 0 = 8 dots per character; 1 = 7 dots [emulated]
121   D5 0 = CRTC and CPU run Asynchronously; 1 = Synchronously [won't be emulated]
122   D4,D3  Dot clock: 00=14MHz; 01=3.58MHz; 10=7MHz; 11=1.79MHz [emulated]
123   D2 0 = Screen On; 1 = Off [emulated]
124   D1 0 = Standard Chars & LoRes; 1 = Alternate Chars & HiRes [not emulated yet]
125   D0 0 = Non-Mixed (all text or all Graphics); 1 = Mixed (Colour Graphics and Monochrome Text) [not emulated yet]
101126 */
127   mc6845_set_hpixels_per_column(m_crtc, (data & 0x40) ? 7 : 8);
102128   m_video_control = data;
129
130   switch (data & 0x18)
131   {
132      case 0x00: mc6845_set_clock(m_crtc, XTAL_14MHz);
133                 break;
134      case 0x08: mc6845_set_clock(m_crtc, XTAL_3_579545MHz);
135                 break;
136      case 0x10: mc6845_set_clock(m_crtc, XTAL_14MHz / 2);
137                 break;
138      case 0x18: mc6845_set_clock(m_crtc, XTAL_3_579545MHz / 2);
139                 break;
140   }
103141}
104142
105143WRITE16_MEMBER( dim68k_state::dim68k_video_reset_w )
r9919r9920
127165
128166static ADDRESS_MAP_START(dim68k_mem, ADDRESS_SPACE_PROGRAM, 16, dim68k_state)
129167   ADDRESS_MAP_UNMAP_HIGH
130   AM_RANGE(0x00000000, 0x00feffff) AM_RAM AM_BASE(ram) // 16MB RAM / ROM at boot   
131   AM_RANGE(0x00ff0000, 0x00ff1fff) AM_ROM AM_REGION("user1",0)
168   AM_RANGE(0x00000000, 0x00feffff) AM_RAM AM_BASE(ram) // 16MB RAM / ROM at boot
169   AM_RANGE(0x00ff0000, 0x00ff1fff) AM_ROM AM_REGION("bootrom", 0)
132170   AM_RANGE(0x00ff2000, 0x00ff7fff) AM_RAM // Graphics Video RAM
133171   AM_RANGE(0x00ff8000, 0x00ff8001) AM_DEVREADWRITE8_LEGACY("crtc", mc6845_status_r, mc6845_address_w, 0xff)
134172   AM_RANGE(0x00ff8002, 0x00ff8003) AM_DEVREADWRITE8_LEGACY("crtc", mc6845_register_r, mc6845_register_w, 0xff)
r9919r9920
160198static MACHINE_RESET(dim68k)
161199{
162200   dim68k_state *state = machine->driver_data<dim68k_state>();
163   UINT8* user1 = machine->region("user1")->base();
201   UINT8* ROM = machine->region("bootrom")->base();
164202
165   memcpy((UINT8*)state->ram,user1,0x20000);
203   memcpy((UINT8*)state->ram, ROM, 0x2000);
166204
167205   machine->device("maincpu")->reset();   
168206}
r9919r9920
180218   return 0;
181219}
182220
183// Text-only; graphics isn't emulated yet
221// Text-only; graphics isn't emulated yet. Need to find out if hardware cursor is used.
184222MC6845_UPDATE_ROW( dim68k_update_row )
185223{
186224   dim68k_state *state = device->machine->driver_data<dim68k_state>();
187225   UINT8 chr,gfx,x,xx,inv;
188   UINT16 dchr;
189
226   UINT16 chr16=0x2020; // set to spaces if screen is off
190227   UINT16 *p = BITMAP_ADDR16(bitmap, y, 0);
228   UINT8 screen_on = ~state->m_video_control & 4;
229   UINT8 dot8 = ~state->m_video_control & 40;
191230
192231   // need to divide everything in half to cater for 16-bit reads
193232   x_count /= 2;
194233   ma /= 2;
195234   xx = 0;
196235
236   if (!screen_on)
237      cursor_x = 0xff; // disable cursor if screen is off
238
197239   for (x = 0; x < x_count; x++)
198240   {
199      dchr = state->ram[ma+x]; // reads 2 characters
241      if (screen_on)
242         chr16 = state->ram[ma+x]; // reads 2 characters
200243
201244      inv=0;
202245      if (xx == cursor_x) inv=0xff;
203246      xx++;
204247
205      chr = dchr>>8;
248      chr = chr16>>8;
206249      gfx = state->FNT[(chr<<4) | ra] ^ inv ^ ((chr & 0x80) ? 0xff : 0);
207250      *p++ = ( gfx & 0x80 ) ? 1 : 0;
208251      *p++ = ( gfx & 0x40 ) ? 1 : 0;
r9919r9920
211254      *p++ = ( gfx & 0x08 ) ? 1 : 0;
212255      *p++ = ( gfx & 0x04 ) ? 1 : 0;
213256      *p++ = ( gfx & 0x02 ) ? 1 : 0;
214      *p++ = ( gfx & 0x01 ) ? 1 : 0;
257      if (dot8) *p++ = ( gfx & 0x01 ) ? 1 : 0;
215258
216259      inv = 0;
217260      if (xx == cursor_x) inv=0xff;
218261      xx++;
219262
220      chr = dchr;
263      chr = chr16;
221264      gfx = state->FNT[(chr<<4) | ra] ^ inv ^ ((chr & 0x80) ? 0xff : 0);
222265      *p++ = ( gfx & 0x80 ) ? 1 : 0;
223266      *p++ = ( gfx & 0x40 ) ? 1 : 0;
r9919r9920
226269      *p++ = ( gfx & 0x08 ) ? 1 : 0;
227270      *p++ = ( gfx & 0x04 ) ? 1 : 0;
228271      *p++ = ( gfx & 0x02 ) ? 1 : 0;
229      *p++ = ( gfx & 0x01 ) ? 1 : 0;
272      if (dot8) *p++ = ( gfx & 0x01 ) ? 1 : 0;
230273   }
231274}
232275
r9919r9920
317360*/
318361/* ROM definition */
319362ROM_START( dim68k )
320   ROM_REGION( 0x10000, "user1", ROMREGION_ERASEFF )
363   ROM_REGION( 0x2000, "bootrom", ROMREGION_ERASEFF )
321364   ROM_LOAD16_BYTE( "mc103e.bin", 0x0000, 0x1000, CRC(4730c902) SHA1(5c4bb79ad22def721a22eb63dd05e0391c8082be))
322365   ROM_LOAD16_BYTE( "mc104.bin",  0x0001, 0x1000, CRC(14b04575) SHA1(43e15d9ebe1c9c1bf1bcfc1be3899a49e6748200))
323366

Previous 15994 Revisions Next


© 1998-2018 The MESS Team