src/mess/includes/x07.h
| r8173 | r8174 | |
| 71 | 71 | |
| 72 | 72 | /* kana */ |
| 73 | 73 | {0xc7, 0xcc, 0xb1, 0xb3, 0xb4, 0xb5, 0xd4, 0xd5}, |
| 74 | | {0xd6, 0xdc, 0xce, 0xcd, 0xc0,0xc3 , 0xb2, 0xbd}, |
| 74 | {0xd6, 0xdc, 0xce, 0xcd, 0xc0, 0xc3, 0xb2, 0xbd}, |
| 75 | 75 | {0xb6, 0xdd, 0xc5, 0xc6, 0xd7, 0xbe, 0xde, 0xdf}, |
| 76 | 76 | {0xc1, 0xc4, 0xbc, 0xca, 0xb7, 0xb8, 0xcf, 0xc9}, |
| 77 | 77 | {0xd8, 0xda, 0xb9, 0xd1, 0xc2, 0xbb, 0xbf, 0xcb}, |
| r8173 | r8174 | |
| 97 | 97 | {0x1d, 0x1c, 0x1e, 0x1f, 0x16, 0x0b, 0x0d, 0x12} |
| 98 | 98 | }; |
| 99 | 99 | |
| 100 | | static const UINT8 font[] = |
| 101 | | { |
| 102 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 103 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 104 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 105 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 106 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 107 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 108 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 109 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 110 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 111 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 112 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 113 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 114 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 115 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 116 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 117 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 118 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 119 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 120 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 121 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 122 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 123 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 124 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 125 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 126 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 127 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 128 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 129 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 130 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 131 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 132 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 133 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 134 | | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 135 | | 0x20, 0x70, 0x70, 0x20, 0x20, 0x00, 0x20, 0x00, |
| 136 | | 0xd8, 0xd8, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 137 | | 0x00, 0x50, 0xf8, 0x50, 0x50, 0xf8, 0x50, 0x00, |
| 138 | | 0x40, 0x70, 0x80, 0x60, 0x10, 0xe0, 0x20, 0x00, |
| 139 | | 0xc0, 0xc8, 0x10, 0x20, 0x40, 0x98, 0x18, 0x00, |
| 140 | | 0x40, 0xa0, 0xa0, 0x40, 0xa8, 0x90, 0x68, 0x00, |
| 141 | | 0x60, 0x60, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 142 | | 0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x00, |
| 143 | | 0x40, 0x20, 0x20, 0x20, 0x20, 0x20, 0x40, 0x00, |
| 144 | | 0x00, 0x50, 0x70, 0xf8, 0x70, 0x50, 0x00, 0x00, |
| 145 | | 0x00, 0x20, 0x20, 0xf8, 0x20, 0x20, 0x00, 0x00, |
| 146 | | 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x60, 0x40, |
| 147 | | 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, |
| 148 | | 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, |
| 149 | | 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, |
| 150 | | 0x70, 0x88, 0x98, 0xa8, 0xc8, 0x88, 0x70, 0x00, |
| 151 | | 0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, |
| 152 | | 0x70, 0x88, 0x08, 0x30, 0x40, 0x80, 0xf8, 0x00, |
| 153 | | 0x70, 0x88, 0x08, 0x70, 0x08, 0x88, 0x70, 0x00, |
| 154 | | 0x10, 0x30, 0x50, 0x90, 0xf8, 0x10, 0x10, 0x00, |
| 155 | | 0xf8, 0x80, 0x80, 0xf0, 0x08, 0x88, 0x70, 0x00, |
| 156 | | 0x30, 0x40, 0x80, 0xf0, 0x88, 0x88, 0x70, 0x00, |
| 157 | | 0xf8, 0x08, 0x10, 0x20, 0x40, 0x40, 0x40, 0x00, |
| 158 | | 0x70, 0x88, 0x88, 0x70, 0x88, 0x88, 0x70, 0x00, |
| 159 | | 0x70, 0x88, 0x88, 0x78, 0x08, 0x10, 0x60, 0x00, |
| 160 | | 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, |
| 161 | | 0x00, 0x00, 0x60, 0x60, 0x00, 0x20, 0x60, 0x40, |
| 162 | | 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x00, |
| 163 | | 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, |
| 164 | | 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x00, |
| 165 | | 0x78, 0x88, 0x08, 0x30, 0x20, 0x00, 0x20, 0x00, |
| 166 | | 0x70, 0x88, 0xb8, 0xa8, 0xb8, 0x80, 0x70, 0x00, |
| 167 | | 0xf8, 0x88, 0x88, 0x88, 0xf8, 0x88, 0x88, 0x00, |
| 168 | | 0xf0, 0x88, 0x88, 0xf0, 0x88, 0x88, 0xf0, 0x00, |
| 169 | | 0xf8, 0x88, 0x80, 0x80, 0x80, 0x88, 0xf8, 0x00, |
| 170 | | 0xf0, 0x88, 0x88, 0x88, 0x88, 0x88, 0xf0, 0x00, |
| 171 | | 0xf8, 0x80, 0x80, 0xf0, 0x80, 0x80, 0xf8, 0x00, |
| 172 | | 0xf8, 0x80, 0x80, 0xf0, 0x80, 0x80, 0x80, 0x00, |
| 173 | | 0xf8, 0x88, 0x80, 0xb8, 0x88, 0x88, 0xf8, 0x00, |
| 174 | | 0x88, 0x88, 0x88, 0xf8, 0x88, 0x88, 0x88, 0x00, |
| 175 | | 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, |
| 176 | | 0x08, 0x08, 0x08, 0x08, 0x88, 0x88, 0xf8, 0x00, |
| 177 | | 0x88, 0x90, 0xa0, 0xc0, 0xa0, 0x90, 0x88, 0x00, |
| 178 | | 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf8, 0x00, |
| 179 | | 0x88, 0xf8, 0xa8, 0xa8, 0x88, 0x88, 0x88, 0x00, |
| 180 | | 0x88, 0xc8, 0xa8, 0x98, 0x88, 0x88, 0x88, 0x00, |
| 181 | | 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, 0x00, |
| 182 | | 0xf8, 0x88, 0x88, 0xf8, 0x80, 0x80, 0x80, 0x00, |
| 183 | | 0x70, 0x88, 0x88, 0x88, 0xa8, 0x90, 0x68, 0x00, |
| 184 | | 0xf0, 0x88, 0x88, 0xf0, 0x90, 0x88, 0x88, 0x00, |
| 185 | | 0x70, 0x88, 0x80, 0x70, 0x08, 0x88, 0x70, 0x00, |
| 186 | | 0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, |
| 187 | | 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0xf8, 0x00, |
| 188 | | 0x88, 0x88, 0x88, 0x88, 0x88, 0x50, 0x20, 0x00, |
| 189 | | 0x88, 0x88, 0xa8, 0xa8, 0xa8, 0xa8, 0x50, 0x00, |
| 190 | | 0x88, 0x88, 0x50, 0x20, 0x50, 0x88, 0x88, 0x00, |
| 191 | | 0x88, 0x88, 0x88, 0x50, 0x20, 0x20, 0x20, 0x00, |
| 192 | | 0xf0, 0x10, 0x20, 0x40, 0x80, 0x80, 0xf0, 0x00, |
| 193 | | 0x70, 0x40, 0x40, 0x40, 0x40, 0x40, 0x70, 0x00, |
| 194 | | 0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, |
| 195 | | 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x70, 0x00, |
| 196 | | 0x20, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 197 | | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, |
| 198 | | 0x60, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 199 | | 0x00, 0x00, 0xf8, 0x08, 0xf8, 0x88, 0xf8, 0x00, |
| 200 | | 0x80, 0x80, 0xf8, 0x88, 0x88, 0x88, 0xf8, 0x00, |
| 201 | | 0x00, 0x00, 0xf8, 0x80, 0x80, 0x80, 0xf8, 0x00, |
| 202 | | 0x08, 0x08, 0x78, 0x88, 0x88, 0x88, 0x78, 0x00, |
| 203 | | 0x00, 0x00, 0xf8, 0x88, 0xf8, 0x80, 0xf8, 0x00, |
| 204 | | 0x30, 0x40, 0x40, 0xf0, 0x40, 0x40, 0x40, 0x00, |
| 205 | | 0x00, 0x00, 0xf8, 0x88, 0x88, 0xf8, 0x08, 0x78, |
| 206 | | 0x80, 0x80, 0xf0, 0x90, 0x90, 0x90, 0x90, 0x00, |
| 207 | | 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, |
| 208 | | 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x90, 0x60, |
| 209 | | 0x80, 0x80, 0x90, 0xa0, 0xc0, 0xa0, 0x90, 0x00, |
| 210 | | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x30, 0x00, |
| 211 | | 0x00, 0x00, 0xf8, 0xa8, 0xa8, 0x88, 0x88, 0x00, |
| 212 | | 0x00, 0x00, 0xf0, 0x90, 0x90, 0x90, 0x90, 0x00, |
| 213 | | 0x00, 0x00, 0xf8, 0x88, 0x88, 0x88, 0xf8, 0x00, |
| 214 | | 0x00, 0x00, 0xf0, 0x88, 0x88, 0x88, 0xf0, 0x80, |
| 215 | | 0x00, 0x00, 0x78, 0x88, 0x88, 0x88, 0x78, 0x08, |
| 216 | | 0x00, 0x00, 0xb8, 0x48, 0x40, 0x40, 0xe0, 0x00, |
| 217 | | 0x00, 0x00, 0x70, 0x80, 0x70, 0x08, 0x70, 0x00, |
| 218 | | 0x00, 0x40, 0xf0, 0x40, 0x40, 0x50, 0x20, 0x00, |
| 219 | | 0x00, 0x00, 0x90, 0x90, 0x90, 0xb0, 0x50, 0x00, |
| 220 | | 0x00, 0x00, 0x88, 0x88, 0x88, 0x50, 0x20, 0x00, |
| 221 | | 0x00, 0x00, 0x88, 0x88, 0xa8, 0xf8, 0x50, 0x00, |
| 222 | | 0x00, 0x00, 0x90, 0x90, 0x60, 0x90, 0x90, 0x00, |
| 223 | | 0x00, 0x00, 0x90, 0x90, 0x90, 0x70, 0x20, 0xc0, |
| 224 | | 0x00, 0x00, 0xf0, 0x10, 0x60, 0x80, 0xf0, 0x00, |
| 225 | | 0x30, 0x40, 0x40, 0xc0, 0x40, 0x40, 0x30, 0x00, |
| 226 | | 0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x00, |
| 227 | | 0x60, 0x10, 0x10, 0x18, 0x10, 0x10, 0x60, 0x00, |
| 228 | | 0x50, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 229 | | 0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00, |
| 230 | | 0x00, 0x30, 0x78, 0xfc, 0x78, 0x30, 0x00, 0x00, |
| 231 | | 0x00, 0x30, 0x78, 0xfc, 0x78, 0x30, 0x00, 0x00, |
| 232 | | 0x00, 0x30, 0x78, 0xfc, 0x78, 0x30, 0x00, 0x00, |
| 233 | | 0x00, 0x00, 0x10, 0x38, 0x7c, 0x38, 0x10, 0x00 |
| 234 | | }; |
| 235 | | |
| 236 | | |
| 237 | 100 | /*************************************************************************** |
| 238 | 101 | FUNCTION PROTOTYPES |
| 239 | 102 | ***************************************************************************/ |
| r8173 | r8174 | |
| 242 | 105 | static VIDEO_UPDATE( x07 ); |
| 243 | 106 | static READ8_HANDLER( x07_IO_r ); |
| 244 | 107 | static WRITE8_HANDLER( x07_IO_w ); |
| 108 | static NVRAM_HANDLER( x07 ); |
| 245 | 109 | static TIMER_CALLBACK( irq_clear ); |
| 110 | static TIMER_CALLBACK( beep_stop ); |
| 246 | 111 | static TIMER_CALLBACK( keyboard_clear ); |
| 247 | 112 | static TIMER_DEVICE_CALLBACK( keyboard_poll ); |
| 248 | 113 | static MACHINE_START( x07 ); |
src/mess/drivers/x07.c
| r8173 | r8174 | |
| 5 | 5 | Driver by Sandro Ronco based on X-07 emu by J.Brigaud |
| 6 | 6 | |
| 7 | 7 | TODO: |
| 8 | | -External video |
| 9 | | -Sound |
| 10 | | -NVRAM and Save State |
| 11 | | -Kana and graphic char |
| 8 | -External video (need X-720 dump) |
| 12 | 9 | -Serial port |
| 13 | 10 | |
| 14 | | |
| 15 | 11 | Memory Map |
| 16 | 12 | |
| 17 | 13 | 0x0000 - 0x1fff Internal RAM |
| r8173 | r8174 | |
| 20 | 16 | 0x6000 - 0x7fff ROM Card |
| 21 | 17 | 0x8000 - 0x97ff Video RAM |
| 22 | 18 | 0x9800 - 0x9fff ? |
| 23 | | 0xA000 - 0xafff TV ROM |
| 19 | 0xa000 - 0xafff TV ROM (no dump) |
| 24 | 20 | 0xb000 - 0xffff ROM |
| 25 | 21 | |
| 26 | 22 | CPU was actually a NSC800 (Z80 compatible) |
| r8173 | r8174 | |
| 30 | 26 | |
| 31 | 27 | #include "emu.h" |
| 32 | 28 | #include "cpu/z80/z80.h" |
| 29 | #include "sound/beep.h" |
| 33 | 30 | #include "includes/x07.h" |
| 34 | 31 | |
| 35 | 32 | static void t6834_cmd (running_machine *machine, UINT8 cmd); |
| r8173 | r8174 | |
| 51 | 48 | t6834_state(running_machine &machine) { } |
| 52 | 49 | |
| 53 | 50 | /* General */ |
| 51 | UINT8 *ram; |
| 52 | UINT16 ram_size; |
| 54 | 53 | UINT8 t6834_ram[800]; |
| 55 | 54 | UINT8 regs_r[8]; |
| 56 | 55 | UINT8 regs_w[8]; |
| r8173 | r8174 | |
| 65 | 64 | UINT8 out_data[256]; |
| 66 | 65 | UINT8 out_size; |
| 67 | 66 | UINT8 out_pos; |
| 67 | emu_timer *irq_clear; |
| 68 | emu_timer *beep_clear; |
| 68 | 69 | |
| 69 | 70 | /* LCD */ |
| 70 | 71 | UINT8 lcd_on; |
| r8173 | r8174 | |
| 74 | 75 | UINT8 cur_on; |
| 75 | 76 | UINT8 cur_x; |
| 76 | 77 | UINT8 cur_y; |
| 77 | | UINT8 loc_on ; |
| 78 | UINT8 loc_on; |
| 78 | 79 | UINT8 loc_x; |
| 79 | 80 | UINT8 loc_y; |
| 80 | 81 | UINT8 font_code; |
| r8173 | r8174 | |
| 92 | 93 | UINT8 kb_wait; |
| 93 | 94 | UINT8 kb_data[20]; |
| 94 | 95 | UINT8 kb_size; |
| 96 | emu_timer *kb_clear; |
| 95 | 97 | }; |
| 96 | 98 | |
| 97 | 99 | |
| r8173 | r8174 | |
| 308 | 310 | break; |
| 309 | 311 | |
| 310 | 312 | case 0x16: //udk write |
| 311 | | p1 = state->in_data[state->in_pos++]; |
| 313 | p1 = state->in_data[state->in_pos++] - 1; |
| 312 | 314 | for(i = 0; i < ((p1 != 5 && p1 != 11) ? 0x2a : 0x2e); i++) |
| 313 | 315 | state->t6834_ram[udk_ptr[p1] + i] = state->in_data[state->in_pos++]; |
| 314 | 316 | break; |
| 315 | 317 | |
| 316 | 318 | case 0x17: //udk read |
| 317 | | p1 = state->in_data[state->in_pos++]; |
| 319 | p1 = state->in_data[state->in_pos++] - 1; |
| 318 | 320 | for(i = 0; i < ((p1 != 5 && p1 != 11) ? 0x2a : 0x2e); i++) |
| 319 | 321 | { |
| 320 | 322 | UINT8 code = state->t6834_ram[udk_ptr[p1] + i]; |
| r8173 | r8174 | |
| 341 | 343 | break; |
| 342 | 344 | |
| 343 | 345 | case 0x1c: //udc Init |
| 344 | | memcpy(&state->udc, &font, sizeof(state->udc)); |
| 346 | memcpy(&state->udc, (UINT8*)memory_region(machine, "gfx1"), memory_region_length(machine, "gfx1")); |
| 345 | 347 | break; |
| 346 | 348 | |
| 347 | 349 | case 0x1d: //Pgm Write |
| r8173 | r8174 | |
| 622 | 624 | state->shift = (row7 & 0x01) ? 1 : 0; |
| 623 | 625 | state->ctrl = (row7 & 0x02) ? 1 : 0; |
| 624 | 626 | state->graph = (row7 & 0x04) ? 1 : 0; |
| 627 | state->kana = (row7 & 0x10) ? 1 : 0; |
| 625 | 628 | |
| 626 | 629 | if(state->udk) |
| 627 | 630 | draw_udk(machine); |
| r8173 | r8174 | |
| 673 | 676 | } |
| 674 | 677 | else |
| 675 | 678 | { |
| 676 | | if (state->shift && !state->ctrl) |
| 679 | if (state->shift && !state->ctrl && !state->kana && !state->graph) |
| 677 | 680 | kb_table = 1; |
| 678 | | else if (!state->shift && state->ctrl) |
| 681 | else if (!state->shift && state->ctrl && !state->kana && !state->graph) |
| 679 | 682 | kb_table = 2; |
| 683 | else if (!state->shift && state->kana && !state->ctrl && !state->graph) |
| 684 | kb_table = 3; |
| 685 | else if (state->shift && state->kana && !state->ctrl && !state->graph) |
| 686 | kb_table = 4; |
| 687 | else if (!state->shift && !state->kana && !state->ctrl && state->graph) |
| 688 | kb_table = 5; |
| 689 | else |
| 690 | kb_table = 0; |
| 680 | 691 | |
| 681 | 692 | for (row = 0; row < 7; row++) |
| 682 | 693 | { |
| r8173 | r8174 | |
| 699 | 710 | { |
| 700 | 711 | state->kb_wait = 1; |
| 701 | 712 | irq_exec(machine); |
| 702 | | timer_set(machine, ATTOTIME_IN_MSEC(150), NULL, 0, keyboard_clear); |
| 713 | timer_adjust_oneshot(state->kb_clear, ATTOTIME_IN_MSEC(150), 0); |
| 703 | 714 | } |
| 704 | 715 | } |
| 705 | 716 | |
| r8173 | r8174 | |
| 712 | 723 | { |
| 713 | 724 | state->regs_r[0] = 0; |
| 714 | 725 | state->regs_r[1] = state->kb_data[0]; |
| 715 | | memcpy(state->kb_data, &state->kb_data[1], sizeof(state->kb_data - 1)); |
| 726 | memcpy(state->kb_data, &state->kb_data[1], sizeof(state->kb_data) - 1); |
| 716 | 727 | state->kb_size--; |
| 717 | 728 | state->regs_r[2] |= 0x01; |
| 718 | 729 | cputag_set_input_line(machine, "maincpu", NSC800_RSTA, ASSERT_LINE); |
| 719 | | timer_set(machine, cputag_clocks_to_attotime(machine, "maincpu", 500), NULL, 0, irq_clear); |
| 730 | timer_adjust_oneshot(state->irq_clear, cputag_clocks_to_attotime(machine, "maincpu", 500), 0); |
| 720 | 731 | return; |
| 721 | 732 | } |
| 722 | 733 | else if (state->kb_brk) |
| r8173 | r8174 | |
| 726 | 737 | state->regs_r[2] |= 0x01; |
| 727 | 738 | state->kb_brk = 0; |
| 728 | 739 | cputag_set_input_line(machine, "maincpu", NSC800_RSTA, ASSERT_LINE ); |
| 729 | | timer_set(machine, cputag_clocks_to_attotime(machine, "maincpu", 500), NULL, 0, irq_clear); |
| 740 | timer_adjust_oneshot(state->irq_clear, cputag_clocks_to_attotime(machine, "maincpu", 500), 0); |
| 730 | 741 | return; |
| 731 | 742 | } |
| 732 | 743 | else if ( state->z80_irq&1 ) |
| r8173 | r8174 | |
| 734 | 745 | receive_from_t6834 (machine); |
| 735 | 746 | state->z80_irq &= ~1; |
| 736 | 747 | cputag_set_input_line(machine, "maincpu", NSC800_RSTA, ASSERT_LINE); |
| 737 | | timer_set(machine, cputag_clocks_to_attotime(machine, "maincpu", 500), NULL, 0, irq_clear); |
| 748 | timer_adjust_oneshot(state->irq_clear, cputag_clocks_to_attotime(machine, "maincpu", 500), 0); |
| 738 | 749 | return; |
| 739 | 750 | } |
| 740 | 751 | } |
| r8173 | r8174 | |
| 916 | 927 | state->enable_k7=((data & 0x0c) == 8) ? 1 : 0; |
| 917 | 928 | if((data & 0x0e) == 0x0e) |
| 918 | 929 | { |
| 919 | | popmessage("Beep %x", state->regs_w[2] | (state->regs_w[3] << 8)); |
| 930 | running_device *speaker = devtag_get_device(space->machine, "beep"); |
| 920 | 931 | |
| 932 | beep_set_state(speaker, 1); |
| 933 | beep_set_frequency(speaker, 192000 / (state->regs_w[2] | (state->regs_w[3] << 8))); |
| 934 | |
| 935 | timer_adjust_oneshot(state->beep_clear, ATTOTIME_IN_MSEC(state->ram[0x450] * 0x32), 0); |
| 921 | 936 | } |
| 922 | 937 | |
| 923 | 938 | break; |
| r8173 | r8174 | |
| 933 | 948 | |
| 934 | 949 | static ADDRESS_MAP_START(x07_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 935 | 950 | ADDRESS_MAP_UNMAP_HIGH |
| 936 | | AM_RANGE(0x0000, 0x5fff) AM_RAM |
| 951 | AM_RANGE(0x0000, 0x5fff) AM_RAM AM_BASE_SIZE_MEMBER(t6834_state, ram, ram_size) |
| 937 | 952 | AM_RANGE(0x6000, 0x7fff) AM_READONLY |
| 938 | 953 | AM_RANGE(0x8000, 0x97ff) AM_RAM |
| 939 | 954 | AM_RANGE(0x9800, 0x9fff) AM_NOP |
| r8173 | r8174 | |
| 1033 | 1048 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("shift") PORT_CODE(KEYCODE_LSHIFT) |
| 1034 | 1049 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ctrl") PORT_CODE(KEYCODE_LCONTROL) |
| 1035 | 1050 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("GRPH") PORT_CODE(KEYCODE_RCONTROL) |
| 1036 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Break") PORT_CODE(KEYCODE_RSHIFT) |
| 1051 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Kana") PORT_CODE(KEYCODE_RALT) |
| 1052 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ON/Break") PORT_CODE(KEYCODE_RSHIFT) |
| 1037 | 1053 | |
| 1038 | 1054 | PORT_START("ROW8") |
| 1039 | 1055 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) |
| r8173 | r8174 | |
| 1044 | 1060 | |
| 1045 | 1061 | INPUT_PORTS_END |
| 1046 | 1062 | |
| 1063 | |
| 1064 | static NVRAM_HANDLER( x07 ) |
| 1065 | { |
| 1066 | t6834_state *state = (t6834_state *)machine->driver_data; |
| 1067 | |
| 1068 | if (read_or_write) |
| 1069 | { |
| 1070 | mame_fwrite(file, state->ram, state->ram_size); |
| 1071 | mame_fwrite(file, state->t6834_ram, sizeof(state->t6834_ram)); |
| 1072 | mame_fwrite(file, state->udc, sizeof(state->udc)); |
| 1073 | } |
| 1074 | else |
| 1075 | { |
| 1076 | if (file) |
| 1077 | { |
| 1078 | mame_fread(file, state->ram, state->ram_size); |
| 1079 | mame_fread(file, state->t6834_ram, sizeof(state->t6834_ram)); |
| 1080 | mame_fread(file, state->udc, sizeof(state->udc)); |
| 1081 | |
| 1082 | } |
| 1083 | else |
| 1084 | { |
| 1085 | for(int i = 0; i < 12; i++) |
| 1086 | strcpy((char*)state->t6834_ram + udk_ptr[i], udk_ini[i]); |
| 1087 | |
| 1088 | memcpy(&state->udc, (UINT8*)memory_region(machine, "gfx1"), memory_region_length(machine, "gfx1")); |
| 1089 | } |
| 1090 | } |
| 1091 | } |
| 1092 | |
| 1093 | |
| 1047 | 1094 | static TIMER_CALLBACK( irq_clear ) |
| 1048 | 1095 | { |
| 1049 | 1096 | cputag_set_input_line(machine, "maincpu", NSC800_RSTA, CLEAR_LINE); |
| 1050 | 1097 | } |
| 1051 | 1098 | |
| 1099 | static TIMER_CALLBACK( beep_stop ) |
| 1100 | { |
| 1101 | running_device *speaker = devtag_get_device(machine, "beep"); |
| 1102 | beep_set_state(speaker, 0); |
| 1103 | } |
| 1104 | |
| 1052 | 1105 | static TIMER_CALLBACK( keyboard_clear ) |
| 1053 | 1106 | { |
| 1054 | 1107 | t6834_state *state = (t6834_state *)machine->driver_data; |
| r8173 | r8174 | |
| 1061 | 1114 | keyboard_scan (timer->machine); |
| 1062 | 1115 | } |
| 1063 | 1116 | |
| 1117 | static const gfx_layout x07_charlayout = |
| 1118 | { |
| 1119 | 6, 8, /* 6 x 8 characters */ |
| 1120 | 256, /* 256 characters */ |
| 1121 | 1, /* 1 bits per pixel */ |
| 1122 | { 0 }, /* no bitplanes */ |
| 1123 | { 0, 1, 2, 3, 4, 5}, |
| 1124 | { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8}, |
| 1125 | 8*8 /* 8 bytes */ |
| 1126 | }; |
| 1127 | |
| 1128 | static GFXDECODE_START( x07 ) |
| 1129 | GFXDECODE_ENTRY( "gfx1", 0x0000, x07_charlayout, 0, 1 ) |
| 1130 | GFXDECODE_END |
| 1131 | |
| 1132 | |
| 1064 | 1133 | static MACHINE_START( x07 ) |
| 1065 | 1134 | { |
| 1066 | 1135 | t6834_state *state = (t6834_state *)machine->driver_data; |
| 1067 | 1136 | |
| 1068 | | state_save_register_global_pointer(machine, state->t6834_ram, sizeof(state->t6834_ram)); |
| 1137 | state ->irq_clear = timer_alloc(machine, irq_clear, 0); |
| 1138 | state ->beep_clear = timer_alloc(machine, beep_stop, 0); |
| 1139 | state ->kb_clear = timer_alloc(machine, keyboard_clear, 0); |
| 1140 | |
| 1141 | /* Save State */ |
| 1142 | |
| 1143 | state_save_register_global_array(machine, state->t6834_ram); |
| 1144 | state_save_register_global_array(machine, state->regs_r); |
| 1145 | state_save_register_global_array(machine, state->regs_w); |
| 1146 | state_save_register_global_array(machine, state->udc); |
| 1147 | state_save_register_global_array(machine, state->alarm); |
| 1148 | state_save_register_global(machine, state->enable_k7); |
| 1149 | state_save_register_global(machine, state->udk); |
| 1150 | state_save_register_global(machine, state->z80_irq); |
| 1151 | state_save_register_global_array(machine, state->in_data); |
| 1152 | state_save_register_global(machine, state->in_size); |
| 1153 | state_save_register_global(machine, state->in_pos); |
| 1154 | state_save_register_global_array(machine, state->out_data); |
| 1155 | state_save_register_global(machine, state->out_size); |
| 1156 | state_save_register_global(machine, state->out_pos); |
| 1157 | state_save_register_global(machine, state->lcd_on); |
| 1158 | state_save_register_global_2d_array(machine, state->lcd_map); |
| 1159 | state_save_register_global(machine, state->scroll_min); |
| 1160 | state_save_register_global(machine, state->scroll_max); |
| 1161 | state_save_register_global(machine, state->cur_on); |
| 1162 | state_save_register_global(machine, state->cur_x); |
| 1163 | state_save_register_global(machine, state->cur_y); |
| 1164 | state_save_register_global(machine, state->loc_on); |
| 1165 | state_save_register_global(machine, state->loc_x); |
| 1166 | state_save_register_global(machine, state->loc_y); |
| 1167 | state_save_register_global(machine, state->font_code); |
| 1168 | state_save_register_global(machine, state->kb_on); |
| 1169 | state_save_register_global(machine, state->ctrl); |
| 1170 | state_save_register_global(machine, state->shift); |
| 1171 | state_save_register_global(machine, state->kana); |
| 1172 | state_save_register_global(machine, state->graph); |
| 1173 | state_save_register_global(machine, state->stick); |
| 1174 | state_save_register_global(machine, state->strig); |
| 1175 | state_save_register_global(machine, state->strig1); |
| 1176 | state_save_register_global(machine, state->kb_brk); |
| 1177 | state_save_register_global(machine, state->kb_wait); |
| 1178 | state_save_register_global_array(machine, state->kb_data); |
| 1179 | state_save_register_global(machine, state->kb_size); |
| 1069 | 1180 | } |
| 1070 | 1181 | |
| 1071 | 1182 | static MACHINE_RESET( x07 ) |
| 1072 | 1183 | { |
| 1073 | 1184 | t6834_state *state = (t6834_state *)machine->driver_data; |
| 1074 | | UINT8 i; |
| 1185 | |
| 1075 | 1186 | cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_PC, 0xc3c3); |
| 1076 | 1187 | |
| 1077 | | memset(state, 0, sizeof(t6834_state)); |
| 1188 | memset(state->regs_r, 0, sizeof(state->regs_r)); |
| 1189 | memset(state->regs_w, 0, sizeof(state->regs_w)); |
| 1190 | memset(state->alarm, 0, sizeof(state->alarm)); |
| 1191 | memset(state->in_data, 0, sizeof(state->in_data)); |
| 1192 | memset(state->out_data, 0, sizeof(state->out_data)); |
| 1193 | memset(state->lcd_map, 0, sizeof(state->lcd_map)); |
| 1194 | memset(state->kb_data, 0, sizeof(state->kb_data)); |
| 1078 | 1195 | |
| 1079 | | state->lcd_on = 0x01; |
| 1080 | | state->stick = 0x30; |
| 1081 | | state->strig = 0xFF; |
| 1082 | | state->strig1 = 0xFF; |
| 1083 | | state->scroll_max = 0x03; |
| 1196 | state->enable_k7 = 0; |
| 1197 | state->udk = 0; |
| 1198 | state->z80_irq = 0; |
| 1199 | state->in_size = 0; |
| 1200 | state->in_pos = 0; |
| 1201 | state->out_size = 0; |
| 1202 | state->out_pos = 0; |
| 1203 | state->lcd_on = 0x01; |
| 1204 | state->scroll_min = 0; |
| 1205 | state->scroll_max = 0x03; |
| 1206 | state->cur_on = 0; |
| 1207 | state->cur_x = 0; |
| 1208 | state->cur_y = 0; |
| 1209 | state->loc_on = 0; |
| 1210 | state->loc_x = 0; |
| 1211 | state->loc_y = 0; |
| 1212 | state->font_code = 0; |
| 1213 | state->kb_on = 0; |
| 1214 | state->ctrl = 0; |
| 1215 | state->shift = 0; |
| 1216 | state->kana = 0; |
| 1217 | state->graph = 0; |
| 1218 | state->stick = 0x30; |
| 1219 | state->strig = 0xff; |
| 1220 | state->strig1 = 0xff; |
| 1221 | state->kb_brk = 0; |
| 1222 | state->kb_wait = 0; |
| 1223 | state->kb_size = 0; |
| 1084 | 1224 | |
| 1085 | | for(i = 0; i < 12; i++) |
| 1086 | | strcpy((char*)state->t6834_ram + udk_ptr[i], udk_ini[i]); |
| 1087 | | |
| 1088 | 1225 | state->regs_r[2] = input_port_read(machine, "CARDBATTERY"); |
| 1089 | | |
| 1090 | | memcpy(&state->udc, &font, sizeof(font)); |
| 1091 | 1226 | } |
| 1092 | 1227 | |
| 1093 | 1228 | static MACHINE_DRIVER_START( x07 ) |
| r8173 | r8174 | |
| 1112 | 1247 | MDRV_PALETTE_LENGTH(2) |
| 1113 | 1248 | MDRV_PALETTE_INIT(x07) |
| 1114 | 1249 | MDRV_DEFAULT_LAYOUT(layout_lcd) |
| 1250 | MDRV_GFXDECODE(x07) |
| 1115 | 1251 | MDRV_VIDEO_UPDATE(x07) |
| 1116 | 1252 | |
| 1253 | |
| 1254 | MDRV_SPEAKER_STANDARD_MONO( "mono" ) |
| 1255 | MDRV_SOUND_ADD( "beep", BEEP, 0 ) |
| 1256 | MDRV_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) |
| 1257 | |
| 1117 | 1258 | MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_poll, USEC(2500)) |
| 1118 | 1259 | |
| 1260 | MDRV_NVRAM_HANDLER(x07) |
| 1261 | |
| 1119 | 1262 | MACHINE_DRIVER_END |
| 1120 | 1263 | |
| 1121 | 1264 | /* ROM definition */ |
| r8173 | r8174 | |
| 1123 | 1266 | /* very strange size... */ |
| 1124 | 1267 | ROM_REGION( 0x11000, "maincpu", 0 ) |
| 1125 | 1268 | ROM_LOAD( "x07.bin", 0xb000, 0x5001, CRC(61a6e3cc) SHA1(c53c22d33085ac7d5e490c5d8f41207729e5f08a) ) |
| 1269 | |
| 1270 | ROM_REGION( 0x0800, "gfx1", 0 ) |
| 1271 | ROM_LOAD( "charset.rom", 0x0000, 0x0800, CRC(b1e59a6e) SHA1(b0c06315a2d5c940a8f288fb6a3428d738696e69) ) |
| 1272 | |
| 1126 | 1273 | ROM_END |
| 1127 | 1274 | |
| 1128 | 1275 | /* Driver */ |
| 1129 | 1276 | |
| 1130 | 1277 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ |
| 1131 | | COMP( 1983, x07, 0, 0, x07, x07, 0, "Canon", "X-07", GAME_NO_SOUND) |
| 1278 | COMP( 1983, x07, 0, 0, x07, x07, 0, "Canon", "X-07", GAME_SUPPORTS_SAVE) |