Previous 15994 Revisions Next

r15766 Monday 6th August, 2012 at 08:51:29 UTC by Robbbert
V6809 : various video improvements. [Robbbert]
[src/mess/drivers]v6809.c

src/mess/drivers/v6809.c
r15765r15766
2929
3030ToDo:
3131
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).
3834
3935- Connect the devices (RTC, FDC, PIAs, ACIAs, timer).
4036
r15765r15766
7167
7268   required_device<cpu_device> m_maincpu;
7369   required_device<mc6845_device> m_crtc;
74   DECLARE_READ8_MEMBER(videoram_r);
7570   DECLARE_READ8_MEMBER(key_r);
7671   DECLARE_READ8_MEMBER(status_r);
7772   DECLARE_WRITE8_MEMBER(videoram_w);
r15765r15766
8378   UINT16 m_video_address;
8479   UINT8 m_video_index;
8580   UINT8 m_term_data;
81   UINT8 m_vidbyte;
8682};
8783
8884
89READ8_MEMBER( v6809_state::videoram_r )
90{
91   return m_p_videoram[m_video_address & 0xfff];
92}
93
94READ8_MEMBER( v6809_state::key_r )
95{
96   UINT8 ret = m_term_data;
97   m_term_data = 0;
98   return ret;
99}
100
101READ8_MEMBER( v6809_state::status_r )
102{
103   return (m_term_data) ? 0x80 : 0;
104}
105
106WRITE8_MEMBER( v6809_state::videoram_w )
107{
108   m_p_videoram[m_video_address & 0xfff] = data;
109}
110
111WRITE8_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
122WRITE8_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
13785static ADDRESS_MAP_START(v6809_mem, AS_PROGRAM, 8, v6809_state)
13886   ADDRESS_MAP_UNMAP_HIGH
13987   AM_RANGE(0x0000, 0xefff) AM_RAM
14088   AM_RANGE(0xf000, 0xf000) AM_MIRROR(0xfe) AM_DEVREAD("crtc", mc6845_device, status_r) AM_WRITE(v6809_address_w)
14189   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)
14391   //AM_RANGE(0xf505, 0xf506) acia-1 (modem)
14492   //AM_RANGE(0xf50c, 0xf50d) acia-2 (printer)
14593   //AM_RANGE(0xf600, 0xf603) AM_MIRROR(0x3c) disk controller
r15765r15766
163111static INPUT_PORTS_START( v6809 )
164112INPUT_PORTS_END
165113
114// **** Video ****
166115
167static MACHINE_RESET(v6809)
168{
169}
170
171116/* F4 Character Displayer */
172117static const gfx_layout v6809_charlayout =
173118{
r15765r15766
183128};
184129
185130static GFXDECODE_START( v6809 )
186   GFXDECODE_ENTRY( "chargen", 0x0000, v6809_charlayout, 0, 1 )
131   GFXDECODE_ENTRY( "chargen", 0x0000, v6809_charlayout, 0, 4 )
187132GFXDECODE_END
188133
189134MC6845_UPDATE_ROW( v6809_update_row )
190135{
191136   v6809_state *state = device->machine().driver_data<v6809_state>();
192137   const rgb_t *palette = palette_entry_list_raw(bitmap.palette());
193   UINT8 chr,gfx,col,bg,fg;
138   UINT8 chr,gfx;
194139   UINT16 mem,x;
195140   UINT32 *p = &bitmap.pix32(y);
196141
197   ma &= 0x7ff;
198
199142   for (x = 0; x < x_count; x++)
200143   {
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];
204150
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
212151      /* 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)];
221160   }
222161}
223162
224163MC6845_ON_UPDATE_ADDR_CHANGED( v6809_update_addr )
225164{
226165/* 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;
227168}
228169
229170static VIDEO_START( v6809 )
r15765r15766
246187   v6809_update_addr      /* handler to process transparent mode */
247188};
248189
190WRITE8_MEMBER( v6809_state::videoram_w )
191{
192   m_vidbyte = data;
193}
194
195WRITE8_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
205WRITE8_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
221READ8_MEMBER( v6809_state::key_r )
222{
223   UINT8 ret = m_term_data;
224   m_term_data = 0;
225   return ret;
226}
227
228READ8_MEMBER( v6809_state::status_r )
229{
230   return (m_term_data) ? 0x80 : 0;
231}
232
249233WRITE8_MEMBER( v6809_state::kbd_put )
250234{
251235   m_term_data = data;
r15765r15766
256240   DEVCB_DRIVER_MEMBER(v6809_state, kbd_put)
257241};
258242
243// *** Machine ****
244
245static MACHINE_RESET(v6809)
246{
247}
248
259249static MACHINE_CONFIG_START( v6809, v6809_state )
260250   /* basic machine hardware */
261251   MCFG_CPU_ADD("maincpu", M6809, XTAL_16MHz / 4)
r15765r15766
272262   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
273263   MCFG_SCREEN_UPDATE_DEVICE("crtc", sy6545_1_device, screen_update)
274264   MCFG_VIDEO_START(v6809)
275   MCFG_PALETTE_LENGTH(16)
265   MCFG_PALETTE_LENGTH(2)
266   MCFG_PALETTE_INIT(black_and_white)
276267   MCFG_GFXDECODE(v6809)
277268
278269   /* Devices */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team