src/mess/video/apf.c
| r1708 | r1709 | |
| 8 | 8 | |
| 9 | 9 | UINT8 *apf_video_ram; |
| 10 | 10 | UINT8 apf_m6847_attr; |
| 11 | static UINT8 apf_chars[0x20], apf_video[0x20]; |
| 11 | 12 | |
| 12 | 13 | static ATTR_CONST UINT8 apf_get_attributes(UINT8 c) |
| 13 | 14 | { |
| 15 | |
| 14 | 16 | /* this seems to be the same so far, as it gives the same result as vapf */ |
| 15 | | UINT8 result = apf_m6847_attr; |
| 17 | UINT8 result = apf_m6847_attr; |
| 18 | if (apf_m6847_attr&M6847_AG) { |
| 19 | result |= M6847_GM2|M6847_GM1; |
| 20 | } else { |
| 16 | 21 | if (c & 0x40) result |= M6847_INV; |
| 17 | 22 | if (c & 0x80) result |= M6847_AS; |
| 23 | } |
| 18 | 24 | return result; |
| 19 | 25 | } |
| 20 | 26 | |
| 27 | static UINT8 apf_get_character(int character, int line) |
| 28 | { |
| 29 | return apf_video_ram[(character&0x1f)*0x10+line+0x200]; |
| 30 | } |
| 21 | 31 | |
| 22 | | |
| 23 | 32 | static void apf_vsync_int(int line) |
| 24 | 33 | { |
| 25 | 34 | extern unsigned int apf_ints; |
| r1708 | r1709 | |
| 34 | 43 | |
| 35 | 44 | static const UINT8 *apf_get_video_ram(int scanline) |
| 36 | 45 | { |
| 37 | | return &apf_video_ram[(scanline / 12) * 0x20 + 0x200]; |
| 46 | if (apf_m6847_attr&M6847_AG) { |
| 47 | /* apf has only 1kbyte ram and can't use all for video of course |
| 48 | it doesn't combine the 6847 with the 6883, instead it has own circuit |
| 49 | to do special 32x12 tilemap at 0x0000 with 8x16 sized characters. The 32 characters are defined at address 0x0200 |
| 50 | and delivers resulting byte to the m6847 which operates in graphics mode |
| 51 | */ |
| 52 | int i; |
| 53 | if ((scanline&0xf)==0) |
| 54 | memcpy (apf_chars, &apf_video_ram[(scanline/16)*0x20], sizeof(apf_chars)); |
| 55 | for (i=0; i<sizeof(apf_video); i++) |
| 56 | apf_video[i]=apf_get_character(apf_chars[i], scanline&0xf); |
| 57 | return apf_video; |
| 58 | } else { |
| 59 | return &apf_video_ram[(scanline / 12) * 0x20 + 0x200]; |
| 60 | } |
| 38 | 61 | } |
| 39 | 62 | |
| 40 | 63 | |
| r1708 | r1709 | |
| 50 | 73 | cfg.get_video_ram = apf_get_video_ram; |
| 51 | 74 | m6847_init(&cfg); |
| 52 | 75 | } |
| 76 | |
| 77 | VIDEO_UPDATE(apf) |
| 78 | { |
| 79 | return VIDEO_UPDATE_CALL(m6847); |
| 80 | } |
src/mess/drivers/apf.c
| r1708 | r1709 | |
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | |
| 3 | driver by ? |
| 4 | |
| 5 | PeT mess@utanet.at around February 2008: |
| 6 | added apfm1000 cartridge loading |
| 7 | fixed apfm1000 pads |
| 8 | added apf video mode |
| 9 | |
| 10 | todo for apf m1000: |
| 11 | add exact cpu/video timing. memory controller+6847 memory operations hold cpu |
| 12 | (backgammon relies on exact video timing) |
| 13 | support special cartridges (basic, space destroyer) |
| 14 | |
| 3 | 15 | ******************************************************************************/ |
| 4 | 16 | #include "driver.h" |
| 5 | 17 | #include "video/m6847.h" |
| r1708 | r1709 | |
| 100 | 112 | /* multi colour graphics mode */ |
| 101 | 113 | /* 158 = 1001 multi-colour graphics */ |
| 102 | 114 | /* 222 = 1101 mono graphics */ |
| 103 | | // if (((previous_mode^data) & 0x0f0)!=0) |
| 115 | if (((previous_mode^data) & 0x0f0)!=0) |
| 104 | 116 | { |
| 105 | | extern UINT8 apf_m6847_attr; |
| 117 | // logerror("apf vidmode %02x\n", data); |
| 106 | 118 | |
| 107 | 119 | /* not sure if this is correct - need to check */ |
| 108 | 120 | apf_m6847_attr = 0x00; |
| 109 | | if (data & 0x80) apf_m6847_attr |= M6847_AG; |
| 110 | | if (data & 0x40) apf_m6847_attr |= M6847_GM2; |
| 111 | | if (data & 0x20) apf_m6847_attr |= M6847_GM1; |
| 112 | | if (data & 0x10) apf_m6847_attr |= M6847_GM0; |
| 121 | if (data & 0x80) apf_m6847_attr |= M6847_AG; |
| 122 | if (data & 0x40) apf_m6847_attr |= M6847_GM0; |
| 123 | // if (data & 0x20) apf_m6847_attr |= M6847_GM1; //? |
| 124 | // if (data & 0x10) apf_m6847_attr |= M6847_GM2; //M6847_GM0; //? |
| 113 | 125 | previous_mode = data; |
| 114 | 126 | } |
| 115 | 127 | } |
| r1708 | r1709 | |
| 514 | 526 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 5") PORT_CODE(KEYCODE_5_PAD) PORT_PLAYER(2) |
| 515 | 527 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 8") PORT_CODE(KEYCODE_8_PAD) PORT_PLAYER(2) |
| 516 | 528 | |
| 529 | PORT_INCLUDE( m6847_artifacting ) |
| 517 | 530 | INPUT_PORTS_END |
| 518 | 531 | |
| 519 | 532 | |
| r1708 | r1709 | |
| 620 | 633 | static MACHINE_DRIVER_START( apf_imagination ) |
| 621 | 634 | /* basic machine hardware */ |
| 622 | 635 | MDRV_CPU_ADD_TAG("main", M6800, 3750000) /* 7.8336 Mhz */ |
| 636 | // MDRV_CPU_ADD_TAG("main", M6800, (3750000/2) ) /* backgammon uses timing from vertical interrupt to switch between video modes during frame */ |
| 623 | 637 | MDRV_CPU_PROGRAM_MAP(apf_imagination_map, 0) |
| 624 | 638 | MDRV_SCREEN_REFRESH_RATE(M6847_NTSC_FRAMES_PER_SECOND) |
| 625 | 639 | MDRV_INTERLEAVE(0) |