src/mess/drivers/ptcsol.c
| r9618 | r9619 | |
| 26 | 26 | |
| 27 | 27 | #include "emu.h" |
| 28 | 28 | #include "cpu/i8085/i8085.h" |
| 29 | #include "machine/terminal.h" |
| 29 | 30 | #include "devices/messram.h" |
| 30 | 31 | |
| 32 | static UINT8 sol20_fa; |
| 33 | static UINT8 sol20_fc; |
| 34 | static UINT8 sol20_fe; |
| 35 | static const UINT8 *FNT; |
| 36 | static const UINT8 *videoram; |
| 37 | |
| 38 | static READ8_HANDLER( sol20_fa_r ) |
| 39 | { |
| 40 | return sol20_fa; |
| 41 | } |
| 42 | |
| 43 | static READ8_HANDLER( sol20_fc_r ) |
| 44 | { |
| 45 | sol20_fa = 0xff; |
| 46 | return sol20_fc; |
| 47 | } |
| 48 | |
| 49 | static WRITE8_HANDLER( sol20_fe_w ) |
| 50 | { |
| 51 | sol20_fe = data; |
| 52 | } |
| 53 | |
| 31 | 54 | static ADDRESS_MAP_START( sol20_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 32 | 55 | AM_RANGE(0X0000, 0Xbfff) AM_RAM // optional s100 ram |
| 33 | 56 | AM_RANGE(0xc000, 0xc7ff) AM_ROM |
| 34 | 57 | AM_RANGE(0Xc800, 0Xcbff) AM_RAM // system ram |
| 35 | | AM_RANGE(0Xcc00, 0Xcfff) AM_RAM // video ram |
| 58 | AM_RANGE(0Xcc00, 0Xcfff) AM_RAM AM_REGION("maincpu", 0xcc00)// video ram |
| 36 | 59 | AM_RANGE(0Xd000, 0Xffff) AM_RAM // optional s100 ram |
| 37 | 60 | ADDRESS_MAP_END |
| 38 | 61 | |
| 39 | 62 | static ADDRESS_MAP_START( sol20_io , ADDRESS_SPACE_IO, 8) |
| 40 | 63 | ADDRESS_MAP_UNMAP_HIGH |
| 41 | 64 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 65 | AM_RANGE(0xfa, 0xfa) AM_READ(sol20_fa_r) |
| 66 | AM_RANGE(0xfc, 0xfc) AM_READ(sol20_fc_r) |
| 67 | AM_RANGE(0xfe, 0xfe) AM_WRITE(sol20_fe_w) |
| 42 | 68 | /* AM_RANGE(0xf8, 0xf8) serial status in (bit 6=data av, bit 7=tmbe) |
| 43 | 69 | AM_RANGE(0xf9, 0xf9) serial data in, out |
| 44 | 70 | AM_RANGE(0xfa, 0xfa) general status in (bit 0=keyb data av, bit 1=parin data av, bit 2=parout ready) |
| r9618 | r9619 | |
| 51 | 77 | |
| 52 | 78 | /* Input ports */ |
| 53 | 79 | static INPUT_PORTS_START( sol20 ) |
| 80 | PORT_INCLUDE(generic_terminal) |
| 54 | 81 | INPUT_PORTS_END |
| 55 | 82 | |
| 56 | 83 | |
| 57 | 84 | static MACHINE_RESET( sol20 ) |
| 58 | 85 | { |
| 86 | sol20_fa=0xff; |
| 87 | sol20_fe=0; |
| 59 | 88 | } |
| 60 | 89 | |
| 61 | 90 | static VIDEO_START( sol20 ) |
| 62 | 91 | { |
| 92 | FNT = memory_region(machine, "chargen"); |
| 93 | videoram = memory_region(machine, "maincpu")+0xcc00; |
| 63 | 94 | } |
| 64 | 95 | |
| 65 | 96 | static VIDEO_UPDATE( sol20 ) |
| 66 | 97 | { |
| 67 | 98 | /* visible screen is 64 x 16, with start position controlled by scroll register */ |
| 99 | static UINT8 framecnt=0; |
| 100 | UINT8 y,ra,chr,gfx; |
| 101 | UINT16 sy=0,ma,x,inv; |
| 102 | |
| 103 | framecnt++; |
| 104 | |
| 105 | ma = sol20_fe << 6; // scroll register |
| 106 | |
| 107 | for (y = 0; y < 16; y++) |
| 108 | { |
| 109 | for (ra = 0; ra < 13; ra++) |
| 110 | { |
| 111 | UINT16 *p = BITMAP_ADDR16(bitmap, sy++, 0); |
| 112 | |
| 113 | for (x = ma; x < ma + 64; x++) |
| 114 | { |
| 115 | chr = videoram[x & 0x3ff]; |
| 116 | inv = 0; |
| 117 | |
| 118 | /* Take care of flashing characters */ |
| 119 | if ((chr & 0x80) && (framecnt & 0x08)) |
| 120 | inv ^= 0xff; |
| 121 | |
| 122 | chr &= 0x7f; |
| 123 | |
| 124 | if (ra == 0) |
| 125 | gfx = 0; |
| 126 | else |
| 127 | if (ra < 10) |
| 128 | |
| 129 | gfx = FNT[(chr<<4) | (ra-1) ] ^ inv; |
| 130 | else |
| 131 | gfx = inv; |
| 132 | |
| 133 | /* Display a scanline of a character */ |
| 134 | *p++ = ( gfx & 0x80 ) ? 1 : 0; |
| 135 | *p++ = ( gfx & 0x40 ) ? 1 : 0; |
| 136 | *p++ = ( gfx & 0x20 ) ? 1 : 0; |
| 137 | *p++ = ( gfx & 0x10 ) ? 1 : 0; |
| 138 | *p++ = ( gfx & 0x08 ) ? 1 : 0; |
| 139 | *p++ = ( gfx & 0x04 ) ? 1 : 0; |
| 140 | *p++ = ( gfx & 0x02 ) ? 1 : 0; |
| 141 | *p++ = ( gfx & 0x01 ) ? 1 : 0; |
| 142 | } |
| 143 | } |
| 144 | ma+=64; |
| 145 | } |
| 68 | 146 | return 0; |
| 69 | 147 | } |
| 70 | 148 | |
| 149 | static WRITE8_DEVICE_HANDLER( sol20_kbd_put ) |
| 150 | { |
| 151 | sol20_fa &= 0xfe; |
| 152 | sol20_fc = data; |
| 153 | } |
| 154 | |
| 155 | static GENERIC_TERMINAL_INTERFACE( sol20_terminal_intf ) |
| 156 | { |
| 157 | DEVCB_HANDLER(sol20_kbd_put) |
| 158 | }; |
| 159 | |
| 71 | 160 | static MACHINE_CONFIG_START( sol20, driver_device ) |
| 72 | 161 | /* basic machine hardware */ |
| 73 | 162 | MDRV_CPU_ADD("maincpu",I8080, XTAL_14_31818MHz/7) |
| r9618 | r9619 | |
| 81 | 170 | MDRV_SCREEN_REFRESH_RATE(50) |
| 82 | 171 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 83 | 172 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 84 | | MDRV_SCREEN_SIZE(640, 480) |
| 85 | | MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 173 | MDRV_SCREEN_SIZE(512, 208) |
| 174 | MDRV_SCREEN_VISIBLE_AREA(0, 511, 0, 207) |
| 86 | 175 | MDRV_PALETTE_LENGTH(2) |
| 87 | 176 | MDRV_PALETTE_INIT(black_and_white) |
| 88 | 177 | |
| r9618 | r9619 | |
| 93 | 182 | // MDRV_RAM_ADD("messram") |
| 94 | 183 | // MDRV_RAM_DEFAULT_SIZE("8K") |
| 95 | 184 | // MDRV_RAM_EXTRA_OPTIONS("16K,32K") |
| 185 | MDRV_GENERIC_TERMINAL_ADD("terminal", sol20_terminal_intf) |
| 96 | 186 | MACHINE_CONFIG_END |
| 97 | 187 | |
| 98 | 188 | /* ROM definition */ |
| r9618 | r9619 | |
| 100 | 190 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 101 | 191 | ROM_LOAD( "solos.rom", 0xc000, 0x0800, BAD_DUMP CRC(4d0af383) SHA1(ac4510c3380ed4a31ccf4f538af3cb66b76701ef) ) // from solace emu |
| 102 | 192 | /* Character generator rom is missing */ |
| 193 | |
| 194 | /* character generator not dumped, using the one from 'c10' for now */ |
| 195 | ROM_REGION( 0x2000, "chargen", 0 ) |
| 196 | ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) |
| 103 | 197 | ROM_END |
| 104 | 198 | |
| 105 | 199 | /* Driver */ |