src/mess/includes/galaxy.h
| r2678 | r2679 | |
| 16 | 16 | extern MACHINE_RESET( galaxy ); |
| 17 | 17 | extern INTERRUPT_GEN( galaxy_interrupt ); |
| 18 | 18 | extern SNAPSHOT_LOAD( galaxy ); |
| 19 | | extern int galaxy_interrupts_enabled; |
| 20 | 19 | extern READ8_HANDLER( galaxy_keyboard_r ); |
| 21 | 20 | extern READ8_HANDLER( galaxy_latch_r ); |
| 22 | 21 | extern WRITE8_HANDLER( galaxy_latch_w ); |
| 23 | 22 | |
| 23 | extern MACHINE_RESET( galaxyp ); |
| 24 | 24 | |
| 25 | extern UINT32 gal_cnt; |
| 26 | extern UINT8 gal_latch_value; |
| 27 | |
| 25 | 28 | /*----------- defined in video/galaxy.c -----------*/ |
| 26 | 29 | |
| 27 | 30 | extern const gfx_layout galaxy_charlayout; |
| 28 | 31 | extern const unsigned char galaxy_palette[2*3]; |
| 29 | | extern const unsigned short galaxy_colortable[1][2]; |
| 30 | 32 | extern PALETTE_INIT( galaxy ); |
| 31 | | extern VIDEO_START( galaxy ); |
| 32 | | extern VIDEO_UPDATE( galaxy ); |
| 33 | extern INTERRUPT_GEN( gal_video ); |
| 33 | 34 | |
| 34 | 35 | |
| 35 | 36 | #endif /* GALAXY_H_ */ |
src/mess/video/galaxy.c
| r2678 | r2679 | |
| 5 | 5 | Functions to emulate the video hardware of the Galaksija. |
| 6 | 6 | |
| 7 | 7 | 01/03/2008 - Update by Miodrag Milanovic to make Galaksija video work with new SVN code |
| 8 | | |
| 8 | 21/05/2008 - Real video implementation by Miodrag Milanovic |
| 9 | 9 | ***************************************************************************/ |
| 10 | 10 | |
| 11 | 11 | #include "driver.h" |
| 12 | 12 | #include "includes/galaxy.h" |
| 13 | 13 | #include "cpu/z80/z80.h" |
| 14 | 14 | |
| 15 | | static int horizontal_pos = 0x0b; |
| 16 | | |
| 17 | 15 | const gfx_layout galaxy_charlayout = |
| 18 | 16 | { |
| 19 | 17 | 8, 13, /* 8x8 characters */ |
| r2678 | r2679 | |
| 42 | 40 | } |
| 43 | 41 | } |
| 44 | 42 | |
| 45 | | VIDEO_START( galaxy ) |
| 46 | | { |
| 47 | | } |
| 43 | UINT32 gal_cnt = 0; |
| 44 | static UINT8 code = 0; |
| 45 | static UINT8 first = 0; |
| 48 | 46 | |
| 49 | | VIDEO_UPDATE( galaxy ) |
| 50 | | { |
| 51 | | int offs; |
| 52 | | rectangle black_area = {0,0,0,16*13}; |
| 53 | | static int fast_mode = FALSE; |
| 54 | | int full_refresh = 1; |
| 55 | | |
| 56 | | UINT8* videoram = mess_ram; |
| 57 | | |
| 58 | | if (!galaxy_interrupts_enabled) |
| 59 | | { |
| 60 | | black_area.min_x = 0; |
| 61 | | black_area.max_x = 32*8-1; |
| 62 | | black_area.min_y = 0; |
| 63 | | black_area.max_y = 16*13-1; |
| 64 | | fillbitmap(bitmap, 1, &black_area); |
| 65 | | fast_mode = TRUE; |
| 66 | | return 0; |
| 67 | | } |
| 68 | | |
| 69 | | if (horizontal_pos!=program_read_byte(0x2ba8)) |
| 70 | | { |
| 71 | | full_refresh=1; |
| 72 | | horizontal_pos = program_read_byte(0x2ba8); |
| 73 | | if (horizontal_pos > 0x0b) |
| 74 | | { |
| 75 | | black_area.min_x = 0; |
| 76 | | black_area.max_x = 8*(horizontal_pos-0x0b)-1; |
| 47 | INTERRUPT_GEN( gal_video ) |
| 48 | { |
| 49 | UINT8 *gfx = memory_region(REGION_GFX1); |
| 50 | UINT8 dat = (gal_latch_value & 0x3c) >> 2; |
| 51 | if (gal_cnt < 384 * 212) { // display on screen just first 212 lines |
| 52 | if ((gal_cnt % 8)==0) { //fetch code |
| 53 | UINT16 addr = (cpunum_get_reg(0, Z80_I) << 8) | cpunum_get_reg(0, Z80_R) | ((gal_latch_value & 0x80) ^ 0x80); |
| 54 | if (first==0 && (cpunum_get_reg(0, Z80_R) & 0x1f) ==0) { |
| 55 | // Due to a fact that on real processor latch value is set at |
| 56 | // the end of last cycle we need to skip dusplay of double |
| 57 | // first char in each row |
| 58 | code = 0xff; |
| 59 | first = 1; |
| 60 | } else { |
| 61 | code = program_read_byte(addr) & 0xbf; |
| 62 | code += (code & 0x80) >> 1; |
| 63 | code = gfx[(code & 0x7f) +(dat << 7 )]; |
| 64 | first = 0; |
| 65 | } |
| 77 | 66 | } |
| 78 | | if (horizontal_pos < 0x0b) |
| 79 | | { |
| 80 | | black_area.min_x = 8*(21+horizontal_pos); |
| 81 | | black_area.max_x = 32*8-1; |
| 82 | | } |
| 83 | | if (horizontal_pos == 0x0b) |
| 84 | | black_area.min_x = black_area.max_x = 0; |
| 85 | | fillbitmap(bitmap, 1, &black_area); |
| 67 | *BITMAP_ADDR16(tmpbitmap, gal_cnt / 384, gal_cnt % 384) = (code >> (gal_cnt & 7)) & 1; |
| 86 | 68 | } |
| 87 | | |
| 88 | | for( offs = 0; offs < 512; offs++ ) |
| 89 | | { |
| 90 | | int sx, sy; |
| 91 | | int code = videoram[offs]; |
| 92 | | |
| 93 | | sx = (offs % 32) * 8 + horizontal_pos*8-88; |
| 94 | | |
| 95 | | if (sx>=0 && sx<32*8) |
| 96 | | { |
| 97 | | if ((code>63 && code<96) || (code>127 && code<192)) |
| 98 | | code-=64; |
| 99 | | if (code>191) |
| 100 | | code-=128; |
| 101 | | sy = (offs / 32) * 13; |
| 102 | | drawgfx(bitmap, screen->machine->gfx[0], code & 0x7f, 0, 0,0, sx,sy, |
| 103 | | NULL, TRANSPARENCY_NONE, 0); |
| 104 | | } |
| 105 | | } |
| 106 | | |
| 107 | | galaxy_interrupts_enabled = FALSE; |
| 108 | | return 0; |
| 69 | |
| 70 | gal_cnt++; |
| 109 | 71 | } |
src/mess/machine/galaxy.c
| r2678 | r2679 | |
| 16 | 16 | #define LOG_GALAXY_LATCH_R(_port, _data) do { if (DEBUG_GALAXY_LATCH) logerror ("Galaxy latch read : %04x, Data: %02x\n", _port, _data); } while (0) |
| 17 | 17 | #define LOG_GALAXY_LATCH_W(_port, _data) do { if (DEBUG_GALAXY_LATCH) logerror ("Galaxy latch write: %04x, Data: %02x\n", _port, _data); } while (0) |
| 18 | 18 | |
| 19 | | int galaxy_interrupts_enabled = TRUE; |
| 20 | | |
| 21 | 19 | /*************************************************************************** |
| 22 | 20 | I/O devices |
| 23 | 21 | ***************************************************************************/ |
| r2678 | r2679 | |
| 27 | 25 | return input_port_read_indexed(machine, (offset>>3)&0x07) & (0x01<<(offset&0x07)) ? 0xfe : 0xff; |
| 28 | 26 | } |
| 29 | 27 | |
| 28 | |
| 29 | UINT8 gal_latch_value = 0; |
| 30 | |
| 30 | 31 | READ8_HANDLER( galaxy_latch_r ) |
| 31 | 32 | { |
| 32 | | UINT8 data = 0xff; |
| 33 | | LOG_GALAXY_LATCH_R(offset, data); |
| 34 | | return data; |
| 33 | return 0xff; |
| 35 | 34 | } |
| 36 | | |
| 37 | 35 | WRITE8_HANDLER( galaxy_latch_w ) |
| 38 | | { |
| 39 | | LOG_GALAXY_LATCH_W(offset, data); |
| 36 | { |
| 37 | gal_latch_value = data; |
| 40 | 38 | } |
| 41 | 39 | |
| 40 | |
| 41 | |
| 42 | 42 | /*************************************************************************** |
| 43 | 43 | Interrupts |
| 44 | 44 | ***************************************************************************/ |
| 45 | 45 | |
| 46 | 46 | INTERRUPT_GEN( galaxy_interrupt ) |
| 47 | | { |
| 48 | | cpunum_set_input_line(machine, 0, 0, HOLD_LINE); |
| 47 | { |
| 48 | cpunum_set_input_line(machine, 0, 0, HOLD_LINE); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | | static IRQ_CALLBACK(galaxy_irq_callback) |
| 51 | IRQ_CALLBACK ( galaxy_irq_callback ) |
| 52 | 52 | { |
| 53 | | galaxy_interrupts_enabled = TRUE; |
| 53 | gal_cnt = 0; |
| 54 | 54 | return 1; |
| 55 | 55 | } |
| 56 | 56 | |
| r2678 | r2679 | |
| 168 | 168 | { |
| 169 | 169 | /* ROM 2 enable/disable */ |
| 170 | 170 | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x1fff, 0, 0, input_port_read_indexed(machine, 7) ? SMH_BANK10 : SMH_NOP); |
| 171 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x1fff, 0, 0, SMH_NOP); |
| 172 | | if (input_port_read_indexed(machine, 7)) |
| 173 | | memory_set_bankptr(10, memory_region(REGION_CPU1) + 0x1000); |
| 171 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x1fff, 0, 0, SMH_NOP); |
| 172 | memory_set_bankptr(10, memory_region(REGION_CPU1) + 0x1000); |
| 174 | 173 | |
| 175 | 174 | cpunum_set_irq_callback(0, galaxy_irq_callback); |
| 176 | | |
| 177 | | galaxy_interrupts_enabled = TRUE; |
| 178 | 175 | } |
src/mess/drivers/galaxy.c
| r2678 | r2679 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | Galaksija driver by Krzysztof Strzecha |
| 3 | 3 | |
| 4 | 21/05/2008 Added real video implementation (Miodrag Milanovic) |
| 4 | 5 | 18/04/2005 Possibilty to disable ROM 2. 2k, 22k, 38k and 54k memory |
| 5 | 6 | configurations added. |
| 6 | 7 | 13/03/2005 Memory mapping improved. Palette corrected. Supprort for newer |
| r2678 | r2679 | |
| 17 | 18 | 01/01/2001 Preliminary driver. |
| 18 | 19 | |
| 19 | 20 | To do: |
| 20 | | -Video subsystem 'real' emulation |
| 21 | 21 | -Tape |
| 22 | 22 | -Galaksija Plus |
| 23 | 23 | |
| r2678 | r2679 | |
| 41 | 41 | AM_RANGE(0x2038, 0x203f) AM_MIRROR(0x07c0) AM_READWRITE( galaxy_latch_r, galaxy_latch_w ) |
| 42 | 42 | ADDRESS_MAP_END |
| 43 | 43 | |
| 44 | | |
| 45 | 44 | static GFXDECODE_START( galaxy ) |
| 46 | 45 | GFXDECODE_ENTRY( REGION_GFX1, 0x0000, galaxy_charlayout, 0, 2 ) |
| 47 | 46 | GFXDECODE_END |
| r2678 | r2679 | |
| 129 | 128 | PORT_CONFSETTING( 0x00, "Not installed") |
| 130 | 129 | INPUT_PORTS_END |
| 131 | 130 | |
| 131 | |
| 132 | #define XTAL 6144000 |
| 133 | |
| 134 | |
| 132 | 135 | static MACHINE_DRIVER_START( galaxy ) |
| 133 | 136 | /* basic machine hardware */ |
| 134 | | MDRV_CPU_ADD(Z80, 3072000) |
| 137 | MDRV_CPU_ADD(Z80, XTAL / 2) |
| 135 | 138 | MDRV_CPU_PROGRAM_MAP(galaxy_mem, 0) |
| 136 | 139 | MDRV_CPU_IO_MAP(galaxy_readport, galaxy_writeport) |
| 137 | 140 | MDRV_CPU_VBLANK_INT("main", galaxy_interrupt) |
| 138 | 141 | MDRV_SCREEN_ADD("main", RASTER) |
| 139 | 142 | MDRV_SCREEN_REFRESH_RATE(50) |
| 140 | | MDRV_SCREEN_VBLANK_TIME(0) |
| 141 | | MDRV_INTERLEAVE(1) |
| 143 | MDRV_CPU_PERIODIC_INT(gal_video,XTAL) |
| 142 | 144 | |
| 143 | 145 | MDRV_MACHINE_RESET( galaxy ) |
| 144 | 146 | |
| 145 | 147 | /* video hardware */ |
| 146 | 148 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 147 | | MDRV_SCREEN_SIZE(256, 208) |
| 148 | | MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 0, 208-1) |
| 149 | MDRV_SCREEN_SIZE(384, 212) |
| 150 | MDRV_SCREEN_VISIBLE_AREA(0, 384-1, 0, 212-1) |
| 149 | 151 | MDRV_GFXDECODE( galaxy ) |
| 150 | 152 | MDRV_PALETTE_LENGTH(sizeof (galaxy_palette) / 3) |
| 151 | 153 | MDRV_PALETTE_INIT( galaxy ) |
| 152 | 154 | |
| 153 | | MDRV_VIDEO_START( galaxy ) |
| 154 | | MDRV_VIDEO_UPDATE( galaxy ) |
| 155 | MDRV_VIDEO_START( generic_bitmapped ) |
| 156 | MDRV_VIDEO_UPDATE( generic_bitmapped ) |
| 155 | 157 | |
| 156 | 158 | /* snapshot */ |
| 157 | 159 | MDRV_SNAPSHOT_ADD(galaxy, "gal", 0) |
| r2678 | r2679 | |
| 165 | 167 | ROM_LOAD ("galchr.bin", 0x0000, 0x0800, CRC(5c3b5bb5) SHA1(19429a61dc5e55ddec3242a8f695e06dd7961f88)) |
| 166 | 168 | ROM_END |
| 167 | 169 | |
| 170 | |
| 168 | 171 | SYSTEM_CONFIG_START(galaxy) |
| 169 | 172 | CONFIG_RAM(2 * 1024) |
| 170 | 173 | CONFIG_RAM_DEFAULT(6 * 1024) |
| r2678 | r2679 | |
| 174 | 177 | SYSTEM_CONFIG_END |
| 175 | 178 | |
| 176 | 179 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ |
| 177 | | COMP(1983, galaxy, 0, 0, galaxy, galaxy, galaxy, galaxy, "", "Galaksija", 0) |
| 180 | COMP(1983, galaxy, 0, 0, galaxy, galaxy, galaxy, galaxy, "Elektronika inzenjering", "Galaksija", 0) |