Previous 15994 Revisions Next

r2551 Monday 5th May, 2008 at 19:51:57 UTC by Wilbert Pol
[IBMPCJR] Added cartridge support.
[src/mess/drivers]pc.c
[src/mess/includes]pc.h
[src/mess/machine]pc.c

src/mess/includes/pc.h
r2550r2551
4545MACHINE_RESET( pc );
4646MACHINE_RESET( pcjr );
4747
48DEVICE_IMAGE_LOAD( pcjr_cartridge );
49
4850INTERRUPT_GEN( pc_frame_interrupt );
4951INTERRUPT_GEN( pc_vga_frame_interrupt );
5052INTERRUPT_GEN( pcjr_frame_interrupt );
src/mess/machine/pc.c
r2550r2551
10281028}
10291029
10301030
1031DEVICE_IMAGE_LOAD( pcjr_cartridge )
1032{
1033   unsigned size = image_length(image);
1034   UINT8   header[0x200];
1035   UINT32   address;
1036
1037   /* Check for supported image sizes */
1038   switch( size )
1039   {
1040   case 0x2200:
1041   case 0x4200:
1042   case 0x8200:
1043   case 0x10200:
1044      break;
1045   default:
1046      image_seterror( image, IMAGE_ERROR_UNSUPPORTED, "Invalid rom file size" );
1047      return 1;
1048   }
1049
1050   /* Read and verify the header */
1051   if ( 512 != image_fread( image, header, 512 ) )
1052   {
1053      image_seterror( image, IMAGE_ERROR_UNSUPPORTED, "Unable to read header" );
1054      return 1;
1055   }
1056
1057   address = header[0x1CF] << 12;
1058
1059   if ( ( address & ( size - 0x201 ) ) != 0 )
1060   {
1061      image_seterror( image, IMAGE_ERROR_UNSUPPORTED, "Invalid header" );
1062      return 1;
1063   }
1064
1065   /* Read the cartridge contents */
1066   if ( ( size - 0x200 ) != image_fread( image, memory_region(REGION_CPU1) + address, size - 0x200 ) )
1067   {
1068      image_seterror( image, IMAGE_ERROR_UNSUPPORTED, "Unable to read cartridge contents" );
1069      return 1;
1070   }
1071
1072   return 0;
1073}
1074
1075
10311076/**************************************************************************
10321077 *
10331078 *      Interrupt handlers.
src/mess/drivers/pc.c
r2550r2551
8484#include "devices/mflopimg.h"
8585#include "devices/harddriv.h"
8686#include "devices/cassette.h"
87#include "devices/cartslot.h"
8788#include "formats/pc_dsk.h"
8889
8990#include "machine/8237dma.h"
r2550r2551
291292
292293
293294
295static ADDRESS_MAP_START(ibmpcjr_map, ADDRESS_SPACE_PROGRAM, 8 )
296   AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK(10)
297   AM_RANGE(0xa0000, 0xaffff) AM_RAM
298   AM_RANGE(0xb0000, 0xb7fff) AM_NOP
299   AM_RANGE(0xb8000, 0xbffff) AM_READWRITE(pc_t1t_videoram_r, pc_video_videoram_w)
300   AM_RANGE(0xc0000, 0xc7fff) AM_NOP
301   AM_RANGE(0xc8000, 0xc9fff) AM_ROM
302   AM_RANGE(0xca000, 0xcffff) AM_NOP
303   AM_RANGE(0xd0000, 0xeffff) AM_ROM
304   AM_RANGE(0xf0000, 0xfffff) AM_ROM
305ADDRESS_MAP_END
306
307
294308static ADDRESS_MAP_START(ibmpcjr_io, ADDRESS_SPACE_IO, 8)
295309   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE(DMA8237, "dma8237", dma8237_r, dma8237_w)
296310   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE(PIC8259, "pic8259_master", pic8259_r, pic8259_w)
r2550r2551
17311745
17321746static MACHINE_DRIVER_START( ibmpcjr )
17331747   /* basic machine hardware */
1734   MDRV_CPU_PC(tandy1000, ibmpcjr, I8088, 4900000, pcjr_frame_interrupt)   /* TODO: Get correct cpu frequency, probably XTAL_14_31818MHz/3 */
1748   MDRV_CPU_PC(ibmpcjr, ibmpcjr, I8088, 4900000, pcjr_frame_interrupt)   /* TODO: Get correct cpu frequency, probably XTAL_14_31818MHz/3 */
17351749
17361750   MDRV_MACHINE_START(pc)
17371751   MDRV_MACHINE_RESET(pcjr)
r2550r2551
22042218   }
22052219}
22062220
2221static void pcjr_cartslot_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
2222{
2223   switch( state )
2224   {
2225   /* --- the following bits of info are returned as 64-bit signed integers --- */
2226   case MESS_DEVINFO_INT_COUNT:                  info->i = 2; break;
2227   case MESS_DEVINFO_INT_MUST_BE_LOADED:            info->i = 0; break;
2228
2229   /* --- the following bits of info are returned as pointers to data or functions --- */
2230   case MESS_DEVINFO_PTR_LOAD:                     info->load = DEVICE_IMAGE_LOAD_NAME( pcjr_cartridge ); break;
2231
2232   /* --- the following bits of info are returned as NULL-terminated strings --- */
2233   case MESS_DEVINFO_STR_FILE_EXTENSIONS:            strcpy( info->s = device_temp_str(), "jrc" ); break;
2234
2235   default:                                 cartslot_device_getinfo( devclass, state, info ); break;
2236   }
2237}
2238
22072239SYSTEM_CONFIG_START(ibmpc)
22082240   CONFIG_RAM_DEFAULT( 640 * 1024 )
22092241   CONFIG_DEVICE(ibmpc_cassette_getinfo)
r2550r2551
22112243   CONFIG_DEVICE(ibmpc_harddisk_getinfo)
22122244SYSTEM_CONFIG_END
22132245
2246SYSTEM_CONFIG_START(pcjr)
2247   CONFIG_RAM_DEFAULT( 640 * 1024 )
2248   CONFIG_DEVICE(ibmpc_cassette_getinfo)
2249   CONFIG_DEVICE(ibmpc_floppy_getinfo)
2250   CONFIG_DEVICE(pcjr_cartslot_getinfo)
2251SYSTEM_CONFIG_END
2252
22142253/***************************************************************************
22152254
22162255  Game driver(s)
r2550r2551
22252264COMP(  1988,   europc,      ibm5150,   0,      europc,     europc,      europc,     ibmpc,   "Schneider Rdf. AG",  "EURO PC", 0)
22262265
22272266// pcjr (better graphics, better sound)
2228COMP(  1983,   ibmpcjr,   ibm5150,   0,      ibmpcjr,    tandy1t,   pcjr,       ibmpc,   "International Business Machines",  "IBM PC Jr", GAME_NOT_WORKING|GAME_IMPERFECT_COLORS )
2267COMP(  1983,   ibmpcjr,   ibm5150,   0,      ibmpcjr,    tandy1t,   pcjr,       pcjr,    "International Business Machines",  "IBM PC Jr", GAME_NOT_WORKING|GAME_IMPERFECT_COLORS )
22292268COMP(  1987,   t1000hx,   ibm5150,   0,      t1000hx,    tandy1t,   t1000hx,   ibmpc,   "Tandy Radio Shack",  "Tandy 1000HX", 0)
22302269COMP(  1987,   t1000sx,   ibm5150,   0,      t1000hx,    tandy1t,   t1000hx,   ibmpc,   "Tandy Radio Shack",  "Tandy 1000SX", 0)
22312270

Previous 15994 Revisions Next


© 1998-2018 The MESS Team