src/mess/video/pegasus.c
| r7902 | r7903 | |
| 159 | 159 | 1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0 |
| 160 | 160 | }; |
| 161 | 161 | |
| 162 | | static UINT8 get_mcm6571a_line(UINT8 code, UINT8 line) |
| 162 | static UINT8 get_mcm6571a_line(UINT8 code, UINT8 line, UINT8 pcg_mode, UINT8 *FNT) |
| 163 | 163 | { |
| 164 | if (pcg_mode) |
| 165 | { |
| 166 | return FNT[(code << 4) | line]; |
| 167 | } |
| 168 | else |
| 164 | 169 | if (!mcm6571a_shift[code]) |
| 165 | 170 | { |
| 166 | 171 | if (line < 1) |
| r7902 | r7903 | |
| 189 | 194 | { |
| 190 | 195 | UINT16 addr,xpos,x,y; |
| 191 | 196 | UINT8 b,j,l,code,inv; |
| 197 | UINT8 *FNT = memory_region(screen->machine, "pcg"); |
| 198 | UINT8 pcg_mode = pegasus_control_bits & 2; |
| 192 | 199 | |
| 193 | 200 | for(y = 0; y < 16; y++ ) |
| 194 | 201 | { |
| r7902 | r7903 | |
| 200 | 207 | inv = (code >> 7) ^ 1; |
| 201 | 208 | for(j = 0; j < 16; j++ ) |
| 202 | 209 | { |
| 203 | | l = get_mcm6571a_line(code &0x7f, j); |
| 204 | | for(b = 0; b < 7; b++ ) |
| 205 | | *BITMAP_ADDR16(bitmap, (y<<4)|j, xpos+b ) = inv ^ ((l >> (6-b)) & 1); |
| 206 | | *BITMAP_ADDR16(bitmap, (y<<4)|j, xpos+7 ) = inv; |
| 210 | l = get_mcm6571a_line(code &0x7f, j, pcg_mode, FNT); |
| 211 | for(b = 0; b < 8; b++ ) |
| 212 | *BITMAP_ADDR16(bitmap, (y<<4)|j, xpos+b ) = inv ^ ((l >> (7-b)) & 1); |
| 207 | 213 | } |
| 208 | 214 | xpos +=8; |
| 209 | 215 | } |
src/mess/drivers/pegasus.c
| r7902 | r7903 | |
| 21 | 21 | |
| 22 | 22 | static UINT8 pegasus_kbd_row = 0; |
| 23 | 23 | static UINT8 pegasus_kbd_irq = 1; |
| 24 | | static UINT8 pegasus_control_bits = 0; |
| 24 | UINT8 pegasus_control_bits = 0; |
| 25 | 25 | static running_device *pegasus_cass; |
| 26 | static UINT8 *FNT; |
| 26 | 27 | |
| 27 | | |
| 28 | 28 | static TIMER_DEVICE_CALLBACK( pegasus_firq ) |
| 29 | 29 | { |
| 30 | 30 | running_device *cpu = devtag_get_device( timer->machine, "maincpu" ); |
| r7902 | r7903 | |
| 57 | 57 | { |
| 58 | 58 | /* Bit 0 - Blank - Video blanking |
| 59 | 59 | Bit 1 - Char - select character rom or ram |
| 60 | | Bit 2 - Page - ? |
| 60 | Bit 2 - Page - enables video ram |
| 61 | 61 | Bit 3 - Asc - Select which half of the keyboard to read |
| 62 | 62 | */ |
| 63 | 63 | |
| r7902 | r7903 | |
| 79 | 79 | cassette_output(pegasus_cass, state ? 1 : -1); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | static READ8_HANDLER( pegasus_pcg_r ) |
| 83 | { |
| 84 | UINT8 code = pegasus_video_ram[offset] & 0x7f; |
| 85 | return FNT[(code << 4) | (~pegasus_kbd_row & 15)]; |
| 86 | } |
| 87 | |
| 88 | static WRITE8_HANDLER( pegasus_pcg_w ) |
| 89 | { |
| 90 | // if (pegasus_control_bits & 2) |
| 91 | { |
| 92 | UINT8 code = pegasus_video_ram[offset] & 0x7f; |
| 93 | FNT[(code << 4) | (~pegasus_kbd_row & 15)] = data; |
| 94 | } |
| 95 | } |
| 96 | |
| 82 | 97 | static ADDRESS_MAP_START(pegasus_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 83 | 98 | ADDRESS_MAP_UNMAP_HIGH |
| 84 | | AM_RANGE(0x0000, 0x1fff) AM_ROM |
| 99 | AM_RANGE(0x0000, 0x1fff) AM_ROM AM_WRITENOP |
| 85 | 100 | AM_RANGE(0xb000, 0xbdff) AM_RAM |
| 86 | 101 | AM_RANGE(0xbe00, 0xbfff) AM_RAM AM_BASE(&pegasus_video_ram) |
| 87 | | AM_RANGE(0xc000, 0xdfff) AM_ROM |
| 88 | | AM_RANGE(0xe200, 0xe3ff) AM_RAM // PCG |
| 89 | | AM_RANGE(0xe400, 0xe403) AM_DEVREADWRITE("pegasus_pia_u", pia6821_r, pia6821_w) |
| 90 | | AM_RANGE(0xe600, 0xe603) AM_DEVREADWRITE("pegasus_pia_s", pia6821_r, pia6821_w) |
| 102 | AM_RANGE(0xc000, 0xdfff) AM_ROM AM_WRITENOP |
| 103 | AM_RANGE(0xe200, 0xe3ff) AM_READWRITE(pegasus_pcg_r,pegasus_pcg_w) |
| 104 | AM_RANGE(0xe400, 0xe403) AM_MIRROR(0x1fc) AM_DEVREADWRITE("pegasus_pia_u", pia6821_r, pia6821_w) |
| 105 | AM_RANGE(0xe600, 0xe603) AM_MIRROR(0x1fc) AM_DEVREADWRITE("pegasus_pia_s", pia6821_r, pia6821_w) |
| 91 | 106 | AM_RANGE(0xf000, 0xffff) AM_ROM |
| 92 | 107 | |
| 93 | 108 | /* AM_RANGE(0xe000, 0xe000) AM_READ(pegasus_protection) |
| r7902 | r7903 | |
| 185 | 200 | DEVCB_NULL, /* port A input */ |
| 186 | 201 | DEVCB_HANDLER(pegasus_keyboard_r), /* port B input */ |
| 187 | 202 | DEVCB_LINE(pegasus_cassette_r), /* CA1 input */ |
| 188 | | DEVCB_NULL, /* CB1 input */ |
| 189 | | DEVCB_LINE(pegasus_keyboard_irq), /* CA2 input */ |
| 203 | DEVCB_LINE(pegasus_keyboard_irq), /* CB1 input */ |
| 204 | DEVCB_NULL, /* CA2 input */ |
| 190 | 205 | DEVCB_NULL, /* CB2 input */ |
| 191 | 206 | DEVCB_HANDLER(pegasus_keyboard_w), /* port A output */ |
| 192 | 207 | DEVCB_HANDLER(pegasus_controls), /* port B output */ |
| r7902 | r7903 | |
| 251 | 266 | static MACHINE_START( pegasus ) |
| 252 | 267 | { |
| 253 | 268 | pegasus_cass = devtag_get_device(machine, "cassette"); |
| 269 | FNT = memory_region(machine, "pcg"); |
| 254 | 270 | } |
| 255 | 271 | |
| 256 | 272 | static MACHINE_DRIVER_START( pegasus ) |
| r7902 | r7903 | |
| 258 | 274 | MDRV_CPU_ADD("maincpu", M6809E, XTAL_4MHz) // actually a 6809C |
| 259 | 275 | MDRV_CPU_PROGRAM_MAP(pegasus_mem) |
| 260 | 276 | |
| 261 | | MDRV_TIMER_ADD_PERIODIC("pegasus_firq", pegasus_firq, HZ(50)) |
| 277 | MDRV_TIMER_ADD_PERIODIC("pegasus_firq", pegasus_firq, HZ(400)) // controls accuracy of the clock (ctrl-P) |
| 262 | 278 | MDRV_MACHINE_START(pegasus) |
| 263 | 279 | /* video hardware */ |
| 264 | 280 | MDRV_SCREEN_ADD("screen", RASTER) |
| r7902 | r7903 | |
| 297 | 313 | ROM_FILL(0xf09e, 1, 0x20) // hack out the protection |
| 298 | 314 | // ROM_LOAD( "mon23_2601.bin", 0xf000, 0x1000, CRC(7dd451bb) SHA1(7843e9166151570f9c915589dc252feb0cb1cec4) ) |
| 299 | 315 | // ROM_LOAD( "mon23a_2569.bin", 0xf000, 0x1000, CRC(b4c6b352) SHA1(10bb08305a574dab48d0384e35d0781b6bde880f) ) |
| 316 | ROM_REGION( 0x800, "pcg", ROMREGION_ERASEFF ) |
| 300 | 317 | ROM_END |
| 301 | 318 | |
| 302 | 319 | /* Driver */ |