Previous 15994 Revisions Next

r13655 Wednesday 21st December, 2011 at 14:56:42 UTC by Angelo Salese
Includes work for x1
[src/mess/drivers]x1.c
[src/mess/includes]x1.h

src/mess/includes/x1.h
r13654r13655
5858   x1_state(const machine_config &mconfig, device_type type, const char *tag)
5959      : driver_device(mconfig, type, tag) { }
6060
61   UINT8 m_tvram[0x800];
62   UINT8 m_avram[0x800];
63   UINT8 m_kvram[0x800];
61   UINT8 *m_tvram;
62   UINT8 *m_avram;
63   UINT8 *m_kvram;
6464   UINT8 m_hres_320;
6565   UINT8 m_io_switch;
6666   UINT8 m_io_sys;
6767   UINT8 m_vsync;
6868   UINT8 m_vdisp;
6969   UINT8 m_io_bank_mode;
70   UINT8 m_gfx_bitmap_ram[0xc000*2];
70   UINT8 *m_gfx_bitmap_ram;
7171   UINT8 m_pcg_reset;
7272   UINT8 m_sub_obf;
7373   UINT8 m_ctc_irq_flag;
r13654r13655
102102   UINT8 m_key_irq_flag;
103103   UINT8 m_key_irq_vector;
104104   UINT32 m_emm_addr;
105   UINT8 m_pal_4096[0x1000*3];
105   UINT8 *m_pal_4096;
106106   UINT8 m_crtc_vreg[0x100],m_crtc_index;
107107   UINT8 m_is_turbo;
108108   UINT8 m_ex_bank;
109109   UINT8 m_ram_bank;
110110};
111111
112SCREEN_UPDATE( x1 );
113READ8_HANDLER( x1_sub_io_r );
114WRITE8_HANDLER( x1_sub_io_w );
115READ8_HANDLER( x1_rom_r );
116WRITE8_HANDLER( x1_rom_w );
117WRITE8_HANDLER( x1_rom_bank_0_w );
118WRITE8_HANDLER( x1_rom_bank_1_w );
119READ8_HANDLER( x1_fdc_r );
120WRITE8_HANDLER( x1_fdc_w );
121READ8_HANDLER( x1_pcg_r );
122WRITE8_HANDLER( x1_pcg_w );
123WRITE8_HANDLER( x1_pal_r_w );
124WRITE8_HANDLER( x1_pal_g_w );
125WRITE8_HANDLER( x1_pal_b_w );
126WRITE8_HANDLER( x1_ex_gfxram_w );
127WRITE8_HANDLER( x1_scrn_w );
128WRITE8_HANDLER( x1_pri_w );
129WRITE8_HANDLER( x1_6845_w );
130READ8_HANDLER( x1_kanji_r );
131WRITE8_HANDLER( x1_kanji_w );
132READ8_HANDLER( x1_emm_r );
133WRITE8_HANDLER( x1_emm_w );
134READ8_HANDLER( x1_mem_r );
135WRITE8_HANDLER( x1_mem_w );
136READ8_HANDLER( x1_io_r );
137WRITE8_HANDLER( x1_io_w );
112138
139
140READ8_HANDLER( x1turbo_pal_r );
141READ8_HANDLER( x1turbo_txpal_r );
142READ8_HANDLER( x1turbo_txdisp_r );
143READ8_HANDLER( x1turbo_gfxpal_r );
144WRITE8_HANDLER( x1turbo_pal_w );
145WRITE8_HANDLER( x1turbo_txpal_w );
146WRITE8_HANDLER( x1turbo_txdisp_w );
147WRITE8_HANDLER( x1turbo_gfxpal_w );
148WRITE8_HANDLER( x1turbo_blackclip_w );
149READ8_HANDLER( x1turbo_mem_r );
150WRITE8_HANDLER( x1turbo_mem_w );
151READ8_HANDLER( x1turbo_io_r );
152WRITE8_HANDLER( x1turbo_io_w );
153
154WRITE8_HANDLER( x1turboz_4096_palette_w );
155READ8_HANDLER( x1turboz_blackclip_r );
156
157READ8_DEVICE_HANDLER( x1_porta_r );
158READ8_DEVICE_HANDLER( x1_portb_r );
159READ8_DEVICE_HANDLER( x1_portc_r );
160WRITE8_DEVICE_HANDLER( x1_porta_w );
161WRITE8_DEVICE_HANDLER( x1_portb_w );
162WRITE8_DEVICE_HANDLER( x1_portc_w );
163
164TIMER_DEVICE_CALLBACK(x1_keyboard_callback);
165TIMER_CALLBACK(x1_rtc_increment);
166
167MACHINE_RESET( x1 );
168MACHINE_RESET( x1turbo );
169MACHINE_START( x1 );
170PALETTE_INIT(x1);
171
172
113173/*----------- defined in machine/x1.c -----------*/
114174
115175extern const device_type X1_KEYBOARD;
src/mess/drivers/x1.c
r13654r13655
244244
245245static VIDEO_START( x1 )
246246{
247//  x1_state *state = machine.driver_data<x1_state>();
248//  state->m_avram = auto_alloc_array(machine, UINT8, 0x800);
249//  state->m_tvram = auto_alloc_array(machine, UINT8, 0x800);
250//  state->m_kvram = auto_alloc_array(machine, UINT8, 0x800);
251//  state->m_gfx_bitmap_ram = auto_alloc_array(machine, UINT8, 0xc000*2);
252//  state->m_pal_4096 = auto_alloc_array(machine, UINT8, 0x1000*3);
247   x1_state *state = machine.driver_data<x1_state>();
248
249   state->m_avram = auto_alloc_array_clear(machine, UINT8, 0x800);
250   state->m_tvram = auto_alloc_array_clear(machine, UINT8, 0x800);
251   state->m_kvram = auto_alloc_array_clear(machine, UINT8, 0x800);
252   state->m_gfx_bitmap_ram = auto_alloc_array_clear(machine, UINT8, 0xc000*2);
253   state->m_pal_4096 = auto_alloc_array_clear(machine, UINT8, 0x1000*3);
253254}
254255
255256static void x1_draw_pixel(running_machine &machine, bitmap_t *bitmap,int y,int x,UINT16   pen,UINT8 width,UINT8 height)
r13654r13655
563564   }
564565}
565566
566static SCREEN_UPDATE( x1 )
567SCREEN_UPDATE( x1 )
567568{
568569   x1_state *state = screen->machine().driver_data<x1_state>();
569570
r13654r13655
576577   return 0;
577578}
578579
579static SCREEN_EOF( x1 )
580{
581//  x1_state *state = screen->machine().driver_data<x1_state>();
582580
583//  state->m_old_vpos = -1;
584}
585
586581/*************************************
587582 *
588583 *  Keyboard MCU simulation
r13654r13655
731726   return ret;
732727}
733728
734static READ8_HANDLER( sub_io_r )
729READ8_HANDLER( x1_sub_io_r )
735730{
736731   x1_state *state = space->machine().driver_data<x1_state>();
737732   UINT8 ret,bus_res;
r13654r13655
832827   logerror("CMT: Command 0xe9-0x%02x received.\n",cmd);
833828}
834829
835static TIMER_DEVICE_CALLBACK( cmt_wind_timer )
830static TIMER_DEVICE_CALLBACK( x1_cmt_wind_timer )
836831{
837832   x1_state *state = timer.machine().driver_data<x1_state>();
838833   cassette_image_device* cmt = timer.machine().device<cassette_image_device>(CASSETTE_TAG);
r13654r13655
857852   }
858853}
859854
860static WRITE8_HANDLER( sub_io_w )
855WRITE8_HANDLER( x1_sub_io_w )
861856{
862857   x1_state *state = space->machine().driver_data<x1_state>();
863858   /* sub-routine at $10e sends to these sub-routines when a keyboard input is triggered:
r13654r13655
988983 *************************************/
989984
990985
991static READ8_HANDLER( x1_rom_r )
986READ8_HANDLER( x1_rom_r )
992987{
993988   x1_state *state = space->machine().driver_data<x1_state>();
994989   UINT8 *rom = space->machine().region("cart_img")->base();
r13654r13655
998993   return rom[state->m_rom_index[0]<<16|state->m_rom_index[1]<<8|state->m_rom_index[2]<<0];
999994}
1000995
1001static WRITE8_HANDLER( x1_rom_w )
996WRITE8_HANDLER( x1_rom_w )
1002997{
1003998   x1_state *state = space->machine().driver_data<x1_state>();
1004999   state->m_rom_index[offset] = data;
10051000}
10061001
1007static WRITE8_HANDLER( rom_bank_0_w )
1002WRITE8_HANDLER( x1_rom_bank_0_w )
10081003{
10091004   x1_state *state = space->machine().driver_data<x1_state>();
10101005   state->m_ram_bank = 0x10;
10111006}
10121007
1013static WRITE8_HANDLER( rom_bank_1_w )
1008WRITE8_HANDLER( x1_rom_bank_1_w )
10141009{
10151010   x1_state *state = space->machine().driver_data<x1_state>();
10161011   state->m_ram_bank = 0x00;
r13654r13655
10271022//static UINT8 fdc_side;
10281023//static UINT8 fdc_drive;
10291024
1030static READ8_HANDLER( x1_fdc_r )
1025READ8_HANDLER( x1_fdc_r )
10311026{
10321027   device_t* dev = space->machine().device("fdc");
10331028   //UINT8 ret = 0;
r13654r13655
10591054   return 0x00;
10601055}
10611056
1062static WRITE8_HANDLER( x1_fdc_w )
1057WRITE8_HANDLER( x1_fdc_w )
10631058{
10641059   device_t* dev = space->machine().device("fdc");
10651060
r13654r13655
11521147   return pcg_offset;
11531148}
11541149
1155static READ8_HANDLER( x1_pcg_r )
1150READ8_HANDLER( x1_pcg_r )
11561151{
11571152   x1_state *state = space->machine().driver_data<x1_state>();
11581153   int addr;
r13654r13655
11891184   return res;
11901185}
11911186
1192static WRITE8_HANDLER( x1_pcg_w )
1187WRITE8_HANDLER( x1_pcg_w )
11931188{
11941189   x1_state *state = space->machine().driver_data<x1_state>();
11951190   int addr,pcg_offset;
r13654r13655
12571252   }
12581253}
12591254
1260static WRITE8_HANDLER( x1turboz_4096_palette_w )
1255WRITE8_HANDLER( x1turboz_4096_palette_w )
12611256{
12621257   x1_state *state = space->machine().driver_data<x1_state>();
12631258   UINT32 pal_entry;
r13654r13655
12761271
12771272/* Note: docs claims that reading the palette ports makes the value to change somehow in X1 mode ...
12781273         In 4096 color mode, it's used for reading the value back. */
1279static WRITE8_HANDLER( x1_pal_r_w )
1274WRITE8_HANDLER( x1_pal_r_w )
12801275{
12811276   x1_state *state = space->machine().driver_data<x1_state>();
12821277
r13654r13655
12971292   }
12981293}
12991294
1300static WRITE8_HANDLER( x1_pal_g_w )
1295WRITE8_HANDLER( x1_pal_g_w )
13011296{
13021297   x1_state *state = space->machine().driver_data<x1_state>();
13031298
r13654r13655
13181313   }
13191314}
13201315
1321static WRITE8_HANDLER( x1_pal_b_w )
1316WRITE8_HANDLER( x1_pal_b_w )
13221317{
13231318   x1_state *state = space->machine().driver_data<x1_state>();
13241319
r13654r13655
13391334   }
13401335}
13411336
1342static WRITE8_HANDLER( x1_ex_gfxram_w )
1337WRITE8_HANDLER( x1_ex_gfxram_w )
13431338{
13441339   x1_state *state = space->machine().driver_data<x1_state>();
13451340   UINT8 ex_mask;
r13654r13655
13661361    d6(40) = 0:8-raster graphics      1:16-raster graphics
13671362    d7(80) = 0:don't display          1:display  <- underline (when 1, graphics are not displayed)
13681363*/
1369static WRITE8_HANDLER( x1_scrn_w )
1364WRITE8_HANDLER( x1_scrn_w )
13701365{
13711366   x1_state *state = space->machine().driver_data<x1_state>();
13721367   state->m_scrn_reg.pcg_mode = (data & 0x20)>>5;
r13654r13655
13811376      printf("SCRN sets true 400 lines mode\n");
13821377}
13831378
1384static WRITE8_HANDLER( x1_pri_w )
1379WRITE8_HANDLER( x1_pri_w )
13851380{
13861381   x1_state *state = space->machine().driver_data<x1_state>();
13871382   state->m_scrn_reg.pri = data;
13881383//  printf("PRI = %02x\n",data);
13891384}
13901385
1391static WRITE8_HANDLER( x1_6845_w )
1386WRITE8_HANDLER( x1_6845_w )
13921387{
13931388   x1_state *state = space->machine().driver_data<x1_state>();
13941389   if(offset == 0)
r13654r13655
14031398   }
14041399}
14051400
1406static READ8_HANDLER( x1_blackclip_r )
1401READ8_HANDLER( x1turboz_blackclip_r )
14071402{
14081403   x1_state *state = space->machine().driver_data<x1_state>();
14091404   /*  TODO: this returns only on x1turboz */
14101405   return state->m_scrn_reg.blackclip;
14111406}
14121407
1413static WRITE8_HANDLER( x1_blackclip_w )
1408WRITE8_HANDLER( x1turbo_blackclip_w )
14141409{
14151410   /*
14161411    -x-- ---- replace blanking duration with black
r13654r13655
14251420      printf("Blackclip data access %02x\n",data);
14261421}
14271422
1428static READ8_HANDLER( x1turbo_pal_r )
1423READ8_HANDLER( x1turbo_pal_r )
14291424{
14301425   x1_state *state = space->machine().driver_data<x1_state>();
14311426   return state->m_turbo_reg.pal;
14321427}
14331428
1434static READ8_HANDLER( x1turbo_txpal_r )
1429READ8_HANDLER( x1turbo_txpal_r )
14351430{
14361431   x1_state *state = space->machine().driver_data<x1_state>();
14371432   return state->m_turbo_reg.txt_pal[offset];
14381433}
14391434
1440static READ8_HANDLER( x1turbo_txdisp_r )
1435READ8_HANDLER( x1turbo_txdisp_r )
14411436{
14421437   x1_state *state = space->machine().driver_data<x1_state>();
14431438   return state->m_turbo_reg.txt_disp;
14441439}
14451440
1446static READ8_HANDLER( x1turbo_gfxpal_r )
1441READ8_HANDLER( x1turbo_gfxpal_r )
14471442{
14481443   x1_state *state = space->machine().driver_data<x1_state>();
14491444   return state->m_turbo_reg.gfx_pal;
14501445}
14511446
1452static WRITE8_HANDLER( x1turbo_pal_w )
1447WRITE8_HANDLER( x1turbo_pal_w )
14531448{
14541449   x1_state *state = space->machine().driver_data<x1_state>();
14551450   printf("TURBO PAL %02x\n",data);
14561451   state->m_turbo_reg.pal = data;
14571452}
14581453
1459static WRITE8_HANDLER( x1turbo_txpal_w )
1454WRITE8_HANDLER( x1turbo_txpal_w )
14601455{
14611456   x1_state *state = space->machine().driver_data<x1_state>();
14621457   int r,g,b;
r13654r13655
14741469   }
14751470}
14761471
1477static WRITE8_HANDLER( x1turbo_txdisp_w )
1472WRITE8_HANDLER( x1turbo_txdisp_w )
14781473{
14791474   x1_state *state = space->machine().driver_data<x1_state>();
14801475   printf("TURBO TEXT DISPLAY %02x\n",data);
14811476   state->m_turbo_reg.txt_disp = data;
14821477}
14831478
1484static WRITE8_HANDLER( x1turbo_gfxpal_w )
1479WRITE8_HANDLER( x1turbo_gfxpal_w )
14851480{
14861481   x1_state *state = space->machine().driver_data<x1_state>();
14871482   printf("TURBO GFX PAL %02x\n",data);
r13654r13655
15081503   return 0x0000;
15091504}
15101505
1511static READ8_HANDLER( x1_kanji_r )
1506READ8_HANDLER( x1_kanji_r )
15121507{
15131508   x1_state *state = space->machine().driver_data<x1_state>();
15141509   UINT8 *kanji_rom = space->machine().region("kanji")->base();
r13654r13655
15221517   return res;
15231518}
15241519
1525static WRITE8_HANDLER( x1_kanji_w )
1520WRITE8_HANDLER( x1_kanji_w )
15261521{
15271522   x1_state *state = space->machine().driver_data<x1_state>();
15281523//  if(offset < 2)
r13654r13655
15531548   }
15541549}
15551550
1556static READ8_HANDLER( x1_emm_r )
1551READ8_HANDLER( x1_emm_r )
15571552{
15581553   x1_state *state = space->machine().driver_data<x1_state>();
15591554   UINT8 *emm_ram = space->machine().region("emm")->base();
r13654r13655
15791574   return res;
15801575}
15811576
1582static WRITE8_HANDLER( x1_emm_w )
1577WRITE8_HANDLER( x1_emm_w )
15831578{
15841579   x1_state *state = space->machine().driver_data<x1_state>();
15851580   UINT8 *emm_ram = space->machine().region("emm")->base();
r13654r13655
16051600/*
16061601    CZ-141SF, CZ-127MF, X1turboZII, X1turboZ3 boards
16071602*/
1608static READ8_HANDLER( x1turbo_bank_r )
1603READ8_HANDLER( x1turbo_bank_r )
16091604{
16101605   x1_state *state = space->machine().driver_data<x1_state>();
16111606
r13654r13655
16131608   return state->m_ex_bank & 0x3f;
16141609}
16151610
1616static WRITE8_HANDLER( x1turbo_bank_w )
1611WRITE8_HANDLER( x1turbo_bank_w )
16171612{
16181613   x1_state *state = space->machine().driver_data<x1_state>();
16191614   //UINT8 *RAM = space->machine().region("maincpu")->base();
r13654r13655
16281623}
16291624
16301625/* TODO: waitstate penalties */
1631static READ8_HANDLER( x1_mem_r )
1626READ8_HANDLER( x1_mem_r )
16321627{
16331628   x1_state *state = space->machine().driver_data<x1_state>();
16341629   UINT8 *wram = space->machine().region("wram")->base();
r13654r13655
16421637   return wram[offset]; //RAM
16431638}
16441639
1645static WRITE8_HANDLER( x1_mem_w )
1640WRITE8_HANDLER( x1_mem_w )
16461641{
16471642   //x1_state *state = space->machine().driver_data<x1_state>();
16481643   UINT8 *wram = space->machine().region("wram")->base();
r13654r13655
16501645   wram[offset] = data; //RAM
16511646}
16521647
1653static READ8_HANDLER( x1turbo_mem_r )
1648READ8_HANDLER( x1turbo_mem_r )
16541649{
16551650   x1_state *state = space->machine().driver_data<x1_state>();
16561651
r13654r13655
16641659   return x1_mem_r(space,offset);
16651660}
16661661
1667static WRITE8_HANDLER( x1turbo_mem_w )
1662WRITE8_HANDLER( x1turbo_mem_w )
16681663{
16691664   x1_state *state = space->machine().driver_data<x1_state>();
16701665
r13654r13655
16841679 *
16851680 *************************************/
16861681
1687static READ8_HANDLER( x1_io_r )
1682READ8_HANDLER( x1_io_r )
16881683{
16891684   x1_state *state = space->machine().driver_data<x1_state>();
16901685   state->m_io_bank_mode = 0; //any read disables the extended mode.
r13654r13655
16951690   //if(offset >= 0x0704 && offset <= 0x0707)      { return z80ctc_r(space->machine().device("ctc"), offset-0x0704); }
16961691   else if(offset >= 0x0ff8 && offset <= 0x0fff)   { return x1_fdc_r(space, offset-0xff8); }
16971692   else if(offset >= 0x1400 && offset <= 0x17ff)   { return x1_pcg_r(space, offset-0x1400); }
1698   else if(offset >= 0x1900 && offset <= 0x19ff)   { return sub_io_r(space, 0); }
1693   else if(offset >= 0x1900 && offset <= 0x19ff)   { return x1_sub_io_r(space, 0); }
16991694   else if(offset >= 0x1a00 && offset <= 0x1aff)   { return space->machine().device<i8255_device>("ppi8255_0")->read(*space, (offset-0x1a00) & 3); }
17001695   else if(offset >= 0x1b00 && offset <= 0x1bff)   { return ay8910_r(space->machine().device("ay"), 0); }
17011696//  else if(offset >= 0x1f80 && offset <= 0x1f8f)   { return z80dma_r(space->machine().device("dma"), 0); }
r13654r13655
17041699   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { return z80ctc_r(space->machine().device("ctc"), offset-0x1fa0); }
17051700   else if(offset >= 0x1fa8 && offset <= 0x1fab)   { return z80ctc_r(space->machine().device("ctc"), offset-0x1fa8); }
17061701//  else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { return x1_scrn_r(space,offset-0x1fd0); }
1707//  else if(offset == 0x1fe0)                       { return x1_blackclip_r(space,0); }
1702//  else if(offset == 0x1fe0)                       { return x1turboz_blackclip_r(space,0); }
17081703   else if(offset >= 0x2000 && offset <= 0x2fff)   { return state->m_avram[offset & 0x7ff]; }
17091704   else if(offset >= 0x3000 && offset <= 0x3fff)   { return state->m_tvram[offset & 0x7ff]; } // Ys checks if it's a x1/x1turbo machine by checking if this area is a mirror
17101705   else if(offset >= 0x4000 && offset <= 0xffff)   { return state->m_gfx_bitmap_ram[offset-0x4000+(state->m_scrn_reg.gfx_bank*0xc000)]; }
r13654r13655
17151710   return 0xff;
17161711}
17171712
1718static WRITE8_HANDLER( x1_io_w )
1713WRITE8_HANDLER( x1_io_w )
17191714{
17201715   x1_state *state = space->machine().driver_data<x1_state>();
17211716
r13654r13655
17331728   else if(offset >= 0x1300 && offset <= 0x13ff)   { x1_pri_w(space, 0,data); }
17341729   else if(offset >= 0x1400 && offset <= 0x17ff)   { x1_pcg_w(space, offset-0x1400,data); }
17351730   else if(offset == 0x1800 || offset == 0x1801)   { x1_6845_w(space, offset-0x1800, data); }
1736   else if(offset >= 0x1900 && offset <= 0x19ff)   { sub_io_w(space, 0,data); }
1731   else if(offset >= 0x1900 && offset <= 0x19ff)   { x1_sub_io_w(space, 0,data); }
17371732   else if(offset >= 0x1a00 && offset <= 0x1aff)   { space->machine().device<i8255_device>("ppi8255_0")->write(*space, (offset-0x1a00) & 3,data); }
17381733   else if(offset >= 0x1b00 && offset <= 0x1bff)   { ay8910_data_w(space->machine().device("ay"), 0,data); }
17391734   else if(offset >= 0x1c00 && offset <= 0x1cff)   { ay8910_address_w(space->machine().device("ay"), 0,data); }
1740   else if(offset >= 0x1d00 && offset <= 0x1dff)   { rom_bank_1_w(space,0,data); }
1741   else if(offset >= 0x1e00 && offset <= 0x1eff)   { rom_bank_0_w(space,0,data); }
1735   else if(offset >= 0x1d00 && offset <= 0x1dff)   { x1_rom_bank_1_w(space,0,data); }
1736   else if(offset >= 0x1e00 && offset <= 0x1eff)   { x1_rom_bank_0_w(space,0,data); }
17421737//  else if(offset >= 0x1f80 && offset <= 0x1f8f)   { z80dma_w(space->machine().device("dma"), 0,data); }
17431738//  else if(offset >= 0x1f90 && offset <= 0x1f91)   { z80sio_c_w(space->machine().device("sio"), (offset-0x1f90) & 1,data); }
17441739//  else if(offset >= 0x1f92 && offset <= 0x1f93)   { z80sio_d_w(space->machine().device("sio"), (offset-0x1f92) & 1,data); }
r13654r13655
17491744//  else if(offset == 0x1fc0)                       { x1turbo_txdisp_w(space,0,data); }
17501745//  else if(offset == 0x1fc5)                       { x1turbo_gfxpal_w(space,0,data); }
17511746//  else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { x1_scrn_w(space,0,data); }
1752//  else if(offset == 0x1fe0)                       { x1_blackclip_w(space,0,data); }
1747//  else if(offset == 0x1fe0)                       { x1turbo_blackclip_w(space,0,data); }
17531748   else if(offset >= 0x2000 && offset <= 0x2fff)   { state->m_avram[offset & 0x7ff] = data; }
17541749   else if(offset >= 0x3000 && offset <= 0x3fff)   { state->m_tvram[offset & 0x7ff] = data; }
17551750   else if(offset >= 0x4000 && offset <= 0xffff)   { state->m_gfx_bitmap_ram[offset-0x4000+(state->m_scrn_reg.gfx_bank*0xc000)] = data; }
r13654r13655
17601755}
17611756
17621757/* TODO: I should actually simplify this, by just overwriting X1 Turbo specifics here, and call plain X1 functions otherwise */
1763static READ8_HANDLER( x1turbo_io_r )
1758READ8_HANDLER( x1turbo_io_r )
17641759{
17651760   x1_state *state = space->machine().driver_data<x1_state>();
17661761   state->m_io_bank_mode = 0; //any read disables the extended mode.
r13654r13655
17821777   else if(offset >= 0x0fe8 && offset <= 0x0fef)   { printf("8-inch FD read %04x\n",offset); return 0xff; } // *
17831778   else if(offset >= 0x0ff8 && offset <= 0x0fff)   { return x1_fdc_r(space, offset-0xff8); }
17841779   else if(offset >= 0x1400 && offset <= 0x17ff)   { return x1_pcg_r(space, offset-0x1400); }
1785   else if(offset >= 0x1900 && offset <= 0x19ff)   { return sub_io_r(space, 0); }
1780   else if(offset >= 0x1900 && offset <= 0x19ff)   { return x1_sub_io_r(space, 0); }
17861781   else if(offset >= 0x1a00 && offset <= 0x1aff)   { return space->machine().device<i8255_device>("ppi8255_0")->read(*space, (offset-0x1a00) & 3); }
17871782   else if(offset >= 0x1b00 && offset <= 0x1bff)   { return ay8910_r(space->machine().device("ay"), 0); }
17881783   else if(offset >= 0x1f80 && offset <= 0x1f8f)   { return z80dma_r(space->machine().device("dma"), 0); }
r13654r13655
17951790   else if(offset == 0x1fc0)                  { return x1turbo_txdisp_r(space,0); } // Z only!
17961791   else if(offset == 0x1fc5)                  { return x1turbo_gfxpal_r(space,0); } // Z only!
17971792//  else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { return x1_scrn_r(space,offset-0x1fd0); } //Z only
1798   else if(offset == 0x1fe0)                  { return x1_blackclip_r(space,0); }
1793   else if(offset == 0x1fe0)                  { return x1turboz_blackclip_r(space,0); }
17991794   else if(offset == 0x1ff0)                  { return input_port_read(space->machine(), "X1TURBO_DSW"); }
18001795   else if(offset >= 0x2000 && offset <= 0x2fff)   { return state->m_avram[offset & 0x7ff]; }
18011796   else if(offset >= 0x3000 && offset <= 0x37ff)   { return state->m_tvram[offset & 0x7ff]; }
r13654r13655
18081803   return 0xff;
18091804}
18101805
1811static WRITE8_HANDLER( x1turbo_io_w )
1806WRITE8_HANDLER( x1turbo_io_w )
18121807{
18131808   x1_state *state = space->machine().driver_data<x1_state>();
18141809
r13654r13655
18341829   else if(offset >= 0x1300 && offset <= 0x13ff)   { x1_pri_w(space, 0,data); }
18351830   else if(offset >= 0x1400 && offset <= 0x17ff)   { x1_pcg_w(space, offset-0x1400,data); }
18361831   else if(offset == 0x1800 || offset == 0x1801)   { x1_6845_w(space, offset-0x1800, data); }
1837   else if(offset >= 0x1900 && offset <= 0x19ff)   { sub_io_w(space, 0,data); }
1832   else if(offset >= 0x1900 && offset <= 0x19ff)   { x1_sub_io_w(space, 0,data); }
18381833   else if(offset >= 0x1a00 && offset <= 0x1aff)   { space->machine().device<i8255_device>("ppi8255_0")->write(*space, (offset-0x1a00) & 3,data); }
18391834   else if(offset >= 0x1b00 && offset <= 0x1bff)   { ay8910_data_w(space->machine().device("ay"), 0,data); }
18401835   else if(offset >= 0x1c00 && offset <= 0x1cff)   { ay8910_address_w(space->machine().device("ay"), 0,data); }
1841   else if(offset >= 0x1d00 && offset <= 0x1dff)   { rom_bank_1_w(space,0,data); }
1842   else if(offset >= 0x1e00 && offset <= 0x1eff)   { rom_bank_0_w(space,0,data); }
1836   else if(offset >= 0x1d00 && offset <= 0x1dff)   { x1_rom_bank_1_w(space,0,data); }
1837   else if(offset >= 0x1e00 && offset <= 0x1eff)   { x1_rom_bank_0_w(space,0,data); }
18431838   else if(offset >= 0x1f80 && offset <= 0x1f8f)   { z80dma_w(space->machine().device("dma"), 0,data); }
18441839   else if(offset >= 0x1f90 && offset <= 0x1f93)   { z80dart_ba_cd_w(space->machine().device("sio"), (offset-0x1f90) & 3,data); }
18451840   else if(offset >= 0x1f98 && offset <= 0x1f9f)   { printf("Extended SIO/CTC write %04x %02x\n",offset,data); }
r13654r13655
18541849   else if(offset == 0x1fc4)                  { printf("Z Extra scroll config access %02x\n",data); } // Z only!
18551850   else if(offset == 0x1fc5)                  { x1turbo_gfxpal_w(space,0,data); } // Z only!
18561851   else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { x1_scrn_w(space,0,data); }
1857   else if(offset == 0x1fe0)                  { x1_blackclip_w(space,0,data); }
1852   else if(offset == 0x1fe0)                  { x1turbo_blackclip_w(space,0,data); }
18581853   else if(offset >= 0x2000 && offset <= 0x2fff)   { state->m_avram[offset & 0x7ff] = data; }
18591854   else if(offset >= 0x3000 && offset <= 0x37ff)   { state->m_tvram[offset & 0x7ff] = data; }
18601855   else if(offset >= 0x3800 && offset <= 0x3fff)   { state->m_kvram[offset & 0x7ff] = data; }
r13654r13655
18911886 *
18921887 *************************************/
18931888
1894static READ8_DEVICE_HANDLER( x1_porta_r )
1889READ8_DEVICE_HANDLER( x1_porta_r )
18951890{
18961891   printf("PPI Port A read\n");
18971892   return 0xff;
18981893}
18991894
19001895/* this port is system related */
1901static READ8_DEVICE_HANDLER( x1_portb_r )
1896READ8_DEVICE_HANDLER( x1_portb_r )
19021897{
19031898   x1_state *state = device->machine().driver_data<x1_state>();
19041899   //printf("PPI Port B read\n");
r13654r13655
19421937}
19431938
19441939/* I/O system port */
1945static READ8_DEVICE_HANDLER( x1_portc_r )
1940READ8_DEVICE_HANDLER( x1_portc_r )
19461941{
19471942   x1_state *state = device->machine().driver_data<x1_state>();
19481943   //printf("PPI Port C read\n");
r13654r13655
19561951   return (state->m_io_sys & 0x9f) | state->m_hres_320 | ~state->m_io_switch;
19571952}
19581953
1959static WRITE8_DEVICE_HANDLER( x1_porta_w )
1954WRITE8_DEVICE_HANDLER( x1_porta_w )
19601955{
19611956   //printf("PPI Port A write %02x\n",data);
19621957}
19631958
1964static WRITE8_DEVICE_HANDLER( x1_portb_w )
1959WRITE8_DEVICE_HANDLER( x1_portb_w )
19651960{
19661961   //printf("PPI Port B write %02x\n",data);
19671962}
19681963
1969static WRITE8_DEVICE_HANDLER( x1_portc_w )
1964WRITE8_DEVICE_HANDLER( x1_portc_w )
19701965{
19711966   x1_state *state = device->machine().driver_data<x1_state>();
19721967   state->m_hres_320 = data & 0x40;
r13654r13655
20452040   cputag_set_input_line(field.machine(), "maincpu", INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
20462041}
20472042
2048static INPUT_PORTS_START( x1 )
2043INPUT_PORTS_START( x1 )
20492044   PORT_START("FP_SYS") //front panel buttons, hard-wired with the soft reset/NMI lines
20502045   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CHANGED(ipl_reset,0) PORT_NAME("IPL reset")
20512046   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CHANGED(nmi_reset,0) PORT_NAME("NMI reset")
r13654r13655
24942489}
24952490#endif
24962491
2497static TIMER_DEVICE_CALLBACK(keyboard_callback)
2492TIMER_DEVICE_CALLBACK(x1_keyboard_callback)
24982493{
24992494   x1_state *state = timer.machine().driver_data<x1_state>();
25002495   address_space *space = timer.machine().device("maincpu")->memory().space(AS_PROGRAM);
r13654r13655
25122507      if((key1 != state->m_old_key1) || (key2 != state->m_old_key2) || (key3 != state->m_old_key3) || (key4 != state->m_old_key4) || (f_key != state->m_old_fkey))
25132508      {
25142509         // generate keyboard IRQ
2515         sub_io_w(space,0,0xe6);
2510         x1_sub_io_w(space,0,0xe6);
25162511         state->m_irq_vector = state->m_key_irq_vector;
25172512         state->m_key_irq_flag = 1;
25182513         cputag_set_input_line(timer.machine(),"maincpu",0,ASSERT_LINE);
r13654r13655
25252520   }
25262521}
25272522
2528static TIMER_CALLBACK(x1_rtc_increment)
2523TIMER_CALLBACK(x1_rtc_increment)
25292524{
25302525   x1_state *state = machine.driver_data<x1_state>();
25312526   static const UINT8 dpm[12] = { 0x31, 0x28, 0x31, 0x30, 0x31, 0x30, 0x31, 0x31, 0x30, 0x31, 0x30, 0x31 };
r13654r13655
25532548   if((state->m_rtc.year & 0xf0) >= 0xa0)            { state->m_rtc.year = 0; } //roll over
25542549}
25552550
2556static MACHINE_RESET( x1 )
2551MACHINE_RESET( x1 )
25572552{
25582553   x1_state *state = machine.driver_data<x1_state>();
25592554   //UINT8 *ROM = machine.region("maincpu")->base();
r13654r13655
25992594//  state->m_old_vpos = -1;
26002595}
26012596
2602static MACHINE_RESET( x1turbo )
2597MACHINE_RESET( x1turbo )
26032598{
26042599   x1_state *state = machine.driver_data<x1_state>();
26052600   MACHINE_RESET_CALL( x1 );
r13654r13655
26092604   state->m_scrn_reg.blackclip = 0;
26102605}
26112606
2612static MACHINE_START( x1 )
2607MACHINE_START( x1 )
26132608{
26142609   x1_state *state = machine.driver_data<x1_state>();
26152610
r13654r13655
26302625   }
26312626}
26322627
2633static PALETTE_INIT(x1)
2628PALETTE_INIT(x1)
26342629{
26352630   int i;
26362631
r13654r13655
26842679   MCFG_SCREEN_SIZE(640, 480)
26852680   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
26862681   MCFG_SCREEN_UPDATE(x1)
2687   MCFG_SCREEN_EOF(x1)
26882682
26892683   MCFG_MC6845_ADD("crtc", H46505, (VDP_CLOCK/48), mc6845_intf) //unknown divider
26902684   MCFG_PALETTE_LENGTH(0x10+0x1000)
r13654r13655
27192713   MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(x1_floppy_interface)
27202714   MCFG_SOFTWARE_LIST_ADD("flop_list","x1_flop")
27212715
2722   MCFG_TIMER_ADD_PERIODIC("keyboard_timer", keyboard_callback, attotime::from_hz(250))
2723   MCFG_TIMER_ADD_PERIODIC("cmt_wind_timer", cmt_wind_timer, attotime::from_hz(16))
2716   MCFG_TIMER_ADD_PERIODIC("keyboard_timer", x1_keyboard_callback, attotime::from_hz(250))
2717   MCFG_TIMER_ADD_PERIODIC("x1_cmt_wind_timer", x1_cmt_wind_timer, attotime::from_hz(16))
27242718MACHINE_CONFIG_END
27252719
27262720static MACHINE_CONFIG_DERIVED( x1turbo, x1 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team