Previous 15994 Revisions Next

r6244 Monday 2nd November, 2009 at 01:03:25 UTC by Angelo Salese
[Apricot Xi]: hooked up PIC/PIT chips and started to work-out the PPI write bits
[X1]: Fixed a small bug with floppy options
[src/mess/drivers]act.c x1.c

src/mess/drivers/act.c
r6243r6244
1919#include "devices/flopdrv.h"
2020#include "cpu/z80/z80daisy.h"
2121#include "machine/z80ctc.h"
22#include "machine/pit8253.h"
23#include "machine/pic8259.h"
2224
25#include "devices/flopdrv.h"
26#include "formats/basicdsk.h"
27
2328static UINT16 *act_vram,*act_scrollram,*act_ram;
29static struct
30{
31   UINT8 disp_en;       //bit 3
32   UINT8 gfx_mode;    //bit 4
33   UINT8 fdrv_num;      //bit 6
34   UINT8 p_input_dir;   //bit 7
35}xi_sys_ctrl;
2436
2537static VIDEO_START( act_f1 )
2638{
r6243r6244
6678{
6779   int y,x,xi,yi;
6880
69   for (y=0;y<25;y++)
81   if(xi_sys_ctrl.disp_en)
82      return 0;
83
84   if(xi_sys_ctrl.gfx_mode)
7085   {
71      for (x=0;x<80;x++)
86      for (y=0;y<25;y++)
7287      {
73         int tile = act_vram[(x+y*80)] & 0x03ff;
88         for (x=0;x<80;x++)
89         {
90            int tile = act_vram[(x+y*80)] & 0x03ff;
7491
75         //0x8000: reverse
76         //0x4000: bright
77         //0x2000: underline
78         //0x1000: strikethrough
92            //0x8000: reverse
93            //0x4000: bright
94            //0x2000: underline
95            //0x1000: strikethrough
7996
80         for(yi=0;yi<16;yi++)
81         {
82            for(xi=0;xi<10;xi++)
97            for(yi=0;yi<16;yi++)
8398            {
84               int color;
99               for(xi=0;xi<10;xi++)
100               {
101                  int color;
85102
86               color = (act_ram[(tile*16)+(yi)]>>(xi) & 1) ? 7 : 0;
103                  color = (act_ram[(tile*16)+(yi)]>>(xi) & 1) ? 7 : 0;
87104
88               //FIXME: X should actually be multiplied by 10.
89               if((x*8+xi)<=video_screen_get_visible_area(screen)->max_x && ((y*16+yi))<video_screen_get_visible_area(screen)->max_y)
90                  *BITMAP_ADDR16(bitmap, y*16+yi, x*8+xi) = screen->machine->pens[color];
105                  //FIXME: X should actually be multiplied by 10.
106                  if((x*8+xi)<=video_screen_get_visible_area(screen)->max_x && ((y*16+yi))<video_screen_get_visible_area(screen)->max_y)
107                     *BITMAP_ADDR16(bitmap, y*16+yi, x*8+xi) = screen->machine->pens[color];
108               }
91109            }
92110         }
93111      }
94112   }
113   else
114   {
115      //...
116   }
117
95118   return 0;
96119}
97120
r6243r6244
113136
114137static READ8_HANDLER( act_fdc_r )
115138{
116//   const device_config* dev = devtag_get_device(space->machine,"fdc");
139   const device_config* dev = devtag_get_device(space->machine,"fdc");
117140
118141//   printf("%02x\n",offset);
119142
143   floppy_drive_set_motor_state(floppy_get_device(space->machine, xi_sys_ctrl.fdrv_num), 1);
144   floppy_drive_set_ready_state(floppy_get_device(space->machine, xi_sys_ctrl.fdrv_num), 1,0);
145
120146   switch(offset)
121147   {
122148      case 0:
123         return mame_rand(space->machine);
124//         return wd17xx_status_r(dev,offset);
125//      case 1:
126//         return wd17xx_track_r(dev,offset);
127//      case 2:
128//         return wd17xx_sector_r(dev,offset);
129//      case 3:
130//         return wd17xx_data_r(dev,offset);
149         return wd17xx_status_r(dev,offset);
150      case 1:
151         return wd17xx_track_r(dev,offset);
152      case 2:
153         return wd17xx_sector_r(dev,offset);
154      case 3:
155         return wd17xx_data_r(dev,offset);
131156      default:
132157         logerror("FDC: read from %04x\n",offset);
133158         return 0xff;
r6243r6244
138163
139164static WRITE8_HANDLER( act_fdc_w )
140165{
141//   const device_config* dev = devtag_get_device(space->machine,"fdc");
166   const device_config* dev = devtag_get_device(space->machine,"fdc");
142167
143168//   printf("%02x %02x\n",offset,data);
144169
170   floppy_drive_set_motor_state(floppy_get_device(space->machine, xi_sys_ctrl.fdrv_num), 1);
171   floppy_drive_set_ready_state(floppy_get_device(space->machine, xi_sys_ctrl.fdrv_num), 1,0);
172
145173   switch(offset)
146174   {
147//      case 0:
148//         wd17xx_command_w(dev,offset,data);
149//         break;
150//      case 1:
151//         wd17xx_track_w(dev,offset,data);
152//         break;
153//      case 2:
154//         wd17xx_sector_w(dev,offset,data);
155//         break;
156//      case 3:
157//         wd17xx_data_w(dev,offset,data);
158//         break;
175      case 0:
176         wd17xx_command_w(dev,offset,data);
177         break;
178      case 1:
179         wd17xx_track_w(dev,offset,data);
180         break;
181      case 2:
182         wd17xx_sector_w(dev,offset,data);
183         break;
184      case 3:
185         wd17xx_data_w(dev,offset,data);
186         break;
159187      default:
160188         logerror("FDC: write to %04x = %02x\n",offset,data);
161189         break;
r6243r6244
208236
209237static ADDRESS_MAP_START( act_xi_io , ADDRESS_SPACE_IO, 16)
210238   ADDRESS_MAP_UNMAP_HIGH
211//   AM_RANGE(0x0000, 0x0003) pic
239   AM_RANGE(0x0000, 0x0003) AM_DEVREADWRITE8("pic8259_master",pic8259_r, pic8259_w,0x00ff)
212240   AM_RANGE(0x0040, 0x0047) AM_READWRITE8(act_fdc_r, act_fdc_w,0x00ff)
213241   AM_RANGE(0x0048, 0x004f) AM_DEVREADWRITE8("ppi8255_0", ppi8255_r, ppi8255_w,0x00ff)
214242//   AM_RANGE(0x0050, 0x0051) sound gen
215//   AM_RANGE(0x0058, 0x005f) pit
243   AM_RANGE(0x0058, 0x005f) AM_DEVREADWRITE8("pit8253",pit8253_r,pit8253_w,0x00ff)
216244   AM_RANGE(0x0060, 0x0067) AM_READWRITE8(act_sio_r,act_sio_w,0x00ff)
217245   AM_RANGE(0x0068, 0x0069) AM_DEVWRITE8("crtc", mc6845_address_w,0x00ff)
218   AM_RANGE(0x006a, 0x006b) AM_DEVWRITE8("crtc", mc6845_register_w,0x00ff)
246   AM_RANGE(0x006a, 0x006b) AM_DEVREADWRITE8("crtc", mc6845_register_r,mc6845_register_w,0x00ff)
219247//   AM_RANGE(0x0070, 0x0073) 8089
220248ADDRESS_MAP_END
221249
r6243r6244
289317   NULL      /* update address callback */
290318};
291319
320static READ8_DEVICE_HANDLER( act_portb_r )
321{
322   return 0xff;
323}
324
325/*
326   x--- ---- Parallel Input Direction
327   -x-- ---- FDC Drive select
328   ---x ---- Text/GFX Mode
329   ---- x--- Display Enable
330   ---- -x-- FDC Side load
331   ---- ---x CRTC reset
332*/
333static WRITE8_DEVICE_HANDLER( act_portb_w )
334{
335   const device_config* dev = devtag_get_device(device->machine,"fdc");
336
337//   printf("PPI Port B write %02x\n",data);
338   xi_sys_ctrl.disp_en = (data & 8)>>3;
339   xi_sys_ctrl.gfx_mode = (data & 0x10)>>4;
340   xi_sys_ctrl.p_input_dir = (data & 0x80)>>7;
341   xi_sys_ctrl.fdrv_num = (data & 0x40)>>6;
342
343   wd17xx_set_drive(dev,xi_sys_ctrl.fdrv_num);
344   wd17xx_set_side(dev,(data & 0x04)>>2);
345}
346
292347static const ppi8255_interface ppi8255_intf =
293348{
294   DEVCB_NULL,                  /* Port A read */
295   DEVCB_NULL,                  /* Port B read */
296   DEVCB_NULL,                  /* Port C read */
297   DEVCB_NULL,                  /* Port A write */
298   DEVCB_NULL,                  /* Port B write */
299   DEVCB_NULL                  /* Port C write */
349   DEVCB_NULL,                           /* Port A read */
350   DEVCB_HANDLER(act_portb_r),               /* Port B read */
351   DEVCB_NULL,                           /* Port C read */
352   DEVCB_NULL,                           /* Port A write */
353   DEVCB_HANDLER(act_portb_w),               /* Port B write */
354   DEVCB_NULL                           /* Port C write */
300355};
301356
302357static const gfx_layout charset_8x8 =
r6243r6244
365420   //   cpu_set_input_line_and_vector(device,0,HOLD_LINE,0x60);
366421}
367422
423static PIC8259_SET_INT_LINE( pc98_master_set_int_line ) {
424   //printf("%02x\n",interrupt);
425   cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? HOLD_LINE : CLEAR_LINE);
426}
427
428
429static const struct pic8259_interface pic8259_master_config = {
430   pc98_master_set_int_line
431};
432
433static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
434{
435   pic8259_set_irq_line(devtag_get_device( device->machine, "pic8259_master" ), 0, state);
436}
437
438static const struct pit8253_config pit8253_config =
439{
440   {
441      {
442         4670000,            /* heartbeat IRQ */
443         pc_timer0_w
444      }, {
445         4670000,            /* dram refresh */
446         NULL
447      }, {
448         4670000,            /* pio port c pin 4, and speaker polling enough */
449         NULL
450      }
451   }
452};
453
454static FLOPPY_OPTIONS_START( act )
455   FLOPPY_OPTION( img2hd, "dsk", "2HD disk image", basicdsk_identify_default, basicdsk_construct_default,
456      HEADS([2])
457      TRACKS([80])
458      SECTORS([16])
459      SECTOR_LENGTH([256])
460      FIRST_SECTOR_ID([1]))
461FLOPPY_OPTIONS_END
462
463static const floppy_config act_floppy_config =
464{
465   DEVCB_NULL,
466   DEVCB_NULL,
467   DEVCB_NULL,
468   DEVCB_NULL,
469   DEVCB_NULL,
470   FLOPPY_DRIVE_DS_80,
471   FLOPPY_OPTIONS_NAME(act),
472   DO_NOT_KEEP_GEOMETRY
473};
474
368475static MACHINE_DRIVER_START( act_f1 )
369476   /* basic machine hardware */
370477   MDRV_CPU_ADD("maincpu", I8086, 4670000)
r6243r6244
420527
421528   MDRV_PPI8255_ADD("ppi8255_0", ppi8255_intf )
422529   MDRV_WD2793_ADD("fdc", act_wd2797_interface )
530   MDRV_PIC8259_ADD( "pic8259_master", pic8259_master_config )
531   MDRV_PIT8253_ADD( "pit8253", pit8253_config )
423532
424533   MDRV_GFXDECODE(act_xi)
425534
426535   MDRV_VIDEO_START(act_xi)
427536   MDRV_VIDEO_UPDATE(act_xi)
537
538   MDRV_FLOPPY_2_DRIVES_ADD(act_floppy_config)
428539MACHINE_DRIVER_END
429540
430541/* ROM definition */
src/mess/drivers/x1.c
r6243r6244
21122112   DEVCB_NULL,
21132113   DEVCB_NULL,
21142114   DEVCB_NULL,
2115   FLOPPY_DRIVE_DS_80,
2115   FLOPPY_DRIVE_DS_40,
21162116   FLOPPY_OPTIONS_NAME(x1),
21172117   DO_NOT_KEEP_GEOMETRY
21182118};

Previous 15994 Revisions Next


© 1998-2018 The MESS Team