Previous 199869 Revisions Next

r18974 Thursday 15th November, 2012 at 16:18:30 UTC by Angelo Salese
Hooked up basic text support for NEC APC
[src/mess/drivers]apc.c

trunk/src/mess/drivers/apc.c
r18973r18974
7171        m_hgdc1(*this, "upd7220_chr"),
7272        m_hgdc2(*this, "upd7220_btm"),
7373        m_i8259_m(*this, "pic8259_master"),
74        m_i8259_s(*this, "pic8259_slave")
74        m_i8259_s(*this, "pic8259_slave"),
75        m_video_ram_1(*this, "video_ram_1"),
76        m_video_ram_2(*this, "video_ram_2")
7577   { }
7678
7779   // devices
r18973r18974
8284   required_device<pic8259_device> m_i8259_s;
8385   UINT8 *m_char_rom;
8486
87   required_shared_ptr<UINT8> m_video_ram_1;
88   required_shared_ptr<UINT8> m_video_ram_2;
89
8590   // screen updates
8691   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
8792
r18973r18974
108113   DECLARE_WRITE8_MEMBER(pc_dma_write_byte);
109114
110115   DECLARE_DRIVER_INIT(apc);
116   DECLARE_PALETTE_INIT(apc);
111117
112118   int m_dma_channel;
113119   UINT8 m_dma_offset[2][4];
r18973r18974
146152
147153static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
148154{
155   apc_state *state = device->machine().driver_data<apc_state>();
156   int xi,yi;
157   int x;
158   UINT8 char_size;
159//   UINT8 interlace_on;
149160
161//   if(state->m_video_ff[DISPLAY_REG] == 0) //screen is off
162//      return;
163
164//   interlace_on = state->m_video_reg[2] == 0x10; /* TODO: correct? */
165   char_size = 16;
166
167   for(x=0;x<pitch;x++)
168   {
169      UINT8 tile_data;
170//      UINT8 secret,reverse,u_line,v_line;
171      UINT8 color;
172      UINT8 tile,attr,pen;
173      UINT32 tile_addr;
174
175//      tile_addr = addr+(x*(state->m_video_ff[WIDTH40_REG]+1));
176      tile_addr = addr+(x*(1));
177
178      tile = state->m_video_ram_1[(tile_addr*2+1) & 0x1fff] & 0x00ff;
179      attr = (state->m_video_ram_1[(tile_addr*2 & 0x1fff) | 0x2000] & 0x00ff);
180
181//      secret = (attr & 1) ^ 1;
182      //blink = attr & 2;
183//      reverse = attr & 4;
184//      u_line = attr & 8;
185//      v_line = attr & 0x10;
186      color = (attr & 0xe0) >> 5;
187
188      for(yi=0;yi<lr;yi++)
189      {
190         for(xi=0;xi<8;xi++)
191         {
192            int res_x,res_y;
193
194//            res_x = (x*8+xi) * (state->m_video_ff[WIDTH40_REG]+1);
195            res_x = (x*8+xi) * (1);
196            res_y = y*lr+yi;
197
198            if(res_x > 640 || res_y > char_size*25) //TODO
199               continue;
200
201//            tile_data = secret ? 0 : (state->m_char_rom[tile*char_size+interlace_on*0x800+yi]);
202            tile_data = (state->m_char_rom[tile*char_size+yi]);
203
204//            if(reverse) { tile_data^=0xff; }
205//            if(u_line && yi == 7) { tile_data = 0xff; }
206//            if(v_line)   { tile_data|=8; }
207
208            if(cursor_on && cursor_addr == tile_addr)
209               tile_data^=0xff;
210
211            if(yi >= char_size)
212               pen = 0;
213            else
214               pen = (tile_data >> (7-xi) & 1) ? color : 0;
215
216            if(pen)
217               bitmap.pix16(res_y, res_x) = pen;
218
219//            if(state->m_video_ff[WIDTH40_REG])
220//            {
221//               if(res_x+1 > 640 || res_y > char_size*25) //TODO
222//                  continue;
223
224//               bitmap.pix16(res_y, res_x+1) = pen;
225//            }
226         }
227      }
228   }
150229}
151230
152231READ8_MEMBER(apc_state::apc_port_28_r)
r18973r18974
533612   SLOT_INTERFACE( "8sd", FLOPPY_8_SSSD ) // TODO: Ok?
534613SLOT_INTERFACE_END
535614
615PALETTE_INIT_MEMBER(apc_state,apc)
616{
617   int i;
536618
619   for(i=0;i<8;i++)
620      palette_set_color_rgb(machine(), i, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0));
621   for(i=8;i<machine().total_colors();i++)
622      palette_set_color_rgb(machine(), i, pal1bit(0), pal1bit(0), pal1bit(0));
623}
624
537625#define MAIN_CLOCK XTAL_5MHz
538626
539627static MACHINE_CONFIG_START( apc, apc_state )
r18973r18974
565653   MCFG_UPD7220_ADD("upd7220_chr", 5000000/2, hgdc_1_intf, upd7220_1_map)
566654   MCFG_UPD7220_ADD("upd7220_btm", 5000000/2, hgdc_2_intf, upd7220_2_map)
567655
568   MCFG_PALETTE_LENGTH(8)
656   MCFG_PALETTE_LENGTH(16)
657   MCFG_PALETTE_INIT_OVERRIDE(apc_state,apc)
569658
570659   /* sound hardware */
571660   MCFG_SPEAKER_STANDARD_MONO("mono")
r18973r18974
589678//   ROM_LOAD( "sioapc.o", 0, 0x10000, CRC(1) SHA1(1) )
590679
591680   ROM_REGION( 0x2000, "gfx", ROMREGION_ERASE00 )
592    ROM_LOAD( "pfcu1r.bin",   0x000000, 0x002000, BAD_DUMP CRC(683efa94) SHA1(43157984a1746b2e448f3236f571011af9a3aa73) )
681    ROM_LOAD("pfcu1r.bin",   0x000000, 0x002000, BAD_DUMP CRC(683efa94) SHA1(43157984a1746b2e448f3236f571011af9a3aa73) )
682      ROM_LOAD("hn613128pac8.bin",0x00000, 0x01000, BAD_DUMP CRC(b5a15b5c) SHA1(e5f071edb72a5e9a8b8b1c23cf94a74d24cb648e) ) //fake, taken from PC-9801
593683ROM_END
594684
595685DRIVER_INIT_MEMBER(apc_state,apc)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team