Previous 15994 Revisions Next

r9688 Sunday 28th November, 2010 at 12:06:20 UTC by Robbbert
[JUPITER] Simplified video.
[src/mess/drivers]jupiter.c

src/mess/drivers/jupiter.c
r9687r9688
4141
4242
4343static READ8_HANDLER( jupiter_io_r );
44static WRITE8_HANDLER( jupiter_port_fe_w );
44static WRITE8_HANDLER( jupiter_io_w );
4545static WRITE8_HANDLER( jupiter_expram_w );
46static WRITE8_HANDLER( jupiter_vh_charram_w );
4746
4847
4948/* memory w/r functions */
5049static ADDRESS_MAP_START( jupiter_mem , ADDRESS_SPACE_PROGRAM, 8)
5150   AM_RANGE(0x0000, 0x1fff) AM_ROM
5251   AM_RANGE(0x2400, 0x27ff) AM_MIRROR(0x0400) AM_RAM AM_BASE_MEMBER(jupiter_state, videoram)
53   AM_RANGE(0x2c00, 0x2fff) AM_MIRROR(0x0400) AM_WRITE(jupiter_vh_charram_w) AM_BASE_MEMBER(jupiter_state, charram)
52   AM_RANGE(0x2c00, 0x2fff) AM_MIRROR(0x0400) AM_RAM AM_BASE_MEMBER(jupiter_state, charram) AM_REGION("maincpu", 0x2c00)
5453   AM_RANGE(0x3c00, 0x3fff) AM_MIRROR(0x0c00) AM_RAM
5554   AM_RANGE(0x4800, 0xffff) AM_RAM_WRITE( jupiter_expram_w ) AM_BASE_MEMBER(jupiter_state, expram)         /* Expansion RAM */
5655ADDRESS_MAP_END
5756
5857/* port i/o functions */
5958static ADDRESS_MAP_START( jupiter_io , ADDRESS_SPACE_IO, 8)
60   AM_RANGE( 0x0000, 0xffff ) AM_READWRITE( jupiter_io_r, jupiter_port_fe_w )
59   AM_RANGE( 0x0000, 0xffff ) AM_READWRITE( jupiter_io_r, jupiter_io_w )
6160ADDRESS_MAP_END
6261
6362
r9687r9688
178177}
179178
180179
181static WRITE8_HANDLER( jupiter_port_fe_w )
180static WRITE8_HANDLER( jupiter_io_w )
182181{
183182   running_device *speaker = space->machine->device("speaker");
184//  cassette_output( machine->device("cassette"), 1 );
183//  cassette_output( space->machine->device("cassette"), 1 );
185184   speaker_level_w(speaker,1);
186185}
187186
r9687r9688
204203
205204/* graphics output */
206205
207static PALETTE_INIT( jupiter )
208{
209   palette_set_color(machine,0,RGB_BLACK); /* black */
210   palette_set_color(machine,1,RGB_WHITE); /* white */
211   palette_set_color(machine,2,RGB_WHITE); /* white */
212   palette_set_color(machine,3,RGB_BLACK); /* black */
213}
214206
215
216207static const gfx_layout jupiter_charlayout =
217208{
218209   8, 8,   /* 8x8 characters */
r9687r9688
227218
228219static GFXDECODE_START( jupiter )
229220   GFXDECODE_ENTRY( "maincpu", 0x2c00, jupiter_charlayout, 0, 1 )
230   GFXDECODE_ENTRY( "maincpu", 0x2c00, jupiter_charlayout, 2, 1 )
231221GFXDECODE_END
232222
233223
234static WRITE8_HANDLER( jupiter_vh_charram_w )
235{
236   jupiter_state *state = space->machine->driver_data<jupiter_state>();
237   if(data == state->charram[offset])
238      return; /* no change */
239
240   state->charram[offset] = data;
241
242   /* decode character graphics again */
243   offset >>= 3;
244   gfx_element_mark_dirty(space->machine->gfx[0], offset);
245   gfx_element_mark_dirty(space->machine->gfx[1], offset);
246}
247
248
249224static TIMER_CALLBACK( jupiter_set_irq_callback )
250225{
251226   cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
r9687r9688
277252static VIDEO_UPDATE( jupiter )
278253{
279254   jupiter_state *state = screen->machine->driver_data<jupiter_state>();
255   UINT8 *charram = state->charram;
280256   UINT8 *videoram = state->videoram;
281   int offs;
257   UINT8 y,ra,chr,gfx;
258   UINT16 sy=0,ma=0,x;
282259
283   for(offs = 0; offs < 768; offs++)
260   for (y = 0; y < 24; y++)
284261   {
285      int code = videoram[offs];
286      int sx, sy;
262      for (ra = 0; ra < 8; ra++)
263      {
264         UINT16 *p = BITMAP_ADDR16(bitmap, sy++, 0);
287265
288      sy = (offs / 32) << 3;
289      sx = (offs % 32) << 3;
266         for (x = ma; x < ma+32; x++)
267         {
268            chr = videoram[x];
290269
291      drawgfx_opaque(bitmap, NULL, ( code & 0x80 ) ? screen->machine->gfx[1] : screen->machine->gfx[0],
292         code & 0x7f, 0, 0,0, sx,sy);
293   }
270            /* get pattern of pixels for that character scanline */
271            gfx = charram[((chr&0x7f)<<3) | ra] ^ ((chr&0x80) ? 0xff : 0);
294272
273            /* Display a scanline of a character (8 pixels) */
274            *p++ = ( gfx & 0x80 ) ? 1 : 0;
275            *p++ = ( gfx & 0x40 ) ? 1 : 0;
276            *p++ = ( gfx & 0x20 ) ? 1 : 0;
277            *p++ = ( gfx & 0x10 ) ? 1 : 0;
278            *p++ = ( gfx & 0x08 ) ? 1 : 0;
279            *p++ = ( gfx & 0x04 ) ? 1 : 0;
280            *p++ = ( gfx & 0x02 ) ? 1 : 0;
281            *p++ = ( gfx & 0x01 ) ? 1 : 0;
282         }
283      }
284      ma+=32;
285   }
295286   return 0;
296287}
297288
298static DRIVER_INIT( jupiter )
299{
300   jupiter_state *state = machine->driver_data<jupiter_state>();
301   state->charram = memory_region(machine, "maincpu")+0x2c00;
302}
303289
304290static const cassette_config jupiter_cassette_config =
305291{
r9687r9688
325311   MDRV_SCREEN_RAW_PARAMS( XTAL_6_5MHz, 416, 0, 256, 264, 0, 192 )
326312
327313   MDRV_GFXDECODE( jupiter )
328   MDRV_PALETTE_LENGTH(4)
329   MDRV_PALETTE_INIT(jupiter)
314   MDRV_PALETTE_LENGTH(2)
315   MDRV_PALETTE_INIT(black_and_white)
330316
331317   MDRV_VIDEO_START( jupiter )
332318   MDRV_VIDEO_UPDATE( jupiter )
r9687r9688
352338ROM_END
353339
354340/*    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT     INIT        COMPANY   FULLNAME */
355COMP( 1981, jupiter,  0,   0,   jupiter,  jupiter,  jupiter,   "Jupiter Cantab",  "Jupiter Ace" , 0 )
341COMP( 1981, jupiter,  0,   0,   jupiter,  jupiter,  0,   "Jupiter Cantab",  "Jupiter Ace" , 0 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team