Previous 15994 Revisions Next

r7903 Tuesday 27th April, 2010 at 03:23:27 UTC by Robbbert
[PEGASUS] Added PCG. Tank game starts up now.
[src/mess/drivers]pegasus.c
[src/mess/includes]pegasus.h
[src/mess/video]pegasus.c

src/mess/video/pegasus.c
r7902r7903
159159   1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0
160160};
161161
162static UINT8 get_mcm6571a_line(UINT8 code, UINT8 line)
162static UINT8 get_mcm6571a_line(UINT8 code, UINT8 line, UINT8 pcg_mode, UINT8 *FNT)
163163{
164   if (pcg_mode)
165   {
166      return FNT[(code << 4) | line];
167   }
168   else
164169   if (!mcm6571a_shift[code])
165170   {
166171      if (line < 1)
r7902r7903
189194{
190195   UINT16 addr,xpos,x,y;
191196   UINT8 b,j,l,code,inv;
197   UINT8 *FNT = memory_region(screen->machine, "pcg");
198   UINT8 pcg_mode = pegasus_control_bits & 2;
192199
193200   for(y = 0; y < 16; y++ )
194201   {
r7902r7903
200207         inv = (code >> 7) ^ 1;
201208         for(j = 0; j < 16; j++ )
202209         {
203            l = get_mcm6571a_line(code &0x7f, j);
204            for(b = 0; b < 7; b++ )
205               *BITMAP_ADDR16(bitmap, (y<<4)|j, xpos+b ) =  inv ^ ((l >> (6-b)) & 1);
206            *BITMAP_ADDR16(bitmap, (y<<4)|j, xpos+7 ) =  inv;
210            l = get_mcm6571a_line(code &0x7f, j, pcg_mode, FNT);
211            for(b = 0; b < 8; b++ )
212               *BITMAP_ADDR16(bitmap, (y<<4)|j, xpos+b ) =  inv ^ ((l >> (7-b)) & 1);
207213         }
208214         xpos +=8;
209215      }
src/mess/includes/pegasus.h
r7902r7903
44extern VIDEO_START( pegasus );
55extern VIDEO_UPDATE( pegasus );
66
7extern UINT8 pegasus_control_bits;
8
src/mess/drivers/pegasus.c
r7902r7903
2121
2222static UINT8 pegasus_kbd_row = 0;
2323static UINT8 pegasus_kbd_irq = 1;
24static UINT8 pegasus_control_bits = 0;
24UINT8 pegasus_control_bits = 0;
2525static running_device *pegasus_cass;
26static UINT8 *FNT;
2627
27
2828static TIMER_DEVICE_CALLBACK( pegasus_firq )
2929{
3030   running_device *cpu = devtag_get_device( timer->machine, "maincpu" );
r7902r7903
5757{
5858/*   Bit 0 - Blank - Video blanking
5959   Bit 1 - Char - select character rom or ram
60   Bit 2 - Page - ?
60   Bit 2 - Page - enables video ram
6161   Bit 3 - Asc - Select which half of the keyboard to read
6262*/
6363
r7902r7903
7979   cassette_output(pegasus_cass, state ? 1 : -1);
8080}
8181
82static READ8_HANDLER( pegasus_pcg_r )
83{
84   UINT8 code = pegasus_video_ram[offset] & 0x7f;
85   return FNT[(code << 4) | (~pegasus_kbd_row & 15)];
86}
87
88static WRITE8_HANDLER( pegasus_pcg_w )
89{
90//   if (pegasus_control_bits & 2)
91   {
92      UINT8 code = pegasus_video_ram[offset] & 0x7f;
93      FNT[(code << 4) | (~pegasus_kbd_row & 15)] = data;
94   }
95}
96
8297static ADDRESS_MAP_START(pegasus_mem, ADDRESS_SPACE_PROGRAM, 8)
8398   ADDRESS_MAP_UNMAP_HIGH
84   AM_RANGE(0x0000, 0x1fff) AM_ROM
99   AM_RANGE(0x0000, 0x1fff) AM_ROM AM_WRITENOP
85100   AM_RANGE(0xb000, 0xbdff) AM_RAM
86101   AM_RANGE(0xbe00, 0xbfff) AM_RAM AM_BASE(&pegasus_video_ram)
87   AM_RANGE(0xc000, 0xdfff) AM_ROM
88   AM_RANGE(0xe200, 0xe3ff) AM_RAM      // PCG
89   AM_RANGE(0xe400, 0xe403) AM_DEVREADWRITE("pegasus_pia_u", pia6821_r, pia6821_w)
90   AM_RANGE(0xe600, 0xe603) AM_DEVREADWRITE("pegasus_pia_s", pia6821_r, pia6821_w)
102   AM_RANGE(0xc000, 0xdfff) AM_ROM AM_WRITENOP
103   AM_RANGE(0xe200, 0xe3ff) AM_READWRITE(pegasus_pcg_r,pegasus_pcg_w)
104   AM_RANGE(0xe400, 0xe403) AM_MIRROR(0x1fc) AM_DEVREADWRITE("pegasus_pia_u", pia6821_r, pia6821_w)
105   AM_RANGE(0xe600, 0xe603) AM_MIRROR(0x1fc) AM_DEVREADWRITE("pegasus_pia_s", pia6821_r, pia6821_w)
91106   AM_RANGE(0xf000, 0xffff) AM_ROM
92107
93108/*   AM_RANGE(0xe000, 0xe000) AM_READ(pegasus_protection)
r7902r7903
185200   DEVCB_NULL,                  /* port A input */
186201   DEVCB_HANDLER(pegasus_keyboard_r),         /* port B input */
187202   DEVCB_LINE(pegasus_cassette_r),            /* CA1 input */
188   DEVCB_NULL,                  /* CB1 input */
189   DEVCB_LINE(pegasus_keyboard_irq),         /* CA2 input */
203   DEVCB_LINE(pegasus_keyboard_irq),         /* CB1 input */
204   DEVCB_NULL,                  /* CA2 input */
190205   DEVCB_NULL,                  /* CB2 input */
191206   DEVCB_HANDLER(pegasus_keyboard_w),         /* port A output */
192207   DEVCB_HANDLER(pegasus_controls),         /* port B output */
r7902r7903
251266static MACHINE_START( pegasus )
252267{
253268   pegasus_cass = devtag_get_device(machine, "cassette");
269   FNT = memory_region(machine, "pcg");
254270}
255271
256272static MACHINE_DRIVER_START( pegasus )
r7902r7903
258274   MDRV_CPU_ADD("maincpu", M6809E, XTAL_4MHz)   // actually a 6809C
259275   MDRV_CPU_PROGRAM_MAP(pegasus_mem)
260276
261   MDRV_TIMER_ADD_PERIODIC("pegasus_firq", pegasus_firq, HZ(50))
277   MDRV_TIMER_ADD_PERIODIC("pegasus_firq", pegasus_firq, HZ(400))   // controls accuracy of the clock (ctrl-P)
262278   MDRV_MACHINE_START(pegasus)
263279   /* video hardware */
264280   MDRV_SCREEN_ADD("screen", RASTER)
r7902r7903
297313   ROM_FILL(0xf09e, 1, 0x20)      // hack out the protection
298314//   ROM_LOAD( "mon23_2601.bin", 0xf000, 0x1000, CRC(7dd451bb) SHA1(7843e9166151570f9c915589dc252feb0cb1cec4) )
299315//   ROM_LOAD( "mon23a_2569.bin", 0xf000, 0x1000, CRC(b4c6b352) SHA1(10bb08305a574dab48d0384e35d0781b6bde880f) )
316   ROM_REGION( 0x800, "pcg", ROMREGION_ERASEFF )
300317ROM_END
301318
302319/* Driver */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team