Previous 15994 Revisions Next

r2698 Thursday 22nd May, 2008 at 19:42:51 UTC by Miodrag Milanović
[GALAXY] space/tab cleanup
[src/mess/drivers]galaxy.c
[src/mess/formats]gtp_cas.c
[src/mess/machine]galaxy.c
[src/mess/video]galaxy.c

src/mess/video/galaxy.c
r2697r2698
33  galaxy.c
44
55  Functions to emulate the video hardware of the Galaksija.
6 
6
77  20/05/2008 - Real video implementation by Miodrag Milanovic
8  01/03/2008 - Update by Miodrag Milanovic to make Galaksija video work with new SVN code 
8  01/03/2008 - Update by Miodrag Milanovic to make Galaksija video work with new SVN code
99***************************************************************************/
1010
1111#include "driver.h"
r2697r2698
4747emu_timer *gal_video_timer = NULL;
4848
4949TIMER_CALLBACK( gal_video )
50{   
50{
5151   int y,x;
5252   if (galaxy_interrupts_enabled==TRUE) {
53      UINT8 *gfx = memory_region(REGION_GFX1);   
53      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         
55      if ((gal_cnt > 96 * 2) && (gal_cnt < 96 * 210)) { // display on screen just first 208 lines
5656         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);               
57              UINT16 addr = (cpunum_get_reg(0, Z80_I) << 8) |  cpunum_get_reg(0, Z80_R) | ((gal_latch_value & 0x80) ^ 0x80);
5858              if (first==0 && (cpunum_get_reg(0, Z80_R) & 0x1f) ==0) {
5959                 // 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             
60                 // the end of last cycle we need to skip dusplay of double
61                 // first char in each row
6262                 code = 0xff;
6363                 first = 1;
6464            } else {
6565               code = program_read_byte(addr) & 0xbf;
66               code += (code & 0x80) >> 1;   
67               code = gfx[(code & 0x7f) +(dat << 7 )];     
68               first = 0;           
66               code += (code & 0x80) >> 1;
67               code = gfx[(code & 0x7f) +(dat << 7 )];
68               first = 0;
6969            }
7070            y = gal_cnt / 96 - 2;
7171            x = (gal_cnt % 96)*4;
r2697r2698
7676            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 4) & 1; x++;
7777            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 5) & 1; x++;
7878            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 6) & 1; x++;
79            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 7) & 1;
80         }         
81      }   
82      gal_cnt++;     
83   }     
79            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 7) & 1;
80         }
81      }
82      gal_cnt++;
83   }
8484}
8585
86VIDEO_START ( galaxy )
86VIDEO_START ( galaxy )
8787{
8888   return VIDEO_START_CALL ( generic_bitmapped );
8989}
r2697r2698
9393   timer_adjust_periodic(gal_video_timer, attotime_zero, 0, attotime_never);
9494   if (galaxy_interrupts_enabled == FALSE) {
9595      rectangle black_area = {0,384-1,0,212-2};
96      fillbitmap(tmpbitmap, 1, &black_area);           
96      fillbitmap(tmpbitmap, 1, &black_area);
9797   }
98   galaxy_interrupts_enabled = FALSE;     
98   galaxy_interrupts_enabled = FALSE;
9999   return VIDEO_UPDATE_CALL ( generic_bitmapped );
100100}
101101
src/mess/machine/galaxy.c
r2697r2698
3030
3131READ8_HANDLER( galaxy_latch_r )
3232{
33   return 0xff;   
33   return 0xff;
3434}
3535WRITE8_HANDLER( galaxy_latch_w )
36{   
36{
3737   double val = (((data >>6) & 1 ) + ((data >> 2) & 1) - 1) * 32000;
38   gal_latch_value = data;     
39   cassette_output(image_from_devtype_and_index(IO_CASSETTE, 0), val);
38   gal_latch_value = data;
39   cassette_output(image_from_devtype_and_index(IO_CASSETTE, 0), val);
4040}
4141
4242
r2697r2698
4747int galaxy_interrupts_enabled = TRUE;
4848
4949INTERRUPT_GEN( galaxy_interrupt )
50{   
51   cpunum_set_input_line(machine, 0, 0, HOLD_LINE);   
50{
51   cpunum_set_input_line(machine, 0, 0, HOLD_LINE);
5252}
5353
5454IRQ_CALLBACK ( galaxy_irq_callback )
r2697r2698
173173{
174174   /* ROM 2 enable/disable */
175175   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x1fff, 0, 0, input_port_read_indexed(machine, 7) ? SMH_BANK10 : SMH_NOP);
176   memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x1fff, 0, 0, SMH_NOP);   
176   memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x1fff, 0, 0, SMH_NOP);
177177   memory_set_bankptr(10, memory_region(REGION_CPU1) + 0x1000);
178178
179179   cpunum_set_irq_callback(0, galaxy_irq_callback);
180180   galaxy_interrupts_enabled = TRUE;
181   
181
182182   gal_video_timer = timer_alloc(gal_video, NULL);
183183   timer_adjust_periodic(gal_video_timer, attotime_zero, 0,attotime_never);
184184}
r2697r2698
191191MACHINE_RESET( galaxyp )
192192{
193193   UINT8 *ROM = memory_region(REGION_CPU1);
194   
195   cpunum_set_irq_callback(0, galaxy_irq_callback);   
196         
194
195   cpunum_set_irq_callback(0, galaxy_irq_callback);
196
197197   ROM[0x0037] = 0x29;
198198   ROM[0x03f9] = 0xcd;
199199   ROM[0x03fa] = 0x00;
200200   ROM[0x03fb] = 0xe0;
201   
201
202202   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xefff, 0, 0, SMH_BANK11);
203   memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xefff, 0, 0, SMH_NOP);   
204   memory_set_bankptr(11, memory_region(REGION_CPU1) + 0xe000);   
203   memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xefff, 0, 0, SMH_NOP);
204   memory_set_bankptr(11, memory_region(REGION_CPU1) + 0xe000);
205205   galaxy_interrupts_enabled = TRUE;
206206
207207   gal_video_timer = timer_alloc(gal_video, NULL);
src/mess/formats/gtp_cas.c
r2697r2698
11/*
2   
3   Tape support for Glaksija GTP format
4       
5   Miodrag Milanovic
2 
3    Tape support for Glaksija GTP format
4 
5    Miodrag Milanovic
66*/
77#include "driver.h"
88#include "formats/gtp_cas.h"
r2697r2698
1313#define WAVE_HIGH      0x5a9e
1414#define WAVE_NULL      0
1515 
16#define   GTP_BLOCK_STANDARD   0x00
17#define   GTP_BLOCK_TURBO      0x01
18#define   GTP_BLOCK_NAME      0x10
1619 
17#define    GTP_BLOCK_STANDARD   0x00
18#define      GTP_BLOCK_TURBO      0x01
19#define      GTP_BLOCK_NAME      0x10
20 
2120static INT16   wave_data;
2221static INT16     len;
2322 
r2697r2698
5756   gtp_output_wave(buffer,PULSE_WIDTH);
5857   wave_data = WAVE_NULL;
5958   gtp_output_wave(buffer,PERIOD_1 - 2 * PULSE_WIDTH);
60   
59
6160   return PERIOD_1 * 2;
6261}
6362 
r2697r2698
6968   gtp_output_wave(buffer,PULSE_WIDTH);
7069   wave_data = WAVE_NULL;
7170   gtp_output_wave(buffer,PERIOD_0 - 2 * PULSE_WIDTH);
72   
71
7372   return PERIOD_0;
7473}
7574 
r2697r2698
7877   UINT8 b;
7978   int j,size = 0;
8079   for (j=0;j<8;j++) {
81      b = (val >> j) & 1;         
82      if (b==0) {             
80      b = (val >> j) & 1;
81      if (b==0) {
8382         size += gtp_mod_0(buffer);
84      } else {           
83      } else {
8584         size += gtp_mod_1(buffer);
86      }           
85      }
8786   }
8887   return size;
8988}
r2697r2698
9796      if (i!=0) {
9897         // Interbyte pause
9998         wave_data = WAVE_NULL;
100         gtp_output_wave(buffer,INTERBYTE_PAUSE);         
99         gtp_output_wave(buffer,INTERBYTE_PAUSE);
101100         size += INTERBYTE_PAUSE;
102101      }
103102      size += gtp_byte(buffer,0);
104103   }
105   return size;   
104   return size;
106105}
107106 
108107static int gtp_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
109   int size,n;   
110   size = 0;   
108   int size,n;
109   size = 0;
111110   n = 0;
112111   if (casdata == NULL) return -1;
113   while(n<caslen) {           
112   while(n<caslen) {
114113      int block_type = casdata[n];
115114      int block_size = casdata[n+2]*256 + casdata[n+1];
116115      n+=5;
117116      if (block_type==GTP_BLOCK_STANDARD) {
118117         // Interblock pause
119         size += INTERBLOCK_PAUSE;       
120         size += 100 * (PERIOD_0 * 8 + INTERBYTE_PAUSE) - INTERBYTE_PAUSE;       
118         size += INTERBLOCK_PAUSE;
119         size += 100 * (PERIOD_0 * 8 + INTERBYTE_PAUSE) - INTERBYTE_PAUSE;
121120         size += (PERIOD_0 * 8 + INTERBYTE_PAUSE) * block_size;
122121      }
123122      n += block_size;
124   }           
125   len = caslen;       
123   }
124   len = caslen;
126125   return size;
127126}
128127 
129128static int gtp_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
130   int i,size,n;   
131   size = 0;   
129   int i,size,n;
130   size = 0;
132131   n = 0;
133132   if (bytes == NULL) return -1;
134   while(n<len) 
135   {         
133   while(n<len)
134   {
136135      int block_type = bytes[n];
137136      int block_size = bytes[n+2]*256 + bytes[n+1];
138137      n+=5;
r2697r2698
141140         // Interblock pause
142141         wave_data = WAVE_NULL;
143142         gtp_output_wave(&buffer,INTERBLOCK_PAUSE);
144         size += INTERBLOCK_PAUSE;     
143         size += INTERBLOCK_PAUSE;
145144         size += gtp_sync(&buffer);
146         
145
147146         for (i=0;i<block_size;i++) {
148147            // Interbyte pause
149148            wave_data = WAVE_NULL;
150            gtp_output_wave(&buffer,INTERBYTE_PAUSE);         
149            gtp_output_wave(&buffer,INTERBYTE_PAUSE);
151150            size += INTERBYTE_PAUSE;
152           
151
153152            size += gtp_byte(&buffer,bytes[n]);
154153            n++;
155         }         
154         }
156155      }
157   }             
156   }
158157   return size;
159158}
160159 
src/mess/drivers/galaxy.c
r2697r2698
4646static ADDRESS_MAP_START (galaxyp_mem, ADDRESS_SPACE_PROGRAM, 8)
4747   AM_RANGE(0x0000, 0x0fff) AM_ROM // ROM A
4848   AM_RANGE(0x1000, 0x1fff) AM_ROM // ROM B
49   AM_RANGE(0x2000, 0x2037) AM_MIRROR(0x07c0) AM_READ( galaxy_keyboard_r )   
49   AM_RANGE(0x2000, 0x2037) AM_MIRROR(0x07c0) AM_READ( galaxy_keyboard_r )
5050   AM_RANGE(0x2038, 0x203f) AM_MIRROR(0x07c0) AM_READWRITE( galaxy_latch_r, galaxy_latch_w )
51   AM_RANGE(0xe000, 0xefff) AM_ROM // ROM C
51   AM_RANGE(0xe000, 0xefff) AM_ROM // ROM C
5252   AM_RANGE(0xf000, 0xffff) AM_ROM // ROM D
5353ADDRESS_MAP_END
5454
r2697r2698
135135INPUT_PORTS_END
136136
137137static INPUT_PORTS_START( galaxy )
138   PORT_INCLUDE( galaxy_common )   
138   PORT_INCLUDE( galaxy_common )
139139   PORT_START /* port 7 */
140140      PORT_CONFNAME(0x01, 0x01, "ROM 2")
141141         PORT_CONFSETTING(0x01, "Installed")
r2697r2698
143143INPUT_PORTS_END
144144
145145static INPUT_PORTS_START( galaxyp )
146   PORT_INCLUDE( galaxy_common )   
146   PORT_INCLUDE( galaxy_common )
147147INPUT_PORTS_END
148148
149149static const struct AY8910interface galaxy_ay_interface =
r2697r2698
159159static MACHINE_DRIVER_START( galaxy )
160160   /* basic machine hardware */
161161   MDRV_CPU_ADD(Z80, XTAL / 2)
162   MDRV_CPU_PROGRAM_MAP(galaxy_mem, 0)   
162   MDRV_CPU_PROGRAM_MAP(galaxy_mem, 0)
163163   MDRV_CPU_VBLANK_INT("main", galaxy_interrupt)
164164   MDRV_SCREEN_ADD("main", RASTER)
165165   MDRV_SCREEN_REFRESH_RATE(50)
r2697r2698
179179
180180   /* snapshot */
181181   MDRV_SNAPSHOT_ADD(galaxy, "gal", 0)
182   
182
183183   MDRV_SPEAKER_STANDARD_MONO("mono")
184184   MDRV_SOUND_ADD(WAVE, 0)
185185   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
r2697r2698
206206
207207   MDRV_VIDEO_START( generic_bitmapped )
208208   MDRV_VIDEO_UPDATE( galaxy )
209   
209
210210   /* snapshot */
211211   MDRV_SNAPSHOT_ADD(galaxy, "gal", 0)
212212
r2697r2698
214214   MDRV_SPEAKER_STANDARD_MONO("mono")
215215   MDRV_SOUND_ADD(AY8910, XTAL/4)
216216   MDRV_SOUND_CONFIG(galaxy_ay_interface)
217   MDRV_SOUND_ADD(WAVE, 0)     
217   MDRV_SOUND_ADD(WAVE, 0)
218218   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
219219MACHINE_DRIVER_END
220220
r2697r2698
228228
229229ROM_START (galaxyp)
230230   ROM_REGION (0x10000, REGION_CPU1, ROMREGION_ERASEFF)
231   ROM_LOAD ("galrom1.bin", 0x0000, 0x1000, CRC(365f3e24) SHA1(ffc6bf2ec09eabdad76604a63f5dd697c30c4358))     
231   ROM_LOAD ("galrom1.bin", 0x0000, 0x1000, CRC(365f3e24) SHA1(ffc6bf2ec09eabdad76604a63f5dd697c30c4358))
232232   ROM_LOAD ("galrom2.bin", 0x1000, 0x1000, CRC(5dc5a100) SHA1(5d5ab4313a2d0effe7572bb129193b64cab002c1))
233   ROM_LOAD ("galplus.bin", 0xe000, 0x1000, CRC(d4cfab14) SHA1(b507b9026844eeb757547679907394aa42055eee))   
233   ROM_LOAD ("galplus.bin", 0xe000, 0x1000, CRC(d4cfab14) SHA1(b507b9026844eeb757547679907394aa42055eee))
234234   ROM_REGION(0x0800, REGION_GFX1,0)
235235   ROM_LOAD ("galchr.bin", 0x0000, 0x0800, CRC(5c3b5bb5) SHA1(19429a61dc5e55ddec3242a8f695e06dd7961f88))
236236ROM_END
r2697r2698
243243      /* --- the following bits of info are returned as 64-bit signed integers --- */
244244      case MESS_DEVINFO_INT_COUNT:            info->i = 1; break;
245245      case MESS_DEVINFO_INT_CASSETTE_DEFAULT_STATE:   info->i = CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED; break;
246      case MESS_DEVINFO_PTR_CASSETTE_FORMATS:      info->p = (void *)gtp_cassette_formats; break;   
246      case MESS_DEVINFO_PTR_CASSETTE_FORMATS:      info->p = (void *)gtp_cassette_formats; break;
247247      default:               cassette_device_getinfo(devclass, state, info); break;
248248   }
249249}
r2697r2698
254254   CONFIG_RAM((6+16) * 1024)
255255   CONFIG_RAM((6+32) * 1024)
256256   CONFIG_RAM((6+48) * 1024)
257   CONFIG_DEVICE(galaxy_common_cassette_getinfo)   
257   CONFIG_DEVICE(galaxy_common_cassette_getinfo)
258258SYSTEM_CONFIG_END
259259
260260SYSTEM_CONFIG_START(galaxyp)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team