Previous 15994 Revisions Next

r15771 Monday 6th August, 2012 at 12:56:47 UTC by Miodrag Milanović
ms0515: video implementation (nw)
[src/mess/drivers]ms0515.c

src/mess/drivers/ms0515.c
r15770r15771
1212#include "imagedev/flopdrv.h"
1313#include "formats/basicdsk.h"
1414#include "machine/ram.h"
15#include "machine/i8255.h"
1516
1617class ms0515_state : public driver_device
1718{
r15770r15771
2324
2425   required_device<cpu_device> m_maincpu;
2526   
26   DECLARE_WRITE16_MEMBER(ms0515_bank_w);
27   DECLARE_WRITE16_MEMBER(ms0515_bank_w);   
28   DECLARE_WRITE8_MEMBER(ms0515_sys_w);
29   
2730   virtual void machine_reset();
2831   
2932   UINT8 *m_video_ram;
33   UINT8 m_sysreg;
34   int m_blink;
3035};
3136
3237static ADDRESS_MAP_START(ms0515_mem, AS_PROGRAM, 16, ms0515_state)
r15770r15771
5762   //AM_RANGE(0177542, 0177543)
5863   //AM_RANGE(0177544, 0177545)  // i8255 for MS-7007 Keyboard
5964   //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)
6565   
66   AM_RANGE(0177600, 0177607) AM_DEVREADWRITE8("ppi8255_1", i8255_device, read, write, 0x00ff)
67   
6668   AM_RANGE(0177640, 0177641) AM_DEVREADWRITE8_LEGACY("vg93", wd17xx_status_r, wd17xx_command_w,0x00ff)
6769   AM_RANGE(0177642, 0177643) AM_DEVREADWRITE8_LEGACY("vg93", wd17xx_track_r, wd17xx_track_w,0x00ff)
6870   AM_RANGE(0177644, 0177645) AM_DEVREADWRITE8_LEGACY("vg93", wd17xx_sector_r, wd17xx_sector_w,0x00ff)
r15770r15771
104106               break;
105107      }
106108   }   
107   printf("bank[%d] %02x video %d\n",((data >> 10) % 3),data & 0x7f, BIT(data,7));
108109}
109110
111WRITE8_MEMBER(ms0515_state::ms0515_sys_w)
112{
113   m_sysreg = data;
114}
115
110116void ms0515_state::machine_reset()
111117{
112118   UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
113119   ms0515_bank_w(*machine().memory().first_space(),0,0);
114120   
115121   m_video_ram = ram + 0000000 + 0340000;
122   m_blink = 0;
116123}
117124
118125/* Input ports */
r15770r15771
157164
158165static SCREEN_UPDATE_IND16( ms0515 )
159166{
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;   
164169   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++)
169172      {
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++)
172175         {
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            }
176183         }
177184      }
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      }
178208   }
209   state->m_blink++;
179210   return 0;
180211}
181212
213static 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
234static WRITE8_DEVICE_HANDLER(ms0515_portc_w)
235{
236   ms0515_state *state = device->machine().driver_data<ms0515_state>();
237   state->m_sysreg = data;
238}
239I8255A_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
182249static MACHINE_CONFIG_START( ms0515, ms0515_state )
183250   /* basic machine hardware */
184251   MCFG_CPU_ADD("maincpu",T11, XTAL_4MHz) // Need proper CPU here
r15770r15771
197264   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
198265    MCFG_SCREEN_UPDATE_STATIC(ms0515)
199266   
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 )
202272
203273   /* internal ram */
204274   MCFG_RAM_ADD(RAM_TAG)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team