Previous 15994 Revisions Next

r12866 Friday 16th September, 2011 at 14:09:06 UTC by Angelo Salese
uPD7220: fixed allocation bug
[src/mess/drivers]vt240.c
[src/mess/video]upd7220.c upd7220.h

src/mess/video/upd7220.c
r12865r12866
737737
738738   // find screen
739739   m_screen = machine().device<screen_device>(m_screen_tag);
740   m_vram = auto_alloc_array_clear(machine(), UINT8, 1 << 18);
740741
741742   // register for state saving
742743   save_item(NAME(m_ra));
src/mess/video/upd7220.h
r12865r12866
220220   emu_timer *m_hsync_timer;      // horizontal sync timer
221221   emu_timer *m_blank_timer;      // CRT blanking timer
222222
223   UINT8 m_vram[0x40000];
223   UINT8 *m_vram;
224224   UINT32 m_vram_bank;
225225
226226   UINT8 m_bitmap_mod;
src/mess/drivers/vt240.c
r12865r12866
1717#include "cpu/i8085/i8085.h"
1818#include "cpu/t11/t11.h"
1919#include "machine/ram.h"
20#include "video/upd7220.h"
2021
22#define VIDEO_START_MEMBER(name) void name::video_start()
23#define SCREEN_UPDATE_MEMBER(name) bool name::screen_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect)
2124
2225class vt240_state : public driver_device
2326{
2427public:
2528   vt240_state(const machine_config &mconfig, device_type type, const char *tag)
26      : driver_device(mconfig, type, tag) { }
29      : driver_device(mconfig, type, tag),
30      m_hgdc(*this, "upd7220")
31      { }
2732
28   DECLARE_READ8_MEMBER(v240_00_r);
33   required_device<upd7220_device> m_hgdc;
34
35   virtual void video_start();
36   virtual bool screen_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect);
2937};
3038
39/* TODO */
40static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
41{
42   //vt240_state *state = device->machine().driver_data<a5105_state>();
43   //int x;
44   //int xi,yi;
45   //int tile,color;
46   //UINT8 tile_data;
3147
32READ8_MEMBER( vt240_state::v240_00_r )
48   #if 0
49   for( x = 0; x < pitch; x++ )
50   {
51      tile = (vram[(addr+x)*2] & 0xff);
52      color = (vram[(addr+x)*2+1] & 0x0f);
53
54      for( yi = 0; yi < lr; yi++)
55      {
56         tile_data = state->m_char_rom[(tile*8+yi) & 0x7ff];
57
58         if(cursor_on && cursor_addr == addr+x) //TODO
59            tile_data^=0xff;
60
61         for( xi = 0; xi < 8; xi++)
62         {
63            int res_x,res_y;
64            int pen = (tile_data >> xi) & 1 ? color : 0;
65
66            if(yi >= 8) { pen = 0; }
67
68            res_x = x * 8 + xi;
69            res_y = y * lr + yi;
70
71            if(res_x > screen_max_x || res_y > screen_max_y)
72               continue;
73
74            *BITMAP_ADDR16(bitmap, res_y, res_x) = pen;
75         }
76      }
77   }
78   #endif
79}
80
81
82VIDEO_START_MEMBER( vt240_state )
3383{
34   return 4 | (machine().rand() & 0x20);
84   // find memory regions
85   //m_char_rom = machine().region("pcg")->base();
86
87   VIDEO_START_NAME(generic_bitmapped)(machine());
3588}
3689
90SCREEN_UPDATE_MEMBER( vt240_state )
91{
92   /* graphics */
93   m_hgdc->update_screen(&bitmap, &cliprect);
94
95   return 0;
96}
97
98
99
37100static ADDRESS_MAP_START(vt240_mem, AS_PROGRAM, 8, vt240_state)
38101   ADDRESS_MAP_UNMAP_HIGH
39102   AM_RANGE(0x0000, 0x3fff) AM_ROM AM_REGION("ipl", 0)
r12865r12866
44107static ADDRESS_MAP_START(vt240_io, AS_IO, 8, vt240_state)
45108   ADDRESS_MAP_UNMAP_HIGH
46109   ADDRESS_MAP_GLOBAL_MASK(0xff)
47   AM_RANGE(0x00, 0x00) AM_READ(v240_00_r)
110   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("upd7220", upd7220_device, read, write)
48111ADDRESS_MAP_END
49112
113
114static ADDRESS_MAP_START( upd7220_map, AS_0, 8, vt240_state)
115   AM_RANGE(0x00000, 0x3ffff) AM_DEVREADWRITE("upd7220", upd7220_device, vram_r, vram_w)
116ADDRESS_MAP_END
117
50118/* Input ports */
51119static INPUT_PORTS_START( vt240 )
52120INPUT_PORTS_END
r12865r12866
56124{
57125}
58126
59static VIDEO_START( vt240 )
127static UPD7220_INTERFACE( hgdc_intf )
60128{
61}
129   "screen",
130   NULL,
131   hgdc_draw_text,
132   DEVCB_NULL,
133   DEVCB_NULL,
134   DEVCB_NULL
135};
62136
63static SCREEN_UPDATE( vt240 )
137static INTERRUPT_GEN( vt240_irq )
64138{
65   return 0;
139   device_set_input_line(device, I8085_RST65_LINE, ASSERT_LINE);
140   device_set_input_line(device, I8085_RST65_LINE, CLEAR_LINE);
66141}
67142
68143static MACHINE_CONFIG_START( vt240, vt240_state )
r12865r12866
70145   MCFG_CPU_ADD("maincpu", I8085A, XTAL_16MHz / 4)
71146   MCFG_CPU_PROGRAM_MAP(vt240_mem)
72147   MCFG_CPU_IO_MAP(vt240_io)
148   MCFG_CPU_VBLANK_INT("screen",vt240_irq)
73149
74150   MCFG_MACHINE_RESET(vt240)
75151
r12865r12866
80156   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
81157   MCFG_SCREEN_SIZE(640, 480)
82158   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
83   MCFG_VIDEO_START(vt240)
84   MCFG_SCREEN_UPDATE(vt240)
85   MCFG_PALETTE_LENGTH(2)
86   MCFG_PALETTE_INIT(black_and_white)
159//   MCFG_VIDEO_START(vt240)
160//   MCFG_SCREEN_UPDATE(vt240)
161   MCFG_PALETTE_LENGTH(8)
162   //MCFG_PALETTE_INIT(black_and_white)
163
164   MCFG_UPD7220_ADD("upd7220", XTAL_4MHz, hgdc_intf, upd7220_map) //unknown clock
87165MACHINE_CONFIG_END
88166
89167/* ROM definition */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team