Previous 15994 Revisions Next

r10029 Thursday 13th January, 2011 at 22:58:01 UTC by Angelo Salese
[PC-8801]: improved bankswitching, enters into proper BASIC
[src/mess/drivers]pc8801.c

src/mess/drivers/pc8801.c
r10028r10029
99     later models at some point.
1010   - macros for the various rom / ram areas, it might require various attempts in order to finally get a reasonable arrangement ...
1111   - dipswitches are WRONG
12   - currently it's too slow ... why?
1213   - below notes states that plain PC-8801 doesn't have a disk CPU, but the BIOS clearly checks the floppy ports. Wrong info?
1314
1415   Notes:
r10028r10029
111112static UINT8 fdc_irq_opcode;
112113static UINT8 ext_rom_bank,gfx_ctrl,vram_sel;
113114static UINT8 vrtc_irq_mask;
115static UINT8 window_offset_bank;
114116
115117#define NBASIC_BASE 0x20000
116118#define N88BASIC_BASE 0x28000
r10028r10029
276278
277279static UINT32 pc8801_bankswitch_0_w(running_machine *machine)
278280{
279   return 0x80000;
281   return WRAM_BASE;
280282}
281283
282284static UINT32 pc8801_bankswitch_1_w(running_machine *machine)
283285{
284   return 0x80000 + 0x6000;
286   return WRAM_BASE + 0x6000;
285287}
286288
287/* TODO: window offset */
288289static UINT32 pc8801_bankswitch_2_r(running_machine *machine)
289290{
290   return 0x88000;
291   if(gfx_ctrl & 6) //wram read select or n basic select banks this as normal wram
292      return WRAM_BASE + 0x8000;
293
294   return WRAM_BASE + (window_offset_bank << 8);
291295}
292296
293297static UINT32 pc8801_bankswitch_2_w(running_machine *machine)
294298{
295   return 0x88000;
299   if(gfx_ctrl & 6) //wram read select or n basic select banks this as normal wram
300      return WRAM_BASE + 0x8000;
301
302   return WRAM_BASE + (window_offset_bank << 8);
296303}
297304
298305/* TODO: this isn't correct */
r10028r10029
326333static ADDRESS_MAP_START( pc8801_mem, ADDRESS_SPACE_PROGRAM, 8 )
327334   AM_RANGE(0x0000, 0x5fff) AM_READWRITE(pc8801_mem_0_r,pc8801_mem_0_w)
328335   AM_RANGE(0x6000, 0x7fff) AM_READWRITE(pc8801_mem_1_r,pc8801_mem_1_w)
329   AM_RANGE(0x8000, 0xbfff) AM_READWRITE(pc8801_mem_2_r,pc8801_mem_2_w)
336   AM_RANGE(0x8000, 0x83ff) AM_READWRITE(pc8801_mem_2_r,pc8801_mem_2_w)
337   AM_RANGE(0x8400, 0xbfff) AM_RAM
330338   AM_RANGE(0xc000, 0xefff) AM_READWRITE(pc8801_mem_3_r,pc8801_mem_3_w)
331339   AM_RANGE(0xf000, 0xffff) AM_READWRITE(pc8801_mem_4_r,pc8801_mem_4_w)
332340ADDRESS_MAP_END
r10028r10029
395403   vrtc_irq_mask = data & 2;
396404}
397405
406static READ8_HANDLER( pc8801_window_bank_r )
407{
408   return window_offset_bank;
409}
410
411static WRITE8_HANDLER( pc8801_window_bank_w )
412{
413   window_offset_bank = data;
414   bankr[2] = pc8801_bankswitch_2_r(space->machine);
415   bankw[2] = pc8801_bankswitch_2_w(space->machine);
416}
417
418static WRITE8_HANDLER( pc8801_window_bank_inc_w )
419{
420   window_offset_bank++;
421   bankr[2] = pc8801_bankswitch_2_r(space->machine);
422   bankw[2] = pc8801_bankswitch_2_w(space->machine);
423}
424
398425static ADDRESS_MAP_START( pc8801_io, ADDRESS_SPACE_IO, 8 )
399426   ADDRESS_MAP_GLOBAL_MASK(0xff)
400427   ADDRESS_MAP_UNMAP_HIGH
r10028r10029
430457//   AM_RANGE(0x60, 0x68) AM_READWRITE(pc88_dmac_r, pc88_dmac_w)
431458//  AM_RANGE(0x6e, 0x6e) AM_NOP                                     /* CPU clock info */
432459//  AM_RANGE(0x6f, 0x6f) AM_NOP                                     /* RS-232C speed ctrl */
433//   AM_RANGE(0x70, 0x70) AM_READWRITE(pc8801_inport_70, pc8801_outport_70)
460   AM_RANGE(0x70, 0x70) AM_READWRITE(pc8801_window_bank_r, pc8801_window_bank_w)
434461   AM_RANGE(0x71, 0x71) AM_READWRITE(pc8801_ext_rom_bank_r, pc8801_ext_rom_bank_w)
435//   AM_RANGE(0x78, 0x78) AM_WRITE(pc8801_outport_78)            /* text window increment */
462   AM_RANGE(0x78, 0x78) AM_WRITE(pc8801_window_bank_inc_w)
436463//  AM_RANGE(0x90, 0x9f) AM_NOP                                     /* CD-ROM */
437464//  AM_RANGE(0xa0, 0xa3) AM_NOP                                     /* music & network */
438465//  AM_RANGE(0xa8, 0xad) AM_NOP                                     /* second sound board */
r10028r10029
869896{
870897   ext_rom_bank = 0xff;
871898   gfx_ctrl = 0x31;
899   window_offset_bank = 0x00;
872900   bankr[0] = pc8801_bankswitch_0_r(machine);
873901   bankr[1] = pc8801_bankswitch_1_r(machine);
874902   bankw[0] = pc8801_bankswitch_0_w(machine);
r10028r10029
889917   bank_wp[3] = 0;
890918   bank_wp[4] = 0;
891919
892   fdc_irq_opcode = 0x00; //TODO: should be 0x7f ld a,a
920   fdc_irq_opcode = 0; //TODO: copied from PC-88VA, could be wrong here ... should be 0x7f ld a,a in the latter case
893921}
894922
895923static PALETTE_INIT( pc8801 )
r10028r10029
953981   MCFG_SCREEN_REFRESH_RATE(60)
954982   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
955983   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
956   MCFG_SCREEN_SIZE(640, 440)
984   MCFG_SCREEN_SIZE(640, 240)
957985   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
958986   MCFG_GFXDECODE( pc8801 )
959987   MCFG_PALETTE_LENGTH(0x10)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team