Previous 199869 Revisions Next

r33205 Wednesday 5th November, 2014 at 01:39:38 UTC by Carl
(mess) num9rev: add number 9 revolution 512x32 [Carl]
---
Only the demo programs tested for now
[src/emu/bus]bus.mak
[src/emu/bus/isa]isa_cards.c isa_cards.h num9rev.c* num9rev.h*
[src/emu/video]upd7220.c upd7220.h

trunk/src/emu/bus/bus.mak
r241716r241717
511511BUSOBJS += $(BUSOBJ)/isa/sc499.o
512512BUSOBJS += $(BUSOBJ)/isa/aga.o
513513BUSOBJS += $(BUSOBJ)/isa/svga_trident.o
514BUSOBJS += $(BUSOBJ)/isa/num9rev.o
514515endif
515516
516517#-------------------------------------------------
trunk/src/emu/bus/isa/isa_cards.c
r241716r241717
1919   SLOT_INTERFACE("aga_pc200", ISA8_AGA_PC200)
2020   SLOT_INTERFACE("ega", ISA8_EGA)
2121   SLOT_INTERFACE("svga_et4k", ISA8_SVGA_ET4K)
22   SLOT_INTERFACE("num9rev",ISA8_NUM_9_REV)
2223   SLOT_INTERFACE("com", ISA8_COM)
2324   SLOT_INTERFACE("fdc", ISA8_FDC_SUPERIO)
2425   SLOT_INTERFACE("fdc_xt", ISA8_FDC_XT)
r241716r241717
5758   SLOT_INTERFACE("vga", ISA8_VGA)
5859   SLOT_INTERFACE("svga_et4k", ISA8_SVGA_ET4K)
5960   SLOT_INTERFACE("svga_dm",ISA8_SVGA_CIRRUS)
61   SLOT_INTERFACE("num9rev",ISA8_NUM_9_REV)
6062   SLOT_INTERFACE("com", ISA8_COM)
6163   SLOT_INTERFACE("comat", ISA8_COM_AT)
6264   SLOT_INTERFACE("fdc", ISA8_FDC_AT)
trunk/src/emu/bus/isa/isa_cards.h
r241716r241717
2525#include "svga_s3.h"
2626#include "svga_tseng.h"
2727#include "svga_trident.h"
28#include "num9rev.h"
2829
2930// storage
3031#include "fdc.h"
trunk/src/emu/bus/isa/num9rev.c
r0r241717
1// license:BSD-3-Clause
2// Number Nine Revolution 512x32/1024x8
3// TODO: for 1024x768 mode the 7220 is programmed for 512x768, how does that work?
4
5#include "emu.h"
6#include "num9rev.h"
7
8//**************************************************************************
9//  GLOBAL VARIABLES
10//**************************************************************************
11
12const device_type ISA8_NUM_9_REV = &device_creator<isa8_number_9_rev_device>;
13
14static ADDRESS_MAP_START( upd7220_map, AS_0, 8, isa8_number_9_rev_device )
15   AM_RANGE(0x00000, 0x3ffff) AM_NOP
16ADDRESS_MAP_END
17
18UPD7220_DISPLAY_PIXELS_MEMBER( isa8_number_9_rev_device::hgdc_display_pixels )
19{
20   palette_t *pal = m_palette->palette();
21   if(!m_1024)
22   {
23      rgb_t color(0);
24      UINT16 overlay;
25      if(((address << 3) + 0xc0008) > (1024*1024))
26         return;
27      for(int i = 0; i < 8; i++)
28      {
29         UINT32 addr = (address << 3) + i;
30         overlay = m_ram[addr + 0xc0000] << 1;
31         overlay = m_overlay[overlay + ((m_mode & 8) ? 512 : 0)] | (m_overlay[overlay + 1 + ((m_mode & 8) ? 512 : 0)] << 8);
32         color.set_r(pal->entry_color(m_ram[addr] | ((overlay & 0xf) << 8)).r());
33         color.set_g(pal->entry_color(m_ram[addr + 0x40000] | ((overlay & 0xf0) << 4)).g());
34         color.set_b(pal->entry_color(m_ram[addr + 0x80000] | (overlay & 0xf00)).b());
35         bitmap.pix32(y, x + i) = color;
36      }
37   }
38   else
39   {
40      if(((address << 3) + 8) > (1024*1024))
41         return;
42      for(int i = 0; i < 8; i++)
43         bitmap.pix32(y, x + i) = pal->entry_color(m_ram[(address << 3) + i]);
44   }
45}
46
47static MACHINE_CONFIG_FRAGMENT( num_9_rev )
48   MCFG_SCREEN_ADD("screen", RASTER)
49   MCFG_SCREEN_SIZE(512, 448)
50   MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 448-1)
51   MCFG_SCREEN_REFRESH_RATE(60)
52   MCFG_SCREEN_UPDATE_DRIVER(isa8_number_9_rev_device, screen_update)
53   MCFG_PALETTE_ADD("palette", 4096)
54
55   MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_4_433619MHz/2) // unknown clock
56   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
57   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(isa8_number_9_rev_device, hgdc_display_pixels)
58   MCFG_VIDEO_SET_SCREEN("screen")
59MACHINE_CONFIG_END
60
61//-------------------------------------------------
62//  machine_config_additions - device-specific
63//  machine configurations
64//-------------------------------------------------
65
66machine_config_constructor isa8_number_9_rev_device::device_mconfig_additions() const
67{
68   return MACHINE_CONFIG_NAME( num_9_rev );
69}
70
71//**************************************************************************
72//  LIVE DEVICE
73//**************************************************************************
74
75//-------------------------------------------------
76//  isa16_vga_device - constructor
77//-------------------------------------------------
78
79isa8_number_9_rev_device::isa8_number_9_rev_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
80      device_t(mconfig, ISA8_NUM_9_REV, "Number Nine Revolution 512x32/1024x8", tag, owner, clock, "number_9_rev", __FILE__),
81      device_isa8_card_interface(mconfig, *this),
82      m_upd7220(*this, "upd7220"),
83      m_palette(*this, "palette"),
84      m_ram(1024*1024),
85      m_overlay(1024)
86{
87}
88
89//-------------------------------------------------
90//  device_start - device-specific startup
91//-------------------------------------------------
92
93void isa8_number_9_rev_device::device_start()
94{
95   set_isa_device();
96
97   m_isa->install_memory(0xc0000, 0xc0001, 0, 0, read8_delegate(FUNC(upd7220_device::read), (upd7220_device *)m_upd7220), write8_delegate(FUNC(upd7220_device::write), (upd7220_device *)m_upd7220));
98   m_isa->install_memory(0xc0100, 0xc03ff, 0, 0, read8_delegate(FUNC(isa8_number_9_rev_device::pal8_r), this), write8_delegate(FUNC(isa8_number_9_rev_device::pal8_w), this));
99   m_isa->install_memory(0xc0400, 0xc0401, 0, 0, read8_delegate(FUNC(isa8_number_9_rev_device::bank_r), this), write8_delegate(FUNC(isa8_number_9_rev_device::bank_w), this));
100   m_isa->install_memory(0xc0500, 0xc06ff, 0, 0, read8_delegate(FUNC(isa8_number_9_rev_device::overlay_r), this), write8_delegate(FUNC(isa8_number_9_rev_device::overlay_w), this));
101   m_isa->install_memory(0xc0700, 0xc070f, 0, 0, read8_delegate(FUNC(isa8_number_9_rev_device::ctrl_r), this), write8_delegate(FUNC(isa8_number_9_rev_device::ctrl_w), this));
102   m_isa->install_memory(0xc1000, 0xc3fff, 0, 0, read8_delegate(FUNC(isa8_number_9_rev_device::pal12_r), this), write8_delegate(FUNC(isa8_number_9_rev_device::pal12_w), this));
103   m_isa->install_memory(0xa0000, 0xaffff, 0, 0, read8_delegate(FUNC(isa8_number_9_rev_device::read8), this), write8_delegate(FUNC(isa8_number_9_rev_device::write8), this));
104}
105
106//-------------------------------------------------
107//  device_reset - device-specific reset
108//-------------------------------------------------
109
110void isa8_number_9_rev_device::device_reset()
111{
112   m_bank = 0;
113   m_mode = 0;
114   m_1024 = false;
115}
116
117READ8_MEMBER(isa8_number_9_rev_device::read8)
118{
119   if((m_mode & 1) && !m_1024)
120      return m_ram[offset + ((m_mode & 0xc) << 14)];
121   else if((m_mode & 4) && !m_1024)
122   {
123      UINT32 newoff = ((offset & 3) << 18) | (m_bank << 14) | ((offset >> 2) & 0x3fff);
124      return m_ram[newoff];
125   }
126   else
127      return m_ram[offset + (m_bank << 16)];
128}
129
130WRITE8_MEMBER(isa8_number_9_rev_device::write8)
131{
132   if(m_1024 || ((m_mode & 6) == 0))
133      m_ram[offset + (m_bank << 16)] = data;
134   else if((m_mode & 1) || ((m_mode & 6) == 2))
135   {
136      UINT8 bank = m_bank;
137      if(m_mode & 1)
138         bank = (m_mode & 0xc) >> 2;
139      else
140      {
141         if(m_bank >= 12)
142         {
143            m_ram[offset + (m_bank << 16)] = data;
144            return;
145         }
146         bank &= 3;
147      }
148
149      m_ram[offset + (bank << 16)] = data;
150      m_ram[offset + ((bank + 4) << 16)] = data;
151      m_ram[offset + ((bank + 8) << 16)] = data;
152   }
153   else if(m_mode & 4)
154   {
155      UINT32 newoff = ((offset & 3) << 18) | (m_bank << 14) | ((offset >> 2) & 0x3fff);
156      if((newoff >= 0xc0000) && ((m_mode & 6) == 6))
157         return;
158      m_ram[newoff] = data;
159   }
160}
161
162READ8_MEMBER(isa8_number_9_rev_device::pal8_r)
163{
164   offset += 0x100;
165   palette_t *pal = m_palette->palette();
166   switch(offset & 0xf00)
167   {
168      case 0x100:
169         return pal->entry_color(offset).r();
170      case 0x200:
171         return pal->entry_color(offset).g();
172      case 0x300:
173         return pal->entry_color(offset).b();
174   }
175   return 0;
176}
177
178WRITE8_MEMBER(isa8_number_9_rev_device::pal8_w)
179{
180   offset += 0x100;
181   palette_t *pal = m_palette->palette();
182   rgb_t pen = pal->entry_color(offset);
183   switch(offset & 0xf00)
184   {
185      case 0x100:
186         pen.set_r(data);
187         break;
188      case 0x200:
189         pen.set_g(data);
190         break;
191      case 0x300:
192         pen.set_b(data);
193         break;
194   }
195   pal->entry_set_color(offset, pen);
196}
197
198READ8_MEMBER(isa8_number_9_rev_device::pal12_r)
199{
200   UINT16 color = offset & 0xfff;
201   palette_t *pal = m_palette->palette();
202   switch(offset & 0xf000)
203   {
204      case 0x0000:
205         return pal->entry_color(color).r();
206      case 0x1000:
207         return pal->entry_color(color).g();
208      case 0x2000:
209         return pal->entry_color(color).b();
210   }
211   return 0;
212}
213
214WRITE8_MEMBER(isa8_number_9_rev_device::pal12_w)
215{
216   UINT16 color = offset & 0xfff;
217   palette_t *pal = m_palette->palette();
218   rgb_t pen = pal->entry_color(color);
219   switch(offset & 0xf000)
220   {
221      case 0x0000:
222         pen.set_r(data);
223         break;
224      case 0x1000:
225         pen.set_g(data);
226         break;
227      case 0x2000:
228         pen.set_b(data);
229         break;
230   }
231   pal->entry_set_color(color, pen);
232}
233
234READ8_MEMBER(isa8_number_9_rev_device::overlay_r)
235{
236   return m_overlay[offset + ((m_mode & 8) ? 512 : 0)];
237}
238WRITE8_MEMBER(isa8_number_9_rev_device::overlay_w)
239{
240   m_overlay[offset + ((m_mode & 8) ? 512 : 0)] = data;
241}
242
243READ8_MEMBER(isa8_number_9_rev_device::bank_r)
244{
245   return m_bank;
246}
247
248WRITE8_MEMBER(isa8_number_9_rev_device::bank_w)
249{
250   m_bank = data & 0xf;
251}
252
253READ8_MEMBER(isa8_number_9_rev_device::ctrl_r)
254{
255   switch(offset & 0xf)
256   {
257      case 0:
258      case 1:
259      case 2:
260      case 3:
261         // zoom, set to same value as 7220 external zoom factor
262         break;
263      case 4:
264         return (m_mode & 2) ? 0xff : 0;
265      case 5:
266         return (m_mode & 4) ? 0xff : 0;
267      case 6:
268         return (m_mode & 8) ? 0xff : 0;
269      case 15:
270         return (m_mode & 1) ? 0xff : 0;
271   }
272   return 0;
273}
274
275WRITE8_MEMBER(isa8_number_9_rev_device::ctrl_w)
276{
277   switch(offset & 0xf)
278   {
279      case 0:
280      case 1:
281      case 2:
282      case 3:
283         // zoom
284         break;
285      case 4:
286         if(data & 0x80)
287            m_mode |= 2;
288         else
289            m_mode &= ~2;
290         break;
291      case 5:
292         if(data & 0x80)
293            m_mode |= 4;
294         else
295            m_mode &= ~4;
296         break;
297      case 6:
298         if(data & 0x80)
299            m_mode |= 8;
300         else
301            m_mode &= ~8;
302         break;
303      case 15:
304         if(data & 0x80)
305            m_mode |= 1;
306         else
307            m_mode &= ~1;
308         break;
309   }
310}
311
312UINT32 isa8_number_9_rev_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
313{
314   rectangle visarea = screen.visible_area();
315   // try to support the 1024x8 or at least don't crash as there's no way to detect it
316   m_1024 = (visarea.width() * visarea.height()) > (512 * 512);
317   return m_upd7220->screen_update(screen, bitmap, cliprect);
318}
trunk/src/emu/bus/isa/num9rev.h
r0r241717
1#pragma once
2
3#ifndef __NUM9REV_H__
4#define __NUM9REV_H__
5
6#include "emu.h"
7#include "isa.h"
8#include "video/upd7220.h"
9#include "machine/bankdev.h"
10
11//**************************************************************************
12//  TYPE DEFINITIONS
13//**************************************************************************
14
15// ======================> isa16_vga_device
16
17class isa8_number_9_rev_device :
18      public device_t,
19      public device_isa8_card_interface
20{
21public:
22      // construction/destruction
23      isa8_number_9_rev_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
24
25      // optional information overrides
26      virtual machine_config_constructor device_mconfig_additions() const;
27
28      UPD7220_DISPLAY_PIXELS_MEMBER(hgdc_display_pixels);
29      DECLARE_READ8_MEMBER(pal8_r);
30      DECLARE_WRITE8_MEMBER(pal8_w);
31      DECLARE_READ8_MEMBER(pal12_r);
32      DECLARE_WRITE8_MEMBER(pal12_w);
33      DECLARE_READ8_MEMBER(overlay_r);
34      DECLARE_WRITE8_MEMBER(overlay_w);
35      DECLARE_READ8_MEMBER(bank_r);
36      DECLARE_WRITE8_MEMBER(bank_w);
37      DECLARE_READ8_MEMBER(ctrl_r);
38      DECLARE_WRITE8_MEMBER(ctrl_w);
39      DECLARE_READ8_MEMBER(read8);
40      DECLARE_WRITE8_MEMBER(write8);
41
42      UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
43protected:
44      // device-level overrides
45      virtual void device_start();
46      virtual void device_reset();
47private:
48      required_device<upd7220_device> m_upd7220;
49      required_device<palette_device> m_palette;
50      dynamic_buffer m_ram;
51      dynamic_buffer m_overlay;
52
53      UINT8 m_bank;
54      UINT8 m_mode;
55      bool m_1024;
56};
57
58// device type definition
59extern const device_type ISA8_NUM_9_REV;
60
61#endif  /* __NUM9REV_H__ */
trunk/src/emu/video/upd7220.c
r241716r241717
15661566//  draw_graphics_line -
15671567//-------------------------------------------------
15681568
1569void upd7220_device::draw_graphics_line(bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd)
1569void upd7220_device::draw_graphics_line(bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd, int pitch)
15701570{
1571   int sx;
1571   int sx, al = bitmap.cliprect().height();
15721572
1573   for (sx = 0; sx < 80; sx++)
1573   for (sx = 0; sx < pitch; sx++)
15741574   {
1575      if((sx << 3) < m_aw * 16 && y < (m_al + m_vbp))
1575      if((sx << 3) < m_aw * 16 && y < al)
15761576         m_display_cb(bitmap, y, sx << 3, addr);
15771577
15781578      addr+= wd + 1;
r241716r241717
15911591   int im, wd, area;
15921592   int y = 0, tsy = 0, bsy = 0;
15931593   bool mixed = ((m_mode & UPD7220_MODE_DISPLAY_MASK) == UPD7220_MODE_DISPLAY_MIXED);
1594   UINT8 interlace = ((m_mode & UPD7220_MODE_INTERLACE_MASK) == UPD7220_MODE_INTERLACE_ON) ? 0 : 1;
15941595
15951596   for (area = 0; area < 4; area++)
15961597   {
r241716r241717
16021603
16031604         if(area >= 3) // TODO: most likely to be correct, Quarth (PC-98xx) definitely draws with area 2. We might see an area 3 someday ...
16041605            break;
1605         if(((m_mode & UPD7220_MODE_INTERLACE_MASK) == UPD7220_MODE_INTERLACE_ON))
1606
1607         if(!interlace)
16061608            len <<= 1;
1609
16071610         for (y = 0; y < len; y++)
16081611         {
16091612            /* TODO: again correct?
r241716r241717
16131616            addr = ((sad << 1) & 0x3ffff) + (y * (m_pitch << (im ? 0 : 1)));
16141617
16151618            if (!m_display_cb.isnull())
1616               draw_graphics_line(bitmap, addr, y + ((bsy + m_vbp) / (mixed ? 1 : m_lr)), wd);
1619               draw_graphics_line(bitmap, addr, y + ((bsy + m_vbp) / (mixed ? 1 : m_lr)), wd, (m_pitch << interlace));
16171620         }
16181621      }
16191622      else
trunk/src/emu/video/upd7220.h
r241716r241717
150150   void process_fifo();
151151   void continue_command();
152152   void update_text(bitmap_rgb32 &bitmap, const rectangle &cliprect);
153   void draw_graphics_line(bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd);
153   void draw_graphics_line(bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd, int pitch);
154154   void update_graphics(bitmap_rgb32 &bitmap, const rectangle &cliprect, int force_bitmap);
155155
156156   upd7220_display_pixels_delegate     m_display_cb;


Previous 199869 Revisions Next


© 1997-2024 The MAME Team