Previous 15994 Revisions Next

r2864 Tuesday 17th June, 2008 at 18:00:55 UTC by Miodrag Milanović
[MIKRO80][GALAXY] Some code cleanup
[src/mess/drivers]galaxy.c mikro80.c
[src/mess/includes]galaxy.h mikro80.h
[src/mess/video]galaxy.c mikro80.c

src/mess/includes/mikro80.h
r2863r2864
2424extern UINT8 *mikro80_video_ram;
2525extern UINT8 *mikro80_cursor_ram;
2626
27extern PALETTE_INIT( mikro80 );
28extern const gfx_layout mikro80_charlayout;
29
3027extern VIDEO_START( mikro80 );
3128extern VIDEO_UPDATE( mikro80 );
3229
src/mess/includes/galaxy.h
r2863r2864
3030/*----------- defined in video/galaxy.c -----------*/
3131
3232extern UINT32 gal_cnt;
33extern const gfx_layout galaxy_charlayout;
34extern const unsigned char galaxy_palette[2*3];
35extern PALETTE_INIT( galaxy );
36
37extern VIDEO_START( galaxy );
3833extern VIDEO_UPDATE( galaxy );
3934extern TIMER_CALLBACK( gal_video );
4035
src/mess/video/mikro80.c
r2863r2864
1313UINT8 *mikro80_video_ram;
1414UINT8 *mikro80_cursor_ram;
1515   
16const gfx_layout mikro80_charlayout =
17{
18   8, 8,            /* 8x8 characters */
19   256,            /* 256 characters */
20   1,              /* 1 bits per pixel */
21   {0},            /* no bitplanes; 1 bit per pixel */   
22   {0, 1, 2, 3, 4, 5, 6, 7},
23   {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8},
24   8*8               /* size of one char */
25};
26
27PALETTE_INIT( mikro80 )
28{
29   palette_set_color(machine,0,RGB_BLACK); /* black */   
30   palette_set_color(machine,1,RGB_WHITE); /* white */
31   palette_set_color(machine,2,RGB_WHITE); /* white */   
32   palette_set_color(machine,3,RGB_BLACK); /* black */
33}
34
3516VIDEO_START( mikro80 )
3617{
3718}
3819 
3920VIDEO_UPDATE( mikro80 )
4021{
41   int x,y;
22   UINT8 *gfx = memory_region(REGION_GFX1);
23   int x,y,b;
4224
43   for(y = 0; y < 32; y++ )
25   for(y = 0; y < 32*8; y++ )
4426   {
4527      for(x = 0; x < 64; x++ )
4628      {
47         UINT8 code = mikro80_video_ram [x + y*64 ];
48         UINT8 attr = mikro80_cursor_ram[x+1 + y*64 ] & 0x80 ? 1 : 0;
49         drawgfx(bitmap, screen->machine->gfx[0],  code, attr, 0,0, x*8,y*8,
50            NULL, TRANSPARENCY_NONE, 0);
29         int addr = x + (y / 8)*64;
30         UINT8 code = gfx[mikro80_video_ram [addr]*8+ (y % 8)];
31         UINT8 attr = mikro80_cursor_ram[addr+1] & 0x80 ? 1 : 0;
32         for (b = 7; b >= 0; b--)
33         {                       
34            UINT8 col = (code >> b) & 0x01;
35            *BITMAP_ADDR16(bitmap, y, x*8+(7-b)) =  attr ? col ^ 1 : col;
36         }
5137      }
5238   }
5339   return 0;
src/mess/video/galaxy.c
r2863r2864
1212#include "includes/galaxy.h"
1313#include "cpu/z80/z80.h"
1414
15const gfx_layout galaxy_charlayout =
16{
17   8, 13,            /* 8x8 characters */
18   128,            /* 128 characters */
19   1,            /* 1 bits per pixel */
20   {0},            /* no bitplanes; 1 bit per pixel */
21   {7, 6, 5, 4, 3, 2, 1, 0},
22   {0*128*8, 1*128*8,  2*128*8,  3*128*8,
23    4*128*8, 5*128*8,  6*128*8,  7*128*8,
24    8*128*8, 9*128*8, 10*8*128, 11*128*8, 12*128*8},
25   8             /* each character takes 1 consecutive byte */
26};
27
28const unsigned char galaxy_palette[2*3] =
29{
30   0xff, 0xff, 0xff,      /* White */
31   0x00, 0x00, 0x00      /* Black */
32};
33
34PALETTE_INIT( galaxy )
35{
36   int i;
37
38   for ( i = 0; i < sizeof(galaxy_palette) / 3; i++ ) {
39      palette_set_color_rgb(machine, i, galaxy_palette[i*3], galaxy_palette[i*3+1], galaxy_palette[i*3+2]);
40   }
41}
42
4315UINT32 gal_cnt = 0;
4416static UINT8 code = 0;
4517static UINT8 first = 0;
r2863r2864
5224   if (galaxy_interrupts_enabled==TRUE) {
5325      UINT8 *gfx = memory_region(REGION_GFX1);
5426      UINT8 dat = (gal_latch_value & 0x3c) >> 2;
55      if ((gal_cnt > 48 * 2) && (gal_cnt < 48 * 210)) { // display on screen just first 208 lines
27      if ((gal_cnt >= 48 * 2) && (gal_cnt < 48 * 210)) { // display on screen just first 208 lines
5628         UINT8 mode = (gal_latch_value >> 1) & 1; // bit 2 latch represents mode
5729         UINT16 addr = (cpunum_get_reg(0, Z80_I) << 8) | cpunum_get_reg(0, Z80_R) | ((gal_latch_value & 0x80) ^ 0x80);
5830           if (mode == 0){
r2863r2864
6133                 // Due to a fact that on real processor latch value is set at
6234                 // the end of last cycle we need to skip dusplay of double
6335                 // first char in each row
64                 code = 0xff;
36                 code = 0x00;
6537                 first = 1;
6638            } else {
6739               code = program_read_byte(addr) & 0xbf;
6840               code += (code & 0x80) >> 1;
69               code = gfx[(code & 0x7f) +(dat << 7 )];
41               code = gfx[(code & 0x7f) +(dat << 7 )] ^ 0xff;
7042               first = 0;
7143            }
7244            y = gal_cnt / 48 - 2;
r2863r2864
8759                 // Due to a fact that on real processor latch value is set at
8860                 // the end of last cycle we need to skip dusplay of 4 times
8961                 // first char in each row
90                 code = 0xff;
62                 code = 0x00;
9163                 first++;
9264            } else {
93               code = program_read_byte(addr);
65               code = program_read_byte(addr) ^ 0xff;
9466               first = 0;
9567            }
9668            y = gal_cnt / 48 - 2;
r2863r2864
10173               start_addr = addr;
10274            }
10375            if ((x/8 >=11) && (x/8<44)) {
104               code = program_read_byte(start_addr + y * 32 + (gal_cnt % 48)-11);
76               code = program_read_byte(start_addr + y * 32 + (gal_cnt % 48)-11) ^ 0xff;
10577            } else {
106               code = 0xff;
78               code = 0x00;
10779            }
10880            /* end of hack */
10981           
r2863r2864
12193   }   
12294}
12395
124VIDEO_START ( galaxy )
125{
126   VIDEO_START_CALL ( generic_bitmapped );
127}
128
12996VIDEO_UPDATE( galaxy )
13097{
13198   timer_adjust_periodic(gal_video_timer, attotime_zero, 0, attotime_never);
13299   if (galaxy_interrupts_enabled == FALSE) {
133100      rectangle black_area = {0,384-1,0,208-1};
134      fillbitmap(tmpbitmap, 1, &black_area);
101      fillbitmap(tmpbitmap, 0, &black_area);
135102   }
136103   galaxy_interrupts_enabled = FALSE;
137104   return VIDEO_UPDATE_CALL ( generic_bitmapped );
src/mess/drivers/mikro80.c
r2863r2864
1414#include "devices/cassette.h"
1515#include "formats/rk_cas.h"
1616
17
18static GFXDECODE_START( mikro80 )
19   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, mikro80_charlayout, 0, 2 )
20GFXDECODE_END
21
2217/* Address maps */
2318static ADDRESS_MAP_START(mikro80_mem, ADDRESS_SPACE_PROGRAM, 8)
2419   AM_RANGE( 0x0000, 0x07ff ) AM_RAMBANK(1) // First bank
r2863r2864
137132   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
138133   MDRV_SCREEN_SIZE(64*8, 32*8)
139134   MDRV_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 32*8-1)
140   MDRV_PALETTE_LENGTH(4)
141   MDRV_PALETTE_INIT(mikro80)
142   MDRV_GFXDECODE( mikro80 )
135   MDRV_PALETTE_LENGTH(2)
136   MDRV_PALETTE_INIT(black_and_white)
143137
144138   MDRV_VIDEO_START(mikro80)
145139    MDRV_VIDEO_UPDATE(mikro80)
src/mess/drivers/galaxy.c
r2863r2864
5252   AM_RANGE(0xf000, 0xffff) AM_ROM // ROM D
5353ADDRESS_MAP_END
5454
55static GFXDECODE_START( galaxy )
56   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, galaxy_charlayout, 0, 2 )
57GFXDECODE_END
58
5955/* 2008-05 FP:
6056Small note about natural keyboard support. Currently:
6157- "List" is mapped to 'ESC'
r2863r2864
170166   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
171167   MDRV_SCREEN_SIZE(384, 212)
172168   MDRV_SCREEN_VISIBLE_AREA(0, 384-1, 0, 208-1)
173   MDRV_GFXDECODE( galaxy )
174   MDRV_PALETTE_LENGTH(sizeof (galaxy_palette) / 3)
175   MDRV_PALETTE_INIT( galaxy )
169   MDRV_PALETTE_LENGTH(2)
170   MDRV_PALETTE_INIT( black_and_white )
176171
177172   MDRV_VIDEO_START( generic_bitmapped )
178173   MDRV_VIDEO_UPDATE( galaxy )
r2863r2864
200195   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
201196   MDRV_SCREEN_SIZE(384, 208)
202197   MDRV_SCREEN_VISIBLE_AREA(0, 384-1, 0, 208-1)
203   MDRV_GFXDECODE( galaxy )
204   MDRV_PALETTE_LENGTH(sizeof (galaxy_palette) / 3)
205   MDRV_PALETTE_INIT( galaxy )
198   MDRV_PALETTE_LENGTH(2)
199   MDRV_PALETTE_INIT( black_and_white )
206200
207201   MDRV_VIDEO_START( generic_bitmapped )
208202   MDRV_VIDEO_UPDATE( galaxy )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team