Previous 15994 Revisions Next

r1814 Saturday 1st March, 2008 at 09:00:51 UTC by Wilbert Pol
[PET] Updated to use the new mc6845 device implementation.
[src/mess/drivers]pet.c
[src/mess/includes]pet.h
[src/mess/machine]pet.c
[src/mess/video]pet.c

src/mess/includes/pet.h
r1813r1814
99
1010#include "video/mc6845.h"
1111
12READ8_HANDLER( pet_mc6845_register_r );
13WRITE8_HANDLER( pet_mc6845_register_w );
14WRITE8_HANDLER( pet_mc6845_address_w );
1215
1316/*----------- defined in video/pet.c -----------*/
1417
r1813r1814
1922VIDEO_UPDATE( pet );
2023MC6845_UPDATE_ROW( pet40_update_row );
2124MC6845_UPDATE_ROW( pet80_update_row );
25void pet_display_enable_changed(running_machine *machine, mc6845_t *mc6845, int display_enabled);
2226
2327extern int pet_font;
2428
src/mess/video/pet.c
r1813r1814
103103   }
104104}
105105
106void pet_display_enable_changed(running_machine *machine, mc6845_t *mc6845, int display_enabled)
107{
108}
109
src/mess/machine/pet.c
r1813r1814
1818#include "includes/pet.h"
1919#include "includes/cbmserb.h"
2020#include "includes/cbmieeeb.h"
21#include "video/mc6845.h"
2221
2322/* keyboard lines */
2423static int pet_basic1=0; /* basic version 1 for quickloader */
r1813r1814
256255   else if (offset<0x40) ;
257256   else if (offset<0x50) via_0_w(offset&0xf,data);
258257   else if (offset<0x80) ;
259   else if (offset == 0x80) crtc6845_0_address_w(offset&1, data);
260   else if (offset == 0x81) crtc6845_0_register_w(offset&1,data);
258   else if (offset == 0x80) pet_mc6845_address_w(offset, data);
259   else if (offset == 0x81) pet_mc6845_register_w(offset, data);
261260}
262261
263262static  READ8_HANDLER(cbm8096_io_r)
r1813r1814
270269   else if (offset<0x40) ;
271270   else if (offset<0x50) data=via_0_r(offset&0xf);
272271   else if (offset<0x80) ;
273   else if (offset == 0x81) data=crtc6845_0_register_r(offset&1);
272   else if (offset == 0x81) data=pet_mc6845_register_r(offset);
274273   return data;
275274}
276275
r1813r1814
494493   pet_vh_init();
495494}
496495
497//static const struct mscrtc6845_config crtc_pet = { 800000 /*?*/};
498static void pet_display_enable_changed(running_machine *machine, mc6845_t *mc6845, int display_enabled)
499{
500}
501
502static const mc6845_interface crtc_pet40 = {
503   0,
504   800000 /*?*/,
505   8 /*?*/,
506   NULL,
507   pet40_update_row,
508   NULL,
509   pet_display_enable_changed
510};
511
512static const mc6845_interface crtc_pet80 = {
513   0,
514   800000 /*?*/,
515   16 /*?*/,
516   NULL,
517   pet80_update_row,
518   NULL,
519   pet_display_enable_changed
520};
521
522496DRIVER_INIT( pet40 )
523497{
524498   pet_common_driver_init ();
525499   pia_config(0, &pet_pia0);
526500   pet_vh_init();
527   crtc6845_config( 0, &crtc_pet40);
528501}
529502
530503DRIVER_INIT( cbm80 )
r1813r1814
537510   videoram = &pet_memory[0x8000];
538511   videoram_size = 0x800;
539512   pet80_vh_init();
540   crtc6845_config( 0, &crtc_pet80);
541513}
542514
543515DRIVER_INIT( superpet )
r1813r1814
552524   memory_set_bank(1, 0);
553525
554526   superpet_vh_init();
555   crtc6845_config( 0, &crtc_pet80);
556527}
557528
558529MACHINE_RESET( pet )
src/mess/drivers/pet.c
r1813r1814
125125#include "includes/cbmieeeb.h"
126126/*#include "includes/vc1541.h" */
127127
128static mc6845_t   *mc6845;
129
128130static ADDRESS_MAP_START(pet_mem , ADDRESS_SPACE_PROGRAM, 8)
129   AM_RANGE(0x8000, 0x83ff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size )
131   AM_RANGE(0x8000, 0x83ff) AM_MIRROR(0x0c00) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size )
130132   AM_RANGE(0xa000, 0xe7ff) AM_ROM
131133   AM_RANGE(0xe810, 0xe813) AM_READWRITE(pia_0_r, pia_0_w)
132134   AM_RANGE(0xe820, 0xe823) AM_READWRITE(pia_1_r, pia_1_w)
r1813r1814
136138ADDRESS_MAP_END
137139
138140static ADDRESS_MAP_START( pet40_mem , ADDRESS_SPACE_PROGRAM, 8)
139   AM_RANGE(0x8000, 0x83ff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size )
141   AM_RANGE(0x8000, 0x83ff) AM_MIRROR(0x0c00) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size )
140142   AM_RANGE(0xa000, 0xe7ff) AM_ROM
141143   AM_RANGE(0xe810, 0xe813) AM_READWRITE(pia_0_r, pia_0_w)
142144   AM_RANGE(0xe820, 0xe823) AM_READWRITE(pia_1_r, pia_1_w)
143145   AM_RANGE(0xe840, 0xe84f) AM_READWRITE(via_0_r, via_0_w)
144   AM_RANGE(0xe880, 0xe880) AM_WRITE( crtc6845_0_address_w )
145   AM_RANGE(0xe881, 0xe881) AM_READWRITE(crtc6845_0_register_r, crtc6845_0_register_w)
146   AM_RANGE(0xe880, 0xe880) AM_WRITE( pet_mc6845_address_w )
147   AM_RANGE(0xe881, 0xe881) AM_READWRITE(pet_mc6845_register_r, pet_mc6845_register_w)
146148   AM_RANGE(0xf000, 0xffff) AM_ROM
147149ADDRESS_MAP_END
148150
r1813r1814
158160   AM_RANGE(0xe810, 0xe813) AM_READWRITE(pia_0_r, pia_0_w)
159161   AM_RANGE(0xe820, 0xe823) AM_READWRITE(pia_1_r, pia_1_w)
160162   AM_RANGE(0xe840, 0xe84f) AM_READWRITE(via_0_r, via_0_w)
161   AM_RANGE(0xe880, 0xe880) AM_WRITE( crtc6845_0_address_w )
162   AM_RANGE(0xe881, 0xe881) AM_READWRITE(crtc6845_0_register_r, crtc6845_0_register_w)
163   AM_RANGE(0xe880, 0xe880) AM_WRITE( pet_mc6845_address_w )
164   AM_RANGE(0xe881, 0xe881) AM_READWRITE(pet_mc6845_register_r, pet_mc6845_register_w)
163165#endif
164166   AM_RANGE(0xf000, 0xffff) AM_READ(MRA8_BANK8)
165167   AM_RANGE(0xf000, 0xffef) AM_WRITE(MWA8_BANK8)
r1813r1814
189191   AM_RANGE(0xe810, 0xe813) AM_READWRITE(pia_0_r, pia_0_w)
190192   AM_RANGE(0xe820, 0xe823) AM_READWRITE(pia_1_r, pia_1_w)
191193   AM_RANGE(0xe840, 0xe84f) AM_READWRITE(via_0_r, via_0_w)
192   AM_RANGE(0xe880, 0xe880) AM_WRITE(crtc6845_0_address_w)
193   AM_RANGE(0xe881, 0xe881) AM_READWRITE(crtc6845_0_register_r, crtc6845_0_register_w)
194   AM_RANGE(0xe880, 0xe880) AM_WRITE(pet_mc6845_address_w)
195   AM_RANGE(0xe881, 0xe881) AM_READWRITE(pet_mc6845_register_r, pet_mc6845_register_w)
194196   /* 0xefe0, 0xefe3, mos 6702 */
195197   /* 0xeff0, 0xeff3, acia6551 */
196198   AM_RANGE(0xeff8, 0xefff) AM_READWRITE(superpet_r, superpet_w)
r1813r1814
205207   AM_RANGE(0xe810, 0xe813) AM_READWRITE(pia_0_r, pia_0_w)
206208   AM_RANGE(0xe820, 0xe823) AM_READWRITE(pia_1_r, pia_1_w)
207209   AM_RANGE(0xe840, 0xe84f) AM_READWRITE(via_0_r, via_0_w)
208   AM_RANGE(0xe880, 0xe880) AM_WRITE(crtc6845_0_address_w)
209   AM_RANGE(0xe881, 0xe881) AM_READWRITE(crtc6845_0_register_r, crtc6845_0_register_w)
210   AM_RANGE(0xe880, 0xe880) AM_WRITE(pet_mc6845_address_w)
211   AM_RANGE(0xe881, 0xe881) AM_READWRITE(pet_mc6845_register_r, pet_mc6845_register_w)
210212   AM_RANGE(0xeff8, 0xefff) AM_READWRITE(superpet_r, superpet_w)
211213   AM_RANGE(0xf000, 0xffff) AM_ROM
212214ADDRESS_MAP_END
r1813r1814
476478   0,0x80,0, /* green */
477479};
478480
479static const unsigned short pet_colortable[][2] = {
480   { 0, 1 },
481   /* reverse */
482   { 1, 0 }
483};
484
485481static const gfx_layout pet_charlayout =
486482{
487483   8,8,
r1813r1814
529525   GFXDECODE_ENTRY( REGION_GFX1, 0x3000, pet80_charlayout, 0, 1 )
530526GFXDECODE_END
531527
528static const mc6845_interface crtc_pet40 = {
529   0,
530   XTAL_17_73447MHz/3,         /* This is a wild guess and mostly likely incorrect */
531   8,
532   NULL,
533   pet40_update_row,
534   NULL,
535   pet_display_enable_changed,
536   NULL,
537   NULL
538};
539
540static const mc6845_interface crtc_pet80 = {
541   0,
542   XTAL_12MHz / 2,         /* This is a wild guess and mostly likely incorrect */
543   16,
544   NULL,
545   pet80_update_row,
546   NULL,
547   pet_display_enable_changed,
548   NULL,
549   NULL
550};
551
532552static PALETTE_INIT( pet )
533553{
534554   palette_set_colors_rgb(machine, 0, pet_palette, sizeof(pet_palette) / 3);
535555}
536556
557static VIDEO_START( pet_crtc ) {
558   mc6845 = devtag_get_token(machine, MC6845, "crtc");
559}
560
561static VIDEO_UPDATE( pet_crtc ) {
562   mc6845_update(mc6845, bitmap, cliprect);
563   return 0;
564}
565
566READ8_HANDLER( pet_mc6845_register_r ) {
567   return mc6845_register_r( mc6845 );
568}
569
570WRITE8_HANDLER( pet_mc6845_register_w ) {
571   mc6845_register_w( mc6845, data );
572}
573
574WRITE8_HANDLER( pet_mc6845_address_w ) {
575   mc6845_address_w( mc6845, data );
576}
577
537578/* basic 1 */
538579ROM_START (pet)
539580   ROM_REGION (0x10000, REGION_CPU1, 0)
r1813r1814
815856   MDRV_IMPORT_FROM( pet )
816857   MDRV_CPU_MODIFY( "main" )
817858   MDRV_CPU_PROGRAM_MAP( pet40_mem, 0 )
818   MDRV_VIDEO_UPDATE( crtc6845 )
859
860   MDRV_DEVICE_ADD("crtc", MC6845)
861   MDRV_DEVICE_CONFIG( crtc_pet40 )
862
863   MDRV_VIDEO_START( pet_crtc )
864   MDRV_VIDEO_UPDATE( pet_crtc )
819865MACHINE_DRIVER_END
820866
821867
r1813r1814
837883   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
838884   MDRV_SCREEN_SIZE(640, 250)
839885   MDRV_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 250 - 1)
886
887   MDRV_DEVICE_ADD("crtc", MC6845)
888   MDRV_DEVICE_CONFIG( crtc_pet80 )
889
840890   MDRV_GFXDECODE( pet80 )
841   MDRV_VIDEO_UPDATE( crtc6845 )
891   MDRV_VIDEO_START( pet_crtc )
892   MDRV_VIDEO_UPDATE( pet_crtc )
842893MACHINE_DRIVER_END
843894
844895
r1813r1814
861912
862913   MDRV_SCREEN_MODIFY("main")
863914   MDRV_SCREEN_REFRESH_RATE(50)
864
865    /* video hardware */
866915   MDRV_GFXDECODE( superpet )
867916MACHINE_DRIVER_END
868917

Previous 15994 Revisions Next


© 1998-2018 The MESS Team