Previous 199869 Revisions Next

r40069 Thursday 30th July, 2015 at 08:31:00 UTC by Dirk Best
pmd85: use standard palette, clean up video emulation
[scripts/target/mame]mess.lua
[src/mess/drivers]pmd85.c
[src/mess/includes]pmd85.h
[src/mess/video]pmd85.c

trunk/scripts/target/mame/mess.lua
r248580r248581
23322332   MAME_DIR .. "src/mess/video/ondra.c",
23332333   MAME_DIR .. "src/mess/drivers/pmd85.c",
23342334   MAME_DIR .. "src/mess/machine/pmd85.c",
2335   MAME_DIR .. "src/mess/video/pmd85.c",
23362335   MAME_DIR .. "src/mess/drivers/pmi80.c",     
23372336   MAME_DIR .. "src/mess/drivers/sapi1.c",     
23382337}
trunk/src/mess/drivers/pmd85.c
r248580r248581
182182#include "formats/pmd_cas.h"
183183#include "machine/ram.h"
184184
185
186//**************************************************************************
187//  VIDEO EMULATION
188//**************************************************************************
189
190UINT32 pmd85_state::screen_update_pmd85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
191{
192   for (int y = 0; y < 256; y++)
193   {
194      // address of current line in PMD-85 video memory
195      UINT8 *line = m_ram->pointer() + 0xc000 + 0x40 * y;
196
197      for (int x = 0; x < 288/6; x++)
198      {
199         int pen = BIT(line[x], 7) ? 1 : 2;
200
201         bitmap.pix16(y, x * 6 + 0) = BIT(line[x], 0) ? pen : 0;
202         bitmap.pix16(y, x * 6 + 1) = BIT(line[x], 1) ? pen : 0;
203         bitmap.pix16(y, x * 6 + 2) = BIT(line[x], 2) ? pen : 0;
204         bitmap.pix16(y, x * 6 + 3) = BIT(line[x], 3) ? pen : 0;
205         bitmap.pix16(y, x * 6 + 4) = BIT(line[x], 4) ? pen : 0;
206         bitmap.pix16(y, x * 6 + 5) = BIT(line[x], 5) ? pen : 0;
207      }
208
209   }
210
211   return 0;
212}
213
214
185215/* I/O ports */
186216
187217static ADDRESS_MAP_START( pmd85_io_map, AS_IO, 8, pmd85_state )
r248580r248581
578608   MCFG_SCREEN_UPDATE_DRIVER(pmd85_state, screen_update_pmd85)
579609   MCFG_SCREEN_PALETTE("palette")
580610
581   MCFG_PALETTE_ADD("palette", sizeof (pmd85_palette) / 3)
582   MCFG_PALETTE_INIT_OWNER(pmd85_state, pmd85)
611   MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette")
583612
584613   /* sound hardware */
585614   MCFG_SPEAKER_STANDARD_MONO("mono")
trunk/src/mess/includes/pmd85.h
r248580r248581
7676   DECLARE_DRIVER_INIT(alfa);
7777   DECLARE_DRIVER_INIT(c2717);
7878   virtual void machine_reset();
79   virtual void video_start();
80   DECLARE_PALETTE_INIT(pmd85);
8179   UINT32 screen_update_pmd85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
8280   TIMER_CALLBACK_MEMBER(pmd85_cassette_timer_callback);
8381   DECLARE_WRITE_LINE_MEMBER(write_cas_tx);
r248580r248581
148146   void mato_update_memory();
149147   void c2717_update_memory();
150148   void pmd85_common_driver_init();
151   void pmd85_draw_scanline(bitmap_ind16 &bitmap, int pmd85_scanline);
152149   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
153150
154151   int m_cas_tx;
155152};
156153
157/*----------- defined in video/pmd85.c -----------*/
158154
159extern const unsigned char pmd85_palette[3*3];
160
161
162155#endif /* PMD85_H_ */
trunk/src/mess/video/pmd85.c
r248580r248581
1// license:BSD-3-Clause
2// copyright-holders:Krzysztof Strzecha
3/***************************************************************************
4
5  pmd85.c
6
7  Functions to emulate the video hardware of PMD-85.
8
9  Krzysztof Strzecha
10
11***************************************************************************/
12
13#include "emu.h"
14#include "includes/pmd85.h"
15
16const unsigned char pmd85_palette[3*3] =
17{
18   0x00, 0x00, 0x00,
19   0x7f, 0x7f, 0x7f,
20   0xff, 0xff, 0xff
21};
22
23PALETTE_INIT_MEMBER(pmd85_state, pmd85)
24{
25   int i;
26
27   for ( i = 0; i < sizeof(pmd85_palette) / 3; i++ ) {
28      m_palette->set_pen_color(i, pmd85_palette[i*3], pmd85_palette[i*3+1], pmd85_palette[i*3+2]);
29   }
30}
31
32void pmd85_state::video_start()
33{
34}
35
36void pmd85_state::pmd85_draw_scanline(bitmap_ind16 &bitmap, int pmd85_scanline)
37{
38   int x, i;
39   int pen0, pen1;
40   UINT8 data;
41
42   /* set up scanline */
43   UINT16 *scanline = &bitmap.pix16(pmd85_scanline);
44
45   /* address of current line in PMD-85 video memory */
46   UINT8* pmd85_video_ram_line = m_ram->pointer() + 0xc000 + 0x40*pmd85_scanline;
47
48   for (x=0; x<288; x+=6)
49   {
50      data = pmd85_video_ram_line[x/6];
51      pen0 = 0;
52      pen1 = data & 0x80 ? 1 : 2;
53
54      for (i=0; i<6; i++)
55         scanline[x+i] = (data & (0x01<<i)) ? pen1 : pen0;
56
57   }
58}
59
60UINT32 pmd85_state::screen_update_pmd85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
61{
62   int pmd85_scanline;
63
64   for (pmd85_scanline=0; pmd85_scanline<256; pmd85_scanline++)
65   {
66      pmd85_draw_scanline(bitmap, pmd85_scanline);
67   }
68   return 0;
69}


Previous 199869 Revisions Next


© 1997-2024 The MAME Team