src/mess/drivers/cd2650.c
| r9778 | r9779 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | | cd2650 |
| 3 | Central Data cd2650 |
| 4 | 4 | |
| 5 | 5 | 08/04/2010 Skeleton driver. |
| 6 | 6 | |
| 7 | No info available on this computer apart from a few newsletters. |
| 8 | The system only uses 1000-14FF for videoram and 17F0-17FF for |
| 9 | scratch ram. All other ram is optional. |
| 10 | |
| 11 | All commands must be in upper case. They are A,B,C,D,E,I,L,R,V. |
| 12 | L,D,V appear to be commands to load, dump and verify tapes. |
| 13 | The in and output lines for tapes are SENSE and FLAG, which is |
| 14 | the usual with S2650 systems. The remaining commands have |
| 15 | unknown functions. |
| 16 | |
| 17 | TODO |
| 18 | - Lots, probably. The computer is a complete mystery. No pictures, |
| 19 | manuals or schematics exist. |
| 20 | - Find out how the scrolling works - if it scrolls at all. |
| 21 | - Using the terminal keyboard, as it is unknown if it has its own. |
| 22 | - Cassette interface. |
| 23 | |
| 24 | We used Winarcadia emulator to get an idea of what the computer |
| 25 | might possibly look like, but we DID NOT read the source code. |
| 26 | |
| 7 | 27 | ****************************************************************************/ |
| 8 | 28 | |
| 9 | 29 | #include "emu.h" |
| 10 | 30 | #include "cpu/s2650/s2650.h" |
| 31 | #include "machine/terminal.h" |
| 11 | 32 | |
| 12 | 33 | |
| 13 | 34 | class cd2650_state : public driver_device |
| r9778 | r9779 | |
| 16 | 37 | cd2650_state(running_machine &machine, const driver_device_config_base &config) |
| 17 | 38 | : driver_device(machine, config) { } |
| 18 | 39 | |
| 40 | const UINT8 *charrom; |
| 41 | const UINT8 *videoram; |
| 42 | UINT8 term_data; |
| 19 | 43 | }; |
| 20 | 44 | |
| 21 | 45 | |
| 46 | static READ8_HANDLER( cd2650_keyin_r ) |
| 47 | { |
| 48 | cd2650_state *state = space->machine->driver_data<cd2650_state>(); |
| 49 | UINT8 ret = state->term_data; |
| 50 | state->term_data = 0x80; |
| 51 | if ((ret > 0x60) && (ret < 0x7b)) |
| 52 | ret -= 0x20; // upper case only |
| 53 | return ret; |
| 54 | } |
| 55 | |
| 22 | 56 | static ADDRESS_MAP_START(cd2650_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 23 | 57 | ADDRESS_MAP_UNMAP_HIGH |
| 24 | 58 | AM_RANGE( 0x0000, 0x03ff) AM_ROM |
| 25 | | AM_RANGE( 0x0400, 0x7fff) AM_RAM |
| 59 | AM_RANGE( 0x0400, 0x0fff) AM_RAM |
| 60 | AM_RANGE( 0x1000, 0x17ff) AM_RAM AM_BASE_MEMBER(cd2650_state, videoram) |
| 61 | AM_RANGE( 0x1800, 0x7fff) AM_RAM // expansion ram? the system doesn't use it |
| 26 | 62 | ADDRESS_MAP_END |
| 27 | 63 | |
| 28 | 64 | static ADDRESS_MAP_START( cd2650_io , ADDRESS_SPACE_IO, 8) |
| 29 | 65 | ADDRESS_MAP_UNMAP_HIGH |
| 66 | AM_RANGE(S2650_DATA_PORT,S2650_DATA_PORT) AM_READ(cd2650_keyin_r) |
| 67 | //AM_RANGE(S2650_SENSE_PORT, S2650_FO_PORT) AM_READWRITE(cd2650_cass_in,cd2650_cass_out) |
| 30 | 68 | ADDRESS_MAP_END |
| 31 | 69 | |
| 32 | 70 | /* Input ports */ |
| 33 | 71 | static INPUT_PORTS_START( cd2650 ) |
| 72 | PORT_INCLUDE(generic_terminal) |
| 34 | 73 | INPUT_PORTS_END |
| 35 | 74 | |
| 36 | 75 | |
| 37 | 76 | static MACHINE_RESET(cd2650) |
| 38 | 77 | { |
| 78 | cd2650_state *state = machine->driver_data<cd2650_state>(); |
| 79 | state->term_data = 0x80; |
| 39 | 80 | } |
| 40 | 81 | |
| 41 | 82 | static VIDEO_START( cd2650 ) |
| 42 | 83 | { |
| 84 | cd2650_state *state = machine->driver_data<cd2650_state>(); |
| 85 | state->charrom = memory_region(machine, "chargen"); |
| 43 | 86 | } |
| 44 | 87 | |
| 45 | 88 | static VIDEO_UPDATE( cd2650 ) |
| 46 | 89 | { |
| 47 | | return 0; |
| 90 | /* The video is unusual in that the characters in each line are spaced at 16 bytes in memory, |
| 91 | thus line 1 starts at 1000, line 2 at 1001, etc. There are 16 lines of 80 characters. |
| 92 | Further, the letters have bit 6 set low, thus the range is 01 to 1A. |
| 93 | When the bottom of the screen is reached, it does not scroll, it just wraps around. |
| 94 | There is no scroll register or any indication of how scrolling might be accomplished. */ |
| 95 | |
| 96 | cd2650_state *state = screen->machine->driver_data<cd2650_state>(); |
| 97 | UINT16 offset = 0; // if we figure out how the scrolling works, that calculation goes here |
| 98 | UINT8 y,ra,chr,gfx; |
| 99 | UINT16 sy=0,x,mem; |
| 100 | |
| 101 | for (y = 0; y < 16; y++) |
| 102 | { |
| 103 | for (ra = 0; ra < 10; ra++) |
| 104 | { |
| 105 | UINT16 *p = BITMAP_ADDR16(bitmap, sy++, 0); |
| 106 | |
| 107 | for (x = 0; x < 80; x++) |
| 108 | { |
| 109 | gfx = 0; |
| 110 | if (ra < 9) |
| 111 | { |
| 112 | mem = offset + y + (x<<4); |
| 113 | |
| 114 | if (mem > 0x4ff) |
| 115 | mem -= 0x500; |
| 116 | |
| 117 | chr = state->videoram[mem]; |
| 118 | |
| 119 | if (chr < 0x20) |
| 120 | chr |= 0x40; |
| 121 | |
| 122 | gfx = state->charrom[(chr<<4) | ra ]; |
| 123 | } |
| 124 | |
| 125 | /* Display a scanline of a character */ |
| 126 | *p++ = ( gfx & 0x80 ) ? 1 : 0; |
| 127 | *p++ = ( gfx & 0x40 ) ? 1 : 0; |
| 128 | *p++ = ( gfx & 0x20 ) ? 1 : 0; |
| 129 | *p++ = ( gfx & 0x10 ) ? 1 : 0; |
| 130 | *p++ = ( gfx & 0x08 ) ? 1 : 0; |
| 131 | *p++ = ( gfx & 0x04 ) ? 1 : 0; |
| 132 | *p++ = ( gfx & 0x02 ) ? 1 : 0; |
| 133 | *p++ = ( gfx & 0x01 ) ? 1 : 0; |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | return 0; |
| 48 | 138 | } |
| 49 | 139 | |
| 140 | static WRITE8_DEVICE_HANDLER( cd2650_kbd_put ) |
| 141 | { |
| 142 | cd2650_state *state = device->machine->driver_data<cd2650_state>(); |
| 143 | state->term_data = data; |
| 144 | } |
| 145 | |
| 146 | static GENERIC_TERMINAL_INTERFACE( cd2650_terminal_intf ) |
| 147 | { |
| 148 | DEVCB_HANDLER(cd2650_kbd_put) |
| 149 | }; |
| 150 | |
| 50 | 151 | static MACHINE_CONFIG_START( cd2650, cd2650_state ) |
| 51 | | /* basic machine hardware */ |
| 52 | | MDRV_CPU_ADD("maincpu",S2650, XTAL_1MHz) |
| 53 | | MDRV_CPU_PROGRAM_MAP(cd2650_mem) |
| 54 | | MDRV_CPU_IO_MAP(cd2650_io) |
| 152 | /* basic machine hardware */ |
| 153 | MDRV_CPU_ADD("maincpu",S2650, XTAL_1MHz) |
| 154 | MDRV_CPU_PROGRAM_MAP(cd2650_mem) |
| 155 | MDRV_CPU_IO_MAP(cd2650_io) |
| 55 | 156 | |
| 56 | | MDRV_MACHINE_RESET(cd2650) |
| 157 | MDRV_MACHINE_RESET(cd2650) |
| 57 | 158 | |
| 58 | | /* video hardware */ |
| 59 | | MDRV_SCREEN_ADD("screen", RASTER) |
| 60 | | MDRV_SCREEN_REFRESH_RATE(50) |
| 61 | | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 62 | | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 63 | | MDRV_SCREEN_SIZE(640, 480) |
| 64 | | MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 65 | | MDRV_PALETTE_LENGTH(2) |
| 66 | | MDRV_PALETTE_INIT(black_and_white) |
| 159 | /* video hardware */ |
| 160 | MDRV_SCREEN_ADD("screen", RASTER) |
| 161 | MDRV_SCREEN_REFRESH_RATE(50) |
| 162 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 163 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 164 | MDRV_SCREEN_SIZE(640, 160) |
| 165 | MDRV_SCREEN_VISIBLE_AREA(0, 639, 0, 159) |
| 166 | MDRV_PALETTE_LENGTH(2) |
| 167 | MDRV_PALETTE_INIT(black_and_white) |
| 67 | 168 | |
| 68 | | MDRV_VIDEO_START(cd2650) |
| 69 | | MDRV_VIDEO_UPDATE(cd2650) |
| 169 | MDRV_VIDEO_START(cd2650) |
| 170 | MDRV_VIDEO_UPDATE(cd2650) |
| 171 | |
| 172 | MDRV_GENERIC_TERMINAL_ADD("terminal", cd2650_terminal_intf) // keyboard only |
| 70 | 173 | MACHINE_CONFIG_END |
| 71 | 174 | |
| 72 | 175 | /* ROM definition */ |
| 73 | 176 | ROM_START( cd2650 ) |
| 74 | | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 177 | ROM_REGION( 0x8000, "maincpu", ROMREGION_ERASEFF ) |
| 75 | 178 | ROM_LOAD( "cd2650.rom", 0x0000, 0x0400, CRC(5397328e) SHA1(7106fdb60e1ad2bc5e8e45527f348c23296e8d6a)) |
| 179 | |
| 180 | /* character generator not dumped, using the one from 'c10' for now */ |
| 181 | ROM_REGION( 0x2000, "chargen", 0 ) |
| 182 | ROM_LOAD( "c10_char.bin", 0x0000, 0x2000, BAD_DUMP CRC(cb530b6f) SHA1(95590bbb433db9c4317f535723b29516b9b9fcbf)) |
| 76 | 183 | ROM_END |
| 77 | 184 | |
| 78 | 185 | /* Driver */ |