Previous 15994 Revisions Next

r3582 Wednesday 26th November, 2008 at 13:13:18 UTC by Miodrag Milanović
[GALAXY] Enabled
[src/mess]mess.mak messdriv.c
[src/mess/machine]galaxy.c
[src/mess/video]galaxy.c

src/mess/video/galaxy.c
r3581r3582
2020
2121TIMER_CALLBACK( gal_video )
2222{   
23   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
2324   int y,x;
2425   if (galaxy_interrupts_enabled==TRUE) {
2526      UINT8 *gfx = memory_region(machine, "gfx1");
2627      UINT8 dat = (gal_latch_value & 0x3c) >> 2;
2728      if ((gal_cnt >= 48 * 2) && (gal_cnt < 48 * 210)) { // display on screen just first 208 lines
2829         UINT8 mode = (gal_latch_value >> 1) & 1; // bit 2 latch represents mode
29         UINT16 addr = (cpunum_get_reg(0, Z80_I) << 8) | cpunum_get_reg(0, Z80_R) | ((gal_latch_value & 0x80) ^ 0x80);
30         UINT16 addr = (cpu_get_reg(machine->cpu[0], Z80_I) << 8) | cpu_get_reg(machine->cpu[0], Z80_R) | ((gal_latch_value & 0x80) ^ 0x80);
3031           if (mode == 0){
3132              // Text mode
32              if (first==0 && (cpunum_get_reg(0, Z80_R) & 0x1f) ==0) {
33              if (first==0 && (cpu_get_reg(machine->cpu[0], Z80_R) & 0x1f) ==0) {
3334                 // Due to a fact that on real processor latch value is set at
3435                 // the end of last cycle we need to skip dusplay of double
3536                 // first char in each row
3637                 code = 0x00;
3738                 first = 1;
3839            } else {
39               code = program_read_byte(addr) & 0xbf;
40               code = memory_read_byte(space,addr) & 0xbf;
4041               code += (code & 0x80) >> 1;
4142               code = gfx[(code & 0x7f) +(dat << 7 )] ^ 0xff;
4243               first = 0;
r3581r3582
5556         }
5657         else
5758         { // Graphics mode
58              if (first<4 && (cpunum_get_reg(0, Z80_R) & 0x1f) ==0) {
59              if (first<4 && (cpu_get_reg(machine->cpu[0], Z80_R) & 0x1f) ==0) {
5960                 // Due to a fact that on real processor latch value is set at
6061                 // the end of last cycle we need to skip dusplay of 4 times
6162                 // first char in each row
6263                 code = 0x00;
6364                 first++;
6465            } else {
65               code = program_read_byte(addr) ^ 0xff;
66               code = memory_read_byte(space,addr) ^ 0xff;
6667               first = 0;
6768            }
6869            y = gal_cnt / 48 - 2;
r3581r3582
7374               start_addr = addr;
7475            }
7576            if ((x/8 >=11) && (x/8<44)) {
76               code = program_read_byte(start_addr + y * 32 + (gal_cnt % 48)-11) ^ 0xff;
77               code = memory_read_byte(space,start_addr + y * 32 + (gal_cnt % 48)-11) ^ 0xff;
7778            } else {
7879               code = 0x00;
7980            }
src/mess/messdriv.c
r3581r3582
817817//128u4   DRIVER( exidyd )   /* Sorcerer (diskless)                        */
818818
819819   /* GALAKSIJA */
820//128u4   DRIVER( galaxy )
821//128u4   DRIVER( galaxyp )
820   DRIVER( galaxy )
821   DRIVER( galaxyp )
822822
823823   /* Lviv/L'vov */
824824//128u4   DRIVER( lviv )      /* Lviv/L'vov                              */
src/mess/machine/galaxy.c
r3581r3582
2222
2323   if (offset == 0)
2424   {
25      double level = cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ));
25      double level = cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ));
2626      return (level >  0) ? 0xfe : 0xff;
2727   }
2828   else
2929   {
30      return input_port_read(machine, keynames[(offset>>3) & 0x07]) & (0x01<<(offset & 0x07)) ? 0xfe : 0xff;
30      return input_port_read(space->machine, keynames[(offset>>3) & 0x07]) & (0x01<<(offset & 0x07)) ? 0xfe : 0xff;
3131   }
3232}
3333
r3581r3582
3737{   
3838   double val = (((data >>6) & 1 ) + ((data >> 2) & 1) - 1) * 32000;         
3939   gal_latch_value = data;
40   cassette_output(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ), val);
40   cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), val);
4141}
4242
4343
r3581r3582
4949
5050INTERRUPT_GEN( galaxy_interrupt )
5151{
52   cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE);
52   cpu_set_input_line(device, 0, HOLD_LINE);
5353}
5454
5555static IRQ_CALLBACK ( galaxy_irq_callback )
r3581r3582
7272   switch (size)
7373   {
7474      case GALAXY_SNAPSHOT_V1_SIZE:
75         cpunum_set_reg(0, Z80_AF,   data[0x00] | data[0x01]<<8);
76         cpunum_set_reg(0, Z80_BC,   data[0x04] | data[0x05]<<8);
77         cpunum_set_reg(0, Z80_DE,   data[0x08] | data[0x09]<<8);
78         cpunum_set_reg(0, Z80_HL,   data[0x0c] | data[0x0d]<<8);
79         cpunum_set_reg(0, Z80_IX,   data[0x10] | data[0x11]<<8);
80         cpunum_set_reg(0, Z80_IY,   data[0x14] | data[0x15]<<8);
81         cpunum_set_reg(0, Z80_PC,   data[0x18] | data[0x19]<<8);
82         cpunum_set_reg(0, Z80_SP,   data[0x1c] | data[0x1d]<<8);
83         cpunum_set_reg(0, Z80_AF2,  data[0x20] | data[0x21]<<8);
84         cpunum_set_reg(0, Z80_BC2,  data[0x24] | data[0x25]<<8);
85         cpunum_set_reg(0, Z80_DE2,  data[0x28] | data[0x29]<<8);
86         cpunum_set_reg(0, Z80_HL2,  data[0x2c] | data[0x2d]<<8);
87         cpunum_set_reg(0, Z80_IFF1, data[0x30]);
88         cpunum_set_reg(0, Z80_IFF2, data[0x34]);
89         cpunum_set_reg(0, Z80_HALT, data[0x38]);
90         cpunum_set_reg(0, Z80_IM,   data[0x3c]);
91         cpunum_set_reg(0, Z80_I,    data[0x40]);
92         cpunum_set_reg(0, Z80_R,    (data[0x44]&0x7f) | (data[0x48]&0x80));
75         cpu_set_reg(machine->cpu[0], Z80_AF,   data[0x00] | data[0x01]<<8);
76         cpu_set_reg(machine->cpu[0], Z80_BC,   data[0x04] | data[0x05]<<8);
77         cpu_set_reg(machine->cpu[0], Z80_DE,   data[0x08] | data[0x09]<<8);
78         cpu_set_reg(machine->cpu[0], Z80_HL,   data[0x0c] | data[0x0d]<<8);
79         cpu_set_reg(machine->cpu[0], Z80_IX,   data[0x10] | data[0x11]<<8);
80         cpu_set_reg(machine->cpu[0], Z80_IY,   data[0x14] | data[0x15]<<8);
81         cpu_set_reg(machine->cpu[0], Z80_PC,   data[0x18] | data[0x19]<<8);
82         cpu_set_reg(machine->cpu[0], Z80_SP,   data[0x1c] | data[0x1d]<<8);
83         cpu_set_reg(machine->cpu[0], Z80_AF2,  data[0x20] | data[0x21]<<8);
84         cpu_set_reg(machine->cpu[0], Z80_BC2,  data[0x24] | data[0x25]<<8);
85         cpu_set_reg(machine->cpu[0], Z80_DE2,  data[0x28] | data[0x29]<<8);
86         cpu_set_reg(machine->cpu[0], Z80_HL2,  data[0x2c] | data[0x2d]<<8);
87         cpu_set_reg(machine->cpu[0], Z80_IFF1, data[0x30]);
88         cpu_set_reg(machine->cpu[0], Z80_IFF2, data[0x34]);
89         cpu_set_reg(machine->cpu[0], Z80_HALT, data[0x38]);
90         cpu_set_reg(machine->cpu[0], Z80_IM,   data[0x3c]);
91         cpu_set_reg(machine->cpu[0], Z80_I,    data[0x40]);
92         cpu_set_reg(machine->cpu[0], Z80_R,    (data[0x44]&0x7f) | (data[0x48]&0x80));
9393
9494         memcpy (mess_ram, data+0x084c, (mess_ram_size < 0x1800) ? mess_ram_size : 0x1800);
9595
9696         break;
9797      case GALAXY_SNAPSHOT_V2_SIZE:
98         cpunum_set_reg(0, Z80_AF,   data[0x00] | data[0x01]<<8);
99         cpunum_set_reg(0, Z80_BC,   data[0x02] | data[0x03]<<8);
100         cpunum_set_reg(0, Z80_DE,   data[0x04] | data[0x05]<<8);
101         cpunum_set_reg(0, Z80_HL,   data[0x06] | data[0x07]<<8);
102         cpunum_set_reg(0, Z80_IX,   data[0x08] | data[0x09]<<8);
103         cpunum_set_reg(0, Z80_IY,   data[0x0a] | data[0x0b]<<8);
104         cpunum_set_reg(0, Z80_PC,   data[0x0c] | data[0x0d]<<8);
105         cpunum_set_reg(0, Z80_SP,   data[0x0e] | data[0x0f]<<8);
106         cpunum_set_reg(0, Z80_AF2,  data[0x10] | data[0x11]<<8);
107         cpunum_set_reg(0, Z80_BC2,  data[0x12] | data[0x13]<<8);
108         cpunum_set_reg(0, Z80_DE2,  data[0x14] | data[0x15]<<8);
109         cpunum_set_reg(0, Z80_HL2,  data[0x16] | data[0x17]<<8);
98         cpu_set_reg(machine->cpu[0], Z80_AF,   data[0x00] | data[0x01]<<8);
99         cpu_set_reg(machine->cpu[0], Z80_BC,   data[0x02] | data[0x03]<<8);
100         cpu_set_reg(machine->cpu[0], Z80_DE,   data[0x04] | data[0x05]<<8);
101         cpu_set_reg(machine->cpu[0], Z80_HL,   data[0x06] | data[0x07]<<8);
102         cpu_set_reg(machine->cpu[0], Z80_IX,   data[0x08] | data[0x09]<<8);
103         cpu_set_reg(machine->cpu[0], Z80_IY,   data[0x0a] | data[0x0b]<<8);
104         cpu_set_reg(machine->cpu[0], Z80_PC,   data[0x0c] | data[0x0d]<<8);
105         cpu_set_reg(machine->cpu[0], Z80_SP,   data[0x0e] | data[0x0f]<<8);
106         cpu_set_reg(machine->cpu[0], Z80_AF2,  data[0x10] | data[0x11]<<8);
107         cpu_set_reg(machine->cpu[0], Z80_BC2,  data[0x12] | data[0x13]<<8);
108         cpu_set_reg(machine->cpu[0], Z80_DE2,  data[0x14] | data[0x15]<<8);
109         cpu_set_reg(machine->cpu[0], Z80_HL2,  data[0x16] | data[0x17]<<8);
110110
111         cpunum_set_reg(0, Z80_IFF1, data[0x18]&0x01);
112         cpunum_set_reg(0, Z80_IFF2, 0);
111         cpu_set_reg(machine->cpu[0], Z80_IFF1, data[0x18]&0x01);
112         cpu_set_reg(machine->cpu[0], Z80_IFF2, 0);
113113
114         cpunum_set_reg(0, Z80_HALT, 0);
114         cpu_set_reg(machine->cpu[0], Z80_HALT, 0);
115115
116         cpunum_set_reg(0, Z80_IM,   (data[0x18]>>1)&0x03);
116         cpu_set_reg(machine->cpu[0], Z80_IM,   (data[0x18]>>1)&0x03);
117117
118         cpunum_set_reg(0, Z80_I,    data[0x19]);
119         cpunum_set_reg(0, Z80_R,    data[0x1a]);
118         cpu_set_reg(machine->cpu[0], Z80_I,    data[0x19]);
119         cpu_set_reg(machine->cpu[0], Z80_R,    data[0x1a]);
120120
121121         memcpy (mess_ram, data+0x0834, (mess_ram_size < 0x1800) ? mess_ram_size : 0x1800);
122122
r3581r3582
155155
156156DRIVER_INIT( galaxy )
157157{
158   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2800, 0x2800+mess_ram_size-1, 0, 0, SMH_BANK1);
159   memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2800, 0x2800+mess_ram_size-1, 0, 0, SMH_BANK1);
160   memory_set_bankptr(1, mess_ram);
158   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
159   memory_install_read8_handler(space, 0x2800, 0x2800+mess_ram_size-1, 0, 0, SMH_BANK1);
160   memory_install_write8_handler(space, 0x2800, 0x2800+mess_ram_size-1, 0, 0, SMH_BANK1);
161   memory_set_bankptr(machine,1, mess_ram);
161162
162163   if (mess_ram_size < (6+48)*1024)
163164   {
164      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2800+mess_ram_size, 0xffff, 0, 0, SMH_NOP);
165      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2800+mess_ram_size, 0xffff, 0, 0, SMH_NOP);
165      memory_install_read8_handler(space, 0x2800+mess_ram_size, 0xffff, 0, 0, SMH_NOP);
166      memory_install_write8_handler(space, 0x2800+mess_ram_size, 0xffff, 0, 0, SMH_NOP);
166167   }
167168}
168169
r3581r3582
172173
173174MACHINE_RESET( galaxy )
174175{
176   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
177   
175178   /* ROM 2 enable/disable */
176   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x1fff, 0, 0, input_port_read(machine, "ROM2") ? SMH_BANK10 : SMH_NOP);
177   memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x1fff, 0, 0, SMH_NOP);
178   memory_set_bankptr(10, memory_region(machine, "main") + 0x1000);
179   memory_install_read8_handler(space, 0x1000, 0x1fff, 0, 0, input_port_read(machine, "ROM2") ? SMH_BANK10 : SMH_NOP);
180   memory_install_write8_handler(space, 0x1000, 0x1fff, 0, 0, SMH_NOP);
181   memory_set_bankptr(machine,10, memory_region(machine, "main") + 0x1000);
179182
180   cpunum_set_irq_callback(0, galaxy_irq_callback);
183   cpu_set_irq_callback(machine->cpu[0], galaxy_irq_callback);
181184   galaxy_interrupts_enabled = TRUE;
182185
183186   gal_video_timer = timer_alloc(gal_video, NULL);
r3581r3582
192195MACHINE_RESET( galaxyp )
193196{
194197   UINT8 *ROM = memory_region(machine, "main");
198   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
199   
200   cpu_set_irq_callback(machine->cpu[0], galaxy_irq_callback);
195201
196   cpunum_set_irq_callback(0, galaxy_irq_callback);
197
198202   ROM[0x0037] = 0x29;
199203   ROM[0x03f9] = 0xcd;
200204   ROM[0x03fa] = 0x00;
201205   ROM[0x03fb] = 0xe0;
202206
203   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xefff, 0, 0, SMH_BANK11);
204   memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xefff, 0, 0, SMH_NOP);
205   memory_set_bankptr(11, memory_region(machine, "main") + 0xe000);
207   memory_install_read8_handler(space, 0xe000, 0xefff, 0, 0, SMH_BANK11);
208   memory_install_write8_handler(space, 0xe000, 0xefff, 0, 0, SMH_NOP);
209   memory_set_bankptr(machine,11, memory_region(machine, "main") + 0xe000);
206210   galaxy_interrupts_enabled = TRUE;
207211
208212   gal_video_timer = timer_alloc(gal_video, NULL);
src/mess/mess.mak
r3581r3582
372372   $(MESSOBJ)/aquarius.a \
373373   $(MESSOBJ)/b2m.a \
374374   $(MESSOBJ)/bk.a \
375   $(MESSOBJ)/galaxy.a \
375376   $(MESSOBJ)/homelab.a \
376377   $(MESSOBJ)/irisha.a \
377378   $(MESSOBJ)/mk2.a \
r3581r3582
419420#   $(MESSOBJ)/exeltel.a \
420421#   $(MESSOBJ)/exidy.a \
421422#   $(MESSOBJ)/fairch.a \
422#   $(MESSOBJ)/galaxy.a \
423423#   $(MESSOBJ)/gce.a \
424424#   $(MESSOBJ)/glasgow.a \
425425#   $(MESSOBJ)/gmaster.a \

Previous 15994 Revisions Next


© 1998-2018 The MESS Team