Previous 15994 Revisions Next

r2710 Saturday 24th May, 2008 at 09:34:49 UTC by Miodrag Milanović
[GALAXYP] some initial support for graphics mode
[src/mess/drivers]galaxy.c
[src/mess/machine]galaxy.c
[src/mess/video]galaxy.c

src/mess/video/galaxy.c
r2709r2710
4747emu_timer *gal_video_timer = NULL;
4848
4949TIMER_CALLBACK( gal_video )
50{
50{   
5151   int y,x;
5252   if (galaxy_interrupts_enabled==TRUE) {
5353      UINT8 *gfx = memory_region(REGION_GFX1);
5454      UINT8 dat = (gal_latch_value & 0x3c) >> 2;
55      if ((gal_cnt > 96 * 2) && (gal_cnt < 96 * 210)) { // display on screen just first 208 lines
56         if (((gal_cnt) % 2)==0) { //fetch code
57              UINT16 addr = (cpunum_get_reg(0, Z80_I) << 8) |  cpunum_get_reg(0, Z80_R) | ((gal_latch_value & 0x80) ^ 0x80);
58              if (first==0 && (cpunum_get_reg(0, Z80_R) & 0x1f) ==0) {
59                 // Due to a fact that on real processor latch value is set at
60                 // the end of last cycle we need to skip dusplay of double
61                 // first char in each row
62                 code = 0xff;
63                 first = 1;
64            } else {
65               code = program_read_byte(addr) & 0xbf;
66               code += (code & 0x80) >> 1;
67               code = gfx[(code & 0x7f) +(dat << 7 )];
68               first = 0;
55      if ((gal_cnt > 48 * 2) && (gal_cnt < 48 * 210)) { // display on screen just first 208 lines
56         UINT8 mode = cpunum_get_reg(0, Z80_IM);
57         UINT16 addr = (cpunum_get_reg(0, Z80_I) << 8) |  cpunum_get_reg(0, Z80_R) | ((gal_latch_value & 0x80) ^ 0x80);
58              if (mode == 1) {
59                 if (first==0 && (cpunum_get_reg(0, Z80_R) & 0x1f) ==0) {
60                    // Due to a fact that on real processor latch value is set at
61                    // the end of last cycle we need to skip dusplay of double
62                    // first char in each row
63                    code = 0xff;
64                    first = 1;
65               } else {
66                  code = program_read_byte(addr) & 0xbf;
67                  code += (code & 0x80) >> 1;
68                  code = gfx[(code & 0x7f) +(dat << 7 )];
69                  first = 0;
70               }
71               y = gal_cnt / 48 - 2;
72               x = (gal_cnt % 48) * 8;
73               
74               *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 0) & 1; x++;
75               *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 1) & 1; x++;
76               *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 2) & 1; x++;
77               *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 3) & 1; x++;
78               *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 4) & 1; x++;
79               *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 5) & 1; x++;
80               *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 6) & 1; x++;
81               *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 7) & 1;
6982            }
70            y = gal_cnt / 96 - 2;
71            x = (gal_cnt % 96)*4;
83         if (mode == 2) {
84            code = program_read_byte(addr);                           
85            y = gal_cnt / 48 - 2;
86            x = (gal_cnt % 48) * 8;
87            if (x < 11*8 || x > 42*8) code = 0xff;
7288            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 0) & 1; x++;
7389            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 1) & 1; x++;
7490            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 2) & 1; x++;
r2709r2710
7793            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 5) & 1; x++;
7894            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 6) & 1; x++;
7995            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 7) & 1;
80         }
96         }               
8197      }
8298      gal_cnt++;
83   }
99   }   
84100}
85101
86102VIDEO_START ( galaxy )
src/mess/machine/galaxy.c
r2709r2710
2828
2929UINT8 gal_latch_value = 0;
3030
31READ8_HANDLER( galaxy_latch_r )
32{
33   return 0xff;
34}
3531WRITE8_HANDLER( galaxy_latch_w )
3632{
3733   double val = (((data >>6) & 1 ) + ((data >> 2) & 1) - 1) * 32000;
r2709r2710
5551{
5652   gal_cnt = 0;
5753   galaxy_interrupts_enabled = TRUE;
58   timer_adjust_periodic(gal_video_timer, attotime_zero, 0, ATTOTIME_IN_HZ(6144000 / 4));
59   return 1;
54   timer_adjust_periodic(gal_video_timer, attotime_zero, 0, ATTOTIME_IN_HZ(6144000 / 8));
55   return 0xff;
6056}
6157
6258/***************************************************************************
src/mess/drivers/galaxy.c
r2709r2710
3939
4040static ADDRESS_MAP_START (galaxy_mem, ADDRESS_SPACE_PROGRAM, 8)
4141   AM_RANGE(0x0000, 0x0fff) AM_ROM
42   AM_RANGE(0x2000, 0x2037) AM_MIRROR(0x07c0) AM_READ( galaxy_keyboard_r )
43   AM_RANGE(0x2038, 0x203f) AM_MIRROR(0x07c0) AM_READWRITE( galaxy_latch_r, galaxy_latch_w )
42   AM_RANGE(0x2000, 0x203f) AM_MIRROR(0x07c0) AM_READWRITE ( galaxy_keyboard_r, galaxy_latch_w )
4443ADDRESS_MAP_END
4544
4645static ADDRESS_MAP_START (galaxyp_mem, ADDRESS_SPACE_PROGRAM, 8)
4746   AM_RANGE(0x0000, 0x0fff) AM_ROM // ROM A
4847   AM_RANGE(0x1000, 0x1fff) AM_ROM // ROM B
49   AM_RANGE(0x2000, 0x2037) AM_MIRROR(0x07c0) AM_READ( galaxy_keyboard_r )
50   AM_RANGE(0x2038, 0x203f) AM_MIRROR(0x07c0) AM_READWRITE( galaxy_latch_r, galaxy_latch_w )
48   AM_RANGE(0x2000, 0x203f) AM_MIRROR(0x07c0) AM_READWRITE ( galaxy_keyboard_r, galaxy_latch_w )
5149   AM_RANGE(0xe000, 0xefff) AM_ROM // ROM C
5250   AM_RANGE(0xf000, 0xffff) AM_ROM // ROM D
5351ADDRESS_MAP_END
r2709r2710
206204
207205   MDRV_VIDEO_START( generic_bitmapped )
208206   MDRV_VIDEO_UPDATE( galaxy )
209
207   
210208   /* snapshot */
211209   MDRV_SNAPSHOT_ADD(galaxy, "gal", 0)
212210

Previous 15994 Revisions Next


© 1998-2018 The MESS Team