src/mess/drivers/v6809.c
| r15765 | r15766 | |
| 29 | 29 | |
| 30 | 30 | ToDo: |
| 31 | 31 | |
| 32 | | - Fix the video, it is currently a complete hackfest. |
| 33 | | -- Cursor not working |
| 34 | | -- Colours are a guess |
| 35 | | -- Doesn't scroll properly. |
| 36 | | -- Please note, the colour bytes are intermingled with the characters, |
| 37 | | this appears to be the most likely mode of operation. |
| 32 | - Colours (a photo shows colours but the schematic doesn't |
| 33 | have any ram for colours). |
| 38 | 34 | |
| 39 | 35 | - Connect the devices (RTC, FDC, PIAs, ACIAs, timer). |
| 40 | 36 | |
| r15765 | r15766 | |
| 71 | 67 | |
| 72 | 68 | required_device<cpu_device> m_maincpu; |
| 73 | 69 | required_device<mc6845_device> m_crtc; |
| 74 | | DECLARE_READ8_MEMBER(videoram_r); |
| 75 | 70 | DECLARE_READ8_MEMBER(key_r); |
| 76 | 71 | DECLARE_READ8_MEMBER(status_r); |
| 77 | 72 | DECLARE_WRITE8_MEMBER(videoram_w); |
| r15765 | r15766 | |
| 83 | 78 | UINT16 m_video_address; |
| 84 | 79 | UINT8 m_video_index; |
| 85 | 80 | UINT8 m_term_data; |
| 81 | UINT8 m_vidbyte; |
| 86 | 82 | }; |
| 87 | 83 | |
| 88 | 84 | |
| 89 | | READ8_MEMBER( v6809_state::videoram_r ) |
| 90 | | { |
| 91 | | return m_p_videoram[m_video_address & 0xfff]; |
| 92 | | } |
| 93 | | |
| 94 | | READ8_MEMBER( v6809_state::key_r ) |
| 95 | | { |
| 96 | | UINT8 ret = m_term_data; |
| 97 | | m_term_data = 0; |
| 98 | | return ret; |
| 99 | | } |
| 100 | | |
| 101 | | READ8_MEMBER( v6809_state::status_r ) |
| 102 | | { |
| 103 | | return (m_term_data) ? 0x80 : 0; |
| 104 | | } |
| 105 | | |
| 106 | | WRITE8_MEMBER( v6809_state::videoram_w ) |
| 107 | | { |
| 108 | | m_p_videoram[m_video_address & 0xfff] = data; |
| 109 | | } |
| 110 | | |
| 111 | | WRITE8_MEMBER( v6809_state::v6809_address_w ) |
| 112 | | { |
| 113 | | m_crtc->address_w( space, 0, data ); |
| 114 | | |
| 115 | | m_video_index = data & 0x1f; |
| 116 | | |
| 117 | | // increment address so we can store the colour byte next |
| 118 | | if (m_video_index == 31) |
| 119 | | m_video_address++; |
| 120 | | } |
| 121 | | |
| 122 | | WRITE8_MEMBER( v6809_state::v6809_register_w ) |
| 123 | | { |
| 124 | | UINT16 temp = m_video_address >> 1; |
| 125 | | |
| 126 | | m_crtc->register_w( space, 0, data ); |
| 127 | | |
| 128 | | // Get transparent address |
| 129 | | if (m_video_index == 18) |
| 130 | | m_video_address = (((data & 0x3f) << 8 ) | (temp & 0xff)) << 1; |
| 131 | | else |
| 132 | | if (m_video_index == 19) |
| 133 | | m_video_address = (data | (temp & 0xff00)) << 1; |
| 134 | | } |
| 135 | | |
| 136 | | |
| 137 | 85 | static ADDRESS_MAP_START(v6809_mem, AS_PROGRAM, 8, v6809_state) |
| 138 | 86 | ADDRESS_MAP_UNMAP_HIGH |
| 139 | 87 | AM_RANGE(0x0000, 0xefff) AM_RAM |
| 140 | 88 | AM_RANGE(0xf000, 0xf000) AM_MIRROR(0xfe) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(v6809_address_w) |
| 141 | 89 | AM_RANGE(0xf001, 0xf001) AM_MIRROR(0xfe) AM_DEVREAD("crtc", mc6845_device, register_r) AM_WRITE(v6809_register_w) |
| 142 | | AM_RANGE(0xf200, 0xf200) AM_MIRROR(0xff) AM_READWRITE(videoram_r,videoram_w) |
| 90 | AM_RANGE(0xf200, 0xf200) AM_MIRROR(0xff) AM_WRITE(videoram_w) |
| 143 | 91 | //AM_RANGE(0xf505, 0xf506) acia-1 (modem) |
| 144 | 92 | //AM_RANGE(0xf50c, 0xf50d) acia-2 (printer) |
| 145 | 93 | //AM_RANGE(0xf600, 0xf603) AM_MIRROR(0x3c) disk controller |
| r15765 | r15766 | |
| 163 | 111 | static INPUT_PORTS_START( v6809 ) |
| 164 | 112 | INPUT_PORTS_END |
| 165 | 113 | |
| 114 | // **** Video **** |
| 166 | 115 | |
| 167 | | static MACHINE_RESET(v6809) |
| 168 | | { |
| 169 | | } |
| 170 | | |
| 171 | 116 | /* F4 Character Displayer */ |
| 172 | 117 | static const gfx_layout v6809_charlayout = |
| 173 | 118 | { |
| r15765 | r15766 | |
| 183 | 128 | }; |
| 184 | 129 | |
| 185 | 130 | static GFXDECODE_START( v6809 ) |
| 186 | | GFXDECODE_ENTRY( "chargen", 0x0000, v6809_charlayout, 0, 1 ) |
| 131 | GFXDECODE_ENTRY( "chargen", 0x0000, v6809_charlayout, 0, 4 ) |
| 187 | 132 | GFXDECODE_END |
| 188 | 133 | |
| 189 | 134 | MC6845_UPDATE_ROW( v6809_update_row ) |
| 190 | 135 | { |
| 191 | 136 | v6809_state *state = device->machine().driver_data<v6809_state>(); |
| 192 | 137 | const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); |
| 193 | | UINT8 chr,gfx,col,bg,fg; |
| 138 | UINT8 chr,gfx; |
| 194 | 139 | UINT16 mem,x; |
| 195 | 140 | UINT32 *p = &bitmap.pix32(y); |
| 196 | 141 | |
| 197 | | ma &= 0x7ff; |
| 198 | | |
| 199 | 142 | for (x = 0; x < x_count; x++) |
| 200 | 143 | { |
| 201 | | mem = (ma + x) << 1; |
| 202 | | chr = state->m_p_videoram[mem++]; |
| 203 | | if (!chr) chr=0x20; // remove when we get the correct chargen |
| 144 | mem = (ma + x) & 0x7ff; |
| 145 | chr = state->m_p_videoram[mem]; |
| 146 | if (x == cursor_x) |
| 147 | gfx = 0xff; |
| 148 | else |
| 149 | gfx = state->m_p_chargen[(chr<<4) | ra]; |
| 204 | 150 | |
| 205 | | col = state->m_p_videoram[mem]; |
| 206 | | fg = col >> 4; |
| 207 | | bg = col & 15; |
| 208 | | |
| 209 | | /* get pattern of pixels for that character scanline */ |
| 210 | | gfx = state->m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); |
| 211 | | |
| 212 | 151 | /* Display a scanline of a character (8 pixels) */ |
| 213 | | *p++ = palette[BIT(gfx, 7) ? fg : bg]; |
| 214 | | *p++ = palette[BIT(gfx, 6) ? fg : bg]; |
| 215 | | *p++ = palette[BIT(gfx, 5) ? fg : bg]; |
| 216 | | *p++ = palette[BIT(gfx, 4) ? fg : bg]; |
| 217 | | *p++ = palette[BIT(gfx, 3) ? fg : bg]; |
| 218 | | *p++ = palette[BIT(gfx, 2) ? fg : bg]; |
| 219 | | *p++ = palette[BIT(gfx, 1) ? fg : bg]; |
| 220 | | *p++ = palette[BIT(gfx, 0) ? fg : bg]; |
| 152 | *p++ = palette[BIT(gfx, 7)]; |
| 153 | *p++ = palette[BIT(gfx, 6)]; |
| 154 | *p++ = palette[BIT(gfx, 5)]; |
| 155 | *p++ = palette[BIT(gfx, 4)]; |
| 156 | *p++ = palette[BIT(gfx, 3)]; |
| 157 | *p++ = palette[BIT(gfx, 2)]; |
| 158 | *p++ = palette[BIT(gfx, 1)]; |
| 159 | *p++ = palette[BIT(gfx, 0)]; |
| 221 | 160 | } |
| 222 | 161 | } |
| 223 | 162 | |
| 224 | 163 | MC6845_ON_UPDATE_ADDR_CHANGED( v6809_update_addr ) |
| 225 | 164 | { |
| 226 | 165 | /* not sure what goes in here - parameters passed are device, address, strobe */ |
| 166 | v6809_state *state = device->machine().driver_data<v6809_state>(); |
| 167 | state->m_video_address = address & 0x7ff; |
| 227 | 168 | } |
| 228 | 169 | |
| 229 | 170 | static VIDEO_START( v6809 ) |
| r15765 | r15766 | |
| 246 | 187 | v6809_update_addr /* handler to process transparent mode */ |
| 247 | 188 | }; |
| 248 | 189 | |
| 190 | WRITE8_MEMBER( v6809_state::videoram_w ) |
| 191 | { |
| 192 | m_vidbyte = data; |
| 193 | } |
| 194 | |
| 195 | WRITE8_MEMBER( v6809_state::v6809_address_w ) |
| 196 | { |
| 197 | m_crtc->address_w( space, 0, data ); |
| 198 | |
| 199 | m_video_index = data & 0x1f; |
| 200 | |
| 201 | if (m_video_index == 31) |
| 202 | m_p_videoram[m_video_address] = m_vidbyte; |
| 203 | } |
| 204 | |
| 205 | WRITE8_MEMBER( v6809_state::v6809_register_w ) |
| 206 | { |
| 207 | UINT16 temp = m_video_address; |
| 208 | |
| 209 | m_crtc->register_w( space, 0, data ); |
| 210 | |
| 211 | // Get transparent address |
| 212 | if (m_video_index == 18) |
| 213 | m_video_address = ((data & 7) << 8 ) | (temp & 0xff); |
| 214 | else |
| 215 | if (m_video_index == 19) |
| 216 | m_video_address = data | (temp & 0xff00); |
| 217 | } |
| 218 | |
| 219 | // **** Keyboard **** |
| 220 | |
| 221 | READ8_MEMBER( v6809_state::key_r ) |
| 222 | { |
| 223 | UINT8 ret = m_term_data; |
| 224 | m_term_data = 0; |
| 225 | return ret; |
| 226 | } |
| 227 | |
| 228 | READ8_MEMBER( v6809_state::status_r ) |
| 229 | { |
| 230 | return (m_term_data) ? 0x80 : 0; |
| 231 | } |
| 232 | |
| 249 | 233 | WRITE8_MEMBER( v6809_state::kbd_put ) |
| 250 | 234 | { |
| 251 | 235 | m_term_data = data; |
| r15765 | r15766 | |
| 256 | 240 | DEVCB_DRIVER_MEMBER(v6809_state, kbd_put) |
| 257 | 241 | }; |
| 258 | 242 | |
| 243 | // *** Machine **** |
| 244 | |
| 245 | static MACHINE_RESET(v6809) |
| 246 | { |
| 247 | } |
| 248 | |
| 259 | 249 | static MACHINE_CONFIG_START( v6809, v6809_state ) |
| 260 | 250 | /* basic machine hardware */ |
| 261 | 251 | MCFG_CPU_ADD("maincpu", M6809, XTAL_16MHz / 4) |
| r15765 | r15766 | |
| 272 | 262 | MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 273 | 263 | MCFG_SCREEN_UPDATE_DEVICE("crtc", sy6545_1_device, screen_update) |
| 274 | 264 | MCFG_VIDEO_START(v6809) |
| 275 | | MCFG_PALETTE_LENGTH(16) |
| 265 | MCFG_PALETTE_LENGTH(2) |
| 266 | MCFG_PALETTE_INIT(black_and_white) |
| 276 | 267 | MCFG_GFXDECODE(v6809) |
| 277 | 268 | |
| 278 | 269 | /* Devices */ |