Previous 15994 Revisions Next

r5693 Friday 11th September, 2009 at 16:45:26 UTC by Angelo Salese
[X1]: Improved vdisp/vsync behaviour
[src/mess/drivers]x1.c

src/mess/drivers/x1.c
r5692r5693
154154#include "formats/fm7_dsk.h"
155155#include <ctype.h>
156156
157static UINT8 hres_320,io_switch,io_sys;
157static UINT8 hres_320,io_switch,io_sys,vsync,vdisp;
158158static UINT8 io_bank_mode;
159159static UINT8 *gfx_bitmap_ram;
160160static UINT16 pcg_index[3];
r5692r5693
172172   UINT8 blackclip; // x1 turbo specific
173173}scrn_reg;
174174
175static struct
176{
177   UINT8 pal;
178   UINT8 gfx_pal;
179   UINT8 txt_pal;
180   UINT8 txt_disp;
181}turbo_reg;
182
175183static UINT8 pcg_write_addr;
176184
177185
r5692r5693
886894         used_pcg_addr = pcg_write_addr*8;
887895         pcg_offset = (pcg_index[addr-1]+used_pcg_addr) & 0x7ff;
888896         pcg_offset+=((addr-1)*0x800);
897         printf("%04x\n",pcg_offset);
889898         PCG_RAM[pcg_offset] = data;
890899
891900         pcg_offset &= 0x7ff;
r5692r5693
10041013   scrn_reg.blackclip = data;
10051014}
10061015
1016static READ8_HANDLER( x1turbo_pal_r )    { return turbo_reg.pal; }
1017static READ8_HANDLER( x1turbo_txpal_r )  { return turbo_reg.txt_pal; }
1018static READ8_HANDLER( x1turbo_txdisp_r ) { return turbo_reg.txt_disp; }
1019static READ8_HANDLER( x1turbo_gfxpal_r ) { return turbo_reg.gfx_pal; }
1020
10071021static WRITE8_HANDLER( x1turbo_pal_w )
10081022{
10091023   printf("TURBO PAL %02x\n",data);
1024   turbo_reg.pal = data;
10101025}
10111026
10121027static WRITE8_HANDLER( x1turbo_txpal_w )
10131028{
10141029   printf("TURBO TEXT PAL %02x\n",data);
1030   turbo_reg.txt_pal = data;
10151031}
10161032
10171033static WRITE8_HANDLER( x1turbo_txdisp_w )
10181034{
10191035   printf("TURBO TEXT DISPLAY %02x\n",data);
1036   turbo_reg.txt_disp = data;
10201037}
10211038
10221039static WRITE8_HANDLER( x1turbo_gfxpal_w )
10231040{
10241041   printf("TURBO GFX PAL %02x\n",data);
1042   turbo_reg.gfx_pal = data;
10251043}
10261044
10271045/*************************************
r5692r5693
11151133   else if(offset >= 0x1f92 && offset <= 0x1f93)   { return z80sio_d_r(devtag_get_device(space->machine, "sio"), (offset-0x1f92) & 1); }
11161134   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa0); }
11171135   else if(offset >= 0x1fa8 && offset <= 0x1fab)   { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa8); }
1136   else if(offset == 0x1fb0)                  { return x1turbo_pal_r(space,0); }
1137   else if(offset >= 0x1fb9 && offset <= 0x1fbf)   { return x1turbo_txpal_r(space,offset-0x1fb9); }
1138   else if(offset == 0x1fc0)                  { return x1turbo_txdisp_r(space,0); }
1139   else if(offset == 0x1fc5)                  { return x1turbo_gfxpal_r(space,0); }
11181140//   else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { return x1_scrn_r(space,offset-0x1fd0); }
11191141   else if(offset == 0x1fe0)                  { return x1_blackclip_r(space,0); }
11201142   else if(offset >= 0x2000 && offset <= 0x2fff)   { return colorram[offset-0x2000]; }
r5692r5693
12121234   ---- ---x "cmt test" (active low)
12131235   */
12141236   UINT8 dat = 0;
1215   dat = (input_port_read(device->machine, "SYSTEM") & ~0x6e) | sub_obf;
1237   vdisp = (video_screen_get_vpos(device->machine->primary_screen) < 200) ? 0x80 : 0x00;
1238   dat = (input_port_read(device->machine, "SYSTEM") & 0x11) | sub_obf | vsync | vdisp;
12161239
1217   if((dat & 0x80) == 0)
1218      dat |= 0x04;  // VSync (todo: proper implementation of vsync)
1219
12201240   if(cassette_input(devtag_get_device(device->machine,"cass")) > 0.03)
12211241      dat |= 0x02;
12221242
r5692r5693
12771297   DEVCB_HANDLER(x1_portc_w)                  /* Port C write */
12781298};
12791299
1300static WRITE_LINE_DEVICE_HANDLER(vsync_changed)
1301{
1302   vsync = (state & 1) ? 0x04 : 0x00;
1303   //printf("%d %02x\n",video_screen_get_vpos(device->machine->primary_screen),vsync);
1304}
1305
12801306static const mc6845_interface mc6845_intf =
12811307{
12821308   "screen",   /* screen we are acting on */
r5692r5693
12871313   DEVCB_NULL,   /* callback for display state changes */
12881314   DEVCB_NULL,   /* callback for cursor state changes */
12891315   DEVCB_NULL,   /* HSYNC callback */
1290   DEVCB_NULL,   /* VSYNC callback */
1316   DEVCB_LINE(vsync_changed),   /* VSYNC callback */
12911317   NULL      /* update address callback */
12921318};
12931319

Previous 15994 Revisions Next


© 1998-2018 The MESS Team