Previous 199869 Revisions Next

r28712 Wednesday 19th March, 2014 at 12:30:42 UTC by Curt Coder
(MESS) vtvideo: devcb2. (nw)
[src/mess/drivers]rainbow.c vt100.c
[src/mess/video]vtvideo.c vtvideo.h

trunk/src/mess/video/vtvideo.c
r28711r28712
4747vt100_video_device::vt100_video_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
4848               : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
4949                  device_video_interface(mconfig, *this),
50                  m_read_ram(*this),
51                  m_write_clear_video_interrupt(*this),
5052                  m_palette(*this, "palette")
5153{
5254}
r28711r28712
5557vt100_video_device::vt100_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
5658               : device_t(mconfig, VT100_VIDEO, "VT100 Video", tag, owner, clock, "vt100_video", __FILE__),
5759                  device_video_interface(mconfig, *this),
60                  m_read_ram(*this),
61                  m_write_clear_video_interrupt(*this),
5862                  m_palette(*this, "palette")
5963{
6064}
r28711r28712
8286   // or initialize to defaults if none provided
8387   else
8488   {
85      memset(&m_in_ram_cb, 0, sizeof(m_in_ram_cb));
86      memset(&m_clear_video_cb, 0, sizeof(m_clear_video_cb));
8789      m_char_rom_tag = "";
8890   }
8991}
r28711r28712
9597void vt100_video_device::device_start()
9698{
9799   /* resolve callbacks */
98   m_in_ram_func.resolve(m_in_ram_cb, *this);
99   m_clear_video_interrupt.resolve(m_clear_video_cb, *this);
100   m_read_ram.resolve_safe(0);
101   m_write_clear_video_interrupt.resolve_safe();
100102
101103   m_gfx = machine().root_device().memregion(m_char_rom_tag)->base();
102104   assert(m_gfx != NULL);
r28711r28712
264266            break;
265267         case 0x09:
266268            // clear vertical frequency interrupt;
267            m_clear_video_interrupt(0, 0);
269            m_write_clear_video_interrupt(0);
268270
269271            break;
270272         case 0x0a:
r28711r28712
438440   UINT8 display_type = 3;  // binary 11
439441   UINT16 temp = 0;
440442
441   if (m_in_ram_func(0) != 0x7f)
443   if (m_read_ram(0) != 0x7f)
442444      return;
443445
444446   while (line < (m_height + m_skip_lines))
445447   {
446      code = m_in_ram_func(addr + xpos);
448      code = m_read_ram(addr + xpos);
447449      if (code == 0x7f)
448450      {
449451         // end of line, fill empty till end of line
r28711r28712
455457            }
456458         }
457459         // move to new data
458         temp = m_in_ram_func(addr + xpos + 1) * 256 + m_in_ram_func(addr + xpos + 2);
460         temp = m_read_ram(addr + xpos + 1) * 256 + m_read_ram(addr + xpos + 2);
459461         addr = (temp) & 0x1fff;
460462         // if A12 is 1 then it is 0x2000 block, if 0 then 0x4000 (AVO)
461463         if (addr & 0x1000) addr &= 0xfff; else addr |= 0x2000;
r28711r28712
708710
709711   while (line < (m_height + m_skip_lines))
710712   {
711      code = m_in_ram_func(addr + xpos);
713      code = m_read_ram(addr + xpos);
712714
713715      if ( code == 0x00 )        // TODO: investigate side effect on regular zero character!
714716            display_type |= 0x80; // DEFAULT: filler chars (till end of line) and empty lines (00) will be blanked
r28711r28712
732734         attr_addr = 0x1000 | ( (addr + xpos + 1) & 0x0fff );
733735
734736         // MOVE TO NEW DATA
735         temp = m_in_ram_func(addr + xpos + 2) * 256 + m_in_ram_func(addr + xpos + 1);
737         temp = m_read_ram(addr + xpos + 2) * 256 + m_read_ram(addr + xpos + 1);
736738         addr = (temp) & 0x0fff;
737739
738         temp = m_in_ram_func(attr_addr);
740         temp = m_read_ram(attr_addr);
739741         scroll_region = (temp) & 1;
740742         display_type  = (temp >> 1) & 3;
741743
r28711r28712
752754         if (line >= m_skip_lines)
753755         {
754756            attr_addr = 0x1000 | ( (addr + xpos) & 0x0fff );
755            temp = m_in_ram_func(attr_addr); // get character attribute
757            temp = m_read_ram(attr_addr); // get character attribute
756758
757759            // CONFIRMED: Reverse active on 1.  No attributes = 0x0E
758760            // 1 = display char. in REVERSE   (encoded as 8)
trunk/src/mess/video/vtvideo.h
r28711r28712
1515
1616#include "emu.h"
1717
18#define MCFG_VT_VIDEO_RAM_CALLBACK(_read) \
19   devcb = &vt100_video_device::set_ram_rd_callback(*device, DEVCB2_##_read);
20
21#define MCFG_VT_VIDEO_CLEAR_VIDEO_INTERRUPT_CALLBACK(_write) \
22   devcb = &vt100_video_device::set_clear_video_irq_wr_callback(*device, DEVCB2_##_write);
23
1824struct vt_video_interface
1925{
2026   const char *m_char_rom_tag; /* character rom region */
21
22   /* this gets called for every memory read */
23   devcb_read8         m_in_ram_cb;
24   devcb_write8        m_clear_video_cb;
2527};
2628
2729
r28711r28712
3436   vt100_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
3537   ~vt100_video_device() {}
3638
39   template<class _Object> static devcb2_base &set_ram_rd_callback(device_t &device, _Object object) { return downcast<vt100_video_device &>(device).m_read_ram.set_callback(object); }
40   template<class _Object> static devcb2_base &set_clear_video_irq_wr_callback(device_t &device, _Object object) { return downcast<vt100_video_device &>(device).m_write_clear_video_interrupt.set_callback(object); }
41
3742   DECLARE_READ8_MEMBER(lba7_r);
3843   DECLARE_WRITE8_MEMBER(dc012_w);
3944   DECLARE_WRITE8_MEMBER(dc011_w);
r28711r28712
5257   virtual void display_char(bitmap_ind16 &bitmap, UINT8 code, int x, int y, UINT8 scroll_region, UINT8 display_type);
5358   TIMER_CALLBACK_MEMBER(lba7_change);
5459
55   devcb_resolved_read8        m_in_ram_func;
56   devcb_resolved_write8       m_clear_video_interrupt;
60   devcb2_read8        m_read_ram;
61   devcb2_write8       m_write_clear_video_interrupt;
5762
5863   UINT8 *m_gfx;     /* content of char rom */
5964
trunk/src/mess/drivers/rainbow.c
r28711r28712
221221   }
222222
223223   DECLARE_READ8_MEMBER(read_video_ram_r);
224   DECLARE_WRITE8_MEMBER(clear_video_interrupt);
224   DECLARE_WRITE_LINE_MEMBER(clear_video_interrupt);
225225
226226   DECLARE_READ8_MEMBER(diagnostic_r);
227227   DECLARE_WRITE8_MEMBER(diagnostic_w);
r28711r28712
10101010   raise_8088_irq(IRQ_8088_VBL);
10111011}
10121012
1013WRITE8_MEMBER( rainbow_state::clear_video_interrupt )
1013WRITE_LINE_MEMBER( rainbow_state::clear_video_interrupt )
10141014{
10151015   lower_8088_irq(IRQ_8088_VBL);
10161016}
r28711r28712
11461146static const vt_video_interface video_interface =
11471147{
11481148   "chargen",
1149   DEVCB_DRIVER_MEMBER(rainbow_state, read_video_ram_r),
1150   DEVCB_DRIVER_MEMBER(rainbow_state, clear_video_interrupt)
11511149};
11521150
11531151/* F4 Character Displayer */
r28711r28712
12141212   MCFG_GFXDECODE_ADD("gfxdecode", "vt100_video:palette", rainbow)
12151213   
12161214   MCFG_RAINBOW_VIDEO_ADD("vt100_video", "screen", video_interface)
1215   MCFG_VT_VIDEO_RAM_CALLBACK(READ8(rainbow_state, read_video_ram_r))
1216   MCFG_VT_VIDEO_CLEAR_VIDEO_INTERRUPT_CALLBACK(WRITELINE(rainbow_state, clear_video_interrupt))
12171217
12181218   MCFG_FD1793_ADD("wd1793", rainbow_wd17xx_interface )
12191219   MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(floppy_intf)
trunk/src/mess/drivers/vt100.c
r28711r28712
5454   DECLARE_WRITE8_MEMBER(vt100_baud_rate_w);
5555   DECLARE_WRITE8_MEMBER(vt100_nvr_latch_w);
5656   DECLARE_READ8_MEMBER(vt100_read_video_ram_r);
57   DECLARE_WRITE8_MEMBER(vt100_clear_video_interrupt);
57   DECLARE_WRITE_LINE_MEMBER(vt100_clear_video_interrupt);
5858   required_shared_ptr<UINT8> m_p_ram;
5959   bool m_keyboard_int;
6060   bool m_receiver_int;
r28711r28712
369369   return m_p_ram[offset];
370370}
371371
372WRITE8_MEMBER( vt100_state::vt100_clear_video_interrupt )
372WRITE_LINE_MEMBER( vt100_state::vt100_clear_video_interrupt )
373373{
374374   m_vertical_int = 0;
375375}
r28711r28712
377377static const vt_video_interface vt100_video_interface =
378378{
379379   "chargen",
380   DEVCB_DRIVER_MEMBER(vt100_state, vt100_read_video_ram_r),
381   DEVCB_DRIVER_MEMBER(vt100_state, vt100_clear_video_interrupt)
382380};
383381
384382INTERRUPT_GEN_MEMBER(vt100_state::vt100_vertical_interrupt)
r28711r28712
428426   MCFG_DEFAULT_LAYOUT( layout_vt100 )
429427
430428   MCFG_VT100_VIDEO_ADD("vt100_video", "screen", vt100_video_interface)
429   MCFG_VT_VIDEO_RAM_CALLBACK(READ8(vt100_state, vt100_read_video_ram_r))
430   MCFG_VT_VIDEO_CLEAR_VIDEO_INTERRUPT_CALLBACK(WRITELINE(vt100_state, vt100_clear_video_interrupt))
431431
432432   MCFG_DEVICE_ADD("i8251", I8251, 0)
433433   MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd))

Previous 199869 Revisions Next


© 1997-2024 The MAME Team