Previous 15994 Revisions Next

r5204 Friday 10th July, 2009 at 14:57:44 UTC by Miodrag Milanović
[FK1] Video display fixed, added diagnostic ROM as optional
[src/mess/drivers]fk1.c

src/mess/drivers/fk1.c
r5203r5204
88
99#include "driver.h"
1010#include "cpu/z80/z80.h"
11#include "machine/8255ppi.h"
12#include "machine/pit8253.h"
13#include "machine/msm8251.h"
1114
15UINT8 fk1_video_rol;
16/*
17Port A:
18      Printer
19Port B:
20      Keyboard
21Port C:
22   READING :
23      7 - / OBF(buffer overflow for the printer)
24      6 - INTE printer
25      5 - ERROR printer
26      4 - /PEND, lack of paper
27      3 - INTR printer
28      2 - INTE keyboard
29      1 - IBF (data from the keyboard)
30      0 - INTR keyboard
31   WRITING : 
32      6 - INTE printer
33      2 - INTE keyboard
34 */
35
36static WRITE8_DEVICE_HANDLER (fk1_ppi_1_a_w )
37{
38//   logerror("fk1_ppi_1_a_w %02x\n",data);
39}
40static WRITE8_DEVICE_HANDLER (fk1_ppi_1_b_w )
41{
42//   logerror("fk1_ppi_1_b_w %02x\n",data);
43}
44static WRITE8_DEVICE_HANDLER (fk1_ppi_1_c_w )
45{
46   //logerror("fk1_ppi_1_c_w %02x\n",data);
47}
48
49static READ8_DEVICE_HANDLER (fk1_ppi_1_a_r )
50{
51   //logerror("fk1_ppi_1_a_r\n");
52   return 0xff;
53}
54static READ8_DEVICE_HANDLER (fk1_ppi_1_b_r )
55{
56//   logerror("fk1_ppi_1_b_r\n");
57   return 0;
58}
59static READ8_DEVICE_HANDLER (fk1_ppi_1_c_r )
60{
61//   logerror("fk1_ppi_1_c_r\n");
62   return 0;
63}
64const ppi8255_interface fk1_ppi8255_interface_1 =
65{
66   DEVCB_HANDLER(fk1_ppi_1_a_r),
67   DEVCB_HANDLER(fk1_ppi_1_b_r),
68   DEVCB_HANDLER(fk1_ppi_1_c_r),
69   DEVCB_HANDLER(fk1_ppi_1_a_w),   
70   DEVCB_HANDLER(fk1_ppi_1_b_w),
71   DEVCB_HANDLER(fk1_ppi_1_c_w)
72};
73
74/*
75Port A:
76   Writing data to disk
77Port B:
78   Reading data from disk
79Port C:   
80   READING:
81      7 - / OF A data write to disk,
82      6 - INTE A,
83      5 - Select the drive A, B,
84      4 - Not connected
85      3 - INTR A
86      2 - INTE B read data,
87      1 - IBF B read data,
88      0 - INTR B
89
90   WRITING:
91      6 - INTE A - reading data
92      2 - INTE B - writing data
93*/
94static WRITE8_DEVICE_HANDLER (fk1_ppi_2_a_w )
95{
96//   logerror("write to disk %02x\n",data);
97}
98
99static WRITE8_DEVICE_HANDLER (fk1_ppi_2_c_w )
100{
101//   logerror("fk1_ppi_2_c_w %02x\n",data);
102}
103
104static READ8_DEVICE_HANDLER (fk1_ppi_2_b_r )
105{
106//   logerror("read from disk\n");
107   return 0;
108}
109static READ8_DEVICE_HANDLER (fk1_ppi_2_c_r )
110{
111//   logerror("fk1_ppi_2_c_r\n");
112   return 0;
113}
114const ppi8255_interface fk1_ppi8255_interface_2 =
115{
116   DEVCB_NULL,
117   DEVCB_HANDLER(fk1_ppi_2_b_r),
118   DEVCB_HANDLER(fk1_ppi_2_c_r),
119   DEVCB_HANDLER(fk1_ppi_2_a_w),   
120   DEVCB_NULL,
121   DEVCB_HANDLER(fk1_ppi_2_c_w)
122};
123
124
125/*
126
127Port A:
128   6 - / disk, authorization disk operations,
129   3 - INTE MOUSE, permit suspension from mouse,
130   2 - INTE RTC from the system clock of 50 Hz,
131   1 and 0 - to set the type for hours write to the disk (01 index, 11 address mark, mark the date, 00 other).
132
133Port B:
134   Video ROL register
135Port C
136
137   READING:
138   7 - INDEX ( index mark on the disk)
139   6 - I do not know,
140   5 - WRITE_PROTECT the protected disk,
141   4 - TRAC_00 as a sign of trace
142   
143   WRITING:
144   3 - HEAD LOAD
145   2 - TRACK_43
146   1 - DIRC - direction to set the direction of stepping disk
147   0 - STEP, move disk (0 1 .. 0.).
148
149*/
150static WRITE8_DEVICE_HANDLER (fk1_ppi_3_a_w )
151{
152//   logerror("fk1_ppi_3_a_w %02x\n",data);
153}
154static WRITE8_DEVICE_HANDLER (fk1_ppi_3_b_w )
155{
156   fk1_video_rol = data;
157}
158static WRITE8_DEVICE_HANDLER (fk1_ppi_3_c_w )
159{
160//   logerror("fk1_ppi_3_c_w %02x\n",data);
161}
162
163static READ8_DEVICE_HANDLER (fk1_ppi_3_a_r )
164{
165//   logerror("fk1_ppi_3_a_r\n");
166   return 0;
167}
168static READ8_DEVICE_HANDLER (fk1_ppi_3_b_r )
169{
170   return fk1_video_rol;
171}
172static READ8_DEVICE_HANDLER (fk1_ppi_3_c_r )
173{
174//   logerror("fk1_ppi_3_c_r\n");
175   return 0;
176}
177const ppi8255_interface fk1_ppi8255_interface_3 =
178{
179   DEVCB_HANDLER(fk1_ppi_3_a_r),
180   DEVCB_HANDLER(fk1_ppi_3_b_r),
181   DEVCB_HANDLER(fk1_ppi_3_c_r),
182   DEVCB_HANDLER(fk1_ppi_3_a_w),   
183   DEVCB_HANDLER(fk1_ppi_3_b_w),
184   DEVCB_HANDLER(fk1_ppi_3_c_w)
185};
186
187static PIT8253_OUTPUT_CHANGED(fk1_pit_out0)
188{
189   // System time
190   logerror("PIT8253_OUTPUT_CHANGED(fk1_pit_out0)\n");
191}
192
193static PIT8253_OUTPUT_CHANGED(fk1_pit_out1)
194{
195   // Timeout for disk operation
196   logerror("PIT8253_OUTPUT_CHANGED(fk1_pit_out1)\n");
197}
198
199static PIT8253_OUTPUT_CHANGED(fk1_pit_out2)
200{
201   // Overflow for disk operations
202   logerror("PIT8253_OUTPUT_CHANGED(fk1_pit_out2)\n");
203}
204
205
206const struct pit8253_config fk1_pit8253_intf =
207{
208   {
209      {
210         50,
211         fk1_pit_out0
212      },
213      {
214         1000000,
215         fk1_pit_out1
216      },
217      {
218         0,
219         fk1_pit_out2
220      }
221   }
222};
223
224/*
225   0 no interrupt allowed,
226   1 allowed INTR-7,
227   2 allowed INTR-7 and INTR-6,
228   8 any interruption allowed.
229*/
230
231WRITE8_HANDLER( fk1_intr_w )
232{
233   logerror("fk1_intr_w %02x\n",data);
234}
235
236READ8_HANDLER( fk1_bank_ram_r )
237{
238   const address_space *space_mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
239   memory_install_write8_handler(space_mem, 0x0000, 0x3fff, 0, 0, SMH_BANK(1));
240   memory_set_bankptr(space->machine, 1, mess_ram);
241   memory_set_bankptr(space->machine, 2, mess_ram + 0x4000);
242   return 0;
243}
244
245READ8_HANDLER( fk1_bank_rom_r )
246{
247   const address_space *space_mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
248   memory_install_write8_handler(space_mem, 0x0000, 0x3fff, 0, 0, SMH_UNMAP);
249   memory_set_bankptr(space->machine, 1, memory_region(space->machine, "maincpu"));
250   memory_set_bankptr(space->machine, 2, mess_ram + 0x10000);
251   return 0;
252}
253
254/*
255   4 - FORMAT authorization
256   3 - READ_ADDRESS_MARK
257   2 - READ_DATA_MARK
258   1 - WRITE
259   0 - READ
260   Functions are allowed in one.
261*/
262WRITE8_HANDLER( fk1_disk_w )
263{
264//   logerror("fk1_disk_w %02x\n",data);
265}
266
267/*
2687 and 6 - 1 to connected mouse and 0 if not connected,
2695 - / T2, right-click
2704 - / T1, left-click
2713 - / BY, Y-axis
2722 - / AY, Y-axis
2731 - / BX, X-axis
2740 - / AX, X-axis
275*/
276READ8_HANDLER( fk1_mouse_r )
277{
278//   logerror("fk1_mouse_r\n");
279   return 0;
280}
281
282/*Write to port 70 resets the interrupt from the system clock of 50 Hz. */
283
284WRITE8_HANDLER( fk1_reset_int_w )
285{
286   logerror("fk1_reset_int_w\n");   
287}
288
12289static ADDRESS_MAP_START(fk1_mem, ADDRESS_SPACE_PROGRAM, 8)
13   ADDRESS_MAP_UNMAP_HIGH
14   AM_RANGE( 0x0000, 0x07ff ) AM_ROM
15   AM_RANGE( 0x0800, 0xffff ) AM_RAM
290   AM_RANGE(0x0000, 0x3fff) AM_RAMBANK(1)
291   AM_RANGE(0x4000, 0x7fff) AM_RAMBANK(2)
292   AM_RANGE(0x8000, 0xbfff) AM_RAMBANK(3)
293   AM_RANGE(0xc000, 0xffff) AM_RAMBANK(4)
16294ADDRESS_MAP_END
17295
18296static ADDRESS_MAP_START( fk1_io , ADDRESS_SPACE_IO, 8)
297   ADDRESS_MAP_GLOBAL_MASK(0xff)
19298   ADDRESS_MAP_UNMAP_HIGH
299   AM_RANGE( 0x00, 0x03 ) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w)
300   AM_RANGE( 0x10, 0x13 ) AM_DEVREADWRITE("pit8253", pit8253_r,pit8253_w)
301   AM_RANGE( 0x20, 0x23 ) AM_DEVREADWRITE("ppi8255_2", ppi8255_r, ppi8255_w)
302   AM_RANGE( 0x30, 0x30 ) AM_READWRITE(fk1_bank_ram_r,fk1_intr_w)
303   AM_RANGE( 0x40, 0x40 ) AM_DEVREADWRITE("uart", msm8251_data_r,msm8251_data_w)
304   AM_RANGE( 0x41, 0x41 ) AM_DEVREADWRITE("uart", msm8251_status_r,msm8251_control_w)
305   AM_RANGE( 0x50, 0x50 ) AM_READWRITE(fk1_bank_rom_r,fk1_disk_w)
306   AM_RANGE( 0x60, 0x63 ) AM_DEVREADWRITE("ppi8255_3", ppi8255_r, ppi8255_w)
307   AM_RANGE( 0x70, 0x70 ) AM_READWRITE(fk1_mouse_r,fk1_reset_int_w)
20308ADDRESS_MAP_END
21309
22310/* Input ports */
23311static INPUT_PORTS_START( fk1 )
312   PORT_START("LINE0")
313      PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
314      PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
315      PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"')
316      PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
317      PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('\xA4')
318      PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
319      PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
320      PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'')
24321INPUT_PORTS_END
25322
323UINT8 int_vector;
26324
325static TIMER_CALLBACK(keyboard_callback)
326{
327   if (input_port_read(machine, "LINE0")) {     
328      int_vector = 6;   
329      cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
330   }
331}
332
333/*
3347 – DATA_READY
3356 – TIMEOUT
3365 – OVERFLOW
3374 – RTC_50HZ
3383 – MOUSE
3392 – SIO
3401 – KEYBOARD
3410 – PRINTER
342*/
343
344static IRQ_CALLBACK (fk1_irq_callback)
345{     
346   logerror("IRQ %02x\n",int_vector*2);
347   return int_vector * 2;
348}
349
350static TIMER_CALLBACK( vsync_callback )
351{
352   int_vector = 3;
353   cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
354}
355
356
27357static MACHINE_RESET(fk1)
28358{
359   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
360   memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP);
361   memory_set_bankptr(machine, 1, memory_region(machine, "maincpu")); // ROM
362   memory_set_bankptr(machine, 2, mess_ram + 0x10000); // VRAM
363   memory_set_bankptr(machine, 3, mess_ram + 0x8000);
364   memory_set_bankptr(machine, 4, mess_ram + 0xc000);
365   
366   cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), fk1_irq_callback);
367   timer_pulse(machine, ATTOTIME_IN_HZ(24000), NULL, 0, keyboard_callback);
368   timer_pulse(machine, ATTOTIME_IN_HZ(50), NULL, 0, vsync_callback);
29369}
30370
31371static VIDEO_START( fk1 )
r5203r5204
34374
35375static VIDEO_UPDATE( fk1 )
36376{
37    return 0;
377    UINT8 code;
378   int y, x, b;
379
380   for (x = 0; x < 64; x++)
381   {
382      for (y = 0; y < 256; y++)
383      {
384         code = mess_ram[x * 0x100 + ((y + fk1_video_rol) & 0xff) + 0x10000];
385         for (b = 0; b < 8; b++)
386         {
387            *BITMAP_ADDR16(bitmap, y, x*8+b) =  ((code << b) & 0x80) ? 1 : 0;
388         }
389      }
390   }
391   return 0;
38392}
39393
40394static MACHINE_DRIVER_START( fk1 )
41395    /* basic machine hardware */
42    MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz)
396    MDRV_CPU_ADD("maincpu",Z80, XTAL_8MHz / 2)
43397    MDRV_CPU_PROGRAM_MAP(fk1_mem)
44398    MDRV_CPU_IO_MAP(fk1_io)
45399
r5203r5204
50404    MDRV_SCREEN_REFRESH_RATE(50)
51405    MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
52406    MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
53    MDRV_SCREEN_SIZE(640, 480)
54    MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
407   MDRV_SCREEN_SIZE(512, 256)
408   MDRV_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
55409    MDRV_PALETTE_LENGTH(2)
56410    MDRV_PALETTE_INIT(black_and_white)
57411
58412    MDRV_VIDEO_START(fk1)
59413    MDRV_VIDEO_UPDATE(fk1)
414   
415   MDRV_PIT8253_ADD( "pit8253", fk1_pit8253_intf )
416   MDRV_PPI8255_ADD( "ppi8255_1", fk1_ppi8255_interface_1 )
417   MDRV_PPI8255_ADD( "ppi8255_2", fk1_ppi8255_interface_2 )         
418   MDRV_PPI8255_ADD( "ppi8255_3", fk1_ppi8255_interface_3 )       
419   /* uart */
420   MDRV_MSM8251_ADD("uart", default_msm8251_interface)   
60421MACHINE_DRIVER_END
61422
62423static SYSTEM_CONFIG_START(fk1)
424   CONFIG_RAM_DEFAULT((64+16) * 1024)
63425SYSTEM_CONFIG_END
64426
65427/* ROM definition */
66428ROM_START( fk1 )
67429    ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
68  ROM_LOAD( "fk1.rom", 0x0000, 0x0800, CRC(145561f8) SHA1(a4eb17d773e51b34620c508b6cebcb4531ae99c2))
69
430    ROM_SYSTEM_BIOS( 0, "orig", "Original BIOS" )
431   ROMX_LOAD( "fk1.u65",       0x0000, 0x0800, CRC(145561f8) SHA1(a4eb17d773e51b34620c508b6cebcb4531ae99c2), ROM_BIOS(1))
432   ROM_SYSTEM_BIOS( 1, "diag", "Diag BIOS" )
433   ROMX_LOAD( "fk1-diag.u65", 0x0000, 0x0800, CRC(e0660ae1) SHA1(6ad609049b28f27126af0a8a6224362351073dee), ROM_BIOS(2))
70434ROM_END
71435
72436/* Driver */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team