src/mess/drivers/ms0515.c
| r15770 | r15771 | |
| 12 | 12 | #include "imagedev/flopdrv.h" |
| 13 | 13 | #include "formats/basicdsk.h" |
| 14 | 14 | #include "machine/ram.h" |
| 15 | #include "machine/i8255.h" |
| 15 | 16 | |
| 16 | 17 | class ms0515_state : public driver_device |
| 17 | 18 | { |
| r15770 | r15771 | |
| 23 | 24 | |
| 24 | 25 | required_device<cpu_device> m_maincpu; |
| 25 | 26 | |
| 26 | | DECLARE_WRITE16_MEMBER(ms0515_bank_w); |
| 27 | DECLARE_WRITE16_MEMBER(ms0515_bank_w); |
| 28 | DECLARE_WRITE8_MEMBER(ms0515_sys_w); |
| 29 | |
| 27 | 30 | virtual void machine_reset(); |
| 28 | 31 | |
| 29 | 32 | UINT8 *m_video_ram; |
| 33 | UINT8 m_sysreg; |
| 34 | int m_blink; |
| 30 | 35 | }; |
| 31 | 36 | |
| 32 | 37 | static ADDRESS_MAP_START(ms0515_mem, AS_PROGRAM, 16, ms0515_state) |
| r15770 | r15771 | |
| 57 | 62 | //AM_RANGE(0177542, 0177543) |
| 58 | 63 | //AM_RANGE(0177544, 0177545) // i8255 for MS-7007 Keyboard |
| 59 | 64 | //AM_RANGE(0177546, 0177547) |
| 60 | | |
| 61 | | //AM_RANGE(0177600, 0177601) |
| 62 | | //AM_RANGE(0177602, 0177603) |
| 63 | | //AM_RANGE(0177604, 0177605) // i8255 for parallel port |
| 64 | | //AM_RANGE(0177606, 0177607) |
| 65 | 65 | |
| 66 | AM_RANGE(0177600, 0177607) AM_DEVREADWRITE8("ppi8255_1", i8255_device, read, write, 0x00ff) |
| 67 | |
| 66 | 68 | AM_RANGE(0177640, 0177641) AM_DEVREADWRITE8_LEGACY("vg93", wd17xx_status_r, wd17xx_command_w,0x00ff) |
| 67 | 69 | AM_RANGE(0177642, 0177643) AM_DEVREADWRITE8_LEGACY("vg93", wd17xx_track_r, wd17xx_track_w,0x00ff) |
| 68 | 70 | AM_RANGE(0177644, 0177645) AM_DEVREADWRITE8_LEGACY("vg93", wd17xx_sector_r, wd17xx_sector_w,0x00ff) |
| r15770 | r15771 | |
| 104 | 106 | break; |
| 105 | 107 | } |
| 106 | 108 | } |
| 107 | | printf("bank[%d] %02x video %d\n",((data >> 10) % 3),data & 0x7f, BIT(data,7)); |
| 108 | 109 | } |
| 109 | 110 | |
| 111 | WRITE8_MEMBER(ms0515_state::ms0515_sys_w) |
| 112 | { |
| 113 | m_sysreg = data; |
| 114 | } |
| 115 | |
| 110 | 116 | void ms0515_state::machine_reset() |
| 111 | 117 | { |
| 112 | 118 | UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer(); |
| 113 | 119 | ms0515_bank_w(*machine().memory().first_space(),0,0); |
| 114 | 120 | |
| 115 | 121 | m_video_ram = ram + 0000000 + 0340000; |
| 122 | m_blink = 0; |
| 116 | 123 | } |
| 117 | 124 | |
| 118 | 125 | /* Input ports */ |
| r15770 | r15771 | |
| 157 | 164 | |
| 158 | 165 | static SCREEN_UPDATE_IND16( ms0515 ) |
| 159 | 166 | { |
| 160 | | ms0515_state *state = screen.machine().driver_data<ms0515_state>(); |
| 161 | | UINT8 code; |
| 162 | | int y, x, b; |
| 163 | | |
| 167 | ms0515_state *state = screen.machine().driver_data<ms0515_state>(); |
| 168 | int y, x, b; |
| 164 | 169 | int addr = 0; |
| 165 | | for (y = 0; y < 200; y++) |
| 166 | | { |
| 167 | | int horpos = 0; |
| 168 | | for (x = 0; x < 40; x++) |
| 170 | if (BIT(state->m_sysreg,3)) { |
| 171 | for (y = 0; y < 200; y++) |
| 169 | 172 | { |
| 170 | | code = state->m_video_ram[addr]; addr+=2; |
| 171 | | for (b = 0; b < 8; b++) |
| 173 | int horpos = 0; |
| 174 | for (x = 0; x < 40; x++) |
| 172 | 175 | { |
| 173 | | // In lower res mode we will just double pixels |
| 174 | | bitmap.pix16(y, horpos++) = (code >> (7-b)) & 0x01; |
| 175 | | bitmap.pix16(y, horpos++) = (code >> (7-b)) & 0x01; |
| 176 | UINT16 code = (state->m_video_ram[addr++] << 8); |
| 177 | code += state->m_video_ram[addr++]; |
| 178 | for (b = 0; b < 16; b++) |
| 179 | { |
| 180 | // In lower res mode we will just double pixels |
| 181 | bitmap.pix16(y, horpos++) = ((code >> (15-b)) & 0x01) ? 0 : 7; |
| 182 | } |
| 176 | 183 | } |
| 177 | 184 | } |
| 185 | } else { |
| 186 | for (y = 0; y < 200; y++) |
| 187 | { |
| 188 | int horpos = 0; |
| 189 | for (x = 0; x < 40; x++) |
| 190 | { |
| 191 | UINT8 code = state->m_video_ram[addr++]; |
| 192 | UINT8 attr = state->m_video_ram[addr++]; |
| 193 | UINT8 fg = (attr & 7) + BIT(attr,14)*8; |
| 194 | UINT8 bg = ((attr >> 3) & 7) + BIT(attr,14)*8; |
| 195 | if (BIT(attr,15) && (state->m_blink == 20)) { |
| 196 | UINT8 tmp = fg; |
| 197 | fg = bg; bg = tmp; |
| 198 | state->m_blink = -1; |
| 199 | } |
| 200 | for (b = 0; b < 8; b++) |
| 201 | { |
| 202 | // In lower res mode we will just double pixels |
| 203 | bitmap.pix16(y, horpos++) = ((code >> (7-b)) & 0x01) ? fg : bg; |
| 204 | bitmap.pix16(y, horpos++) = ((code >> (7-b)) & 0x01) ? fg : bg; |
| 205 | } |
| 206 | } |
| 207 | } |
| 178 | 208 | } |
| 209 | state->m_blink++; |
| 179 | 210 | return 0; |
| 180 | 211 | } |
| 181 | 212 | |
| 213 | static PALETTE_INIT( ms0515 ) |
| 214 | { |
| 215 | palette_set_color(machine, 0, MAKE_RGB(0, 0, 0)); |
| 216 | palette_set_color(machine, 1, MAKE_RGB(0, 0, 127)); |
| 217 | palette_set_color(machine, 2, MAKE_RGB(127, 0, 0)); |
| 218 | palette_set_color(machine, 3, MAKE_RGB(127, 0, 127)); |
| 219 | palette_set_color(machine, 4, MAKE_RGB(0, 127, 0)); |
| 220 | palette_set_color(machine, 5, MAKE_RGB(0, 127, 127)); |
| 221 | palette_set_color(machine, 6, MAKE_RGB(127, 127, 0)); |
| 222 | palette_set_color(machine, 7, MAKE_RGB(127, 127, 127)); |
| 223 | |
| 224 | palette_set_color(machine, 8, MAKE_RGB(127, 127, 127)); |
| 225 | palette_set_color(machine, 9, MAKE_RGB(127, 127, 255)); |
| 226 | palette_set_color(machine, 10, MAKE_RGB(255, 127, 127)); |
| 227 | palette_set_color(machine, 11, MAKE_RGB(255, 127, 255)); |
| 228 | palette_set_color(machine, 12, MAKE_RGB(127, 255, 127)); |
| 229 | palette_set_color(machine, 13, MAKE_RGB(127, 255, 255)); |
| 230 | palette_set_color(machine, 14, MAKE_RGB(255, 255, 127)); |
| 231 | palette_set_color(machine, 15, MAKE_RGB(255, 255, 255)); |
| 232 | } |
| 233 | |
| 234 | static WRITE8_DEVICE_HANDLER(ms0515_portc_w) |
| 235 | { |
| 236 | ms0515_state *state = device->machine().driver_data<ms0515_state>(); |
| 237 | state->m_sysreg = data; |
| 238 | } |
| 239 | I8255A_INTERFACE( ms0515_ppi8255_interface_1 ) |
| 240 | { |
| 241 | DEVCB_NULL, |
| 242 | DEVCB_NULL, |
| 243 | DEVCB_NULL, |
| 244 | DEVCB_NULL, |
| 245 | DEVCB_NULL, |
| 246 | DEVCB_HANDLER(ms0515_portc_w) |
| 247 | }; |
| 248 | |
| 182 | 249 | static MACHINE_CONFIG_START( ms0515, ms0515_state ) |
| 183 | 250 | /* basic machine hardware */ |
| 184 | 251 | MCFG_CPU_ADD("maincpu",T11, XTAL_4MHz) // Need proper CPU here |
| r15770 | r15771 | |
| 197 | 264 | MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) |
| 198 | 265 | MCFG_SCREEN_UPDATE_STATIC(ms0515) |
| 199 | 266 | |
| 200 | | MCFG_PALETTE_LENGTH(2) |
| 201 | | MCFG_PALETTE_INIT(black_and_white) |
| 267 | MCFG_PALETTE_LENGTH(16) |
| 268 | MCFG_PALETTE_INIT(ms0515) |
| 269 | |
| 270 | MCFG_I8255_ADD( "ppi8255_1", ms0515_ppi8255_interface_1 ) |
| 271 | //MCFG_I8255_ADD( "ppi8255_2", ms0515_ppi8255_interface_2 ) |
| 202 | 272 | |
| 203 | 273 | /* internal ram */ |
| 204 | 274 | MCFG_RAM_ADD(RAM_TAG) |