src/mess/video/kim1.c
| r3309 | r3310 | |
| 1 | | /****************************************************************************** |
| 2 | | KIM-1 |
| 3 | | |
| 4 | | video driver |
| 5 | | |
| 6 | | Juergen Buchmueller, Jan 2000 |
| 7 | | |
| 8 | | ******************************************************************************/ |
| 9 | | |
| 10 | | #include "driver.h" |
| 11 | | #include "includes/kim1.h" |
| 12 | | |
| 13 | | |
| 14 | | PALETTE_INIT( kim1 ) |
| 15 | | { |
| 16 | | int i; |
| 17 | | |
| 18 | | machine->colortable = colortable_alloc(machine, 21); |
| 19 | | |
| 20 | | for (i = 0; i < 16; i++) |
| 21 | | colortable_palette_set_color(machine->colortable, i, MAKE_RGB(24 + (i + 1) * (i + 1) - 1, (i + 1) * (i + 1) / 4, 0)); |
| 22 | | |
| 23 | | colortable_palette_set_color(machine->colortable, 16, MAKE_RGB(0, 0, 0)); |
| 24 | | colortable_palette_set_color(machine->colortable, 17, MAKE_RGB(30, 30, 30)); |
| 25 | | colortable_palette_set_color(machine->colortable, 18, MAKE_RGB(90, 90, 90)); |
| 26 | | colortable_palette_set_color(machine->colortable, 19, MAKE_RGB(50, 50, 50)); |
| 27 | | colortable_palette_set_color(machine->colortable, 20, MAKE_RGB(255, 255, 255)); |
| 28 | | |
| 29 | | for (i = 0; i < 16; i++) |
| 30 | | { |
| 31 | | colortable_entry_set_value(machine->colortable, i*2, 1); |
| 32 | | colortable_entry_set_value(machine->colortable, i*2+1, i); |
| 33 | | } |
| 34 | | |
| 35 | | colortable_entry_set_value(machine->colortable, 32, 17); |
| 36 | | colortable_entry_set_value(machine->colortable, 33, 18); |
| 37 | | colortable_entry_set_value(machine->colortable, 34, 19); |
| 38 | | colortable_entry_set_value(machine->colortable, 35, 20); |
| 39 | | colortable_entry_set_value(machine->colortable, 36, 17); |
| 40 | | colortable_entry_set_value(machine->colortable, 37, 17); |
| 41 | | colortable_entry_set_value(machine->colortable, 38, 19); |
| 42 | | colortable_entry_set_value(machine->colortable, 39, 15); |
| 43 | | } |
| 44 | | |
| 45 | | |
| 46 | | VIDEO_START( kim1 ) |
| 47 | | { |
| 48 | | videoram_size = 6 * 2 + 24; |
| 49 | | videoram = auto_malloc (videoram_size); |
| 50 | | } |
| 51 | | |
| 52 | | |
| 53 | | VIDEO_UPDATE( kim1 ) |
| 54 | | { |
| 55 | | int width = video_screen_get_width(screen); |
| 56 | | int x; |
| 57 | | |
| 58 | | fillbitmap(bitmap, get_black_pen(screen->machine), NULL); |
| 59 | | |
| 60 | | /* show leds */ |
| 61 | | for (x = 0; x < 6; x++) |
| 62 | | { |
| 63 | | int sy = 408; |
| 64 | | int sx = width - 212 + x * 30 + ((x >= 4) ? 6 : 0); |
| 65 | | |
| 66 | | drawgfx (bitmap, screen->machine->gfx[0], videoram[x<<1], videoram[(x<<1) + 1], 0, 0, sx, sy, NULL, TRANSPARENCY_PEN, 0); |
| 67 | | } |
| 68 | | |
| 69 | | return 0; |
| 70 | | } |
| 71 | | |
| 72 | | |
src/mess/machine/kim1.c
| r3309 | r3310 | |
| 1 | | /****************************************************************************** |
| 2 | | KIM-1 |
| 3 | | |
| 4 | | machine Driver |
| 5 | | |
| 6 | | Juergen Buchmueller, Jan 2000 |
| 7 | | |
| 8 | | ******************************************************************************/ |
| 9 | | |
| 10 | | #include "driver.h" |
| 11 | | #include "cpu/m6502/m6502.h" |
| 12 | | #include "includes/kim1.h" |
| 13 | | #include "sound/dac.h" |
| 14 | | |
| 15 | | DRIVER_INIT( kim1 ) |
| 16 | | { |
| 17 | | UINT8 *dst; |
| 18 | | int x, y, i; |
| 19 | | |
| 20 | | static const char seg7[] = |
| 21 | | "....aaaaaaaaaaaaa." \ |
| 22 | | "...f.aaaaaaaaaaa.b" \ |
| 23 | | "...ff.aaaaaaaaa.bb" \ |
| 24 | | "...fff.........bbb" \ |
| 25 | | "...fff.........bbb" \ |
| 26 | | "...fff.........bbb" \ |
| 27 | | "..fff.........bbb." \ |
| 28 | | "..fff.........bbb." \ |
| 29 | | "..fff.........bbb." \ |
| 30 | | "..ff...........bb." \ |
| 31 | | "..f.ggggggggggg.b." \ |
| 32 | | "..gggggggggggggg.." \ |
| 33 | | ".e.ggggggggggg.c.." \ |
| 34 | | ".ee...........cc.." \ |
| 35 | | ".eee.........ccc.." \ |
| 36 | | ".eee.........ccc.." \ |
| 37 | | ".eee.........ccc.." \ |
| 38 | | "eee.........ccc..." \ |
| 39 | | "eee.........ccc..." \ |
| 40 | | "eee.........ccc..." \ |
| 41 | | "ee.ddddddddd.cc..." \ |
| 42 | | "e.ddddddddddd.c..." \ |
| 43 | | ".ddddddddddddd...." \ |
| 44 | | ".................."; |
| 45 | | |
| 46 | | dst = memory_region(machine, "gfx1"); |
| 47 | | memset(dst, 0, 128 * 24 * 24 / 8); |
| 48 | | for (i = 0; i < 128; i++) |
| 49 | | { |
| 50 | | for (y = 0; y < 24; y++) |
| 51 | | { |
| 52 | | for (x = 0; x < 18; x++) |
| 53 | | { |
| 54 | | switch (seg7[y * 18 + x]) |
| 55 | | { |
| 56 | | case 'a': |
| 57 | | if (i & 1) |
| 58 | | *dst |= 0x80 >> (x & 7); |
| 59 | | break; |
| 60 | | case 'b': |
| 61 | | if (i & 2) |
| 62 | | *dst |= 0x80 >> (x & 7); |
| 63 | | break; |
| 64 | | case 'c': |
| 65 | | if (i & 4) |
| 66 | | *dst |= 0x80 >> (x & 7); |
| 67 | | break; |
| 68 | | case 'd': |
| 69 | | if (i & 8) |
| 70 | | *dst |= 0x80 >> (x & 7); |
| 71 | | break; |
| 72 | | case 'e': |
| 73 | | if (i & 16) |
| 74 | | *dst |= 0x80 >> (x & 7); |
| 75 | | break; |
| 76 | | case 'f': |
| 77 | | if (i & 32) |
| 78 | | *dst |= 0x80 >> (x & 7); |
| 79 | | break; |
| 80 | | case 'g': |
| 81 | | if (i & 64) |
| 82 | | *dst |= 0x80 >> (x & 7); |
| 83 | | break; |
| 84 | | } |
| 85 | | if ((x & 7) == 7) |
| 86 | | dst++; |
| 87 | | } |
| 88 | | dst++; |
| 89 | | } |
| 90 | | } |
| 91 | | } |
| 92 | | |
| 93 | | |
| 94 | | MACHINE_RESET( kim1 ) |
| 95 | | { |
| 96 | | UINT8 *RAM = memory_region(machine, "main"); |
| 97 | | |
| 98 | | /* setup RAM IRQ vector */ |
| 99 | | if (RAM[0x17fa] == 0x00 && RAM[0x17fb] == 0x00) |
| 100 | | { |
| 101 | | RAM[0x17fa] = 0x00; |
| 102 | | RAM[0x17fb] = 0x1c; |
| 103 | | } |
| 104 | | /* setup RAM NMI vector */ |
| 105 | | if (RAM[0x17fe] == 0x00 && RAM[0x17ff] == 0x00) |
| 106 | | { |
| 107 | | RAM[0x17fe] = 0x00; |
| 108 | | RAM[0x17ff] = 0x1c; |
| 109 | | } |
| 110 | | } |
| 111 | | |
| 112 | | static DEVICE_IMAGE_LOAD( kim1_cassette ) |
| 113 | | { |
| 114 | | const char magic[] = "KIM1"; |
| 115 | | char buff[4]; |
| 116 | | UINT16 addr, size; |
| 117 | | UINT8 ident, *RAM = memory_region(image->machine, "main"); |
| 118 | | |
| 119 | | image_fread(image, buff, sizeof (buff)); |
| 120 | | if (memcmp(buff, magic, sizeof (buff))) |
| 121 | | { |
| 122 | | logerror("kim1_rom_load: magic '%s' not found\n", magic); |
| 123 | | return INIT_FAIL; |
| 124 | | } |
| 125 | | image_fread(image, &addr, 2); |
| 126 | | addr = LITTLE_ENDIANIZE_INT16(addr); |
| 127 | | image_fread(image, &size, 2); |
| 128 | | size = LITTLE_ENDIANIZE_INT16(size); |
| 129 | | image_fread(image, &ident, 1); |
| 130 | | logerror("kim1_rom_load: $%04X $%04X $%02X\n", addr, size, ident); |
| 131 | | while (size-- > 0) |
| 132 | | image_fread(image, &RAM[addr++], 1); |
| 133 | | return INIT_PASS; |
| 134 | | } |
| 135 | | |
| 136 | | INTERRUPT_GEN( kim1_interrupt ) |
| 137 | | { |
| 138 | | int i; |
| 139 | | |
| 140 | | /* decrease the brightness of the six 7segment LEDs */ |
| 141 | | for (i = 0; i < 6; i++) |
| 142 | | { |
| 143 | | if (videoram[i * 2 + 1] > 0) |
| 144 | | videoram[i * 2 + 1] -= 1; |
| 145 | | } |
| 146 | | } |
| 147 | | |
| 148 | | |
| 149 | | void kim1_cassette_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 150 | | { |
| 151 | | switch(state) |
| 152 | | { |
| 153 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 154 | | case MESS_DEVINFO_INT_TYPE: info->i = IO_CASSETTE; break; |
| 155 | | case MESS_DEVINFO_INT_READABLE: info->i = 1; break; |
| 156 | | case MESS_DEVINFO_INT_WRITEABLE: info->i = 0; break; |
| 157 | | case MESS_DEVINFO_INT_CREATABLE: info->i = 0; break; |
| 158 | | case MESS_DEVINFO_INT_COUNT: info->i = 1; break; |
| 159 | | case MESS_DEVINFO_INT_RESET_ON_LOAD: info->i = 1; break; |
| 160 | | |
| 161 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 162 | | case MESS_DEVINFO_PTR_LOAD: info->load = DEVICE_IMAGE_LOAD_NAME(kim1_cassette); break; |
| 163 | | |
| 164 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 165 | | case MESS_DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "kim1"); break; |
| 166 | | } |
| 167 | | } |
| 168 | | |
| 169 | | |
src/mess/layout/kim1.lay
| r0 | r3310 | |
| 1 | <?xml version="1.0"?>
|
| 2 | <mamelayout version="2">
|
| 3 | <element name="button" defstate="1"/>
|
| 4 | |
| 5 | <element name="digit" defstate="0">
|
| 6 | <led7seg>
|
| 7 | <color red="0.75" green="0.0" blue="0.0" />
|
| 8 | </led7seg>
|
| 9 | </element>
|
| 10 | |
| 11 | <view name="Standard">
|
| 12 | <!-- Led address display -->
|
| 13 | <bezel name="digit0" element="digit">
|
| 14 | <bounds x="387" y="409" width="18" height="24" />
|
| 15 | </bezel>
|
| 16 | <bezel name="digit1" element="digit">
|
| 17 | <bounds x="417" y="409" width="18" height="24" />
|
| 18 | </bezel>
|
| 19 | <bezel name="digit2" element="digit">
|
| 20 | <bounds x="447" y="409" width="18" height="24" />
|
| 21 | </bezel>
|
| 22 | <bezel name="digit3" element="digit">
|
| 23 | <bounds x="477" y="409" width="18" height="24" />
|
| 24 | </bezel>
|
| 25 | |
| 26 | <!-- Led data display -->
|
| 27 | <bezel name="digit4" element="digit">
|
| 28 | <bounds x="513" y="409" width="18" height="24" />
|
| 29 | </bezel>
|
| 30 | <bezel name="digit5" element="digit">
|
| 31 | <bounds x="543" y="409" width="18" height="24" />
|
| 32 | </bezel>
|
| 33 | |
| 34 | |
| 35 | <!-- Buttons -->
|
| 36 | <!-- Row 1 : GO ST RS -->
|
| 37 | <bezel element="button" inputtag="LINE2" inputmask="0x02">
|
| 38 | <bounds x="418" y="516" width="24" height="18"/>
|
| 39 | </bezel>
|
| 40 | |
| 41 | <bezel element="button" inputtag="LINE3" inputmask="0x40">
|
| 42 | <bounds x="455" y="516" width="24" height="18"/>
|
| 43 | </bezel>
|
| 44 | |
| 45 | <bezel element="button" inputtag="LINE3" inputmask="0x20">
|
| 46 | <bounds x="492" y="516" width="24" height="18"/>
|
| 47 | </bezel>
|
| 48 | |
| 49 | |
| 50 | <!-- Row 2 : AD DA PC + -->
|
| 51 | <bezel element="button" inputtag="LINE2" inputmask="0x10">
|
| 52 | <bounds x="418" y="552" width="24" height="18"/>
|
| 53 | </bezel>
|
| 54 | |
| 55 | <bezel element="button" inputtag="LINE2" inputmask="0x08">
|
| 56 | <bounds x="455" y="552" width="24" height="18"/>
|
| 57 | </bezel>
|
| 58 | |
| 59 | <bezel element="button" inputtag="LINE2" inputmask="0x01">
|
| 60 | <bounds x="492" y="552" width="24" height="18"/>
|
| 61 | </bezel>
|
| 62 | |
| 63 | <bezel element="button" inputtag="LINE2" inputmask="0x04">
|
| 64 | <bounds x="529" y="552" width="24" height="18"/>
|
| 65 | </bezel>
|
| 66 | |
| 67 | |
| 68 | <!-- Row 3 : C D E F -->
|
| 69 | <bezel element="button" inputtag="LINE1" inputmask="0x02">
|
| 70 | <bounds x="418" y="588" width="24" height="18"/>
|
| 71 | </bezel>
|
| 72 | |
| 73 | <bezel element="button" inputtag="LINE1" inputmask="0x01">
|
| 74 | <bounds x="455" y="588" width="24" height="18"/>
|
| 75 | </bezel>
|
| 76 | |
| 77 | <bezel element="button" inputtag="LINE2" inputmask="0x40">
|
| 78 | <bounds x="492" y="588" width="24" height="18"/>
|
| 79 | </bezel>
|
| 80 | |
| 81 | <bezel element="button" inputtag="LINE2" inputmask="0x20">
|
| 82 | <bounds x="529" y="588" width="24" height="18"/>
|
| 83 | </bezel>
|
| 84 | |
| 85 | |
| 86 | <!-- Row 4 : 8 9 A B -->
|
| 87 | <bezel element="button" inputtag="LINE1" inputmask="0x20">
|
| 88 | <bounds x="418" y="624" width="24" height="18"/>
|
| 89 | </bezel>
|
| 90 | |
| 91 | <bezel element="button" inputtag="LINE1" inputmask="0x10">
|
| 92 | <bounds x="455" y="624" width="24" height="18"/>
|
| 93 | </bezel>
|
| 94 | |
| 95 | <bezel element="button" inputtag="LINE1" inputmask="0x08">
|
| 96 | <bounds x="492" y="624" width="24" height="18"/>
|
| 97 | </bezel>
|
| 98 | |
| 99 | <bezel element="button" inputtag="LINE1" inputmask="0x04">
|
| 100 | <bounds x="529" y="624" width="24" height="18"/>
|
| 101 | </bezel>
|
| 102 | |
| 103 | |
| 104 | <!-- Row 5 : 4 5 6 7 -->
|
| 105 | <bezel element="button" inputtag="LINE0" inputmask="0x04">
|
| 106 | <bounds x="418" y="660" width="24" height="18"/>
|
| 107 | </bezel>
|
| 108 | |
| 109 | <bezel element="button" inputtag="LINE0" inputmask="0x02">
|
| 110 | <bounds x="455" y="660" width="24" height="18"/>
|
| 111 | </bezel>
|
| 112 | |
| 113 | <bezel element="button" inputtag="LINE0" inputmask="0x01">
|
| 114 | <bounds x="492" y="660" width="24" height="18"/>
|
| 115 | </bezel>
|
| 116 | |
| 117 | <bezel element="button" inputtag="LINE1" inputmask="0x40">
|
| 118 | <bounds x="529" y="660" width="24" height="18"/>
|
| 119 | </bezel>
|
| 120 | |
| 121 | |
| 122 | <!-- Row 6 : 0 1 2 3 -->
|
| 123 | <bezel element="button" inputtag="LINE0" inputmask="0x40">
|
| 124 | <bounds x="418" y="696" width="24" height="18"/>
|
| 125 | </bezel>
|
| 126 | |
| 127 | <bezel element="button" inputtag="LINE0" inputmask="0x20">
|
| 128 | <bounds x="455" y="696" width="24" height="18"/>
|
| 129 | </bezel>
|
| 130 | |
| 131 | <bezel element="button" inputtag="LINE0" inputmask="0x10">
|
| 132 | <bounds x="492" y="696" width="24" height="18"/>
|
| 133 | </bezel>
|
| 134 | |
| 135 | <bezel element="button" inputtag="LINE0" inputmask="0x08">
|
| 136 | <bounds x="529" y="696" width="24" height="18"/>
|
| 137 | </bezel>
|
| 138 | |
| 139 | </view>
|
| 140 | </mamelayout>
|
src/mess/drivers/kim1.c
| r3309 | r3310 | |
| 64 | 64 | ******************************************************************************/ |
| 65 | 65 | |
| 66 | 66 | #include "driver.h" |
| 67 | | #include "includes/kim1.h" |
| 68 | 67 | #include "machine/6530miot.h" |
| 69 | 68 | #include "devices/cassette.h" |
| 69 | #include "kim1.lh" |
| 70 | 70 | |
| 71 | 71 | |
| 72 | static UINT8 u2_port_b; |
| 73 | static UINT8 kim1_led_time[6]; |
| 74 | |
| 75 | |
| 72 | 76 | static ADDRESS_MAP_START ( kim1_map , ADDRESS_SPACE_PROGRAM, 8) |
| 73 | 77 | AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0xe000) AM_RAM |
| 74 | 78 | AM_RANGE(0x1700, 0x173f) AM_MIRROR(0xe000) AM_DEVREADWRITE( MIOT6530, "miot_u3", miot6530_r, miot6530_w ) |
| r3309 | r3310 | |
| 131 | 135 | PORT_BIT( 0x01, 0x00, IPT_UNUSED ) |
| 132 | 136 | INPUT_PORTS_END |
| 133 | 137 | |
| 134 | | static const gfx_layout led_layout = |
| 135 | | { |
| 136 | | 18, 24, /* 16 x 24 LED 7segment displays */ |
| 137 | | 128, /* 128 codes */ |
| 138 | | 1, /* 1 bit per pixel */ |
| 139 | | { 0 }, /* no bitplanes */ |
| 140 | | { 0, 1, 2, 3, 4, 5, 6, 7, |
| 141 | | 8, 9,10,11,12,13,14,15, |
| 142 | | 16,17 }, |
| 143 | | { 0*24, 1*24, 2*24, 3*24, |
| 144 | | 4*24, 5*24, 6*24, 7*24, |
| 145 | | 8*24, 9*24,10*24,11*24, |
| 146 | | 12*24,13*24,14*24,15*24, |
| 147 | | 16*24,17*24,18*24,19*24, |
| 148 | | 20*24,21*24,22*24,23*24, |
| 149 | | 24*24,25*24,26*24,27*24, |
| 150 | | 28*24,29*24,30*24,31*24 }, |
| 151 | | 24 * 24, /* every LED code takes 32 times 18 (aligned 24) bit words */ |
| 152 | | }; |
| 153 | 138 | |
| 154 | | |
| 155 | | static GFXDECODE_START( kim1 ) |
| 156 | | GFXDECODE_ENTRY( "gfx1", 0, led_layout, 0, 16 ) |
| 157 | | GFXDECODE_END |
| 158 | | |
| 159 | | |
| 160 | | static UINT8 u2_port_b; |
| 161 | | |
| 162 | 139 | static UINT8 kim1_u2_read_a(const device_config *device, UINT8 olddata) |
| 163 | 140 | { |
| 164 | 141 | UINT8 data = 0xff; |
| r3309 | r3310 | |
| 181 | 158 | |
| 182 | 159 | static void kim1_u2_write_a(const device_config *device, UINT8 newdata, UINT8 olddata) |
| 183 | 160 | { |
| 184 | | switch( ( u2_port_b >> 1 ) & 0x0f ) |
| 161 | UINT8 idx = ( u2_port_b >> 1 ) & 0x0f; |
| 162 | |
| 163 | if ( idx >= 4 && idx < 10 ) |
| 185 | 164 | { |
| 186 | | case 4: |
| 187 | | case 5: |
| 188 | | case 6: |
| 189 | | case 7: |
| 190 | | case 8: |
| 191 | | case 9: |
| 192 | 165 | if ( newdata & 0x80 ) |
| 193 | 166 | { |
| 194 | | videoram[(( ( u2_port_b >> 1 ) & 0x0f ) - 4) * 2 + 0] = newdata & 0x7f; |
| 195 | | videoram[(( ( u2_port_b >> 1 ) & 0x0f ) - 4) * 2 + 1] = 15; |
| 167 | output_set_digit_value( idx-4, newdata & 0x7f ); |
| 168 | kim1_led_time[idx - 4] = 15; |
| 196 | 169 | } |
| 197 | | break; |
| 198 | 170 | } |
| 199 | 171 | } |
| 200 | 172 | |
| 201 | 173 | |
| 202 | 174 | static UINT8 kim1_u2_read_b(const device_config *device, UINT8 olddata) |
| 203 | 175 | { |
| 204 | | return 0x7F | ( cassette_input( device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ) ) > 0.2 ? 0x80 : 0x00 ); |
| 176 | double tap_val = cassette_input( device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ) ); |
| 177 | |
| 178 | if ( miot6530_portb_out_get(device) & 0x20 ) |
| 179 | return 0xFF; |
| 180 | |
| 181 | // printf("kim1_u2_read_b(): tap_val = %f\n", tap_val); |
| 182 | return 0x7F | ( tap_val >= 0.0 ? 0x80 : 0x00 ); |
| 205 | 183 | } |
| 206 | 184 | |
| 207 | 185 | |
| r3309 | r3310 | |
| 209 | 187 | { |
| 210 | 188 | u2_port_b = newdata; |
| 211 | 189 | |
| 212 | | if ( ( newdata & 0x3f ) == 0x27 ) |
| 190 | if ( newdata & 0x20 ) |
| 213 | 191 | { |
| 214 | 192 | /* cassette write/speaker update */ |
| 215 | | cassette_output( device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ), ( newdata & 0x80 ) ? 1.0 : -1.0 ); |
| 193 | cassette_output( device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, "cassette" ), ( newdata & 0x80 ) ? -1.0 : 1.0 ); |
| 216 | 194 | } |
| 217 | 195 | |
| 218 | 196 | /* Set IRQ when bit 7 is cleared */ |
| r3309 | r3310 | |
| 259 | 237 | }; |
| 260 | 238 | |
| 261 | 239 | |
| 240 | static TIMER_CALLBACK( kim1_update_leds ) |
| 241 | { |
| 242 | int i; |
| 243 | |
| 244 | for ( i = 0; i < 6; i++ ) |
| 245 | { |
| 246 | if ( kim1_led_time[i] ) |
| 247 | kim1_led_time[i]--; |
| 248 | else |
| 249 | output_set_digit_value( i, 0 ); |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | |
| 254 | static MACHINE_RESET( kim1 ) |
| 255 | { |
| 256 | int i; |
| 257 | |
| 258 | timer_pulse( ATTOTIME_IN_HZ(60), NULL, 0, kim1_update_leds ); |
| 259 | |
| 260 | for ( i = 0; i < 6; i++ ) |
| 261 | { |
| 262 | kim1_led_time[i] = 0; |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | |
| 262 | 267 | static MACHINE_DRIVER_START( kim1 ) |
| 263 | 268 | /* basic machine hardware */ |
| 264 | 269 | MDRV_CPU_ADD("main", M6502, 1000000) /* 1 MHz */ |
| 265 | 270 | MDRV_CPU_PROGRAM_MAP(kim1_map, 0) |
| 266 | | MDRV_CPU_VBLANK_INT("main", kim1_interrupt) |
| 267 | 271 | MDRV_INTERLEAVE(1) |
| 268 | 272 | |
| 269 | 273 | MDRV_MACHINE_RESET( kim1 ) |
| 270 | 274 | |
| 271 | | /* video hardware (well, actually there was no video ;) */ |
| 272 | | MDRV_SCREEN_ADD("main", RASTER) |
| 273 | | MDRV_SCREEN_REFRESH_RATE(60) |
| 274 | | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 275 | | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 276 | | MDRV_SCREEN_SIZE(600, 768) |
| 277 | | MDRV_SCREEN_VISIBLE_AREA(0, 600 - 1, 0, 768 - 1) |
| 278 | | MDRV_GFXDECODE( kim1 ) |
| 279 | | MDRV_PALETTE_LENGTH(40) |
| 280 | | MDRV_PALETTE_INIT( kim1 ) |
| 281 | | |
| 282 | | MDRV_VIDEO_START( kim1 ) |
| 283 | | MDRV_VIDEO_UPDATE( kim1 ) |
| 284 | | |
| 285 | 275 | MDRV_MIOT6530_ADD( "miot_u2", 1000000, kim1_u2_miot6530_interface ) |
| 286 | 276 | MDRV_MIOT6530_ADD( "miot_u3", 1000000, kim1_u3_miot6530_interface ) |
| 287 | 277 | |
| r3309 | r3310 | |
| 292 | 282 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 293 | 283 | |
| 294 | 284 | MDRV_CASSETTE_ADD( "cassette", default_cassette_config ) |
| 285 | |
| 286 | /* video */ |
| 287 | MDRV_DEFAULT_LAYOUT( layout_kim1 ) |
| 295 | 288 | MACHINE_DRIVER_END |
| 296 | 289 | |
| 297 | 290 | |
| 298 | 291 | ROM_START(kim1) |
| 299 | 292 | ROM_REGION(0x10000,"main",0) |
| 300 | | ROM_LOAD("6530-003.bin", 0x1800, 0x0400, CRC(a2a56502) SHA1(60b6e48f35fe4899e29166641bac3e81e3b9d220)) |
| 301 | | ROM_LOAD("6530-002.bin", 0x1c00, 0x0400, CRC(2b08e923) SHA1(054f7f6989af3a59462ffb0372b6f56f307b5362)) |
| 302 | | ROM_REGION(128 * 24 * 3,"gfx1",ROMREGION_ERASEFF) |
| 303 | | /* space filled with 7segement graphics by kim1_init_driver */ |
| 293 | ROM_LOAD("6530-003.bin", 0x1800, 0x0400, CRC(a2a56502) SHA1(60b6e48f35fe4899e29166641bac3e81e3b9d220)) |
| 294 | ROM_LOAD("6530-002.bin", 0x1c00, 0x0400, CRC(2b08e923) SHA1(054f7f6989af3a59462ffb0372b6f56f307b5362)) |
| 304 | 295 | ROM_END |
| 305 | 296 | |
| 297 | |
| 298 | #ifdef UNUSED_FUNCTION |
| 299 | static DEVICE_IMAGE_LOAD( kim1_cassette ) |
| 300 | { |
| 301 | const char magic[] = "KIM1"; |
| 302 | char buff[4]; |
| 303 | UINT16 addr, size; |
| 304 | UINT8 ident, *RAM = memory_region(image->machine, "main"); |
| 305 | |
| 306 | image_fread(image, buff, sizeof (buff)); |
| 307 | if (memcmp(buff, magic, sizeof (buff))) |
| 308 | { |
| 309 | logerror("kim1_rom_load: magic '%s' not found\n", magic); |
| 310 | return INIT_FAIL; |
| 311 | } |
| 312 | image_fread(image, &addr, 2); |
| 313 | addr = LITTLE_ENDIANIZE_INT16(addr); |
| 314 | image_fread(image, &size, 2); |
| 315 | size = LITTLE_ENDIANIZE_INT16(size); |
| 316 | image_fread(image, &ident, 1); |
| 317 | logerror("kim1_rom_load: $%04X $%04X $%02X\n", addr, size, ident); |
| 318 | while (size-- > 0) |
| 319 | image_fread(image, &RAM[addr++], 1); |
| 320 | return INIT_PASS; |
| 321 | } |
| 322 | |
| 323 | |
| 324 | static void kim1_cassette_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 325 | { |
| 326 | switch(state) |
| 327 | { |
| 328 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 329 | case MESS_DEVINFO_INT_TYPE: info->i = IO_CASSETTE; break; |
| 330 | case MESS_DEVINFO_INT_READABLE: info->i = 1; break; |
| 331 | case MESS_DEVINFO_INT_WRITEABLE: info->i = 0; break; |
| 332 | case MESS_DEVINFO_INT_CREATABLE: info->i = 0; break; |
| 333 | case MESS_DEVINFO_INT_COUNT: info->i = 1; break; |
| 334 | case MESS_DEVINFO_INT_RESET_ON_LOAD: info->i = 1; break; |
| 335 | |
| 336 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 337 | case MESS_DEVINFO_PTR_LOAD: info->load = DEVICE_IMAGE_LOAD_NAME(kim1_cassette); break; |
| 338 | |
| 339 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 340 | case MESS_DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "kim1"); break; |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | |
| 306 | 345 | static SYSTEM_CONFIG_START(kim1) |
| 307 | | // CONFIG_DEVICE(kim1_cassette_getinfo) |
| 346 | CONFIG_DEVICE(kim1_cassette_getinfo) |
| 308 | 347 | SYSTEM_CONFIG_END |
| 348 | #endif |
| 309 | 349 | |
| 310 | 350 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ |
| 311 | | COMP( 1975, kim1, 0, 0, kim1, kim1, kim1, kim1, "MOS Technologies", "KIM-1" , 0) |
| 351 | COMP( 1975, kim1, 0, 0, kim1, kim1, 0, 0, "MOS Technologies", "KIM-1" , 0) |