src/mess/includes/poly88.h
| r4786 | r4787 | |
| 6 | 6 | |
| 7 | 7 | #ifndef POLY88_H_ |
| 8 | 8 | #define POLY88_H_ |
| 9 | #include "machine/msm8251.h" |
| 10 | #include "devices/snapquik.h" |
| 9 | 11 | |
| 10 | 12 | /*----------- defined in machine/poly88.c -----------*/ |
| 11 | 13 | |
| 12 | 14 | MACHINE_RESET(poly88); |
| 13 | 15 | INTERRUPT_GEN( poly88_interrupt ); |
| 14 | | READ8_HANDLER(polly_keyboard_r); |
| 15 | | WRITE8_HANDLER(polly_intr_w); |
| 16 | READ8_HANDLER(poly_keyboard_r); |
| 17 | WRITE8_HANDLER(poly_intr_w); |
| 18 | WRITE8_HANDLER(poly_baud_rate_w); |
| 19 | extern const msm8251_interface poly88_usart_interface; |
| 16 | 20 | |
| 21 | extern SNAPSHOT_LOAD( poly88 ); |
| 22 | |
| 17 | 23 | /*----------- defined in video/poly88.c -----------*/ |
| 18 | 24 | extern UINT8 *poly_video_ram; |
| 19 | 25 | |
| r4786 | r4787 | |
| 21 | 27 | extern VIDEO_UPDATE( poly88 ); |
| 22 | 28 | |
| 23 | 29 | #endif /* POLY88_H_ */ |
| 30 | |
src/mess/machine/poly88.c
| r4786 | r4787 | |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | 10 | #include "includes/poly88.h" |
| 11 | #include "cpu/i8085/i8085.h" |
| 11 | 12 | |
| 12 | 13 | static UINT8 intr = 0; |
| 13 | 14 | static UINT8 last_code = 0; |
| 14 | 15 | static UINT8 int_vector = 0; |
| 15 | 16 | |
| 17 | WRITE8_HANDLER(poly_baud_rate_w) |
| 18 | { |
| 19 | logerror("poly_baud_rate_w %02x\n",data); |
| 20 | } |
| 21 | |
| 16 | 22 | static UINT8 row_number(UINT8 code) { |
| 17 | 23 | if BIT(code,0) return 0; |
| 18 | 24 | if BIT(code,1) return 1; |
| r4786 | r4787 | |
| 131 | 137 | int_vector = 0xf7; |
| 132 | 138 | cpu_set_input_line(device, 0, HOLD_LINE); |
| 133 | 139 | } |
| 140 | static void poly88_usart_rxready (const device_config *device, int state) |
| 141 | { |
| 142 | int_vector = 0xe7; |
| 143 | //cpu_set_input_line(device, 0, HOLD_LINE); |
| 144 | } |
| 145 | const msm8251_interface poly88_usart_interface= |
| 146 | { |
| 147 | NULL, |
| 148 | NULL, |
| 149 | poly88_usart_rxready |
| 150 | }; |
| 134 | 151 | |
| 135 | | READ8_HANDLER(polly_keyboard_r) |
| 152 | READ8_HANDLER(poly_keyboard_r) |
| 136 | 153 | { |
| 137 | 154 | UINT8 retVal = last_code; |
| 138 | 155 | cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); |
| r4786 | r4787 | |
| 140 | 157 | return retVal; |
| 141 | 158 | } |
| 142 | 159 | |
| 143 | | WRITE8_HANDLER(polly_intr_w) |
| 160 | WRITE8_HANDLER(poly_intr_w) |
| 144 | 161 | { |
| 145 | 162 | cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); |
| 146 | 163 | } |
| 164 | |
| 165 | SNAPSHOT_LOAD( poly88 ) |
| 166 | { |
| 167 | const address_space *space = cputag_get_address_space(image->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 168 | UINT8* data= auto_alloc_array(image->machine, UINT8, snapshot_size); |
| 169 | UINT16 recordNum; |
| 170 | UINT16 recordLen; |
| 171 | UINT16 address; |
| 172 | UINT8 recordType; |
| 173 | |
| 174 | int pos = 0x300; |
| 175 | char name[9]; |
| 176 | int i = 0; |
| 177 | int theend = 0; |
| 178 | |
| 179 | image_fread(image, data, snapshot_size); |
| 180 | |
| 181 | while (pos<snapshot_size) { |
| 182 | for(i=0;i<9;i++) { |
| 183 | name[i] = (char) data[pos + i]; |
| 184 | } |
| 185 | pos+=8; |
| 186 | name[8] = 0; |
| 187 | |
| 188 | |
| 189 | recordNum = data[pos]+ data[pos+1]*256; pos+=2; |
| 190 | recordLen = data[pos]; pos++; |
| 191 | if (recordLen==0) recordLen=0x100; |
| 192 | address = data[pos] + data[pos+1]*256; pos+=2; |
| 193 | recordType = data[pos]; pos++; |
| 194 | |
| 195 | logerror("Block :%s number:%d length: %d address=%04x type:%d\n",name,recordNum,recordLen,address, recordType); |
| 196 | switch(recordType) { |
| 197 | case 0 : |
| 198 | /* 00 Absolute */ |
| 199 | memcpy(memory_get_read_ptr(space,address ), data + pos ,recordLen); |
| 200 | break; |
| 201 | case 1 : |
| 202 | /* 01 Comment */ |
| 203 | break; |
| 204 | case 2 : |
| 205 | /* 02 End */ |
| 206 | theend = 1; |
| 207 | break; |
| 208 | case 3 : |
| 209 | /* 03 Auto Start @ Address */ |
| 210 | cpu_set_reg(cputag_get_cpu(image->machine, "maincpu"), I8085_PC, address); |
| 211 | theend = 1; |
| 212 | break; |
| 213 | case 4 : |
| 214 | /* 04 Data ( used by Assembler ) */ |
| 215 | logerror("ASM load unsupported\n"); |
| 216 | theend = 1; |
| 217 | break; |
| 218 | case 5 : |
| 219 | /* 05 BASIC program file */ |
| 220 | logerror("BASIC load unsupported\n"); |
| 221 | theend = 1; |
| 222 | break; |
| 223 | case 6 : |
| 224 | /* 06 End ( used by Assembler? ) */ |
| 225 | theend = 1; |
| 226 | break; |
| 227 | default: break; |
| 228 | } |
| 229 | |
| 230 | if (theend) { |
| 231 | break; |
| 232 | } |
| 233 | pos+=recordLen; |
| 234 | } |
| 235 | return INIT_PASS; |
| 236 | } |
src/mess/drivers/poly88.c
| r4786 | r4787 | |
| 22 | 22 | ADDRESS_MAP_END |
| 23 | 23 | |
| 24 | 24 | static ADDRESS_MAP_START( poly88_io , ADDRESS_SPACE_IO, 8) |
| 25 | | ADDRESS_MAP_UNMAP_HIGH |
| 26 | | AM_RANGE(0x08, 0x08) AM_WRITE(polly_intr_w) |
| 27 | | AM_RANGE(0xf8, 0xf8) AM_READ(polly_keyboard_r) |
| 25 | ADDRESS_MAP_UNMAP_HIGH |
| 26 | AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("uart", msm8251_status_r,msm8251_control_w) |
| 27 | AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("uart", msm8251_data_r,msm8251_data_w) |
| 28 | AM_RANGE(0x04, 0x04) AM_WRITE(poly_baud_rate_w) |
| 29 | AM_RANGE(0x08, 0x08) AM_WRITE(poly_intr_w) |
| 30 | AM_RANGE(0xf8, 0xf8) AM_READ(poly_keyboard_r) |
| 28 | 31 | ADDRESS_MAP_END |
| 29 | 32 | |
| 30 | 33 | /* Input ports */ |
| r4786 | r4787 | |
| 131 | 134 | |
| 132 | 135 | MDRV_VIDEO_START(poly88) |
| 133 | 136 | MDRV_VIDEO_UPDATE(poly88) |
| 137 | |
| 138 | /* uart */ |
| 139 | MDRV_MSM8251_ADD("uart", poly88_usart_interface) |
| 140 | |
| 141 | /* snapshot */ |
| 142 | MDRV_SNAPSHOT_ADD("snapshot", poly88, "img", 0) |
| 134 | 143 | MACHINE_DRIVER_END |
| 135 | 144 | |
| 136 | 145 | static SYSTEM_CONFIG_START(poly88) |