Previous 15994 Revisions Next

r6676 Wednesday 16th December, 2009 at 14:08:26 UTC by Curt Coder
[ABC800] Simplified memory banking.
[src/mess/drivers]abc80x.c
[src/mess/includes]abc80x.h
[src/mess/machine]conkort.c
[src/mess/video]abc800.c

src/mess/video/abc800.c
r6675r6676
1717#include "machine/z80dart.h"
1818#include "video/mc6845.h"
1919
20/* Character Memory */
21
22READ8_HANDLER( abc800_charram_r )
23{
24   abc800_state *state = space->machine->driver_data;
25
26   return state->charram[offset];
27}
28
29WRITE8_HANDLER( abc800_charram_w )
30{
31   abc800_state *state = space->machine->driver_data;
32
33   state->charram[offset] = data;
34}
35
3620/* Palette Initialization */
3721
3822static PALETTE_INIT( abc800m )
r6675r6676
203187{
204188   abc800_state *state = machine->driver_data;
205189
206   /* allocate memory */
207
208   state->charram = auto_alloc_array(machine, UINT8, ABC800M_CHAR_RAM_SIZE);
209
210190   /* find devices */
211
212191   state->mc6845 = devtag_get_device(machine, MC6845_TAG);
213192
214193   /* find memory regions */
215
216194   state->char_rom = memory_region(machine, "chargen");
217195   state->fgctl_prom = memory_region(machine, "fgctl");
218196
219197   /* register for state saving */
220
221   state_save_register_global_pointer(machine, state->charram, ABC800M_CHAR_RAM_SIZE);
222   state_save_register_global_pointer(machine, state->videoram, ABC800_VIDEO_RAM_SIZE);
223
224198   state_save_register_global(machine, state->hrs);
225199   state_save_register_global(machine, state->fgctl);
226200}
r6675r6676
229203{
230204   abc800_state *state = machine->driver_data;
231205
232   /* allocate memory */
233
234   state->charram = auto_alloc_array(machine, UINT8, ABC800C_CHAR_RAM_SIZE);
235
236206   /* find memory regions */
237
238207   state->char_rom = memory_region(machine, "chargen");
239208   state->fgctl_prom = memory_region(machine, "fgctl");
240209
241210   /* register for state saving */
242
243   state_save_register_global_pointer(machine, state->charram, ABC800C_CHAR_RAM_SIZE);
244   state_save_register_global_pointer(machine, state->videoram, ABC800_VIDEO_RAM_SIZE);
245
246211   state_save_register_global(machine, state->hrs);
247212   state_save_register_global(machine, state->fgctl);
248213}
src/mess/includes/abc80x.h
r6675r6676
131131
132132/*----------- defined in video/abc800.c -----------*/
133133
134READ8_HANDLER( abc800_charram_r );
135WRITE8_HANDLER( abc800_charram_w );
136
137134WRITE8_HANDLER( abc800_hrs_w );
138135WRITE8_HANDLER( abc800_hrc_w );
139136
src/mess/machine/conkort.c
r6675r6676
124124   const device_config *cpu;
125125   const device_config *z80pio;
126126   const device_config *wd1791;
127   const device_config *image0;
128   const device_config *image1;
127129};
128130
129131typedef struct _fast_t fast_t;
r6675r6676
137139   const device_config *cpu;
138140   const device_config *z80dma;
139141   const device_config *wd1793;
142   const device_config *image0;
143   const device_config *image1;
140144};
141145
142146/***************************************************************************
r6675r6676
169173   return get_safe_token_fast(device);
170174}
171175
172INLINE const device_config *get_floppy_image(const device_config *device, int drive)
173{
174   return floppy_get_device_owner(device, drive);
175}
176
177176/***************************************************************************
178177    IMPLEMENTATION
179178***************************************************************************/
r6675r6676
277276//  if (BIT(data, 2)) wd17xx_set_drive(conkort->wd1791, 2);
278277
279278   /* motor enable */
280   floppy_mon_w(get_floppy_image(conkort->wd1791, 0), !BIT(data, 3));
281   floppy_mon_w(get_floppy_image(conkort->wd1791, 1), !BIT(data, 3));
282   floppy_drive_set_ready_state(get_floppy_image(conkort->wd1791, 0), 1, 1);
283   floppy_drive_set_ready_state(get_floppy_image(conkort->wd1791, 1), 1, 1);
279   floppy_mon_w(conkort->image0, !BIT(data, 3));
280   floppy_mon_w(conkort->image1, !BIT(data, 3));
281   floppy_drive_set_ready_state(conkort->image0, 1, 1);
282   floppy_drive_set_ready_state(conkort->image1, 1, 1);
284283
285284   /* disk side selection */
286285   wd17xx_set_side(conkort->wd1791, BIT(data, 4));
r6675r6676
752751   { FLOPPY_0, FLOPPY_1, NULL, NULL }
753752};
754753
755static const floppy_config abc80_floppy_config =
756{
757   DEVCB_NULL,
758   DEVCB_NULL,
759   DEVCB_NULL,
760   DEVCB_NULL,
761   DEVCB_NULL,
762   FLOPPY_DRIVE_DS_80,
763   FLOPPY_OPTIONS_NAME(abc80),
764   DO_NOT_KEEP_GEOMETRY
765};
766
767754static const floppy_config abc800_floppy_config =
768755{
769756   DEVCB_NULL,
r6675r6676
786773
787774   MDRV_Z80PIO_ADD(Z80PIO_TAG, conkort_pio_intf)
788775   MDRV_WD179X_ADD(WD1791_TAG, slow_wd17xx_interface)
789   
790   MDRV_FLOPPY_2_DRIVES_ADD(abc80_floppy_config)
776
777   MDRV_FLOPPY_2_DRIVES_ADD(abc800_floppy_config)
791778MACHINE_DRIVER_END
792779
793780static MACHINE_DRIVER_START( luxor_55_21046 )
r6675r6676
798785
799786   MDRV_Z80DMA_ADD(Z80DMA_TAG, XTAL_16MHz/4, dma_intf)
800787   MDRV_WD1793_ADD(SAB1793_TAG, fast_wd17xx_interface)
801   
802   MDRV_FLOPPY_2_DRIVES_ADD(abc800_floppy_config)   
788
789   MDRV_FLOPPY_2_DRIVES_ADD(abc800_floppy_config)
803790MACHINE_DRIVER_END
804791
805792/* ROMs */
r6675r6676
863850   /* find devices */
864851   conkort->z80pio = device_find_child_by_tag(device, Z80PIO_TAG);
865852   conkort->wd1791 = device_find_child_by_tag(device, WD1791_TAG);
853   conkort->image0 = device_find_child_by_tag(device, FLOPPY_0);
854   conkort->image1 = device_find_child_by_tag(device, FLOPPY_1);
866855
867856   /* register for state saving */
868857   state_save_register_device_item(device, 0, conkort->status);
r6675r6676
929918   /* find devices */
930919   conkort->z80dma = device_find_child_by_tag(device, Z80DMA_TAG);
931920   conkort->wd1793 = device_find_child_by_tag(device, SAB1793_TAG);
921   conkort->image0 = device_find_child_by_tag(device, FLOPPY_0);
922   conkort->image1 = device_find_child_by_tag(device, FLOPPY_1);
932923
933924   /* register for state saving */
934925   state_save_register_device_item(device, 0, conkort->status);
r6675r6676
943934static DEVICE_RESET( luxor_55_21046 )
944935{
945936   fast_t *conkort = device->token;
946   
947   floppy_mon_w(get_floppy_image(conkort->wd1793, 0), CLEAR_LINE);
948   floppy_mon_w(get_floppy_image(conkort->wd1793, 1), CLEAR_LINE);
949   floppy_drive_set_ready_state(get_floppy_image(conkort->wd1793, 0), 1, 1);
950   floppy_drive_set_ready_state(get_floppy_image(conkort->wd1793, 1), 1, 1);
937
938   floppy_mon_w(conkort->image0, CLEAR_LINE);
939   floppy_mon_w(conkort->image1, CLEAR_LINE);
940   floppy_drive_set_ready_state(conkort->image0, 1, 1);
941   floppy_drive_set_ready_state(conkort->image1, 1, 1);
951942}
952943
953944/*-------------------------------------------------
src/mess/drivers/abc80x.c
r6675r6676
8080#include "sound/discrete.h"
8181
8282/* Devices */
83#include "devices/flopdrv.h"
8483#include "devices/cassette.h"
8584#include "devices/printer.h"
8685#include "devices/messram.h"
r6675r6676
216215   if (state->fetch_charram)
217216   {
218217      /* HR video RAM selected */
219      memory_install_readwrite_bank(program, 0x0000, 0x3fff, 0, 0, "bank1");
218      memory_install_ram(program, 0x0000, 0x3fff, 0, 0, state->videoram);
220219   }
221220   else
222221   {
223222      /* BASIC ROM selected */
224      memory_install_read_bank(program, 0x0000, 0x3fff, 0, 0, "bank1");
225      memory_unmap_write(program, 0x0000, 0x3fff, 0, 0);
223      memory_install_rom(program, 0x0000, 0x3fff, 0, 0, memory_region(machine, Z80_TAG));
226224   }
227
228   memory_set_bank(machine, "bank1", state->fetch_charram);
229225}
230226
231227static void abc802_bankswitch(running_machine *machine)
r6675r6676
484480
485481static ADDRESS_MAP_START( abc800m_map, ADDRESS_SPACE_PROGRAM, 8 )
486482   ADDRESS_MAP_UNMAP_HIGH
487   AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1")
483   AM_RANGE(0x0000, 0x3fff) AM_RAM AM_BASE_MEMBER(abc800_state, videoram)
488484   AM_RANGE(0x4000, 0x77ff) AM_ROM
489   AM_RANGE(0x7800, 0x7fff) AM_READWRITE(abc800_charram_r, abc800_charram_w)
485   AM_RANGE(0x7800, 0x7fff) AM_RAM AM_BASE_MEMBER(abc800_state, charram)
490486   AM_RANGE(0x8000, 0xffff) AM_RAM
491487ADDRESS_MAP_END
492488
r6675r6676
509505
510506static ADDRESS_MAP_START( abc800c_map, ADDRESS_SPACE_PROGRAM, 8 )
511507   ADDRESS_MAP_UNMAP_HIGH
512   AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1")
508   AM_RANGE(0x0000, 0x3fff) AM_RAM AM_BASE_MEMBER(abc800_state, videoram)
513509   AM_RANGE(0x4000, 0x7bff) AM_ROM
514   AM_RANGE(0x7c00, 0x7fff) AM_READWRITE(abc800_charram_r, abc800_charram_w)
510   AM_RANGE(0x7c00, 0x7fff) AM_RAM AM_BASE_MEMBER(abc800_state, charram)
515511   AM_RANGE(0x8000, 0xffff) AM_RAM
516512ADDRESS_MAP_END
517513
r6675r6676
978974   /* initialize the ABC BUS */
979975   abcbus_init(machine, Z80_TAG, abcbus_config);
980976
981   /* configure memory */
982   state->videoram = auto_alloc_array(machine, UINT8, ABC800_VIDEO_RAM_SIZE);
983
984   memory_configure_bank(machine, "bank1", 0, 1, memory_region(machine, Z80_TAG), 0);
985   memory_configure_bank(machine, "bank1", 1, 1, state->videoram, 0);
986
987977   /* register for state saving */
988978   state_save_register_global(machine, state->fetch_charram);
989979   state_save_register_global(machine, state->pling);
r6675r6676
991981
992982static MACHINE_RESET( abc800 )
993983{
994   /* memory banking */
984   abc800_state *state = machine->driver_data;
985
986   state->fetch_charram = 0;
995987   abc800_bankswitch(machine);
996988}
997989
r6675r6676
13161308   ROM_LOAD( "fgctl.bin",  0x0000, 0x0200, BAD_DUMP CRC(7a19de8d) SHA1(e7cc49e749b37f7d7dd14f3feda53eae843a8fe0) )
13171309ROM_END
13181310
1319ROM_START( abc800c )
1320   ROM_REGION( 0x10000, Z80_TAG, 0 )
1321   ROM_LOAD( "abc c-12.1m", 0x0000, 0x1000, NO_DUMP )
1322   ROM_LOAD( "abc 1-12.1l", 0x1000, 0x1000, CRC(1e99fbdc) SHA1(ec6210686dd9d03a5ed8c4a4e30e25834aeef71d) )
1323   ROM_LOAD( "abc 2-12.1k", 0x2000, 0x1000, CRC(ac196ba2) SHA1(64fcc0f03fbc78e4c8056e1fa22aee12b3084ef5) )
1324   ROM_LOAD( "abc 3-12.1j", 0x3000, 0x1000, CRC(3ea2b5ee) SHA1(5a51ac4a34443e14112a6bae16c92b5eb636603f) )
1325   ROM_LOAD( "abc 4-12.2m", 0x4000, 0x1000, CRC(695cb626) SHA1(9603ce2a7b2d7b1cbeb525f5493de7e5c1e5a803) )
1326   ROM_LOAD( "abc 5-12.2l", 0x5000, 0x1000, CRC(b4b02358) SHA1(95338efa3b64b2a602a03bffc79f9df297e9534a) )
1327   ROM_LOAD( "abc 6-13.2k", 0x6000, 0x1000, CRC(6fa71fb6) SHA1(b037dfb3de7b65d244c6357cd146376d4237dab6) )
1328   ROM_LOAD( "abc 7-21.2j", 0x7000, 0x1000, CRC(fd137866) SHA1(3ac914d90db1503f61397c0ea26914eb38725044) )
1311#define rom_abc800c rom_abc800m
13291312
1330   ROM_REGION( 0x800, "chargen", 0 )
1331   ROM_LOAD( "vu c-se.bin", 0x0000, 0x0800, NO_DUMP )
1332
1333   ROM_REGION( 0x200, "fgctl", 0 )
1334   ROM_LOAD( "fgctl.bin",  0x0000, 0x0200, BAD_DUMP CRC(7a19de8d) SHA1(e7cc49e749b37f7d7dd14f3feda53eae843a8fe0) )
1335ROM_END
1336
13371313ROM_START( abc802 )
13381314   ROM_REGION( 0x10000, Z80_TAG, 0 )
13391315   ROM_LOAD(  "abc 02-11.9f",  0x0000, 0x2000, CRC(b86537b2) SHA1(4b7731ef801f9a03de0b5acd955f1e4a1828355d) )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team