Previous 15994 Revisions Next

r1471 Monday 31st December, 2007 at 22:30:02 UTC by Nathan Woods
Conditional logging improvements [Atari Ace]
[docs]messnew.txt
[src/mess]utils.c
[src/mess/audio]mea8000.c vic6560.c
[src/mess/devices]basicdsk.c cassette.c flopdrv.c thomflop.c
[src/mess/drivers]a310.c channelf.c kim1.c mbee.c mekd2.c mz700.c nc.c pcw.c psx.c sord.c vtech2.c
[src/mess/formats]mz_cas.c oric_tap.c thom_cas.c thom_dsk.c
[src/mess/includes]cbm.h
[src/mess/machine]amigacd.c apple2.c astrocde.c at45dbxx.c ay3600.c bbc.c cbmdrive.c concept.c corvushd.c cybiko.c d88.c dai.c dgn_beta.c galaxy.c i8271.c ibmpc.c kc.c mc6843.c mc6846.c mc6854.c mekd2.c microtan.c msm8251.c mz700.c nes_mmc.c pcf8593.c pclpt.c rriot.c serial.c sms.c sst39vfx.c tc8521.c thomson.c tms5501.c trs80.c uart8250.c vc20.c z80dart.c
[src/mess/video]astrocde.c avigo.c crtc6845.c dai.c hd66421.c i82720.c mekd2.c mz700.c pc_cga.c pc_mda.c ted7360.c thomson.c vdc.c vdc8563.c vic6560.c

src/mess/utils.c
r1470r1471
1#include <stdio.h>
12#include <ctype.h>
23#include <stdlib.h>
34#include "glob.h"
src/mess/devices/cassette.c
r1470r1471
1515#define ANIMATION_FRAMES   4
1616
1717#define VERBOSE            0
18#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
1819
1920
2021/* from devices/mflopimg.c */
r1470r1471
136137   sample = tag->value;
137138   double_value = sample / ((double) 0x7FFFFFFF);
138139
139#if VERBOSE
140   logerror("cassette_input(): time_index=%g value=%g\n", tag->position, double_value);
141#endif
140   LOG(("cassette_input(): time_index=%g value=%g\n", tag->position, double_value));
142141
143142   return double_value;
144143}
src/mess/devices/flopdrv.c
r1470r1471
2020#include "image.h"
2121
2222#define VERBOSE      0
23#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
2324#define FLOPDRVTAG   "flopdrv"
2425
2526static struct floppy_drive *get_drive(mess_image *img)
r1470r1471
344345
345346   pDrive = get_drive(img);
346347
347#if VERBOSE
348   logerror("seek from: %d delta: %d\n",pDrive->current_track, signed_tracks);
349#endif
348   LOG(("seek from: %d delta: %d\n",pDrive->current_track, signed_tracks));
350349
351350   /* update position */
352351   pDrive->current_track+=signed_tracks;
src/mess/devices/basicdsk.c
r1470r1471
1111
1212#define basicdsk_MAX_DRIVES 4
1313#define VERBOSE 1
14#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
1415
1516
1617typedef struct
r1470r1471
282283   }
283284
284285
285#if VERBOSE
286    logerror("basicdsk seek track:%d head:%d sector:%d-> offset #0x%08lX\n",
287             t, h, s, offset);
288#endif
286    LOG(("basicdsk seek track:%d head:%d sector:%d-> offset #0x%08lX\n",
287             t, h, s, offset));
289288
290289   if (offset > w->image_size)
291290   {
r1470r1471
321320            w->head == w->dam_list[i][1] &&
322321            w->sector == w->dam_list[i][2])
323322         {
324#if VERBOSE
325                                logerror("basicdsk reading formatted sector %d, track %d, head %d\n", w->sector, w->track, w->head);
326#endif
323                                LOG(("basicdsk reading formatted sector %d, track %d, head %d\n", w->sector, w->track, w->head));
327324            w->data_offset = w->dam_data[i];
328325            return;
329326         }
r1470r1471
398395   w->dam_cnt = 0;
399396    if (w->image_file != REAL_FDD && w->mode == 0)
400397    {
401#if VERBOSE
402                logerror("basicdsk write_track write protected image\n");
403#endif
398                LOG(("basicdsk write_track write protected image\n"));
404399        w->status = STA_2_WRITE_PRO;
405400        return;
406401    }
r1470r1471
409404   memset(w->dam_data, 0x00, sizeof(w->dam_data));
410405
411406   f = w->buffer;
412#if VERBOSE
413        logerror("basicdsk write_track %s_LOW\n", (w->density) ? "MFM" : "FM" );
414#endif
407        LOG(("basicdsk write_track %s_LOW\n", (w->density) ? "MFM" : "FM" ));
415408    cnt = (w->density) ? TRKSIZE_DD : TRKSIZE_SD;
416409
417410   do
r1470r1471
430423         w->dam_list[w->dam_cnt][3] = *f++;     /* copy sector length */
431424         /* sector length in bytes */
432425         seclen = 128 << w->dam_list[w->dam_cnt][3];
433#if VERBOSE
434                        logerror("basicdsk write_track FE @%5d T:%02X H:%02X S:%02X L:%02X\n",
426                        LOG(("basicdsk write_track FE @%5d T:%02X H:%02X S:%02X L:%02X\n",
435427               (int)(f - w->buffer),
436428               w->dam_list[w->dam_cnt][0],w->dam_list[w->dam_cnt][1],
437               w->dam_list[w->dam_cnt][2],w->dam_list[w->dam_cnt][3]);
438#endif
429               w->dam_list[w->dam_cnt][2],w->dam_list[w->dam_cnt][3]));
430
439431         /* search start of DATA */
440432         while ((--cnt > 0) && (*f != 0xf9) && (*f != 0xfa) && (*f != 0xfb))
441433            f++;
r1470r1471
447439                /* set pointer to DATA to later write the sectors contents */
448440            w->dam_data[w->dam_cnt] = (int)(f - w->buffer);
449441            w->dam_cnt++;
450#if VERBOSE
451                                logerror("basicdsk write_track %02X @%5d data: %02X %02X %02X %02X ... %02X %02X %02X %02X\n",
442
443                                LOG(("basicdsk write_track %02X @%5d data: %02X %02X %02X %02X ... %02X %02X %02X %02X\n",
452444                  f[-1],
453445                  (int)(f - w->buffer),
454446                  f[0], f[1], f[2], f[3],
455                  f[seclen-4], f[seclen-3], f[seclen-2], f[seclen-1]);
456#endif
447                  f[seclen-4], f[seclen-3], f[seclen-2], f[seclen-1]));
448
457449            f += seclen;
458450            cnt -= seclen;
459451         }
src/mess/devices/thomflop.c
r1470r1471
2323
2424#define PRINT(x) mame_printf_info x
2525
26#if VERBOSE > 1
27#define LOG(x)   logerror x
28#define VLOG(x)   logerror x
29#elif VERBOSE
30#define LOG(x)   logerror x
31#define VLOG(x)
32#else
33#define LOG(x)
34#define VLOG(x)
35#endif
26#define LOG(x)   do { if (VERBOSE > 0) logerror x; } while (0)
27#define VLOG(x)   do { if (VERBOSE > 1) logerror x; } while (0)
3628
3729
3830
src/mess/audio/vic6560.c
r1470r1471
8585         if (tone1samples == 0)
8686            tone1samples = 1;
8787      }
88      DBG_LOG (1, "vic6560", (errorlog, "tone1 %.2x %d\n", data, TONE1_FREQUENCY));
88      DBG_LOG (1, "vic6560", ("tone1 %.2x %d\n", data, TONE1_FREQUENCY));
8989      break;
9090   case 0xb:
9191      vic6560[offset] = data;
r1470r1471
9696         if (tone2samples == 0)
9797            tone2samples = 1;
9898      }
99      DBG_LOG (1, "vic6560", (errorlog, "tone2 %.2x %d\n", data, TONE2_FREQUENCY));
99      DBG_LOG (1, "vic6560", ("tone2 %.2x %d\n", data, TONE2_FREQUENCY));
100100      break;
101101   case 0xc:
102102      vic6560[offset] = data;
r1470r1471
107107         if (tone2samples == 0)
108108            tone2samples = 1;
109109      }
110      DBG_LOG (1, "vic6560", (errorlog, "tone3 %.2x %d\n", data, TONE3_FREQUENCY));
110      DBG_LOG (1, "vic6560", ("tone3 %.2x %d\n", data, TONE3_FREQUENCY));
111111      break;
112112   case 0xd:
113113      vic6560[offset] = data;
r1470r1471
115115      {
116116         noisesamples = (int) ((double) NOISE_FREQUENCY_MAX * Machine->sample_rate
117117                          * NOISE_BUFFER_SIZE_SEC / NOISE_FREQUENCY);
118         DBG_LOG (1, "vic6560", (errorlog, "noise %.2x %d sample:%d\n",
118         DBG_LOG (1, "vic6560", ("noise %.2x %d sample:%d\n",
119119                           data, NOISE_FREQUENCY, noisesamples));
120120         if ((double) noisepos / noisesamples >= 1.0)
121121         {
r1470r1471
129129      break;
130130   case 0xe:
131131      vic6560[offset] = (old & ~0xf) | (data & 0xf);
132      DBG_LOG (3, "vic6560", (errorlog, "volume %d\n", data & 0xf));
132      DBG_LOG (3, "vic6560", ("volume %d\n", data & 0xf));
133133      break;
134134   }
135135}
src/mess/audio/mea8000.c
r1470r1471
120120
121121
122122
123#if VERBOSE
124#define LOG(x)  logerror x
125#else
126#define LOG(x)
127#endif
123#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
128124
129125/* digital filters work at 8KHz */
130126#define F0 8096
src/mess/includes/cbm.h
r1470r1471
2727
2828/**************************************************************************
2929 * Logging
30 * call the XXX_LOG with XXX_LOG("info",(errorlog,"%fmt\n",args));
30 * call the XXX_LOG with XXX_LOG("info",("%fmt\n",args));
3131 * where "info" can also be 0 to append .."%fmt",args to a line.
3232 **************************************************************************/
3333#define LOG(LEVEL,N,M,A)  \
3434        { \
3535     if(LEVEL>=N) { \
3636       if( M ) \
37              logerror("%11.6f: %-24s",timer_get_time(), (char*)M );\
37              logerror("%11.6f: %-24s",attotime_to_double(timer_get_time()), (char*)M );\
3838       logerror A; \
3939     } \
4040        }
r1470r1471
5353# define PET_TEST_CODE
5454#endif
5555
56#if VERBOSE_DBG
5756#define DBG_LOG(n,m,a) LOG(VERBOSE_DBG,n,m,a)
58#else
59#define DBG_LOG(n,m,a)
60#endif
6157
6258QUICKLOAD_LOAD( cbm_pet1 );
6359QUICKLOAD_LOAD( cbm_pet );
src/mess/video/vic6560.c
r1470r1471
176176
177177WRITE8_HANDLER ( vic6560_port_w )
178178{
179   DBG_LOG (1, "vic6560_port_w", (errorlog, "%.4x:%.2x\n", offset, data));
179   DBG_LOG (1, "vic6560_port_w", ("%.4x:%.2x\n", offset, data));
180180   switch (offset)
181181   {
182182   case 0xa:
r1470r1471
280280      val = vic6560[offset];
281281      break;
282282   }
283   DBG_LOG (3, "vic6560_port_r", (errorlog, "%.4x:%.2x\n", offset, val));
283   DBG_LOG (3, "vic6560_port_r", ("%.4x:%.2x\n", offset, val));
284284   return val;
285285}
286286
src/mess/video/i82720.c
r1470r1471
2929#define GDC_FIFO_DIR_WRITE 0
3030#define GDC_FIFO_DIR_READ 1
3131
32#define GDC_LOG_CMDS
33#ifdef GDC_LOG_CMDS
34#define GDC_LOG_CMD_1(x) (logerror(x))
35#define GDC_LOG_CMD_2(x,y) (logerror(x,y))
36#define GDC_LOG_CMD_3(x,y,z) (logerror(x,y,z))
37#define GDC_LOG_CMD_4(x,y,z,a) (logerror(x,y,z,a))
38#else
39#define GDC_LOG_CMD_1(x)
40#define GDC_LOG_CMD_2(x,y)
41#define GDC_LOG_CMD_3(x,y,z)
42#define GDC_LOG_CMD_4(x,y,z,a)
43#endif
32#define VERBOSE 1
33#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
4434
4535/* FIFO */
4636typedef struct
r1470r1471
218208      /* We cannot go higher than 15 */
219209      gdcp->fifo.write_pos = (gdcp->fifo.write_pos + 1) & 0x0f;
220210   } else {
221      GDC_LOG_CMD_2("gdc_fifo_enqueue: The fifo is full at PC = %04X\n",
222                    activecpu_get_pc());
211      LOG(("gdc_fifo_enqueue: The fifo is full at PC = %04X\n",
212                    activecpu_get_pc()));
223213   }
224214}
225215
r1470r1471
417407         gdc_write(address, gdc_read(address) | (data & mask));
418408         break;
419409   }
420   /* GDC_LOG_CMD_3("gdc_write_data: address = %04x, base = %04x\n",
421      address, base_addr); */
410   /* LOG(("gdc_write_data: address = %04x, base = %04x\n",
411      address, base_addr)); */
422412}
423413
424414static void gdc_update_ead_and_mask(void)
r1470r1471
483473INLINE
484474void gdc_dump_disp_regs(void)
485475{
486   GDC_LOG_CMD_2("gdc: display mode   = %d\n",
487               gdc.registers.display.display_mode);
488   GDC_LOG_CMD_2("gdc: words_per_line = %d\n",
489               gdc.registers.display.words_per_line);
490   GDC_LOG_CMD_2("gdc: horiz_sync_width = %d\n",
491               gdc.registers.display.horiz_sync_width);
492   GDC_LOG_CMD_2("gdc: lines_per_field = %d\n",
493               gdc.registers.display.lines_per_field);
476   LOG(("gdc: display mode   = %d\n",
477               gdc.registers.display.display_mode));
478   LOG(("gdc: words_per_line = %d\n",
479               gdc.registers.display.words_per_line));
480   LOG(("gdc: horiz_sync_width = %d\n",
481               gdc.registers.display.horiz_sync_width));
482   LOG(("gdc: lines_per_field = %d\n",
483               gdc.registers.display.lines_per_field));
494484}
495485
496486INLINE const char*
r1470r1471
538528   reg += (gdc.registers.command.sync[0] & 0x02) ? 0x01 : 0;
539529   gdc.registers.display.display_mode = reg;
540530
541   GDC_LOG_CMD_2("gdc_cmd_sync: mode byte = %02X\n",
542                 gdc.registers.command.sync[0]);
543   GDC_LOG_CMD_2("gdc_cmd_sync: mode is %s\n", gdc_disp_mode_to_str(reg));
531   LOG(("gdc_cmd_sync: mode byte = %02X\n",
532                 gdc.registers.command.sync[0]));
533   LOG(("gdc_cmd_sync: mode is %s\n", gdc_disp_mode_to_str(reg)));
544534
545535
546536   if ( i == 1 )
r1470r1471
552542   gdc.registers.display.words_per_line = reg + 2;
553543   gdc.registers.display.display_width =  reg + 2;
554544
555   GDC_LOG_CMD_2("gdc_cmd_sync: words_per_line set to %d\n",
556                 gdc.registers.display.words_per_line);
557   GDC_LOG_CMD_2("gdc_cmd_sync: display_width set to %d\n",
558                 gdc.registers.display.display_width);
545   LOG(("gdc_cmd_sync: words_per_line set to %d\n",
546                 gdc.registers.display.words_per_line));
547   LOG(("gdc_cmd_sync: display_width set to %d\n",
548                 gdc.registers.display.display_width));
559549
560550   if ( i == 2 )
561551      return;
r1470r1471
621611   UINT8* param_in_fifo = gdc_fifo_dequeue_param(&gdc);
622612   if ( param_in_fifo ) {
623613      gdc.registers.display.words_per_line = *param_in_fifo;
624      GDC_LOG_CMD_2("gdc_cmd_pitch: words_per_line set to %d\n",
625                    gdc.registers.display.words_per_line);
614      LOG(("gdc_cmd_pitch: words_per_line set to %d\n",
615                    gdc.registers.display.words_per_line));
626616   }
627617}
628618
r1470r1471
689679         param <<= 1;
690680      }
691681      tmp_str[8] = 0;
692      GDC_LOG_CMD_2("gdc_cmd_pram: %s\n", tmp_str);
682      LOG(("gdc_cmd_pram: %s\n", tmp_str));
693683   }
694684   if ( gdc_get_base_addr(&gdc) != base_addr_before ) {
695      GDC_LOG_CMD_3("gdc_cmd_pram: base_addr changed from %08X to %08X\n",
696                    base_addr_before, gdc_get_base_addr(&gdc));
685      LOG(("gdc_cmd_pram: base_addr changed from %08X to %08X\n",
686                    base_addr_before, gdc_get_base_addr(&gdc)));
697687   }
698688}
699689
r1470r1471
712702   dispregs->disp_cursor = (*param_p & 0x80) != 0;
713703   /* Number of lines per character row - 1 */
714704   dispregs->lines_per_ch_row = (*param_p & 0x1f) + 1;
715   GDC_LOG_CMD_2("gdc_cmd_cchar: Display cursor = %d\n",
716                 dispregs->disp_cursor);
717   GDC_LOG_CMD_2("gdc_cmd_cchar: Lines per character row = %d\n",
718                 dispregs->lines_per_ch_row);
705   LOG(("gdc_cmd_cchar: Display cursor = %d\n",
706                 dispregs->disp_cursor));
707   LOG(("gdc_cmd_cchar: Lines per character row = %d\n",
708                 dispregs->lines_per_ch_row));
719709   /* Next parameter */
720710   if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) == NULL  ) return;
721711   /* Lower bits of blink rate (there are 5) */
r1470r1471
724714   dispregs->cursor_blinking = (*param_p & 0x20) == 0;
725715   /* Cursor top lite number in the row */
726716   dispregs->cursor_top_line = *param_p & 0x1f;
727   GDC_LOG_CMD_2("gdc_cmd_cchar: Cursor blinking = %d\n",
728                 dispregs->cursor_blinking);
729   GDC_LOG_CMD_2("gdc_cmd_cchar: Cursor top line = %d\n",
730                 dispregs->cursor_top_line);
717   LOG(("gdc_cmd_cchar: Cursor blinking = %d\n",
718                 dispregs->cursor_blinking));
719   LOG(("gdc_cmd_cchar: Cursor top line = %d\n",
720                 dispregs->cursor_top_line));
731721   /* Next parameter */
732722   if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) == NULL ) return;
733723   dispregs->cursor_blink_rate = (*param_p & 0x07) | temp_reg;
734724   dispregs->cursor_bottom_line = (*param_p & 0xf8) >> 3;
735   GDC_LOG_CMD_2("gdc_cmd_cchar: Cursor blink rate = %d\n",
736                 dispregs->cursor_blink_rate);
737   GDC_LOG_CMD_2("gdc_cmd_cchar: Cursor bottom line = %d\n",
738                 dispregs->cursor_bottom_line);
725   LOG(("gdc_cmd_cchar: Cursor blink rate = %d\n",
726                 dispregs->cursor_blink_rate));
727   LOG(("gdc_cmd_cchar: Cursor bottom line = %d\n",
728                 dispregs->cursor_bottom_line));
739729
740730
741731}
r1470r1471
763753   /* What will be done next time? */
764754   dispregs->figs_operation = (*param_p & 0xf1) >> 3;
765755   dispregs->figs_direction = *param_p & 0x03;
766   GDC_LOG_CMD_2("gdc_cmd_figs: Operation = %x\n", dispregs->figs_operation);
767   GDC_LOG_CMD_2("gdc_cmd_figs: Direction = %x\n", dispregs->figs_direction);
756   LOG(("gdc_cmd_figs: Operation = %x\n", dispregs->figs_operation));
757   LOG(("gdc_cmd_figs: Direction = %x\n", dispregs->figs_direction));
768758   for ( i = 0; i < 5; ++i ) {
769759      UINT8 quit = 0;
770760      if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) == NULL ) return;
r1470r1471
791781            dispregs->figs_dm_param = temp_reg;
792782            break;
793783      }
794      GDC_LOG_CMD_3("gdc_cmd_figs: dc[%d] = %x\n", i, temp_reg);
784      LOG(("gdc_cmd_figs: dc[%d] = %x\n", i, temp_reg));
795785      if ( quit ) {
796786         return;
797787      }
r1470r1471
813803   if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) == NULL ) return;
814804   temp_reg |= (*param_p) << 8;
815805   dispregs->mask = temp_reg;
816   GDC_LOG_CMD_2("gdc_cmd_mask: mask = %04X\n", dispregs->mask);
806   LOG(("gdc_cmd_mask: mask = %04X\n", dispregs->mask));
817807}
818808
819809/*-------------------------------------------------------------------------*/
r1470r1471
844834{
845835   TYP_GDC_REGS_DISPLAY* dispregs = &gdc.registers.display;
846836   gdc_cmd_inner_curs();
847   GDC_LOG_CMD_2("gdc_cmd_curs: ead = %08X, ", dispregs->ead);
848   GDC_LOG_CMD_2("mask = %04X\n", dispregs->mask);
837   LOG(("gdc_cmd_curs: ead = %08X, ", dispregs->ead));
838   LOG(("mask = %04X\n", dispregs->mask));
849839}
850840
851841/*-------------------------------------------------------------------------*/
r1470r1471
902892            return;
903893      }
904894
905      GDC_LOG_CMD_4("gdc_cmd_wdat: data = %04X, dc = %02X, mod = %x",
906                    temp_reg, dispregs->figs_dc_param, dispregs->cur_mod);
907      GDC_LOG_CMD_3(" mask = %04X, transfer = %02X\n", dispregs->mask,
908                    command & 0x18 );
895      LOG(("gdc_cmd_wdat: data = %04X, dc = %02X, mod = %x",
896                    temp_reg, dispregs->figs_dc_param, dispregs->cur_mod));
897      LOG((" mask = %04X, transfer = %02X\n", dispregs->mask,
898                    command & 0x18 ));
909899
910900/*        if ( gdc.registers.display.display_mode == 1 ) { */
911901/*           if ( temp_reg & 0x01 || temp_reg & 0x0100 ) { */
r1470r1471
978968         /* Calculate word address */
979969         dispregs->ead = saved_ead -
980970             (dispregs->zoom_gchr*row+zy) * dispregs->words_per_line;
981         GDC_LOG_CMD_2("gdc_cmd_gchrd: pram : %1x\n", gdc.pram[15-row]);
971         LOG(("gdc_cmd_gchrd: pram : %1x\n", gdc.pram[15-row]));
982972         /* Reset pixel mask (x) */
983973         dispregs->mask = saved_mask;
984974         for ( bitnbr = 0; bitnbr < 8; ++bitnbr ) {
r1470r1471
994984               if ( dispregs->mask & 0x8000 ) {
995985                  dispregs->ead++;
996986               }
997               /* GDC_LOG_CMD_2("gdc_cmd_gchrd: mask before = %02X\n", dispregs->mask); */
987               /* LOG(("gdc_cmd_gchrd: mask before = %02X\n", dispregs->mask)); */
998988               dispregs->mask = rotleft16(dispregs->mask);
999               /* GDC_LOG_CMD_2("gdc_cmd_gchrd: mask now = %02X\n", dispregs->mask); */
1000               /* GDC_LOG_CMD_2("gdc_cmd_gchrd: ead now = %04X\n", dispregs->ead); */
989               /* LOG(("gdc_cmd_gchrd: mask now = %02X\n", dispregs->mask)); */
990               /* LOG(("gdc_cmd_gchrd: ead now = %04X\n", dispregs->ead)); */
1001991            }
1002992         }
1003993      }
r1470r1471
10241014
10251015      case CMD_RESET:
10261016         /* Resets the GDC to its idle mode */
1027         GDC_LOG_CMD_1("gdc_command: RESET\n");
1017         LOG(("gdc_command: RESET\n"));
10281018         gdc_cmd_sync();
10291019         gdc_fifo_reset(&gdc);
10301020         break;
10311021      case CMD_SYNC_OFF:
10321022         /* Specifies the video format and disables the display */
1033         GDC_LOG_CMD_1("gdc_command: SYNC_OFF\n");
1023         LOG(("gdc_command: SYNC_OFF\n"));
10341024         gdc_cmd_sync();
10351025         break;
10361026      case CMD_SYNC_ON:
10371027         /* Specifies the video format and enables the display */
1038         GDC_LOG_CMD_1("gdc_command: SYNC_ON\n");
1028         LOG(("gdc_command: SYNC_ON\n"));
10391029         gdc_cmd_sync();
10401030         break;
10411031
10421032      case CMD_VSYNC_SLAVE:   /* Selects slave video synchronization mode */
1043         GDC_LOG_CMD_1("gdc_command: VSYNC_SLAVE\n");
1033         LOG(("gdc_command: VSYNC_SLAVE\n"));
10441034         break;
10451035
10461036      case CMD_VSYNC_MASTER:   /* Selects master video synchronization mode */
1047         GDC_LOG_CMD_1("gdc_command: VSYNC_MASTER\n");
1037         LOG(("gdc_command: VSYNC_MASTER\n"));
10481038         break;
10491039
10501040      case CMD_CCHAR:      /* Specifies the cursor and character row heights */
1051         GDC_LOG_CMD_1("gdc_command: CCHAR\n");
1041         LOG(("gdc_command: CCHAR\n"));
10521042         gdc_cmd_cchar();
10531043         break;
10541044
10551045      /* Display control commands */
10561046      case CMD_START:      /* Ends idle mode and unblanks the display */
1057         GDC_LOG_CMD_1("gdc_command: START\n");
1047         LOG(("gdc_command: START\n"));
10581048         gdc_cmd_start();
10591049         break;
10601050
10611051      case CMD_BCTRL_OFF:   /* Controls the blanking and unblanking of the display */
1062         GDC_LOG_CMD_1("gdc_command: BCTRL_OFF\n");
1052         LOG(("gdc_command: BCTRL_OFF\n"));
10631053         break;
10641054
10651055      case CMD_BCTRL_ON:   /* Controls the blanking and unblanking of the display */
1066         GDC_LOG_CMD_1("gdc_command: BCTRL_ON\n");
1056         LOG(("gdc_command: BCTRL_ON\n"));
10671057         break;
10681058
10691059         /* Specifies zoom factors for the display and graphics characters writing */
10701060      case CMD_ZOOM:
1071         GDC_LOG_CMD_1("gdc_command: ZOOM\n");
1061         LOG(("gdc_command: ZOOM\n"));
10721062         gdc_cmd_zoom();
10731063         break;
10741064
10751065
10761066      case CMD_CURS:
10771067          /* Sets the position of the cursor in display memory */
1078         GDC_LOG_CMD_1("gdc_command: CURS\n");
1068         LOG(("gdc_command: CURS\n"));
10791069         gdc_cmd_curs();
10801070         break;
10811071
10821072      case CMD_PITCH:
10831073          /* Specifies the width of the X dimension of the display memory */
1084          GDC_LOG_CMD_1("gdc_command: PITCH\n");
1074          LOG(("gdc_command: PITCH\n"));
10851075          gdc_cmd_pitch();
10861076          break;
10871077
10881078      /* Drawing control commands */
10891079
10901080      case CMD_MASK:      /* Sets the MASK register contents */
1091         GDC_LOG_CMD_1("gdc_command: MASK\n");
1081         LOG(("gdc_command: MASK\n"));
10921082         gdc_cmd_mask();
10931083         break;
10941084
10951085      case CMD_FIGS:      /* Specifies the parameters for the drawing processor */
1096         GDC_LOG_CMD_1("gdc_command: FIGS\n");
1086         LOG(("gdc_command: FIGS\n"));
10971087         gdc_cmd_figs();
10981088         break;
10991089
11001090      case CMD_FIGD:      /* Draws the figure as specified above */
1101         GDC_LOG_CMD_1("gdc_command: FIGD\n");
1091         LOG(("gdc_command: FIGD\n"));
11021092         break;
11031093
11041094      case CMD_GCHRD:      /* Draws the graphics character into display */
1105         GDC_LOG_CMD_1("gdc_command: GCHRD\n");
1095         LOG(("gdc_command: GCHRD\n"));
11061096         gdc_cmd_gchrd();
11071097         break;
11081098
11091099      /* Memory data read commands */
11101100
11111101      case CMD_CURD:      /* Reads the cursor position */
1112         GDC_LOG_CMD_1("gdc_command: CURD\n");
1102         LOG(("gdc_command: CURD\n"));
11131103         break;
11141104
11151105      case CMD_LPRD:      /* Reads the light pen address */
1116         GDC_LOG_CMD_1("gdc_command: LPRD\n");
1106         LOG(("gdc_command: LPRD\n"));
11171107         gdc_cmd_lprd();
11181108         break;
11191109
r1470r1471
11221112         /* Display control commands */
11231113         if ((command & CMD_PRAM_BITMASK) == CMD_PRAM_BITMASK)
11241114         {
1125            GDC_LOG_CMD_2("gdc_command: PRAM write at offset %01X\n",
1126                          command & ~((UINT8)CMD_PRAM_BITMASK));
1115            LOG(("gdc_command: PRAM write at offset %01X\n",
1116                          command & ~((UINT8)CMD_PRAM_BITMASK)));
11271117            gdc_cmd_pram(command & ~((UINT8)CMD_PRAM_BITMASK));
11281118            break;
11291119         }
r1470r1471
11351125
11361126               case CMD_WDAT_BITMASK:
11371127                  /* Writes data words or bytes into display memory */
1138                  GDC_LOG_CMD_1("gdc_command: WDAT\n");
1128                  LOG(("gdc_command: WDAT\n"));
11391129                  gdc_cmd_wdat(command);
11401130                  break;
11411131
11421132               /* Memory data read commands */
11431133
11441134               case CMD_RDAT_BITMASK:   /* Reads data words or bytes from display */
1145                  GDC_LOG_CMD_1("gdc_command: RDAT\n");
1135                  LOG(("gdc_command: RDAT\n"));
11461136                  gdc_cmd_rdat(command);
11471137                  break;
11481138
11491139               /* Data control commands */
11501140
11511141               case CMD_DMAR_BITMASK:   /* Requests a DMA read transfer */
1152                  GDC_LOG_CMD_1("gdc_command: DMAR\n");
1142                  LOG(("gdc_command: DMAR\n"));
11531143                  break;
11541144
11551145               case CMD_DMAW_BITMASK:   /* Requests a DMA write transfer */
1156                  GDC_LOG_CMD_1("gdc_command: DMAW\n");
1146                  LOG(("gdc_command: DMAW\n"));
11571147                  break;
11581148
11591149               default:
r1470r1471
11671157   /* Empty the fifo. It could be that we haven't read
11681158      everything correctly */
11691159   if ( (!gdc_fifo_reading(&gdc)) && (! gdc_fifo_empty(&gdc)) ) {
1170      GDC_LOG_CMD_1("GDC Fifo not empty after processing command!\n");
1160      LOG(("GDC Fifo not empty after processing command!\n"));
11711161      while ( gdc_fifo_dequeue_param(&gdc) ) {
11721162         /**/
11731163      }
r1470r1471
12231213               case CMD_DMAW_BITMASK:
12241214                  return 0;
12251215               default:
1226                  GDC_LOG_CMD_2("gdc_nbr_expected_params: cannot find command %X\n",
1227                                command);
1216                  LOG(("gdc_nbr_expected_params: cannot find command %X\n",
1217                                command));
12281218                  return 16;
12291219            }
12301220         }
r1470r1471
12531243         if ( last_command >= 0 ) {
12541244            gdc_fifo_add_from_outside(&gdc, data, 0);
12551245            if ( gdc_fifo_get_nbr_params(&gdc) == nbr_expected_params ) {
1256               GDC_LOG_CMD_1("GDC: Number of parameters reached\n");
1246               LOG(("GDC: Number of parameters reached\n"));
12571247               gdc_command_processor(last_command);
12581248               last_command = -1;
12591249            }
12601250         } else {
1261            GDC_LOG_CMD_1("GDC Got parameter without command\n");
1251            LOG(("GDC Got parameter without command\n"));
12621252         }
12631253
12641254         break;
r1470r1471
12751265
12761266         /* Check if it is a command without parameters, if so process it now */
12771267         if ( gdc_nbr_expected_params(data) == 0 ) {
1278            GDC_LOG_CMD_1("GDC: Command takes zero parameters\n");
1268            LOG(("GDC: Command takes zero parameters\n"));
12791269            gdc_command_processor(data);
12801270            last_command = -1;
12811271         } else {
r1470r1471
13061296   switch(offset & 0x07) {
13071297      case 0x00:   /* Status register */
13081298
1309         GDC_LOG_CMD_3("%04X: GDC Port %04X (Status) Read",
1310                       activecpu_get_pc(), offset);
1299         LOG(("%04X: GDC Port %04X (Status) Read",
1300                       activecpu_get_pc(), offset));
13111301         /* Optimize this later, i.e. when we know what to return */
13121302         data = ( gdc_fifo_reading(&gdc) && !gdc_fifo_empty(&gdc)) |
13131303            (gdc_fifo_full(&gdc) << 1) |
r1470r1471
13201310
13211311      case 0x01:   /* FIFO Read */
13221312
1323         GDC_LOG_CMD_3("%04X: GDC Port %04X (Fifo) Read",
1313         LOG(("%04X: GDC Port %04X (Fifo) Read",
13241314                       activecpu_get_pc(),
1325                       offset);
1315                       offset));
13261316         if ( gdc_fifo_reading(&gdc)) {
13271317            UINT8* data_p = gdc_fifo_dequeue(&gdc);
13281318            if ( data_p ) {
r1470r1471
13371327         break;
13381328
13391329      default:
1340         GDC_LOG_CMD_3("%04X: GDC UNKNOWN Port Read %04X",
1341                          activecpu_get_pc(), offset);
1330         LOG(("%04X: GDC UNKNOWN Port Read %04X",
1331                          activecpu_get_pc(), offset));
13421332         data = 0x44;
13431333         if ( activecpu_get_pc() == 0xF952D ) {
13441334            data = 0x04;
r1470r1471
13501340         data = 0x00;
13511341         break;
13521342   }
1353   GDC_LOG_CMD_2(" returns %1X\n", data);
1343   LOG((" returns %1X\n", data));
13541344   return(data);
13551345}
13561346
src/mess/video/dai.c
r1470r1471
1919
2020#define DEBUG_DAI_VIDEO   0
2121
22#if DEBUG_DAI_VIDEO
23   #define LOG_DAI_VIDEO_LINE(_mode, _unit, _resolution, _repeat, _scan) logerror ("Mode: %02x, Unit: %02x, Resolution: %02x, Repeat: %d, Current line: %d\n", _mode, _unit, _resolution, _repeat, _scan)
24#else
25   #define LOG_DAI_VIDEO_LINE(_mode, _unit, _resolution, _repeat, _scan)
26#endif
22#define LOG_DAI_VIDEO_LINE(_mode, _unit, _resolution, _repeat, _scan) do { if (DEBUG_DAI_VIDEO) logerror ("Mode: %02x, Unit: %02x, Resolution: %02x, Repeat: %d, Current line: %d\n", _mode, _unit, _resolution, _repeat, _scan); } while (0)
2723
2824const unsigned char dai_palette[16*3] =
2925{
src/mess/video/mz700.c
r1470r1471
1515#define VERBOSE 1
1616#endif
1717
18#if VERBOSE
1918#define LOG(N,M,A)   \
20   if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s",timer_get_time(),(char*)M ); logerror A; }
21#else
22#define LOG(N,M,A)
23#endif
19   if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s",attotime_to_double(timer_get_time()),(char*)M ); logerror A; }
2420
2521int mz700_frame_time = 0;
2622
src/mess/video/thomson.c
r1470r1471
1818
1919
2020#define VERBOSE 0
21#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
2122
2223
23#if VERBOSE
24#define LOG(x)   logerror x
25#else
26#define LOG(x)
27#endif
28
29#define PRINT(x) mame_printf_info x
30
31
3224/* One GPL is what is drawn in 1 us by the video system in the active window.
3325   Most of the time, it corresponds to a 8-pixel wide horizontal span.
3426   For some TO8/9/9+/MO6 modes, it can be 4-pixel or 16-pixel wide.
src/mess/video/astrocde.c
r1470r1471
1717
1818#include <math.h> /* for sin() and cos() */
1919
20#define VERBOSE 0
21#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
22
2023unsigned char *astrocade_videoram;
2124static int magic_expand_color, magic_control, magic_expand_flipflop, collision;
2225
r1470r1471
156159
157160   BackgroundData = ((data&0xc0) >> 6) * 0x55;
158161
159#ifdef MAME_DEBUG
160    logerror("Colour split set to %02d\n",ColourSplit);
161#endif
162   LOG(("Colour split set to %02d\n",ColourSplit));
162163}
163164
164165/* This selects commercial (high res, arcade) or
r1470r1471
181182           RightColourCheck = (Colour[0] << 24) | (Colour[1] << 16) | (Colour[2] < 8) | Colour[3];
182183   }
183184
184#ifdef MAME_DEBUG
185    logerror("Colour %01x set to %02x\n",offset,data);
186#endif
185   LOG(("Colour %01x set to %02x\n",offset,data));
187186}
188187
189188WRITE8_HANDLER ( astrocade_colour_block_w )
r1470r1471
192191
193192   Colour[color_reg_num] = data;
194193
195#ifdef MAME_DEBUG
196    logerror("Colour block write: color %x set to %x\n", color_reg_num,data);
197#endif
194   LOG(("Colour block write: color %x set to %x\n", color_reg_num,data));
198195
199196   if (color_reg_num == 0)
200197      color_reg_num = 7;
r1470r1471
217214
218215WRITE8_HANDLER ( astrocade_magic_expand_color_w )
219216{
220#ifdef MAME_DEBUG
221//   logerror("%04x: magic_expand_color = %02x\n",cpu_getpc(),data);
222#endif
217   //LOG(("%04x: magic_expand_color = %02x\n",cpu_getpc(),data));
223218
224219   magic_expand_color = data;
225220}
r1470r1471
227222
228223WRITE8_HANDLER ( astrocade_magic_control_w )
229224{
230#ifdef MAME_DEBUG
231//   logerror("%04x: magic_control = %02x\n",cpu_getpc(),data);
232#endif
225   //LOG(("%04x: magic_control = %02x\n",cpu_getpc(),data));
226
233227   magic_expand_flipflop = 0;   /* initialize the expand nibble */
234228   LastShifter = 0;         /* clear the shifter */
235229
r1470r1471
240234{
241235   unsigned int data1,shift,bits,bibits,stib,k,old_data;
242236
243#ifdef MAME_DEBUG
244//   logerror("%04x: magicram_w(%04x) = %02x, magic_register = %02x\n",cpu_getpc(),offset,data,magic_control);
245#endif
237   //LOG(("%04x: magicram_w(%04x) = %02x, magic_register = %02x\n",cpu_getpc(),offset,data,magic_control));
246238
247239   if (magic_control & EXPAND_MASK)   /* expand mode */
248240   {
src/mess/video/crtc6845.c
r1470r1471
4747
4848#define VERBOSE 0
4949
50#if VERBOSE
5150#define DBG_LOG(N,M,A)      \
52    if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s",timer_get_time(),(char*)M ); logerror A; }
53#else
54#define DBG_LOG(N,M,A)
55#endif
51    if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s",attotime_to_double(timer_get_time()),(char*)M ); logerror A; }
5652
5753/***************************************************************************
5854
src/mess/video/mekd2.c
r1470r1471
1313
1414#include "includes/mekd2.h"
1515
16#ifndef VERBOSE
17#define VERBOSE 1
18#endif
19
20#if VERBOSE
21#define LOG(x)   logerror(x)
22#else
23#define LOG(x)   /* x */
24#endif
25
2616PALETTE_INIT( mekd2 )
2717{
2818   int i;
src/mess/video/pc_mda.c
r1470r1471
1414
1515#define VERBOSE_MDA 0      /* MDA (Monochrome Display Adapter) */
1616
17#if VERBOSE_MDA
1817#define MDA_LOG(N,M,A) \
19   if(VERBOSE_MDA>=N){ if( M )logerror("%11.6f: %-24s",timer_get_time(),(char*)M ); logerror A; }
20#else
21#define MDA_LOG(n,m,a)
22#endif
18   if(VERBOSE_MDA>=N){ if( M )logerror("%11.6f: %-24s",attotime_to_double(timer_get_time()),(char*)M ); logerror A; }
2319
2420const unsigned char mda_palette[4][3] = {
2521   { 0x00,0x00,0x00 },
r1470r1471
217213 */
218214static void hercules_mode_control_w(int data)
219215{
220   MDA_LOG(1,"MDA_mode_control_w",(errorlog, "$%02x: colums %d, gfx %d, enable %d, blink %d\n",
216   MDA_LOG(1,"MDA_mode_control_w",("$%02x: colums %d, gfx %d, enable %d, blink %d\n",
221217      data, (data&1)?80:40, (data>>1)&1, (data>>3)&1, (data>>5)&1));
222218   mda.mode_control = data;
223219}
r1470r1471
242238
243239static void hercules_config_w(int data)
244240{
245   MDA_LOG(1,"HGC_config_w",(errorlog, "$%02x\n", data));
241   MDA_LOG(1,"HGC_config_w",("$%02x\n", data));
246242    mda.configuration_switch = data;
247243}
248244
src/mess/video/vdc8563.c
r1470r1471
2323#define VERBOSE 0
2424#define VERBOSE_DBG   0
2525
26#if VERBOSE
2726#define DBG_LOG(N,M,A)      \
28    if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s",timer_get_time(),(char*)M );
29 logerror A; }
30#else
31#define DBG_LOG(N,M,A)
32#endif
27    if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s",attotime_to_double(timer_get_time()),(char*)M ); logerror A; }
3328
3429/* seems to be a motorola m6845 variant */
3530
r1470r1471
290285            vdc.reg[vdc.index]=data;
291286            if (BLOCK_COPY) {
292287               DBG_LOG (2, "vdc block copy",
293                      (errorlog, "src:%.4x dst:%.4x size:%.2x\n",
288                      ("src:%.4x dst:%.4x size:%.2x\n",
294289                       vdc.src, vdc.addr, data));
295290               i=data;do {
296291                  vdc_videoram_w(vdc.addr++, vdc_videoram_r(vdc.src++));
297292               } while (--i!=0);
298293            } else {
299294               DBG_LOG (2, "vdc block set",
300                      (errorlog, "dest:%.4x value:%.2x size:%.2x\n",
295                      ("dest:%.4x value:%.2x size:%.2x\n",
301296                       vdc.addr, FILLBYTE, data));
302297               i=data;do {
303298                  vdc_videoram_w(vdc.addr++, FILLBYTE);
r1470r1471
306301            break;
307302         case 0x1f:
308303            DBG_LOG (2, "vdc written",
309                   (errorlog, "dest:%.4x size:%.2x\n",
304                   ("dest:%.4x size:%.2x\n",
310305                    vdc.addr, data));
311306            vdc.reg[vdc.index]=data;
312307            vdc_videoram_w(vdc.addr++, data);
r1470r1471
314309         default:
315310            vdc.reg[vdc.index]=data;
316311            DBG_LOG (2, "vdc8563_port_w",
317                   (errorlog, "%.2x:%.2x\n", vdc.index, data));
312                   ("%.2x:%.2x\n", vdc.index, data));
318313            break;
319314         }
320315      }
321316      DBG_LOG (3, "vdc8563_port_w",
322             (errorlog, "%.2x:%.2x\n", vdc.index, data));
317             ("%.2x:%.2x\n", vdc.index, data));
323318   }
324319   else
325320   {
r1470r1471
349344            break;
350345         case 0x1f:
351346            val=vdc_videoram_r(vdc.addr);
352            DBG_LOG (2, "vdc read", (errorlog, "%.4x %.2x\n", vdc.addr, val));
347            DBG_LOG (2, "vdc read", ("%.4x %.2x\n", vdc.addr, val));
353348            break;
354349         case 0x20:
355350            val=vdc.src>>8;
r1470r1471
361356            val=vdc.reg[vdc.index&0x3f]&reg_mask[vdc.index&0x3f].read;
362357         }
363358      }
364      DBG_LOG (2, "vdc8563_port_r", (errorlog, "%.2x:%.2x\n", vdc.index, val));
359      DBG_LOG (2, "vdc8563_port_r", ("%.2x:%.2x\n", vdc.index, val));
365360   }
366361   else
367362   {
src/mess/video/pc_cga.c
r1470r1471
5959
6060#define VERBOSE_CGA 0      /* CGA (Color Graphics Adapter) */
6161
62#if VERBOSE_CGA
6362#define CGA_LOG(N,M,A) \
64   if(VERBOSE_CGA>=N){ if( M )logerror("%11.6f: %-24s",timer_get_time(),(char*)M ); logerror A; }
65#else
66#define CGA_LOG(n,m,a)
67#endif
63   if(VERBOSE_CGA>=N){ if( M )logerror("%11.6f: %-24s",attotime_to_double(timer_get_time()),(char*)M ); logerror A; }
6864
6965/***************************************************************************
7066
r1470r1471
385381{
386382   unsigned char mask = 0x3B;
387383
388   CGA_LOG(1,"CGA_mode_control_w",(errorlog, "$%02x: columns %d, gfx %d, hires %d, blink %d\n",
384   CGA_LOG(1,"CGA_mode_control_w",("$%02x: columns %d, gfx %d, hires %d, blink %d\n",
389385      data, (data&1)?80:40, (data>>1)&1, (data>>4)&1, (data>>5)&1));
390386
391387   /* CGA composite: Switching between mono & colour behaves like a
r1470r1471
406402 */
407403static void pc_cga_color_select_w(int data)
408404{
409   CGA_LOG(1,"CGA_color_select_w",(errorlog, "$%02x\n", data));
405   CGA_LOG(1,"CGA_color_select_w",("$%02x\n", data));
410406   if( cga.color_select == data )
411407      return;
412408   cga.color_select = data;
r1470r1471
420416 */
421417static void pc_cga_plantronics_w(int data)
422418{
423   CGA_LOG(1,"CGA_plantronics_w",(errorlog, "$%02x\n", data));
419   CGA_LOG(1,"CGA_plantronics_w",("$%02x\n", data));
424420
425421   if (CGA_CHIPSET != CGA_CHIPSET_ATI) return;
426422
src/mess/video/avigo.c
r1470r1471
2525/* current column to read/write */
2626static UINT8 avigo_screen_column = 0;
2727
28//#define AVIGO_VIDEO_DEBUG
28#define AVIGO_VIDEO_DEBUG 0
29#define LOG(x) do { if (AVIGO_VIDEO_DEBUG) logerror x; } while (0)
2930
3031static int stylus_x;
3132static int stylus_y;
r1470r1471
7071
7172        if ((offset<0x0100) || (offset>=0x01f0))
7273        {
73#ifdef AVIGO_VIDEO_DEBUG
74         logerror("vid mem read: %04x\n", offset);
75#endif
74         LOG(("vid mem read: %04x\n", offset));
75
7676         return 0;
7777
7878      }
r1470r1471
8989      {
9090         /* select column to read/write */
9191         avigo_screen_column = data;
92#ifdef AVIGO_VIDEO_DEBUG
93         logerror("vid mem column write: %02x\n",data);
94#endif
92
93         LOG(("vid mem column write: %02x\n",data));
94
9595         if (data>=(AVIGO_SCREEN_WIDTH>>3))
9696         {
97#ifdef AVIGO_VIDEO_DEBUG
98            logerror("error: vid mem column write: %02x\n",data);
99#endif
97            LOG(("error: vid mem column write: %02x\n",data));
10098         }
10199         return;
102100        }
103101
104102        if ((offset<0x0100) || (offset>=0x01f0))
105103        {
106#ifdef AVIGO_VIDEO_DEBUG
107         logerror("vid mem write: %04x %02x\n", offset, data);
108#endif
104         LOG(("vid mem write: %04x %02x\n", offset, data));
109105         return;
110106        }
111107
r1470r1471
175171
176172      if (avigo_backdrop)
177173      {
178#ifdef AVIGO_VIDEO_DEBUG
179         logerror("backdrop %s successfully loaded\n", backdrop_name);
180#endif
174         LOG(("backdrop %s successfully loaded\n", backdrop_name));
181175            memcpy (&sys_palette[used * 3], avigo_backdrop->orig_palette,
182176                    avigo_backdrop->num_pens_used * 3 * sizeof (unsigned char));
183177      }
src/mess/video/vdc.c
r1470r1471
326326         int i;
327327
328328         vdc[which].dvssr_write = 0;
329#ifdef MAME_DEBUG
329
330330         assert(((vdc[which].vdc_data[DVSSR].w<<1) + 512) <= 0x10000);
331#endif
331
332332         for( i = 0; i < 256; i++ ) {
333333            vdc[which].sprite_ram[i] = ( vdc[which].vram[ ( vdc[which].vdc_data[DVSSR].w << 1 ) + i * 2 + 1 ] << 8 ) | vdc[which].vram[ ( vdc[which].vdc_data[DVSSR].w << 1 ) + i * 2 ];
334334         }
src/mess/video/ted7360.c
r1470r1471
555555   {
556556      if (!(ted7360[9] & 0x80))
557557      {
558         DBG_LOG (1, "ted7360", (errorlog, "irq start %.2x\n", mask));
558         DBG_LOG (1, "ted7360", ("irq start %.2x\n", mask));
559559         ted7360[9] |= 0x80;
560560         c16_interrupt (1);
561561      }
r1470r1471
568568   ted7360[9] &= ~mask;
569569   if ((ted7360[9] & 0x80) && !(ted7360[9] & ted7360[0xa] & 0x5e))
570570   {
571      DBG_LOG (1, "ted7360", (errorlog, "irq end %.2x\n", mask));
571      DBG_LOG (1, "ted7360", ("irq end %.2x\n", mask));
572572      ted7360[9] &= ~0x80;
573573      c16_interrupt (0);
574574   }
r1470r1471
583583static TIMER_CALLBACK(ted7360_timer_timeout)
584584{
585585   int which = param;
586   DBG_LOG (3, "ted7360 ", (errorlog, "timer %d timeout\n", which));
586   DBG_LOG (3, "ted7360 ", ("timer %d timeout\n", which));
587587   switch (which)
588588   {
589589   case 1:
r1470r1471
626626
627627   if ((offset != 8) && ((offset < 0x15) || (offset > 0x19)))
628628   {
629      DBG_LOG (1, "ted7360_port_w", (errorlog, "%.2x:%.2x\n", offset, data));
629      DBG_LOG (1, "ted7360_port_w", ("%.2x:%.2x\n", offset, data));
630630   }
631631   switch (offset)
632632   {
r1470r1471
715715            x_begin = HORICONTALPOS;
716716            x_end = x_begin + 320;
717717         }
718         DBG_LOG (3, "ted7360_port_w", (errorlog, "%s %s\n", data & 0x40 ? "ntsc" : "pal",
718         DBG_LOG (3, "ted7360_port_w", ("%s %s\n", data & 0x40 ? "ntsc" : "pal",
719719                                 data & 0x20 ? "hori freeze" : ""));
720720         chargenaddr = CHARGENADDR;
721721      }
r1470r1471
743743#endif
744744      if ((data ^ old) & 1)
745745      {
746/*    DBG_LOG(1,"set rasterline hi",(errorlog,"soll:%d\n",RASTERLINE)); */
746/*    DBG_LOG(1,"set rasterline hi",("soll:%d\n",RASTERLINE)); */
747747      }
748748      break;
749749   case 0xb:
r1470r1471
751751      {
752752         ted7360_drawlines (lastline, rasterline);
753753         ted7360[offset] = data;
754         /*  DBG_LOG(1,"set rasterline lo",(errorlog,"soll:%d\n",RASTERLINE)); */
754         /*  DBG_LOG(1,"set rasterline lo",("soll:%d\n",RASTERLINE)); */
755755      }
756756      break;
757757   case 0xc:
r1470r1471
769769         ted7360[offset] = data;
770770         bitmapaddr = BITMAPADDR;
771771         chargenaddr = CHARGENADDR;
772         DBG_LOG (3, "ted7360_port_w", (errorlog, "bitmap %.4x %s\n",
772         DBG_LOG (3, "ted7360_port_w", ("bitmap %.4x %s\n",
773773                                 BITMAPADDR, INROM ? "rom" : "ram"));
774774      }
775775      break;
r1470r1471
779779         ted7360_drawlines (lastline, rasterline);
780780         ted7360[offset] = data;
781781         chargenaddr = CHARGENADDR;
782         DBG_LOG (3, "ted7360_port_w", (errorlog, "chargen %.4x %s %d\n",
782         DBG_LOG (3, "ted7360_port_w", ("chargen %.4x %s %d\n",
783783                                 CHARGENADDR, data & 2 ? "" : "doubleclock",
784784                                 data & 1));
785785      }
r1470r1471
790790         ted7360_drawlines (lastline, rasterline);
791791         ted7360[offset] = data;
792792         videoaddr = VIDEOADDR;
793         DBG_LOG (3, "ted7360_port_w", (errorlog, "videoram %.4x\n",
793         DBG_LOG (3, "ted7360_port_w", ("videoram %.4x\n",
794794                                 VIDEOADDR));
795795      }
796796      break;
r1470r1471
837837      break;
838838   case 0x1c:
839839      ted7360[offset] = data;         /*? */
840      DBG_LOG (1, "ted7360_port_w", (errorlog, "write to rasterline high %.2x\n",
840      DBG_LOG (1, "ted7360_port_w", ("write to rasterline high %.2x\n",
841841                              data));
842842      break;
843843   case 0x1f:
844844      ted7360[offset] = data;
845      DBG_LOG (1, "ted7360_port_w", (errorlog, "write to cursorblink %.2x\n", data));
845      DBG_LOG (1, "ted7360_port_w", ("write to cursorblink %.2x\n", data));
846846      break;
847847   default:
848848      ted7360[offset] = data;
r1470r1471
927927      break;
928928   case 0x1f:
929929      val = ((rasterline & 7) << 4) | (ted7360[offset] & 0x0f);
930      DBG_LOG (1, "ted7360_port_w", (errorlog, "read from cursorblink %.2x\n", val));
930      DBG_LOG (1, "ted7360_port_w", ("read from cursorblink %.2x\n", val));
931931      break;
932932   default:
933933      val = ted7360[offset];
r1470r1471
936936   if ((offset != 8) && (offset >= 6) && (offset != 0x1c) && (offset != 0x1d) && (offset != 9)
937937      && ((offset < 0x15) || (offset > 0x19)))
938938   {
939      DBG_LOG (1, "ted7360_port_r", (errorlog, "%.2x:%.2x\n", offset, val));
939      DBG_LOG (1, "ted7360_port_r", ("%.2x:%.2x\n", offset, val));
940940   }
941941   return val;
942942}
src/mess/video/hd66421.c
r1470r1471
99#include "hd66421.h"
1010
1111#define LOG_LEVEL  1
12#define _logerror(level,...)  if (LOG_LEVEL > level) logerror(__VA_ARGS__)
12#define _logerror(level,x)  if (LOG_LEVEL > level) logerror x
1313
1414//#define BRIGHTNESS_DOES_NOT_WORK
1515
r1470r1471
6666
6767UINT8 hd66421_reg_idx_r( void)
6868{
69   _logerror( 2, "hd66421_reg_idx_r\n");
69   _logerror( 2, ("hd66421_reg_idx_r\n"));
7070   return lcd.idx;
7171}
7272
7373void hd66421_reg_idx_w( UINT8 data)
7474{
75   _logerror( 2, "hd66421_reg_idx_w (%02X)\n", data);
75   _logerror( 2, ("hd66421_reg_idx_w (%02X)\n", data));
7676   lcd.idx = data;
7777}
7878
7979UINT8 hd66421_reg_dat_r( void)
8080{
81   _logerror( 2, "hd66421_reg_dat_r\n");
81   _logerror( 2, ("hd66421_reg_dat_r\n"));
8282   return lcd.dat[lcd.idx];
8383}
8484
8585void hd66421_reg_dat_w( UINT8 data)
8686{
87   _logerror( 2, "hd66421_reg_dat_w (%02X)\n", data);
87   _logerror( 2, ("hd66421_reg_dat_w (%02X)\n", data));
8888   lcd.dat[lcd.idx] = data;
8989   switch (lcd.idx)
9090   {
r1470r1471
101101PALETTE_INIT( hd66421 )
102102{
103103   int i;
104   _logerror( 0, "palette_init_hd66421\n");
104   _logerror( 0, ("palette_init_hd66421\n"));
105105   // init palette
106106   for (i=0;i<4;i++)
107107   {
r1470r1471
124124
125125VIDEO_START( hd66421 )
126126{
127   _logerror( 0, "video_start_hd66421\n");
127   _logerror( 0, ("video_start_hd66421\n"));
128128   memset( &lcd, 0, sizeof( lcd));
129129   lcd.ram = auto_malloc( HD66421_RAM_SIZE);
130130   hd66421_state_save();
r1470r1471
134134{
135135   pen_t pen[4];
136136   int i;
137   _logerror( 1, "video_update_hd66421\n");
137   _logerror( 1, ("video_update_hd66421\n"));
138138   // update palette
139139   for (i=0;i<4;i++)
140140   {
src/mess/machine/dgn_beta.c
r1470r1471
5959#include <assert.h>
6060
6161#include "driver.h"
62#include "debug/debugcon.h"
6263#include "cpu/m6809/m6809.h"
6364#include "machine/6821pia.h"
6465#include "includes/coco.h"
r1470r1471
7071
7172static UINT8 *system_rom;
7273
73/* Only log errors if debugging ! */
74#ifdef MAME_DEBUG
74#define VERBOSE 0
7575
76//#define LOG_BANK_UPDATE   1
77//#define LOG_DEFAULT_TASK   1
78//#define LOG_PAGE_WRITE   1
79//#define LOG_HALT   1
80//#define LOG_TASK   1
81//#define LOG_KEYBOARD   1
82//#define LOG_VIDEO   1
83#define LOG_DISK   0
84//#define LOG_INTS   1
85#endif
8676
77#define LOG_BANK_UPDATE(x) do { if (VERBOSE) logerror x; } while (0)
78#define LOG_DEFAULT_TASK(x) do { if (VERBOSE) logerror x; } while (0)
79#define LOG_PAGE_WRITE(x) do { if (VERBOSE) logerror x; } while (0)
80#define LOG_HALT(x) do { if (VERBOSE) logerror x; } while (0)
81#define LOG_TASK(x) do { if (VERBOSE) logerror x; } while (0)
82#define LOG_KEYBOARD(x) do { if (VERBOSE) logerror x; } while (0)
83#define LOG_VIDEO(x) do { if (VERBOSE) logerror x; } while (0)
84#define LOG_DISK(x) do { if (VERBOSE) logerror x; } while (0)
85#define LOG_INTS(x) do { if (VERBOSE) logerror x; } while (0)
86
87
88
8789#ifdef MAME_DEBUG
8890#include "debug/debugcpu.h"
8991#include "debug/debugcon.h"
r1470r1471
240242   int      bank_start;
241243   int      bank_end;
242244   int      MapPage;
243#ifdef LOG_BANK_UPDATE
244//   logerror("\n\nUpdating banks %d to %d at PC=$%X\n",first,last,activecpu_get_pc());
245#endif
245
246   LOG_BANK_UPDATE(("\n\nUpdating banks %d to %d at PC=$%X\n",first,last,activecpu_get_pc()));
246247   for(Page=first;Page<=last;Page++)
247248   {
248249      bank_start   = bank_info[Page].start;
r1470r1471
293294      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, bank_start, bank_end,0,0,writebank);
294295      memory_install_write8_handler(1, ADDRESS_SPACE_PROGRAM, bank_start, bank_end,0,0,writebank);
295296
296#ifdef LOG_BANK_UPDATE
297      logerror("UpdateBanks:MapPage=$%02X readbank=$%X\n",MapPage,(int)readbank);
298      logerror("PageRegsSet Task=%X Page=%x\n",TaskReg,Page);
299      logerror("memory_set_bankptr(%X)\n",Page+1);
300      logerror("memory_install_write8_handler CPU=0\n");
301      logerror("memory_install_write8_handler CPU=1\n");
302#endif
297      LOG_BANK_UPDATE(("UpdateBanks:MapPage=$%02X readbank=$%X\n",MapPage,(int)readbank));
298      LOG_BANK_UPDATE(("PageRegsSet Task=%X Page=%x\n",TaskReg,Page));
299      LOG_BANK_UPDATE(("memory_set_bankptr(%X)\n",Page+1));
300      LOG_BANK_UPDATE(("memory_install_write8_handler CPU=0\n"));
301      LOG_BANK_UPDATE(("memory_install_write8_handler CPU=1\n"));
303302   }
304303}
305304
r1470r1471
308307{
309308   int      Idx;
310309
311#ifdef LOG_DEFAULT_TASK
312   logerror("SetDefaultTask()\n");
313   debug_console_printf("Set Default task\n");
314#endif
310   LOG_DEFAULT_TASK(("SetDefaultTask()\n"));
311   if (VERBOSE) debug_console_printf("Set Default task\n");
315312
316313   TaskReg=NoPagingTask;
317314
r1470r1471
355352{
356353   PageRegs[PIATaskReg][offset].value=data;
357354
358#ifdef LOG_PAGE_WRITE
359   logerror("PageRegWrite : task=$%X  offset=$%X value=$%X\n",PIATaskReg,offset,data);
360#endif
355   LOG_PAGE_WRITE(("PageRegWrite : task=$%X  offset=$%X value=$%X\n",PIATaskReg,offset,data));
361356
362357   if (EnableMapRegs)
363358   {
r1470r1471
550545   int Idx;
551546   int Selected;
552547
553#ifdef LOG_KEYBOARD
554   logerror("PB Read\n");
555#endif
548   LOG_KEYBOARD(("PB Read\n"));
556549
557550   KAny_next=0;
558551
r1470r1471
594587
595588   RetVal = (KInDat_next<<5) | (KAny_next<<2);
596589
597#ifdef LOG_KEYBOARD
598   logerror("FC22=$%02X KAny=%d\n",RetVal,KAny_next);
599#endif
590   LOG_KEYBOARD(("FC22=$%02X KAny=%d\n",RetVal,KAny_next));
600591
601592   return RetVal;
602593}
r1470r1471
606597   int   InClkState;
607598   int   OutClkState;
608599
609#ifdef LOG_KEYBOARD
610   logerror("PB Write\n");
611#endif
600   LOG_KEYBOARD(("PB Write\n"));
612601
613602   InClkState   = data & KInClk;
614603   OutClkState   = data & KOutClk;
615604
616#ifdef LOG_KEYBOARD
617   logerror("InClkState=$%02X OldInClkState=$%02X Keyrow=$%02X ",InClkState,(d_pia0_pb_last & KInClk),Keyrow);
618#endif
605   LOG_KEYBOARD(("InClkState=$%02X OldInClkState=$%02X Keyrow=$%02X ",InClkState,(d_pia0_pb_last & KInClk),Keyrow));
619606
620607   /* Input clock bit has changed state */
621608   if ((InClkState) != (d_pia0_pb_last & KInClk))
r1470r1471
625612      {
626613         KInDat_next=(~Keyrow & 0x40)>>6;
627614         Keyrow = ((Keyrow<<1) | 0x01) & 0x7F ;
628#ifdef LOG_KEYBOARD
629         logerror("Keyrow=$%02X KInDat_next=%X\n",Keyrow,KInDat_next);
630#endif
615         LOG_KEYBOARD(("Keyrow=$%02X KInDat_next=%X\n",Keyrow,KInDat_next));
631616      }
632617   }
633618
r1470r1471
637622static WRITE8_HANDLER(d_pia0_cb2_w)
638623{
639624   int   RowNo;
640#ifdef LOG_KEYBOARD
641   logerror("\nCB2 Write\n");
642#endif
625   LOG_KEYBOARD(("\nCB2 Write\n"));
626
643627   /* load keyrow on rising edge of CB2 */
644628   if((data==1) && (d_pia0_cb2_last==0))
645629   {
r1470r1471
650634      /* In the beta the shift registers are a cmos 4015, and a cmos 4013 in series */
651635      RowShifter = (RowShifter<<1) | ((d_pia0_pb_last & KOutDat)>>4);
652636      RowShifter &= 0x3FF;
653#ifdef LOG_KEYBOARD
654      logerror("Rowshifter=$%02X Keyrow=$%02X\n",RowShifter,Keyrow);
655      debug_console_printf("rowshifter clocked, value=%3X, RowNo=%d, Keyrow=%2X\n",RowShifter,RowNo,Keyrow);
656#endif
637      LOG_KEYBOARD(("Rowshifter=$%02X Keyrow=$%02X\n",RowShifter,Keyrow));
638      if (VERBOSE) debug_console_printf("rowshifter clocked, value=%3X, RowNo=%d, Keyrow=%2X\n",RowShifter,RowNo,Keyrow);
657639   }
658640
659641   d_pia0_cb2_last=data;
r1470r1471
698680      else
699681         HALT_DMA=CLEAR_LINE;
700682
701#ifdef LOG_HALT
702      logerror("DMA_CPU HALT=%d\n",HALT_DMA);
703#endif
683      LOG_HALT(("DMA_CPU HALT=%d\n",HALT_DMA));
704684      cpunum_set_input_line(1, INPUT_LINE_HALT, HALT_DMA);
705685
706686      /* CPU un-halted let it run ! */
r1470r1471
717697   if (data & DDenCtrl)
718698   {
719699      wd17xx_set_density(DEN_FM_LO);
720#ifdef MAME_DEBUG
721      if (LOG_DISK)
722         logerror("Set density low %d\n",(data & DDenCtrl));
723#endif
700      LOG_DISK(("Set density low %d\n",(data & DDenCtrl)));
724701   }
725702   else
726703   {
727704      wd17xx_set_density(DEN_MFM_LO);
728#ifdef MAME_DEBUG
729      if (LOG_DISK)
730         logerror("Set density high %d\n",(data & DDenCtrl));
731#endif
705      LOG_DISK(("Set density high %d\n",(data & DDenCtrl)));
732706   }
733707}
734708
r1470r1471
749723         HALT_CPU=CLEAR_LINE;
750724      else
751725         HALT_CPU=ASSERT_LINE;
752#ifdef LOG_HALT
753      logerror("MAIN_CPU HALT=%d\n",HALT_CPU);
754#endif
726      LOG_HALT(("MAIN_CPU HALT=%d\n",HALT_CPU));
755727      cpunum_set_input_line(0, INPUT_LINE_HALT, HALT_CPU);
756728
757729      d_pia1_pb_last=data & 0x02;
r1470r1471
792764   int OldEnableMap;
793765   int NMI;
794766
795#ifdef LOG_TASK
796   logerror("FCC0 write : $%02X\n",data);
797#endif
767   LOG_TASK(("FCC0 write : $%02X\n",data));
798768
799769   /* Bit 7 of $FFC0, seems to control NMI on second CPU */
800770   NMI=(data & 0x80);
r1470r1471
802772   /* only take action if NMI changed */
803773   if(NMI!=DMA_NMI_LAST)
804774   {
805#ifdef LOG_INTS
806      logerror("cpu1 NMI : %d\n",NMI);
807//      debug_console_printf("cpu1 NMI : %d\n",NMI);
808#endif
775      LOG_INTS(("cpu1 NMI : %d\n",NMI));
809776      if(!NMI)
810777      {
811778         cpunum_set_input_line(1,INPUT_LINE_NMI,ASSERT_LINE);
r1470r1471
831798   OldTask=PIATaskReg;
832799   PIATaskReg=data & 0x0F;
833800
834#ifdef LOG_TASK
835   logerror("OldTask=$%02X EnableMapRegs=%d OldEnableMap=%d\n",OldTask,EnableMapRegs,OldEnableMap);
836#endif
801   LOG_TASK(("OldTask=$%02X EnableMapRegs=%d OldEnableMap=%d\n",OldTask,EnableMapRegs,OldEnableMap));
837802
838803   // Maping was enabled or disabled, select apropreate task reg
839804   // and map it in
r1470r1471
858823         UpdateBanks(0,IOPage+1);
859824      }
860825   }
861#ifdef LOG_TASK
862   logerror("TaskReg=$%02X PIATaskReg=$%02X\n",TaskReg,PIATaskReg);
863#endif
826   LOG_TASK(("TaskReg=$%02X PIATaskReg=$%02X\n",TaskReg,PIATaskReg));
864827}
865828
866829static READ8_HANDLER(d_pia2_pb_r)
r1470r1471
903866      IRQ = CLEAR_LINE;
904867
905868   cpunum_set_input_line(0, M6809_IRQ_LINE, IRQ);
906#ifdef LOG_INTS
907   logerror("cpu0 IRQ : %d\n",IRQ);
908#endif
869   LOG_INTS(("cpu0 IRQ : %d\n",IRQ));
909870}
910871
911872static void cpu0_recalc_firq(int state)
r1470r1471
920881
921882   cpunum_set_input_line(0, M6809_FIRQ_LINE, FIRQ);
922883
923#ifdef LOG_INTS
924   logerror("cpu0 FIRQ : %d\n",FIRQ);
925#endif
884   LOG_INTS(("cpu0 FIRQ : %d\n",FIRQ));
926885}
927886
928887/* CPU 1 */
r1470r1471
930889static void cpu1_recalc_firq(int state)
931890{
932891   cpunum_set_input_line(1, M6809_FIRQ_LINE, state);
933#ifdef LOG_INTS
934   logerror("cpu1 FIRQ : %d\n",state);
935#endif
892   LOG_INTS(("cpu1 FIRQ : %d\n",state));
936893}
937894
938895/********************************************************************************************/
r1470r1471
962919         break;
963920   }
964921
965#ifdef MAME_DEBUG
966   if (LOG_DISK)
967      logerror("dgnbeta_fdc_callback(%d)\n",event);
968#endif
922   LOG_DISK(("dgnbeta_fdc_callback(%d)\n",event));
969923}
970924
971925 READ8_HANDLER(dgnbeta_wd2797_r)
r1470r1471
976930   {
977931      case 0:
978932         result = wd17xx_status_r(0);
979#ifdef MAME_DEBUG
980         if (LOG_DISK)
981            logerror("Disk status=%2.2X\n",result);
982#endif
933         LOG_DISK(("Disk status=%2.2X\n",result));
983934         break;
984935      case 1:
985936         result = wd17xx_track_r(0);
r1470r1471
1029980   int   Idx;
1030981   int   Row;
1031982
1032#ifdef LOG_KEYBOARD
1033   logerror("Scanning Host keyboard\n");
1034#endif
983   LOG_KEYBOARD(("Scanning Host keyboard\n"));
1035984
1036985   for(Idx=0;Idx<NoKeyrows;Idx++)
1037986   {
r1470r1471
1050999         default : Row=0x7F; break;
10511000      }
10521001      Keyboard[Idx]=Row;
1053#ifdef LOG_KEYBOARD
1054      logerror("Keyboard[%d]=$%02X\n",Idx,Row);
1002      LOG_KEYBOARD(("Keyboard[%d]=$%02X\n",Idx,Row));
10551003      if (Row!=0x7F)
10561004      {
1057         logerror("Found Pressed Key\n");
1005         LOG_KEYBOARD(("Found Pressed Key\n"));
10581006      }
1059#endif
10601007   }
10611008#endif
10621009}
r1470r1471
10731020   {
10741021      pia_2_cb2_w(0,CLEAR_LINE);
10751022   }
1076#ifdef LOG_VIDEO
1077   logerror("Vblank\n");
1078#endif
1023   LOG_VIDEO(("Vblank\n"));
10791024   ScanInKeyboard();
10801025}
10811026
src/mess/machine/uart8250.c
r1470r1471
1818
1919
2020#define LOG(LEVEL,N,M,A)  \
21if( M )logerror("%11.6f: %-24s",timer_get_time(),(char*)M ); logerror A;
21if( M )logerror("%11.6f: %-24s",attotime_to_double(timer_get_time()),(char*)M ); logerror A;
2222
2323
24//#define VERBOSE_COM 0
25#ifdef VERBOSE_COM
24#define VERBOSE_COM 0
2625#define COM_LOG(n,m,a) LOG(VERBOSE_COM,n,m,a)
27#else
28#define COM_LOG(n,m,a)
29#endif
3026
3127typedef struct {
3228   uart8250_interface interface;
r1470r1471
187183
188184void uart8250_w(int n, offs_t idx, UINT8 data)
189185{
190#ifdef VERBOSE_COM
191186    static const char P[8] = "NONENHNL";  /* names for parity select */
192#endif
193187    int tmp;
194188
195189   switch (idx)
r1470r1471
200194            uart[n].dll = data;
201195            tmp = uart[n].dlm * 256 + uart[n].dll;
202196            COM_LOG(1,"COM_dll_w",("COM%d $%02x: [$%04x = %d baud]\n",
203               n+1, data, tmp, (tmp)?uart[n].interface.clockin/16/tmp:0));
197               n+1, data, tmp, (tmp)?(int)(uart[n].interface.clockin/16/tmp):0));
204198         }
205199         else
206200         {
r1470r1471
222216            uart[n].dlm = data;
223217            tmp = uart[n].dlm * 256 + uart[n].dll;
224218                COM_LOG(1,"COM_dlm_w",("COM%d $%02x: [$%04x = %d baud]\n",
225               n+1, data, tmp, (tmp)?uart[n].interface.clockin/16/tmp:0));
219               n+1, data, tmp, (tmp)?(int)(uart[n].interface.clockin/16/tmp):0));
226220         }
227221         else
228222         {
src/mess/machine/dai.c
r1470r1471
2020
2121#define DEBUG_DAI_PORTS   0
2222
23#if DEBUG_DAI_PORTS
24   #define LOG_DAI_PORT_R(_port, _data, _comment) logerror ("DAI port read : %04x, Data: %02x (%s)\n", _port, _data, _comment)
25   #define LOG_DAI_PORT_W(_port, _data, _comment) logerror ("DAI port write: %04x, Data: %02x (%s)\n", _port, _data, _comment)
26#else
27   #define LOG_DAI_PORT_R(_port, _data, _comment)
28   #define LOG_DAI_PORT_W(_port, _data, _comment)
29#endif
23#define LOG_DAI_PORT_R(_port, _data, _comment) do { if (DEBUG_DAI_PORTS) logerror ("DAI port read : %04x, Data: %02x (%s)\n", _port, _data, _comment); } while (0)
24#define LOG_DAI_PORT_W(_port, _data, _comment) do { if (DEBUG_DAI_PORTS) logerror ("DAI port write: %04x, Data: %02x (%s)\n", _port, _data, _comment); } while (0)
3025
3126/* Discrete I/O devices */
3227UINT8 dai_noise_volume;
src/mess/machine/pcf8593.c
r1470r1471
1111#include <time.h>
1212
1313#define LOG_LEVEL  1
14#define _logerror(level,...)  if (LOG_LEVEL > level) logerror(__VA_ARGS__)
14#define _logerror(level,x)  if (LOG_LEVEL > level) logerror x
1515
1616#define RTC_MODE_NONE  0
1717#define RTC_MODE_SEND  1
r1470r1471
5252
5353void pcf8593_init( void)
5454{
55   _logerror( 0, "pcf8593_init\n");
55   _logerror( 0, ("pcf8593_init\n"));
5656   memset( &rtc, 0, sizeof( rtc));
5757   rtc.size = 16;
5858   rtc.data = malloc_or_die( rtc.size);
r1470r1471
6363
6464void pcf8593_exit( void)
6565{
66   _logerror( 0, "pcf8593_exit\n");
66   _logerror( 0, ("pcf8593_exit\n"));
6767   free( rtc.data);
6868}
6969
7070void pcf8593_reset( void)
7171{
72   _logerror( 0, "pcf8593_reset\n");
72   _logerror( 0, ("pcf8593_reset\n"));
7373   rtc.pin_scl = 1;
7474   rtc.pin_sda = 1;
7575   rtc.active  = FALSE;
r1470r1471
9696            // bit 9 = end
9797            if (rtc.bits > 8)
9898            {
99               _logerror( 2, "pcf8593_write_byte(%02X)\n", rtc.data_recv[rtc.data_recv_index]);
99               _logerror( 2, ("pcf8593_write_byte(%02X)\n", rtc.data_recv[rtc.data_recv_index]));
100100               // enter receive mode when 1st byte = 0xA3
101101               if ((rtc.data_recv[0] == 0xA3) && (rtc.data_recv_index == 0))
102102               {
r1470r1471
131131            // bit 9 = end
132132            if (rtc.bits > 8)
133133            {
134               _logerror( 2, "pcf8593_read_byte(%02X)\n", rtc.data[rtc.pos]);
134               _logerror( 2, ("pcf8593_read_byte(%02X)\n", rtc.data[rtc.pos]));
135135               // end ?
136136                 if (rtc.pin_sda)
137137               {
138                  _logerror( 2, "pcf8593 end\n");
138                  _logerror( 2, ("pcf8593 end\n"));
139139                    rtc.mode = RTC_MODE_RECV;
140140                       pcf8593_clear_buffer_rx();
141141               }
r1470r1471
157157   if (rtc.pin_scl)
158158   {
159159      // log init I2C
160      if (data) _logerror( 1, "pcf8593 init i2c\n");
160      if (data) _logerror( 1, ("pcf8593 init i2c\n"));
161161      // start condition (high to low when clock is high)
162162      if ((!data) && (rtc.pin_sda))
163163      {
164         _logerror( 1, "pcf8593 start condition\n");
164         _logerror( 1, ("pcf8593 start condition\n"));
165165         rtc.active          = TRUE;
166166         rtc.bits            = 0;
167167         rtc.data_recv_index = 0;
r1470r1471
171171      // stop condition (low to high when clock is high)
172172      if ((data) && (!rtc.pin_sda))
173173      {
174         _logerror( 1, "pcf8593 stop condition\n");
174         _logerror( 1, ("pcf8593 stop condition\n"));
175175         rtc.active = FALSE;
176176      }
177177   }
r1470r1471
227227static TIMER_CALLBACK( pcf8593_timer_callback )
228228{
229229   int value;
230   _logerror( 2, "pcf8593_timer_callback (%d)\n", param);
230   _logerror( 2, ("pcf8593_timer_callback (%d)\n", param));
231231   // check if counting is enabled
232232   if (rtc.data[0] & 0x80) return;
233233   // increment second
r1470r1471
287287void pcf8593_load( mame_file *file)
288288{
289289   mame_system_time systime;
290   _logerror( 0, "pcf8593_load (%p)\n", file);
290   _logerror( 0, ("pcf8593_load (%p)\n", file));
291291   mame_fread( file, rtc.data, rtc.size);
292292   mame_get_current_datetime( Machine, &systime);
293293   pcf8593_set_date( systime.local_time.year, systime.local_time.month + 1, systime.local_time.mday);
r1470r1471
296296
297297void pcf8593_save( mame_file *file)
298298{
299   _logerror( 0, "pcf8593_save (%p)\n", file);
299   _logerror( 0, ("pcf8593_save (%p)\n", file));
300300   mame_fwrite( file, rtc.data, rtc.size);
301301}
302302
303303/*
304304NVRAM_HANDLER( pcf8593 )
305305{
306   _logerror( 0, "nvram_handler_pcf8593 (%p/%d)\n", file, read_or_write);
306   _logerror( 0, ("nvram_handler_pcf8593 (%p/%d)\n", file, read_or_write));
307307   if (read_or_write)
308308   {
309309      pcf8593_save( file);
src/mess/machine/d88.c
r1470r1471
77
88#define d88image_MAX_DRIVES 4
99#define VERBOSE 1
10#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
11
1012static d88image     d88image_drives[d88image_MAX_DRIVES];
1113
1214static void d88image_seek_callback(mess_image *img,int);
r1470r1471
145147   offset = w->sects[t*2+h][s].offset;
146148
147149
148#if VERBOSE
149    logerror("d88image seek track:%d head:%d sector:%d-> offset #0x%08lX\n",
150             t, h, s, offset);
151#endif
150    LOG(("d88image seek track:%d head:%d sector:%d-> offset #0x%08lX\n",
151             t, h, s, offset));
152152
153153   if (offset > w->image_size)
154154   {
src/mess/machine/at45dbxx.c
r1470r1471
1313#include "at45dbxx.h"
1414
1515#define LOG_LEVEL  1
16#define _logerror(level,...)  if (LOG_LEVEL > level) logerror(__VA_ARGS__)
16#define _logerror(level,x)  if (LOG_LEVEL > level) logerror x
1717
1818#define FLASH_CMD_52  0x52
1919#define FLASH_CMD_57  0x57
r1470r1471
6464
6565void at45dbxx_init( int type)
6666{
67   _logerror( 0, "at45dbxx_init (%d)\n", type);
67   _logerror( 0, ("at45dbxx_init (%d)\n", type));
6868   memset( &flash, 0, sizeof( flash));
6969   switch (type)
7070   {
r1470r1471
8181
8282void at45dbxx_exit( void)
8383{
84   _logerror( 0, "at45dbxx_exit\n");
84   _logerror( 0, ("at45dbxx_exit\n"));
8585   free( flash.buffer2);
8686   free( flash.buffer1);
8787   free( flash.data);
r1470r1471
8989
9090void at45dbxx_reset( void)
9191{
92   _logerror( 1, "at45dbxx_reset\n");
92   _logerror( 1, ("at45dbxx_reset\n"));
9393   // mode
9494   flash.mode = FLASH_MODE_SI;
9595   // command
r1470r1471
137137   if ((flash.mode != FLASH_MODE_SO) || (!flash.io.data)) return 0;
138138   // read byte
139139   data = flash.io.data[flash.io.pos++];
140   _logerror( 2, "at45dbxx_read_byte (%02X) (%03d/%03d)\n", data, flash.io.pos, flash.io.size);
140   _logerror( 2, ("at45dbxx_read_byte (%02X) (%03d/%03d)\n", data, flash.io.pos, flash.io.size));
141141   if (flash.io.pos == flash.io.size) flash.io.pos = 0;
142142   return data;
143143}
r1470r1471
179179   if (flash.cmd.size < 8)
180180   {
181181      UINT8 opcode;
182      _logerror( 2, "at45dbxx_write_byte (%02X)\n", data);
182      _logerror( 2, ("at45dbxx_write_byte (%02X)\n", data));
183183      // add to command buffer
184184      flash.cmd.data[flash.cmd.size++] = data;
185185      // check opcode
r1470r1471
192192            // 8 bits command
193193            if (flash.cmd.size == 1)
194194            {
195               _logerror( 1, "at45dbxx opcode %02X - status register read\n", opcode);
195               _logerror( 1, ("at45dbxx opcode %02X - status register read\n", opcode));
196196               flash.status = (flash.status & 0xC7) | flash.devid; // 80 = busy / 40 = compare fail
197197               flash_set_io( &flash.status, 1, 0);
198198               flash.mode = FLASH_MODE_SO;
r1470r1471
209209               UINT32 page;
210210               UINT8 comp;
211211               page = flash_get_page_addr();
212               _logerror( 1, "at45dbxx opcode %02X - main memory page to buffer 1 compare [%04X]\n", opcode, page);
212               _logerror( 1, ("at45dbxx opcode %02X - main memory page to buffer 1 compare [%04X]\n", opcode, page));
213213               comp = memcmp( flash.data + page * flash.page_size, flash.buffer1, flash.page_size) == 0 ? 0 : 1;
214214               if (comp) flash.status |= 0x40; else flash.status &= ~0x40;
215               _logerror( 1, "at45dbxx page compare %s\n", comp ? "failure" : "success");
215               _logerror( 1, ("at45dbxx page compare %s\n", comp ? "failure" : "success"));
216216               flash.mode = FLASH_MODE_SI;
217217               flash.cmd.size = 8;
218218            }
r1470r1471
227227               UINT32 page, byte;
228228               page = flash_get_page_addr();
229229               byte = flash_get_byte_addr();
230               _logerror( 1, "at45dbxx opcode %02X - main memory page read [%04X/%04X]\n", opcode, page, byte);
230               _logerror( 1, ("at45dbxx opcode %02X - main memory page read [%04X/%04X]\n", opcode, page, byte));
231231               flash_set_io( flash.data + page * flash.page_size, flash.page_size, byte);
232232               flash.mode = FLASH_MODE_SO;
233233               flash.cmd.size = 8;
r1470r1471
243243               UINT32 page, byte;
244244               page = flash_get_page_addr();
245245               byte = flash_get_byte_addr();
246               _logerror( 1, "at45dbxx opcode %02X - main memory page program through buffer 1 [%04X/%04X]\n",opcode, page, byte);
246               _logerror( 1, ("at45dbxx opcode %02X - main memory page program through buffer 1 [%04X/%04X]\n",opcode, page, byte));
247247               flash_set_io( flash.buffer1, flash.page_size, byte);
248248               memset( flash.buffer1, 0xFF, flash.page_size);
249249               flash.mode = FLASH_MODE_SI;
r1470r1471
254254         // other
255255         default :
256256         {
257            _logerror( 1, "at45dbxx opcode %02X - unknown\n", opcode);
257            _logerror( 1, ("at45dbxx opcode %02X - unknown\n", opcode));
258258            flash.cmd.data[0] = 0;
259259            flash.cmd.size = 0;
260260         }
r1470r1471
263263   }
264264   else
265265   {
266      _logerror( 2, "at45dbxx_write_byte (%02X) (%03d/%03d)\n", data, flash.io.pos + 1, flash.io.size);
266      _logerror( 2, ("at45dbxx_write_byte (%02X) (%03d/%03d)\n", data, flash.io.pos + 1, flash.io.size));
267267      // store byte
268268      flash.io.data[flash.io.pos] = data;
269269      flash.io.pos++;
r1470r1471
296296         UINT32 page, byte;
297297         page = flash_get_page_addr();
298298         byte = flash_get_byte_addr();
299         _logerror( 1, "at45dbxx - program data stored in buffer 1 into selected page in main memory [%04X/%04X]\n", page, byte);
299         _logerror( 1, ("at45dbxx - program data stored in buffer 1 into selected page in main memory [%04X/%04X]\n", page, byte));
300300         memcpy( flash.data + page * flash.page_size, flash.buffer1, flash.page_size);
301301      }
302302      // reset
r1470r1471
338338
339339void at45dbxx_load( mame_file *file)
340340{
341   _logerror( 0, "at45dbxx_load (%p)\n", file);
341   _logerror( 0, ("at45dbxx_load (%p)\n", file));
342342   mame_fread( file, flash.data, flash.size);
343343}
344344
345345void at45dbxx_save( mame_file *file)
346346{
347   _logerror( 0, "at45dbxx_save (%p)\n", file);
347   _logerror( 0, ("at45dbxx_save (%p)\n", file));
348348   mame_fwrite( file, flash.data, flash.size);
349349}
350350
351351/*
352352NVRAM_HANDLER( at45dbxx )
353353{
354   _logerror( 0, "nvram_handler_at45dbxx (%p/%d)\n", file, read_or_write);
354   _logerror( 0, ("nvram_handler_at45dbxx (%p/%d)\n", file, read_or_write));
355355   if (read_or_write)
356356   {
357357      at45dbxx_save( file);
src/mess/machine/i8271.c
r1470r1471
3535
3636static char temp_buffer[16384];
3737
38// uncomment to give verbose debug information
39//#define VERBOSE
40
4138static I8271 i8271;
4239
43#ifdef VERBOSE
44#define FDC_LOG(x) logerror("I8271: %s\n",x)
45#define FDC_LOG_COMMAND(x) logerror("I8271: COMMAND %s\n",x)
46#else
47#define FDC_LOG(x)
48#define FDC_LOG_COMMAND(x)
49#endif
40#define VERBOSE 0
5041
42#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
43#define FDC_LOG(x) do { if (VERBOSE) logerror("I8271: %s\n",x); } while (0)
44#define FDC_LOG_COMMAND(x) do { if (VERBOSE) logerror("I8271: COMMAND %s\n",x); } while (0)
45
5146static mess_image *current_image(void)
5247{
5348   return image_from_devtype_and_index(IO_FLOPPY, i8271.drive);
r1470r1471
510505      i8271_timed_data_request();
511506      return;
512507   }
513#ifdef VERBOSE
514   logerror("error getting sector data\n");
515#endif
508   LOG(("error getting sector data\n"));
516509
517510   i8271_timed_command_complete();
518511}
r1470r1471
545538      i8271_timed_data_request();
546539      return;
547540   }
548#ifdef VERBOSE
549   logerror("error getting sector data\n");
550#endif
541   LOG(("error getting sector data\n"));
551542
552543   i8271_timed_command_complete();
553544}
r1470r1471
625616         {
626617            case 0x0d:
627618            {
628#ifdef VERBOSE
629               logerror("Initialization\n");
630#endif
619               LOG(("Initialization\n"));
631620               i8271.StepRate = i8271.CommandParameters[1];
632621               i8271.HeadSettlingTime = i8271.CommandParameters[2];
633622               i8271.IndexCountBeforeHeadUnload = (i8271.CommandParameters[3]>>4) & 0x0f;
r1470r1471
637626
638627            case 0x010:
639628            {
640#ifdef VERBOSE
641               logerror("Load bad Tracks Surface 0\n");
642#endif
629               LOG(("Load bad Tracks Surface 0\n"));
643630               i8271_load_bad_tracks(0);
644631
645632            }
r1470r1471
647634
648635            case 0x018:
649636            {
650#ifdef VERBOSE
651               logerror("Load bad Tracks Surface 1\n");
652#endif
637               LOG(("Load bad Tracks Surface 1\n"));
653638               i8271_load_bad_tracks(1);
654639
655640            }
r1470r1471
782767               /* TODO: Check bits 6-7 and 5-2 are valid */
783768               i8271.Mode = i8271.CommandParameters[1];
784769
785#ifdef VERBOSE
786770               if (i8271.Mode & 0x01)
787771               {
788                  logerror("Mode: Non-DMA\n");
772                  LOG(("Mode: Non-DMA\n"));
789773               }
790774               else
791775               {
792                  logerror("Mode: DMA\n");
776                  LOG(("Mode: DMA\n"));
793777               }
794778
795779               if (i8271.Mode & 0x02)
796780               {
797                  logerror("Single actuator\n");
781                  LOG(("Single actuator\n"));
798782               }
799783               else
800784               {
801                  logerror("Double actuator\n");
785                  LOG(("Double actuator\n"));
802786               }
803#endif
804787            }
805788            break;
806789
807790            case I8271_SPECIAL_REGISTER_SURFACE_0_CURRENT_TRACK:
808791            {
809#ifdef VERBOSE
810               logerror("Surface 0 Current Track\n");
811#endif
792               LOG(("Surface 0 Current Track\n"));
812793               i8271_write_current_track(0, i8271.CommandParameters[1]);
813794            }
814795            break;
815796
816797            case I8271_SPECIAL_REGISTER_SURFACE_1_CURRENT_TRACK:
817798            {
818#ifdef VERBOSE
819               logerror("Surface 1 Current Track\n");
820#endif
799               LOG(("Surface 1 Current Track\n"));
821800               i8271_write_current_track(1, i8271.CommandParameters[1]);
822801            }
823802            break;
824803
825804            case I8271_SPECIAL_REGISTER_SURFACE_0_BAD_TRACK_1:
826805            {
827#ifdef VERBOSE
828               logerror("Surface 0 Bad Track 1\n");
829#endif
806               LOG(("Surface 0 Bad Track 1\n"));
830807               i8271_write_bad_track(0, 1, i8271.CommandParameters[1]);
831808            }
832809            break;
833810
834811            case I8271_SPECIAL_REGISTER_SURFACE_0_BAD_TRACK_2:
835812            {
836#ifdef VERBOSE
837               logerror("Surface 0 Bad Track 2\n");
838#endif
839            i8271_write_bad_track(0, 2,i8271.CommandParameters[1]);
813               LOG(("Surface 0 Bad Track 2\n"));
814               i8271_write_bad_track(0, 2,i8271.CommandParameters[1]);
840815            }
841816            break;
842817
843818            case I8271_SPECIAL_REGISTER_SURFACE_1_BAD_TRACK_1:
844819            {
845#ifdef VERBOSE
846               logerror("Surface 1 Bad Track 1\n");
847#endif
820               LOG(("Surface 1 Bad Track 1\n"));
848821
849822
850823               i8271_write_bad_track(1, 1, i8271.CommandParameters[1]);
r1470r1471
853826
854827            case I8271_SPECIAL_REGISTER_SURFACE_1_BAD_TRACK_2:
855828            {
856#ifdef VERBOSE
857               logerror("Surface 1 Bad Track 2\n");
858#endif
829               LOG(("Surface 1 Bad Track 2\n"));
859830
860831               i8271_write_bad_track(1, 2, i8271.CommandParameters[1]);
861832            }
r1470r1471
869840               FDC_LOG_COMMAND("Write Drive Control Output port\n");
870841
871842
872#ifdef VERBOSE
873843               if (i8271.CommandParameters[1] & 0x01)
874844               {
875                  logerror("Write Enable\n");
845                  LOG(("Write Enable\n"));
876846               }
877847               if (i8271.CommandParameters[1] & 0x02)
878848               {
879                  logerror("Seek/Step\n");
849                  LOG(("Seek/Step\n"));
880850               }
881851               if (i8271.CommandParameters[1] & 0x04)
882852               {
883                  logerror("Direction\n");
853                  LOG(("Direction\n"));
884854               }
885855               if (i8271.CommandParameters[1] & 0x08)
886856               {
887                  logerror("Load Head\n");
857                  LOG(("Load Head\n"));
888858               }
889859               if (i8271.CommandParameters[1] & 0x010)
890860               {
891                  logerror("Low head current\n");
861                  LOG(("Low head current\n"));
892862               }
893863               if (i8271.CommandParameters[1] & 0x020)
894864               {
895                  logerror("Write Fault Reset\n");
865                  LOG(("Write Fault Reset\n"));
896866               }
897867
898               logerror("Select %02x\n", (i8271.CommandParameters[1] & 0x0c0)>>6);
899#endif
868               LOG(("Select %02x\n", (i8271.CommandParameters[1] & 0x0c0)>>6));
869
900870               /* get drive */
901871               i8271_get_drive();
902872
r1470r1471
1019989
1020990         FDC_LOG_COMMAND("READ DATA MULTI RECORD");
1021991
1022#ifdef VERBOSE
1023         logerror("Sector Count: %02x\n", i8271.Counter);
1024         logerror("Track: %02x\n",i8271.CommandParameters[0]);
1025         logerror("Sector: %02x\n", i8271.CommandParameters[1]);
1026         logerror("Sector Length: %02x bytes\n", 1<<(i8271.ID_N+7));
1027#endif
992         LOG(("Sector Count: %02x\n", i8271.Counter));
993         LOG(("Track: %02x\n",i8271.CommandParameters[0]));
994         LOG(("Sector: %02x\n", i8271.CommandParameters[1]));
995         LOG(("Sector Length: %02x bytes\n", 1<<(i8271.ID_N+7)));
1028996
1029997         i8271_get_drive();
1030998
r1470r1471
10541022         i8271.Counter = 1;
10551023         i8271.ID_R = i8271.CommandParameters[1];
10561024
1057#ifdef VERBOSE
1058         logerror("Sector Count: %02x\n", i8271.Counter);
1059         logerror("Track: %02x\n",i8271.CommandParameters[0]);
1060         logerror("Sector: %02x\n", i8271.CommandParameters[1]);
1061         logerror("Sector Length: %02x bytes\n", 1<<(i8271.ID_N+7));
1062#endif
1025         LOG(("Sector Count: %02x\n", i8271.Counter));
1026         LOG(("Track: %02x\n",i8271.CommandParameters[0]));
1027         LOG(("Sector: %02x\n", i8271.CommandParameters[1]));
1028         LOG(("Sector Length: %02x bytes\n", 1<<(i8271.ID_N+7)));
1029
10631030         i8271_get_drive();
10641031
10651032         if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
r1470r1471
10921059
10931060         FDC_LOG_COMMAND("READ DATA MULTI RECORD");
10941061
1095#ifdef VERBOSE
1096         logerror("Sector Count: %02x\n", i8271.Counter);
1097         logerror("Track: %02x\n",i8271.CommandParameters[0]);
1098         logerror("Sector: %02x\n", i8271.CommandParameters[1]);
1099         logerror("Sector Length: %02x bytes\n", 1<<(i8271.ID_N+7));
1100#endif
1062         LOG(("Sector Count: %02x\n", i8271.Counter));
1063         LOG(("Track: %02x\n",i8271.CommandParameters[0]));
1064         LOG(("Sector: %02x\n", i8271.CommandParameters[1]));
1065         LOG(("Sector Length: %02x bytes\n", 1<<(i8271.ID_N+7)));
11011066
11021067         i8271_get_drive();
11031068
r1470r1471
11401105         i8271.ID_R = i8271.CommandParameters[1];
11411106
11421107
1143#ifdef VERBOSE
1144         logerror("Sector Count: %02x\n", i8271.Counter);
1145         logerror("Track: %02x\n",i8271.CommandParameters[0]);
1146         logerror("Sector: %02x\n", i8271.CommandParameters[1]);
1147         logerror("Sector Length: %02x bytes\n", 1<<(i8271.ID_N+7));
1148#endif
1108         LOG(("Sector Count: %02x\n", i8271.Counter));
1109         LOG(("Track: %02x\n",i8271.CommandParameters[0]));
1110         LOG(("Sector: %02x\n", i8271.CommandParameters[1]));
1111         LOG(("Sector Length: %02x bytes\n", 1<<(i8271.ID_N+7)));
11491112         i8271_get_drive();
11501113
11511114            i8271.drive_control_output &=~1;
r1470r1471
11851148      {
11861149         FDC_LOG_COMMAND("READ ID");
11871150
1188#ifdef VERBOSE
1189         logerror("Track: %02x\n",i8271.CommandParameters[0]);
1190         logerror("ID Field Count: %02x\n", i8271.CommandParameters[2]);
1191#endif
1151         LOG(("Track: %02x\n",i8271.CommandParameters[0]));
1152         LOG(("ID Field Count: %02x\n", i8271.CommandParameters[2]));
11921153
11931154         i8271_get_drive();
11941155
r1470r1471
12121173      break;
12131174
12141175      default:
1215#ifdef VERBOSE
1216         logerror("ERROR Unrecognised Command\n");
1217#endif
1176         LOG(("ERROR Unrecognised Command\n"));
12181177         break;
12191178   }
12201179}
r1470r1471
12271186   {
12281187      case 0:
12291188      {
1230#ifdef VERBOSE
1231         logerror("I8271 W Command Register: %02x\n", data);
1232#endif
1189         LOG(("I8271 W Command Register: %02x\n", data));
12331190
12341191         i8271.CommandRegister = data;
12351192         i8271.Command = i8271.CommandRegister & 0x03f;
r1470r1471
13341291
13351292      case 1:
13361293      {
1337#ifdef VERBOSE
1338         logerror("I8271 W Parameter Register: %02x\n",data);
1339#endif
1294         LOG(("I8271 W Parameter Register: %02x\n",data));
13401295         i8271.ParameterRegister = data;
13411296
13421297         if (i8271.ParameterCount!=0)
r1470r1471
13511306
13521307      case 2:
13531308      {
1354#ifdef VERBOSE
1355         logerror("I8271 W Reset Register: %02x\n", data);
1356#endif
1309         LOG(("I8271 W Reset Register: %02x\n", data));
13571310         if (((data ^ i8271.ResetRegister) & 0x01)!=0)
13581311         {
13591312            if ((data & 0x01)==0)
r1470r1471
13811334      {
13821335         /* bit 1,0 are zero other bits contain status data */
13831336         i8271.StatusRegister &= ~0x03;
1384#ifdef VERBOSE
1385         logerror("I8271 R Status Register: %02x\n",i8271.StatusRegister);
1386#endif
1337         LOG(("I8271 R Status Register: %02x\n",i8271.StatusRegister));
13871338         return i8271.StatusRegister;
13881339      }
13891340
r1470r1471
13961347            i8271_set_irq_state(0);
13971348
13981349            i8271.StatusRegister &= ~I8271_STATUS_RESULT_FULL;
1399#ifdef VERBOSE
1400            logerror("I8271 R Result Register %02x\n",i8271.ResultRegister);
1401#endif
1350            LOG(("I8271 R Result Register %02x\n",i8271.ResultRegister));
14021351            return i8271.ResultRegister;
14031352         }
14041353
src/mess/machine/amigacd.c
r1470r1471
1919
2020#define VERBOSE_DMAC 0
2121
22#if VERBOSE_DMAC
23#define LOG logerror
24#else
25INLINE void dummy_log( const char *a, ... ) {}
26#define LOG dummy_log
27#endif
22#define LOG(x) do { if (VERBOSE_DMAC) logerror x; } while (0)
2823
2924/* constants */
3025#define CD_SECTOR_TIME      (1000/((300*1024)/2048))   /* 2X CDROM sector time in msec (300KBps) */
r1470r1471
133128      case 0x20:
134129      {
135130         UINT8   v = dmac_data.istr;
136         LOG( "DMAC: PC=%08x - ISTR Read(%04x)\n", activecpu_get_pc(), dmac_data.istr );
131         LOG(( "DMAC: PC=%08x - ISTR Read(%04x)\n", activecpu_get_pc(), dmac_data.istr ));
137132
138133         dmac_data.istr &= ~0x0f;
139134         return v;
r1470r1471
142137
143138      case 0x21:
144139      {
145         LOG( "DMAC: PC=%08x - CNTR Read(%04x)\n", activecpu_get_pc(), dmac_data.cntr );
140         LOG(( "DMAC: PC=%08x - CNTR Read(%04x)\n", activecpu_get_pc(), dmac_data.cntr ));
146141         return dmac_data.cntr;
147142      }
148143      break;
149144
150145      case 0x40:   /* wtc hi */
151146      {
152         LOG( "DMAC: PC=%08x - WTC HI Read\n", activecpu_get_pc() );
147         LOG(( "DMAC: PC=%08x - WTC HI Read\n", activecpu_get_pc() ));
153148         return (dmac_data.wtc >> 16);
154149      }
155150      break;
156151
157152      case 0x41:   /* wtc lo */
158153      {
159         LOG( "DMAC: PC=%08x - WTC LO Read\n", activecpu_get_pc() );
154         LOG(( "DMAC: PC=%08x - WTC LO Read\n", activecpu_get_pc() ));
160155         return dmac_data.wtc;
161156      }
162157      break;
163158
164159      case 0x42:   /* acr hi */
165160      {
166         LOG( "DMAC: PC=%08x - ACR HI Read\n", activecpu_get_pc() );
161         LOG(( "DMAC: PC=%08x - ACR HI Read\n", activecpu_get_pc() ));
167162         return (dmac_data.acr >> 16);
168163      }
169164      break;
170165
171166      case 0x43:   /* acr lo */
172167      {
173         LOG( "DMAC: PC=%08x - ACR LO Read\n", activecpu_get_pc() );
168         LOG(( "DMAC: PC=%08x - ACR LO Read\n", activecpu_get_pc() ));
174169         return dmac_data.acr;
175170      }
176171      break;
r1470r1471
178173      case 0x48:   /* wd33c93 SCSI expansion */
179174      case 0x49:
180175      {
181         LOG( "DMAC: PC=%08x - WD33C93 Read(%d)\n", activecpu_get_pc(), offset & 1 );
176         LOG(( "DMAC: PC=%08x - WD33C93 Read(%d)\n", activecpu_get_pc(), offset & 1 ));
182177         return 0x00;   /* Not available without SCSI expansion */
183178      }
184179      break;
185180
186181      case 0x50:
187182      {
188         LOG( "DMAC: PC=%08x - CDROM RESP Read\n", activecpu_get_pc() );
183         LOG(( "DMAC: PC=%08x - CDROM RESP Read\n", activecpu_get_pc() ));
189184         return matsucd_response_r();
190185      }
191186      break;
r1470r1471
194189      case 0x52:
195190      case 0x53:
196191      {
197         LOG( "DMAC: PC=%08x - XT IO Read(%d)\n", activecpu_get_pc(), (offset & 3)-1 );
192         LOG(( "DMAC: PC=%08x - XT IO Read(%d)\n", activecpu_get_pc(), (offset & 3)-1 ));
198193         return 0xff;
199194      }
200195      break;
r1470r1471
216211      case 0x66:
217212      case 0x67:
218213      {
219         LOG( "DMAC: PC=%08x - TPI6525 Read(%d)\n", activecpu_get_pc(), (offset - 0x58) );
214         LOG(( "DMAC: PC=%08x - TPI6525 Read(%d)\n", activecpu_get_pc(), (offset - 0x58) ));
220215         return tpi6525_0_port_r(offset - 0x58);
221216      }
222217      break;
223218
224219      case 0x70:   /* DMA start strobe */
225220      {
226         LOG( "DMAC: PC=%08x - DMA Start Strobe\n", activecpu_get_pc() );
221         LOG(( "DMAC: PC=%08x - DMA Start Strobe\n", activecpu_get_pc() ));
227222         timer_adjust( dmac_data.dma_timer, ATTOTIME_IN_MSEC( CD_SECTOR_TIME ), 0, attotime_zero );
228223      }
229224      break;
230225
231226      case 0x71:   /* DMA stop strobe */
232227      {
233         LOG( "DMAC: PC=%08x - DMA Stop Strobe\n", activecpu_get_pc() );
228         LOG(( "DMAC: PC=%08x - DMA Stop Strobe\n", activecpu_get_pc() ));
234229         timer_reset( dmac_data.dma_timer, attotime_never );
235230      }
236231      break;
237232
238233      case 0x72:   /* Clear IRQ strobe */
239234      {
240         LOG( "DMAC: PC=%08x - IRQ Clear Strobe\n", activecpu_get_pc() );
235         LOG(( "DMAC: PC=%08x - IRQ Clear Strobe\n", activecpu_get_pc() ));
241236         dmac_data.istr &= ~ISTR_INT_P;
242237      }
243238      break;
244239
245240      case 0x74:   /* Flush strobe */
246241      {
247         LOG( "DMAC: PC=%08x - Flush Strobe\n", activecpu_get_pc() );
242         LOG(( "DMAC: PC=%08x - Flush Strobe\n", activecpu_get_pc() ));
248243         dmac_data.istr |= ISTR_FE_FLG;
249244      }
250245      break;
r1470r1471
265260   {
266261      case 0x21:   /* control write */
267262      {
268         LOG( "DMAC: PC=%08x - CNTR Write(%04x)\n", activecpu_get_pc(), data );
263         LOG(( "DMAC: PC=%08x - CNTR Write(%04x)\n", activecpu_get_pc(), data ));
269264         dmac_data.cntr = data;
270265         check_interrupts();
271266      }
r1470r1471
273268
274269      case 0x40:   /* wtc hi */
275270      {
276         LOG( "DMAC: PC=%08x - WTC HI Write - data = %04x\n", activecpu_get_pc(), data );
271         LOG(( "DMAC: PC=%08x - WTC HI Write - data = %04x\n", activecpu_get_pc(), data ));
277272         dmac_data.wtc &= 0x0000ffff;
278273         dmac_data.wtc |= ((UINT32)data) << 16;
279274      }
r1470r1471
281276
282277      case 0x41:   /* wtc lo */
283278      {
284         LOG( "DMAC: PC=%08x - WTC LO Write - data = %04x\n", activecpu_get_pc(), data );
279         LOG(( "DMAC: PC=%08x - WTC LO Write - data = %04x\n", activecpu_get_pc(), data ));
285280         dmac_data.wtc &= 0xffff0000;
286281         dmac_data.wtc |= data;
287282      }
r1470r1471
289284
290285      case 0x42:   /* acr hi */
291286      {
292         LOG( "DMAC: PC=%08x - ACR HI Write - data = %04x\n", activecpu_get_pc(), data );
287         LOG(( "DMAC: PC=%08x - ACR HI Write - data = %04x\n", activecpu_get_pc(), data ));
293288         dmac_data.acr &= 0x0000ffff;
294289         dmac_data.acr |= ((UINT32)data) << 16;
295290      }
r1470r1471
297292
298293      case 0x43:   /* acr lo */
299294      {
300         LOG( "DMAC: PC=%08x - ACR LO Write - data = %04x\n", activecpu_get_pc(), data );
295         LOG(( "DMAC: PC=%08x - ACR LO Write - data = %04x\n", activecpu_get_pc(), data ));
301296         dmac_data.acr &= 0xffff0000;
302297         dmac_data.acr |= data;
303298      }
r1470r1471
305300
306301      case 0x47:   /* dawr */
307302      {
308         LOG( "DMAC: PC=%08x - DAWR Write - data = %04x\n", activecpu_get_pc(), data );
303         LOG(( "DMAC: PC=%08x - DAWR Write - data = %04x\n", activecpu_get_pc(), data ));
309304         dmac_data.dawr = data;
310305      }
311306      break;
r1470r1471
313308      case 0x48:   /* wd33c93 SCSI expansion */
314309      case 0x49:
315310      {
316         LOG( "DMAC: PC=%08x - WD33C93 Write(%d) - data = %04x\n", activecpu_get_pc(), offset & 1, data );
311         LOG(( "DMAC: PC=%08x - WD33C93 Write(%d) - data = %04x\n", activecpu_get_pc(), offset & 1, data ));
317312         /* Not available without SCSI expansion */
318313      }
319314      break;
320315
321316      case 0x50:
322317      {
323         LOG( "DMAC: PC=%08x - CDROM CMD Write - data = %04x\n", activecpu_get_pc(), data );
318         LOG(( "DMAC: PC=%08x - CDROM CMD Write - data = %04x\n", activecpu_get_pc(), data ));
324319         matsucd_command_w( data );
325320      }
326321      break;
r1470r1471
342337      case 0x66:
343338      case 0x67:
344339      {
345         LOG( "DMAC: PC=%08x - TPI6525 Write(%d) - data = %04x\n", activecpu_get_pc(), (offset - 0x58), data );
340         LOG(( "DMAC: PC=%08x - TPI6525 Write(%d) - data = %04x\n", activecpu_get_pc(), (offset - 0x58), data ));
346341         tpi6525_0_port_w(offset - 0x58, data);
347342      }
348343      break;
349344
350345      case 0x70:   /* DMA start strobe */
351346      {
352         LOG( "DMAC: PC=%08x - DMA Start Strobe\n", activecpu_get_pc() );
347         LOG(( "DMAC: PC=%08x - DMA Start Strobe\n", activecpu_get_pc() ));
353348         timer_adjust( dmac_data.dma_timer, ATTOTIME_IN_MSEC( CD_SECTOR_TIME ), 0, attotime_zero );
354349      }
355350      break;
356351
357352      case 0x71:   /* DMA stop strobe */
358353      {
359         LOG( "DMAC: PC=%08x - DMA Stop Strobe\n", activecpu_get_pc() );
354         LOG(( "DMAC: PC=%08x - DMA Stop Strobe\n", activecpu_get_pc() ));
360355         timer_reset( dmac_data.dma_timer, attotime_never );
361356      }
362357      break;
363358
364359      case 0x72:   /* Clear IRQ strobe */
365360      {
366         LOG( "DMAC: PC=%08x - IRQ Clear Strobe\n", activecpu_get_pc() );
361         LOG(( "DMAC: PC=%08x - IRQ Clear Strobe\n", activecpu_get_pc() ));
367362         dmac_data.istr &= ~ISTR_INT_P;
368363      }
369364      break;
370365
371366      case 0x74:   /* Flush Strobe */
372367      {
373         LOG( "DMAC: PC=%08x - Flush Strobe\n", activecpu_get_pc() );
368         LOG(( "DMAC: PC=%08x - Flush Strobe\n", activecpu_get_pc() ));
374369         dmac_data.istr |= ISTR_FE_FLG;
375370      }
376371      break;
r1470r1471
465460
466461static void tp6525_irq( int level )
467462{
468   LOG( "TPI6525 Interrupt: level = %d\n", level);
463   LOG(( "TPI6525 Interrupt: level = %d\n", level ));
469464
470465   if ( level )
471466   {
src/mess/machine/mc6854.c
r1470r1471
101101
102102
103103
104/******************* utilitiy function and macros ********************/
104/******************* utility function and macros ********************/
105105
106106
107107
108#if VERBOSE
109#define LOG(x)  logerror x
110#else
111#define LOG(x)
112#endif
108#define LOG(x)  do { if (VERBOSE) logerror x; } while (0)
113109
114110
115111
src/mess/machine/tc8521.c
r1470r1471
9797#define TC8521_ALARM_1_DAY_REGISTER 0x017
9898#define TC8521_ALARM_10_DAY_REGISTER 0x018
9999
100/* uncomment for verbose debugging information */
101//#define VERBOSE
100#define VERBOSE 0
101#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
102102
103103/* mask data with these values when writing */
104104static const unsigned char rtc_write_masks[16*4]=
r1470r1471
310310         case 0x0d:
311311         case 0x0e:
312312         case 0x0f:
313#ifdef VERBOSE
314            logerror("8521 RTC R: %04x %02x\n", offset, rtc.registers[offset]);
315#endif
313            LOG(("8521 RTC R: %04x %02x\n", offset, rtc.registers[offset]));
316314              return rtc.registers[offset];
317315
318316         default:
r1470r1471
320318      }
321319
322320      /* register in selected page */
323        register_index = ((rtc.registers[TC8521_MODE_REGISTER] & 0x03)<<4) | (offset & 0x0f);
324#ifdef VERBOSE
325      logerror("8521 RTC R: %04x %02x\n", offset, rtc.registers[register_index]);
326#endif
321      register_index = ((rtc.registers[TC8521_MODE_REGISTER] & 0x03)<<4) | (offset & 0x0f);
322      LOG(("8521 RTC R: %04x %02x\n", offset, rtc.registers[register_index]));
327323      /* data from selected page */
328324      return rtc.registers[register_index];
329325}
r1470r1471
333329{
334330   unsigned long register_index;
335331
336#ifdef VERBOSE
337        logerror("8521 RTC W: %04x %02x\n", offset, data);
332   LOG(("8521 RTC W: %04x %02x\n", offset, data));
338333
339334      switch (offset)
340335        {
r1470r1471
342337                {
343338                        if (data & 0x08)
344339                        {
345                            logerror("timer enable\n");
340                            LOG(("timer enable\n"));
346341                        }
347342
348343                        if (data & 0x04)
349344                        {
350                            logerror("alarm enable\n");
345                            LOG(("alarm enable\n"));
351346                        }
352347
353348                  logerror("page %02x selected\n", data & 0x03);
r1470r1471
358353                {
359354                        if (data & 0x08)
360355                        {
361                            logerror("test 3\n");
356                            LOG(("test 3\n"));
362357                        }
363358
364359                        if (data & 0x04)
365360                        {
366                            logerror("test 2\n");
361                            LOG(("test 2\n"));
367362                        }
368363
369364                        if (data & 0x02)
370365                        {
371                            logerror("test 1\n");
366                            LOG(("test 1\n"));
372367                        }
373368
374369                        if (data & 0x01)
375370                        {
376                            logerror("test 0\n");
371                            LOG(("test 0\n"));
377372                        }
378373                }
379374                break;
r1470r1471
382377                {
383378                        if ((data & 0x08)==0)
384379                        {
385                           logerror("1hz enable\n");
380                           LOG(("1hz enable\n"));
386381                        }
387382
388383                        if ((data & 0x04)==0)
389384                        {
390                           logerror("16hz enable\n");
385                           LOG(("16hz enable\n"));
391386                        }
392387
393388                        if (data & 0x02)
394389                        {
395                           logerror("reset timer\n");
390                           LOG(("reset timer\n"));
396391                        }
397392
398393                        if (data & 0x01)
399394                        {
400                           logerror("reset alarm\n");
395                           LOG(("reset alarm\n"));
401396                        }
402397                }
403398                break;
r1470r1471
405400                default:
406401                  break;
407402        }
408#endif
403
409404      switch (offset)
410405      {
411406         /* control registers */
src/mess/machine/concept.c
r1470r1471
1616#include "includes/corvushd.h"
1717
1818#define VERBOSE 1
19#define VERY_VERBOSE 0
2019
20#define LOG(x)  do { if (VERBOSE > 0) logerror x; } while (0)
21#define VLOG(x) do { if (VERBOSE > 1) logerror x; } while (0)
22
23
2124/* interrupt priority encoder */
2225static UINT8 pending_interrupts;
2326enum
r1470r1471
224227*/
225228static  READ8_HANDLER(via_in_a)
226229{
227#if VERBOSE
228   logerror("via_in_a: VIA port A (Omninet and COMM port status) read\n");
229#endif
230   LOG(("via_in_a: VIA port A (Omninet and COMM port status) read\n"));
230231   return 1;      /* omninet ready always 1 */
231232}
232233
233234static WRITE8_HANDLER(via_out_a)
234235{
235#if VERBOSE
236   logerror("via_out_a: VIA port A status written: data=0x%2.2x\n", data);
237#endif
236   LOG(("via_out_a: VIA port A status written: data=0x%2.2x\n", data));
238237   /*iox = (data & 0x80) != 0;*/
239238}
240239
r1470r1471
255254   UINT8 status;
256255
257256   status = ((readinputport(dipswitch_port_concept) & 0x80) >> 1) | ((readinputport(dipswitch_port_concept) & 0x40) << 1);
258#if VERBOSE
259   logerror("via_in_b: VIA port B (DIP switches, Video, Comm Rate) - status: 0x%2.2x\n", status);
260#endif
257   LOG(("via_in_b: VIA port B (DIP switches, Video, Comm Rate) - status: 0x%2.2x\n", status));
261258   return status;
262259}
263260
264261static WRITE8_HANDLER(via_out_b)
265262{
266#if VERY_VERBOSE
267   logerror("via_out_b: VIA port B (Video Control and COMM rate select) written: data=0x%2.2x\n", data);
268#endif
263   VLOG(("via_out_b: VIA port B (Video Control and COMM rate select) written: data=0x%2.2x\n", data));
269264}
270265
271266/*
r1470r1471
273268*/
274269static WRITE8_HANDLER(via_out_cb2)
275270{
276#if VERBOSE
277   logerror("via_out_cb2: Sound control written: data=0x%2.2x\n", data);
278#endif
271   LOG(("via_out_cb2: Sound control written: data=0x%2.2x\n", data));
279272}
280273
281274/*
r1470r1471
329322      /* IO4 ROM */
330323      {
331324         int slot = ((offset >> 8) & 7) - 1;
332#if VERBOSE
333         logerror("concept_io_r: Slot ROM memory accessed for slot %d at address 0x03%4.4x\n", slot, offset << 1);
334#endif
325         LOG(("concept_io_r: Slot ROM memory accessed for slot %d at address 0x03%4.4x\n", slot, offset << 1));
335326         if (expansion_slots[slot].rom_read)
336327            return expansion_slots[slot].rom_read(offset & 0xff);
337328      }
r1470r1471
339330
340331   case 5:
341332      /* slot status */
342#if VERBOSE
343      logerror("concept_io_r: Slot status read at address 0x03%4.4x\n", offset << 1);
344#endif
333      LOG(("concept_io_r: Slot status read at address 0x03%4.4x\n", offset << 1));
345334      break;
346335
347336   case 6:
348337      /* calendar R/W */
349#if VERY_VERBOSE
350      logerror("concept_io_r: Calendar read at address 0x03%4.4x\n", offset << 1);
351#endif
338      VLOG(("concept_io_r: Calendar read at address 0x03%4.4x\n", offset << 1));
352339      if (!clock_enable)
353340         return mm58274c_r(0, clock_address);
354341      break;
r1470r1471
389376         /* NSR0 data comm port 0 */
390377      case 2:
391378         /* NSR1 data comm port 1 */
392#if VERBOSE
393         logerror("concept_io_r: Data comm port read at address 0x03%4.4x\n", offset << 1);
394#endif
379         LOG(("concept_io_r: Data comm port read at address 0x03%4.4x\n", offset << 1));
395380         if ((offset & 0xf) == 1)
396381            return 0x10;
397382         break;
398383
399384      case 3:
400385         /* NVIA versatile system interface */
401#if VERBOSE
402         logerror("concept_io_r: VIA read at address 0x03%4.4x\n", offset << 1);
403#endif
386         LOG(("concept_io_r: VIA read at address 0x03%4.4x\n", offset << 1));
404387         return via_read(0, offset & 0xf);
405388         break;
406389
407390      case 4:
408391         /* NCALM clock calendar address and strobe register */
409392         /* write-only? */
410#if VERBOSE
411         logerror("concept_io_r: NCALM clock/calendar read at address 0x03%4.4x\n", offset << 1);
412#endif
393         LOG(("concept_io_r: NCALM clock/calendar read at address 0x03%4.4x\n", offset << 1));
413394         break;
414395
415396      case 5:
r1470r1471
456437         /* IO4 registers */
457438         {
458439            int slot = ((offset >> 4) & 7) - 1;
459#if VERBOSE
460            logerror("concept_io_w: Slot I/O register written for slot %d at address 0x03%4.4x, data: 0x%4.4x\n",
461               slot, offset << 1, data);
462#endif
440            LOG(("concept_io_w: Slot I/O register written for slot %d at address 0x03%4.4x, data: 0x%4.4x\n",
441               slot, offset << 1, data));
463442            if (expansion_slots[slot].reg_write)
464443               expansion_slots[slot].reg_write(offset & 0xf, data);
465444         }
r1470r1471
482461      /* IO4 ROM */
483462      {
484463         int slot = ((offset >> 8) & 7) - 1;
485#if VERBOSE
486         logerror("concept_io_w: Slot ROM memory written to for slot %d at address 0x03%4.4x, data: 0x%4.4x\n", slot, offset << 1, data);
487#endif
464         LOG(("concept_io_w: Slot ROM memory written to for slot %d at address 0x03%4.4x, data: 0x%4.4x\n", slot, offset << 1, data));
488465         if (expansion_slots[slot].rom_write)
489466            expansion_slots[slot].rom_write(offset & 0xff, data);
490467      }
r1470r1471
497474
498475   case 6:
499476      /* calendar R/W */
500#if VERBOSE
501      logerror("concept_io_w: Calendar written to at address 0x03%4.4x, data: 0x%4.4x\n", offset << 1, data);
502#endif
477      LOG(("concept_io_w: Calendar written to at address 0x03%4.4x, data: 0x%4.4x\n", offset << 1, data));
503478      if (!clock_enable)
504479         mm58274c_w(0, clock_address, data & 0xf);
505480      break;
src/mess/machine/mz700.c
r1470r1471
1717#define VERBOSE 0
1818#endif
1919
20#if VERBOSE
2120#define LOG(N,M,A)   \
22   if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s",timer_get_time(), (const char*)M ); logerror A; }
23#else
24#define LOG(N,M,A)
25#endif
21   if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s",attotime_to_double(timer_get_time()), (const char*)M ); logerror A; }
2622
2723typedef UINT32 data_t;
2824
r1470r1471
531527        bank2_ROM(mem);
532528      if ((mz800_display_mode & 0x08) == 0)
533529      {
534         LOG(1,0,("; 8000-9FFF videoram"));
530         if (VERBOSE>=1) logerror("; 8000-9FFF videoram");
535531            bank3_VID(mem);
536532         if (mz800_display_mode & 0x04)
537533         {
538            LOG(1,0,("; A000-BFFF videoram"));
534            if (VERBOSE>=1) logerror("; A000-BFFF videoram");
539535                /* 640x480 mode so A000-BFFF is videoram too */
540536            bank4_VID(mem);
541537            }
542538         else
543539         {
544            LOG(1,0,("; A000-BFFF RAM"));
540            if (VERBOSE>=1) logerror("; A000-BFFF RAM");
545541            bank4_RAM(mem);
546542            }
547543      }
548544      else
549545      {
550         LOG(1,0,("; C000-CFFF PCG RAM"));
546         if (VERBOSE>=1) logerror("; C000-CFFF PCG RAM");
551547            /* make C000-CFFF PCG RAM */
552548         bank5_RAM(mem);
553549        }
554      LOG(1,0,("\n"));
550      if (VERBOSE>=1) logerror("\n");
555551        break;
556552
557553    case 1: /* make 1000-1FFF and C000-CFFF RAM */
r1470r1471
559555        bank2_RAM(mem);
560556      if ((mz800_display_mode & 0x08) == 0)
561557      {
562         LOG(1,0,("; 8000-9FFF RAM; A000-BFFF RAM"));
558         if (VERBOSE>=1) logerror("; 8000-9FFF RAM; A000-BFFF RAM");
563559            /* make 8000-BFFF RAM */
564560            bank3_RAM(mem);
565561         bank4_RAM(mem);
566562      }
567563      else
568564      {
569         LOG(1,0,("; C000-CFFF RAM"));
565         if (VERBOSE>=1) logerror("; C000-CFFF RAM");
570566            /* make C000-CFFF RAM */
571567         bank5_RAM(mem);
572568        }
573      LOG(1,0,("\n"));
569      if (VERBOSE>=1) logerror("\n");
574570        break;
575571
576572    case 8: /* get MZ700 enable bit 7 ? */
src/mess/machine/serial.c
r1470r1471
3232#include "driver.h"
3333#include "includes/serial.h"
3434
35#define VERBOSE 0
36#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
37
3538/* number of serial streams supported. This is also the number
3639of serial ports supported */
3740#define MAX_SERIAL_DEVICES   4
r1470r1471
287290{
288291   int previous_bit;
289292
290//#ifdef VERBOSE
291   //logerror("receive register receive bit: %1x\n",bit);
292//#endif
293   LOG(("receive register receive bit: %1x\n",bit));
293294   previous_bit = receive->register_data & 1;
294295
295296   /* shift previous bit 7 out */
src/mess/machine/nes_mmc.c
r1470r1471
2727#include "nes_mmc.h"
2828#include "sound/nes_apu.h"
2929
30#define LOG_MMC   1
31#define LOG_FDS   1
30#define VERBOSE 1
3231
32#define LOG_MMC(x) do { if (VERBOSE) logerror x; } while (0)
33#define LOG_FDS(x) do { if (VERBOSE) logerror x; } while (0)
34
3335/* Global variables */
3436static int prg_mask;
3537
r1470r1471
352354      MMC1_Size_16k = 1;
353355      MMC1_Switch_Low = 1;
354356      /* TODO: should we switch banks at this time also? */
355#ifdef LOG_MMC
356      logerror("=== MMC1 regs reset to default\n");
357#endif
357      LOG_MMC(("=== MMC1 regs reset to default\n"));
358358      return;
359359   }
360360
r1470r1471
384384            }
385385
386386            MMC1_SizeVrom_4k = (MMC1_reg & 0x10);
387#ifdef LOG_MMC
388            logerror("   MMC1 reg #1 val:%02x\n", MMC1_reg);
389               logerror("\t\tBank Size: ");
387            LOG_MMC(("   MMC1 reg #1 val:%02x\n", MMC1_reg));
388               LOG_MMC(("\t\tBank Size: "));
390389               if (MMC1_Size_16k)
391                  logerror("16k\n");
392               else logerror("32k\n");
390                  LOG_MMC(("16k\n"));
391               else LOG_MMC(("32k\n"));
393392
394               logerror("\t\tBank Select: ");
393               LOG_MMC(("\t\tBank Select: "));
395394               if (MMC1_Switch_Low)
396                  logerror("$8000\n");
397               else logerror("$C000\n");
395                  LOG_MMC(("$8000\n"));
396               else LOG_MMC(("$C000\n"));
398397
399               logerror("\t\tVROM Bankswitch Size Select: ");
398               LOG_MMC(("\t\tVROM Bankswitch Size Select: "));
400399               if (MMC1_SizeVrom_4k)
401                  logerror("4k\n");
402               else logerror("8k\n");
400                  LOG_MMC(("4k\n"));
401               else LOG_MMC(("8k\n"));
403402
404               logerror ("\t\tMirroring: %d\n", MMC1_reg & 0x03);
405#endif
403               LOG_MMC(("\t\tMirroring: %d\n", MMC1_reg & 0x03));
406404            break;
407405
408406         case 1:
r1470r1471
418416                  memory_set_bankptr (2, &nes.rom[MMC1_extended_base + MMC1_bank2]);
419417                  memory_set_bankptr (3, &nes.rom[MMC1_extended_base + MMC1_bank3]);
420418                  memory_set_bankptr (4, &nes.rom[MMC1_extended_base + MMC1_bank4]);
421#ifdef LOG_MMC
422                  logerror("MMC1_extended 1024k bank (no reg) select: %02x\n", MMC1_extended_bank);
423#endif
419                  LOG_MMC(("MMC1_extended 1024k bank (no reg) select: %02x\n", MMC1_extended_bank));
424420               }
425421               else
426422               {
r1470r1471
432428                     memory_set_bankptr (2, &nes.rom[MMC1_extended_base + MMC1_bank2]);
433429                     memory_set_bankptr (3, &nes.rom[MMC1_extended_base + MMC1_bank3]);
434430                     memory_set_bankptr (4, &nes.rom[MMC1_extended_base + MMC1_bank4]);
435#ifdef LOG_MMC
436                     logerror("MMC1_extended 1024k bank (reg 1) select: %02x\n", MMC1_extended_bank);
437#endif
431                     LOG_MMC(("MMC1_extended 1024k bank (reg 1) select: %02x\n", MMC1_extended_bank));
438432                     MMC1_extended_swap = 0;
439433                  }
440434                  else MMC1_extended_swap = 1;
r1470r1471
448442               memory_set_bankptr (2, &nes.rom[MMC1_extended_base + MMC1_bank2]);
449443               memory_set_bankptr (3, &nes.rom[MMC1_extended_base + MMC1_bank3]);
450444               memory_set_bankptr (4, &nes.rom[MMC1_extended_base + MMC1_bank4]);
451#ifdef LOG_MMC
452               logerror("MMC1_extended 512k bank select: %02x\n", MMC1_extended_bank & 0x01);
453#endif
445               LOG_MMC(("MMC1_extended 512k bank select: %02x\n", MMC1_extended_bank & 0x01));
454446            }
455447            else if (nes.chr_chunks > 0)
456448            {
r1470r1471
460452               {
461453                  int bank = MMC1_reg & ((nes.chr_chunks << 1) - 1);
462454                  ppu2c0x_set_videorom_bank(0, 0, 8, bank, 256);
463#ifdef LOG_MMC
464                  logerror("MMC1 8k VROM switch: %02x\n", MMC1_reg);
465#endif
455                  LOG_MMC(("MMC1 8k VROM switch: %02x\n", MMC1_reg));
466456               }
467457               else
468458               {
469459                  int bank = MMC1_reg & ((nes.chr_chunks << 1) - 1);
470460                  ppu2c0x_set_videorom_bank(0, 0, 4, bank, 256);
471#ifdef LOG_MMC
472                  logerror("MMC1 4k VROM switch (low): %02x\n", MMC1_reg);
473#endif
461                  LOG_MMC(("MMC1 4k VROM switch (low): %02x\n", MMC1_reg));
474462               }
475463            }
476464            break;
r1470r1471
487475                  memory_set_bankptr (2, &nes.rom[MMC1_extended_base + MMC1_bank2]);
488476                  memory_set_bankptr (3, &nes.rom[MMC1_extended_base + MMC1_bank3]);
489477                  memory_set_bankptr (4, &nes.rom[MMC1_extended_base + MMC1_bank4]);
490#ifdef LOG_MMC
491                  logerror("MMC1_extended 1024k bank (reg 2) select: %02x\n", MMC1_extended_bank);
492#endif
478                  LOG_MMC(("MMC1_extended 1024k bank (reg 2) select: %02x\n", MMC1_extended_bank));
493479                  MMC1_extended_swap = 0;
494480               }
495481               else
r1470r1471
499485            {
500486               int bank = MMC1_reg & ((nes.chr_chunks << 1) - 1);
501487               ppu2c0x_set_videorom_bank(0, 4, 4, bank, 256);
502#ifdef LOG_MMC
503               logerror("MMC1 4k VROM switch (high): %02x\n", MMC1_reg);
504#endif
488               LOG_MMC(("MMC1 4k VROM switch (high): %02x\n", MMC1_reg));
505489            }
506490            break;
507491         case 3:
r1470r1471
522506                  memory_set_bankptr (3, &nes.rom[MMC1_extended_base + MMC1_bank3]);
523507                  memory_set_bankptr (4, &nes.rom[MMC1_extended_base + MMC1_bank4]);
524508               }
525#ifdef LOG_MMC
526               logerror("MMC1 32k bank select: %02x\n", MMC1_reg);
527#endif
509               LOG_MMC(("MMC1 32k bank select: %02x\n", MMC1_reg));
528510            }
529511            else
530512            /* Switching one 16k bank */
r1470r1471
545527                     memory_set_bankptr (3, &nes.rom[MMC1_extended_base + MMC1_bank3]);
546528                     memory_set_bankptr (4, &nes.rom[MMC1_extended_base + MMC1_bank4]);
547529                  }
548#ifdef LOG_MMC
549                  logerror("MMC1 16k-low bank select: %02x\n", MMC1_reg);
550#endif
530                  LOG_MMC(("MMC1 16k-low bank select: %02x\n", MMC1_reg));
551531               }
552532               else
553533               {
r1470r1471
566546                     memory_set_bankptr (3, &nes.rom[MMC1_extended_base + MMC1_bank3]);
567547                     memory_set_bankptr (4, &nes.rom[MMC1_extended_base + MMC1_bank4]);
568548                  }
569#ifdef LOG_MMC
570                  logerror("MMC1 16k-high bank select: %02x\n", MMC1_reg);
571#endif
549                  LOG_MMC(("MMC1 16k-high bank select: %02x\n", MMC1_reg));
572550               }
573551            }
574552
575#ifdef LOG_MMC
576            logerror("-- page1: %06x\n", MMC1_bank1);
577            logerror("-- page2: %06x\n", MMC1_bank2);
578            logerror("-- page3: %06x\n", MMC1_bank3);
579            logerror("-- page4: %06x\n", MMC1_bank4);
580#endif
553            LOG_MMC(("-- page1: %06x\n", MMC1_bank1));
554            LOG_MMC(("-- page2: %06x\n", MMC1_bank2));
555            LOG_MMC(("-- page3: %06x\n", MMC1_bank3));
556            LOG_MMC(("-- page4: %06x\n", MMC1_bank4));
581557            break;
582558      }
583559      MMC1_reg_count = 0;
r1470r1471
663639            /* Reset the banks */
664640            mapper4_set_prg ();
665641            mapper4_set_chr ();
666#ifdef LOG_MMC
667            logerror("     MMC3 reset banks\n");
668#endif
642            LOG_MMC(("     MMC3 reset banks\n"));
669643         }
670644         last_bank = data & 0xc0;
671645         break;
r1470r1471
679653               data &= 0xfe;
680654               MMC3_chr[cmd] = data * 64;
681655               mapper4_set_chr ();
682#ifdef LOG_MMC
683               logerror("     MMC3 set vram %d: %d\n", cmd, data);
684#endif
656               LOG_MMC(("     MMC3 set vram %d: %d\n", cmd, data));
685657               break;
686658
687659            case 2: case 3: case 4: case 5:
688660               MMC3_chr[cmd] = data * 64;
689661               mapper4_set_chr ();
690#ifdef LOG_MMC
691               logerror("     MMC3 set vram %d: %d\n", cmd, data);
692#endif
662               LOG_MMC(("     MMC3 set vram %d: %d\n", cmd, data));
693663               break;
694664
695665            case 6:
r1470r1471
718688
719689      case 0x2001: /* $a001 - extra RAM enable/disable */
720690         nes.mid_ram_enable = data;
721#ifdef LOG_MMC
722         logerror("     MMC3 mid_ram enable: %02x\n", 0);
723#endif
691         LOG_MMC(("     MMC3 mid_ram enable: %02x\n", 0));
724692         break;
725693
726694      case 0x4000: /* $c000 - IRQ scanline counter */
727695         IRQ_count_latch = data;
728#ifdef LOG_MMC
729//         logerror("     MMC3 set irq count latch: %02x (scanline %d)\n", data, ppu2c0x_get_current_scanline(0));
730#endif
696//         LOG_MMC(("     MMC3 set irq count latch: %02x (scanline %d)\n", data, ppu2c0x_get_current_scanline(0)));
731697         break;
732698
733699      case 0x4001: /* $c001 - IRQ scanline latch */
734700         IRQ_reload = 1;
735#ifdef LOG_MMC
736//         logerror("     MMC3 set irq reload (scanline %d)\n", ppu2c0x_get_current_scanline(0));
737#endif
701//         LOG_MMC(("     MMC3 set irq reload (scanline %d)\n", ppu2c0x_get_current_scanline(0)));
738702         break;
739703
740704      case 0x6000: /* $e000 - Disable IRQs */
741705         IRQ_enable = 0;
742#ifdef LOG_MMC
743         logerror("     MMC3 disable irqs\n");
744#endif
706         LOG_MMC(("     MMC3 disable irqs\n"));
745707         break;
746708
747709      case 0x6001: /* $e001 - Enable IRQs */
748710         IRQ_enable = 1;
749#ifdef LOG_MMC
750         logerror("     MMC3 enable irqs\n");
751#endif
711         LOG_MMC(("     MMC3 enable irqs\n"));
752712         break;
753713
754714      default:
r1470r1471
808768         break;
809769      }
810770      case 0x2000: /* $a000 */
811#ifdef LOG_MMC
812         logerror("     mapper 118 mirroring: %02x\n", data);
813#endif
771         LOG_MMC(("     mapper 118 mirroring: %02x\n", data));
814772         switch (data & 0x02)
815773         {
816774            case 0x00: ppu2c0x_set_mirroring(0, PPU_MIRROR_LOW); break;
r1470r1471
820778
821779      case 0x2001: /* $a001 - extra RAM enable/disable */
822780         nes.mid_ram_enable = data;
823#ifdef LOG_MMC
824         logerror("     MMC3 mid_ram enable: %02x\n", data);
825#endif
781         LOG_MMC(("     MMC3 mid_ram enable: %02x\n", data));
826782         break;
827783
828784      case 0x4000: /* $c000 - IRQ scanline counter */
829785         IRQ_count = data;
830#ifdef LOG_MMC
831         logerror("     MMC3 set irq count: %02x\n", data);
832#endif
786         LOG_MMC(("     MMC3 set irq count: %02x\n", data));
833787         break;
834788
835789      case 0x4001: /* $c001 - IRQ scanline latch */
836790         IRQ_count_latch = data;
837#ifdef LOG_MMC
838         logerror("     MMC3 set irq count latch: %02x\n", data);
839#endif
791         LOG_MMC(("     MMC3 set irq count latch: %02x\n", data));
840792         break;
841793
842794      case 0x6000: /* $e000 - Disable IRQs */
843795         IRQ_enable = 0;
844796         IRQ_count = IRQ_count_latch; /* TODO: verify this */
845#ifdef LOG_MMC
846         logerror("     MMC3 disable irqs: %02x\n", data);
847#endif
797         LOG_MMC(("     MMC3 disable irqs: %02x\n", data));
848798         break;
849799
850800      case 0x6001: /* $e001 - Enable IRQs */
851801         IRQ_enable = 1;
852#ifdef LOG_MMC
853         logerror("     MMC3 enable irqs: %02x\n", data);
854#endif
802         LOG_MMC(("     MMC3 enable irqs: %02x\n", data));
855803         break;
856804
857805      default:
r1470r1471
13961344
13971345static WRITE8_HANDLER( mapper8_w )
13981346{
1399#ifdef LOG_MMC
1400   logerror("* Mapper 8 switch, vrom: %02x, rom: %02x\n", data & 0x07, (data >> 3));
1401#endif
1347   LOG_MMC(("* Mapper 8 switch, vrom: %02x, rom: %02x\n", data & 0x07, (data >> 3)));
14021348   /* Switch 8k VROM bank */
14031349   chr8 (data & 0x07);
14041350
r1470r1471
15561502
15571503static WRITE8_HANDLER( mapper11_w )
15581504{
1559#ifdef LOG_MMC
1560   logerror("* Mapper 11 switch, data: %02x\n", data);
1561#endif
1505   LOG_MMC(("* Mapper 11 switch, data: %02x\n", data));
1506
15621507   /* Switch 8k VROM bank */
15631508   chr8 (data >> 4);
15641509
r1470r1471
15671512}
15681513static WRITE8_HANDLER( mapper13_w )
15691514{
1570#ifdef LOG_MMC
1571   logerror("* Mapper 13 switch, data: %02x\n", data );
1572#endif
1515   LOG_MMC(("* Mapper 13 switch, data: %02x\n", data ));
1516
15731517   //this is a place-holder call.
15741518   //mapper doesn't work because CHR-RAM is not mapped.
15751519   chr4_4 (data);
r1470r1471
21202064         break;
21212065   }
21222066
2123#ifdef LOG_FDS
2124   logerror ("fds_r, address: %04x, data: %02x\n", offset + 0x4030, ret);
2125#endif
2067   LOG_FDS(("fds_r, address: %04x, data: %02x\n", offset + 0x4030, ret));
21262068
21272069   return ret;
21282070}
r1470r1471
21662108         break;
21672109   }
21682110
2169#ifdef LOG_FDS
2170   logerror ("fds_w, address: %04x, data: %02x\n", offset + 0x4020, data);
2171#endif
2172
2111   LOG_FDS(("fds_w, address: %04x, data: %02x\n", offset + 0x4020, data));
21732112}
21742113
21752114static void konami_irq ( int num, int scanline, int vblank, int blanked )
r1470r1471
28732812
28742813static WRITE8_HANDLER( mapper41_m_w )
28752814{
2876#ifdef LOG_MMC
2877   logerror("mapper41_m_w, offset: %04x, data: %02x\n", offset, data);
2878#endif
2815   LOG_MMC(("mapper41_m_w, offset: %04x, data: %02x\n", offset, data));
2816
28792817   if (offset & 0x20)
28802818      ppu2c0x_set_mirroring(0, PPU_MIRROR_HORZ);
28812819   else
r1470r1471
28892827
28902828static WRITE8_HANDLER( mapper41_w )
28912829{
2892#ifdef LOG_MMC
2893   logerror("mapper41_w, offset: %04x, data: %02x\n", offset, data);
2894#endif
2830   LOG_MMC(("mapper41_w, offset: %04x, data: %02x\n", offset, data));
28952831
28962832   if (mapper41_reg2)
28972833   {
r1470r1471
30873023         /* Switch 8k bank at $8000 */
30883024         data &= prg_mask;
30893025         memory_set_bankptr (1, &nes.rom[0x2000 * (data) + 0x10000]);
3090#ifdef LOG_MMC
3091         logerror("     Mapper 65 switch ($8000) value: %02x\n", data);
3092#endif
3026         LOG_MMC(("     Mapper 65 switch ($8000) value: %02x\n", data));
30933027         break;
30943028      case 0x1001:
30953029         if (data & 0x80)
r1470r1471
31083042         /* Switch 8k bank at $a000 */
31093043         data &= prg_mask;
31103044         memory_set_bankptr (2, &nes.rom[0x2000 * (data) + 0x10000]);
3111#ifdef LOG_MMC
3112         logerror("     Mapper 65 switch ($a000) value: %02x\n", data);
3113#endif
3045         LOG_MMC(("     Mapper 65 switch ($a000) value: %02x\n", data));
31143046         break;
31153047
31163048      case 0x3000:
r1470r1471
31293061         /* Switch 8k bank at $c000 */
31303062         data &= prg_mask;
31313063         memory_set_bankptr (3, &nes.rom[0x2000 * (data) + 0x10000]);
3132#ifdef LOG_MMC
3133         logerror("     Mapper 65 switch ($c000) value: %02x\n", data);
3134#endif
3064         LOG_MMC(("     Mapper 65 switch ($c000) value: %02x\n", data));
31353065         break;
31363066
31373067      default:
r1470r1471
31423072
31433073static WRITE8_HANDLER( mapper66_w )
31443074{
3145#ifdef LOG_MMC
3146   logerror("* Mapper 66 switch, offset %04x, data: %02x\n", offset, data);
3147#endif
3075   LOG_MMC(("* Mapper 66 switch, offset %04x, data: %02x\n", offset, data));
31483076
31493077   prg32 ((data & 0x30) >> 4);
31503078   chr8 (data & 0x03);
r1470r1471
38443772
38453773static WRITE8_HANDLER( mapper93_m_w )
38463774{
3847#ifdef LOG_MMC
3848   logerror("mapper93_m_w %04x:%02x\n", offset, data);
3849#endif
3775   LOG_MMC(("mapper93_m_w %04x:%02x\n", offset, data));
38503776
38513777   prg16_89ab (data);
38523778}
38533779
38543780static WRITE8_HANDLER( mapper93_w )
38553781{
3856#ifdef LOG_MMC
3857   logerror("mapper93_w %04x:%02x\n", offset, data);
3858#endif
3782   LOG_MMC(("mapper93_w %04x:%02x\n", offset, data));
3783
38593784   /* The high nibble appears to be the same prg bank as */
38603785   /* was written to the mid-area mapper */
38613786}
38623787
38633788static WRITE8_HANDLER( mapper94_w )
38643789{
3865#ifdef LOG_MMC
3866   logerror("mapper94_w %04x:%02x\n", offset, data);
3867#endif
3790   LOG_MMC(("mapper94_w %04x:%02x\n", offset, data));
38683791
38693792   prg16_89ab (data >> 2);
38703793}
38713794
38723795static WRITE8_HANDLER( mapper95_w )
38733796{
3874#ifdef LOG_MMC
3875   logerror("mapper95_w %04x:%02x\n", offset, data);
3876#endif
3797   LOG_MMC(("mapper95_w %04x:%02x\n", offset, data));
38773798
38783799   switch (offset)
38793800   {
r1470r1471
39053826}
39063827static WRITE8_HANDLER( mapper101_m_w )
39073828{
3908#ifdef LOG_MMC
3909   logerror("mapper101_m_w %04x:%02x\n", offset, data);
3910#endif
3829   LOG_MMC(("mapper101_m_w %04x:%02x\n", offset, data));
39113830
39123831   chr8 (data);
39133832}
39143833
39153834static WRITE8_HANDLER( mapper101_w )
39163835{
3917#ifdef LOG_MMC
3918   logerror("mapper101_w %04x:%02x\n", offset, data);
3919#endif
3836   LOG_MMC(("mapper101_w %04x:%02x\n", offset, data));
39203837
39213838   /* ??? */
39223839}
39233840static WRITE8_HANDLER( mapper113_l_w )
39243841{
3925#ifdef LOG_MMC
3926   logerror("mapper113_w %04x:%02x\n", offset, data);
3927#endif
3842   LOG_MMC(("mapper113_w %04x:%02x\n", offset, data));
3843
39283844   //I think this is the right value
39293845   if(offset>0xFF)
39303846      return;
r1470r1471
39333849}
39343850static WRITE8_HANDLER( mapper133_l_w )
39353851{
3936#ifdef LOG_MMC
3937   logerror("mapper133_w %04x:%02x\n", offset, data);
3938#endif
3852   LOG_MMC(("mapper133_w %04x:%02x\n", offset, data));
3853
39393854   //I think this is the right value
39403855   if(offset!=0x20)
39413856      return;
r1470r1471
39513866
39523867static WRITE8_HANDLER( mapper144_w )
39533868{
3954#ifdef LOG_MMC
3955   logerror("* Mapper 144 switch, data: %02x\n", data);
3956#endif
3869   LOG_MMC(("* Mapper 144 switch, data: %02x\n", data));
39573870
39583871   //just like mapper 11, except bit 0 taken from ROM
39593872   //and 0x8000 ignored?
r1470r1471
39713884}
39723885static WRITE8_HANDLER( mapper180_w )
39733886{
3974#ifdef LOG_MMC
3975   logerror("* Mapper 180 switch, data: %02x\n", data);
3976#endif
3887   LOG_MMC(("* Mapper 180 switch, data: %02x\n", data));
39773888
39783889   prg16_cdef(data&7);
39793890}
39803891static WRITE8_HANDLER( mapper184_m_w )
39813892{
3982#ifdef LOG_MMC
3983   logerror("* Mapper 184 switch, data: %02x\n", data);
3984#endif
3893   LOG_MMC(("* Mapper 184 switch, data: %02x\n", data));
39853894
39863895   if(0==offset)
39873896   {
r1470r1471
39963905   int size_16;
39973906   int bank;
39983907
3999#ifdef LOG_MMC
4000   logerror ("mapper225_w, offset: %04x, data: %02x\n", offset, data);
4001#endif
3908   LOG_MMC(("mapper225_w, offset: %04x, data: %02x\n", offset, data));
40023909
40033910   chr8 (offset & 0x3f);
40043911   hi_bank = offset & 0x40;
r1470r1471
40293936   int bank;
40303937   static int reg0, reg1;
40313938
4032#ifdef LOG_MMC
4033   logerror ("mapper226_w, offset: %04x, data: %02x\n", offset, data);
4034#endif
3939   LOG_MMC(("mapper226_w, offset: %04x, data: %02x\n", offset, data));
40353940
40363941   if (offset & 0x01)
40373942   {
r1470r1471
40703975   int size_32;
40713976   int bank;
40723977
4073#ifdef LOG_MMC
4074   logerror ("mapper227_w, offset: %04x, data: %02x\n", offset, data);
4075#endif
3978   LOG_MMC(("mapper227_w, offset: %04x, data: %02x\n", offset, data));
40763979
40773980   hi_bank = offset & 0x04;
40783981   size_32 = offset & 0x01;
r1470r1471
41104013   int bank;
41114014   int chr;
41124015
4113#ifdef LOG_MMC
4114   logerror ("mapper228_w, offset: %04x, data: %02x\n", offset, data);
4115#endif
4016   LOG_MMC(("mapper228_w, offset: %04x, data: %02x\n", offset, data));
41164017
41174018   /* Determine low 4 bits of program bank */
41184019   bank = (offset & 0x780) >> 7;
r1470r1471
41604061
41614062static WRITE8_HANDLER( mapper229_w )
41624063{
4163#ifdef LOG_MMC
4164   logerror ("mapper229_w, offset: %04x, data: %02x\n", offset, data);
4165#endif
4064   LOG_MMC(("mapper229_w, offset: %04x, data: %02x\n", offset, data));
41664065
41674066   if (offset & 0x20)
41684067      ppu2c0x_set_mirroring(0, PPU_MIRROR_HORZ);
r1470r1471
41864085{
41874086   int bank;
41884087
4189#ifdef LOG_MMC
4190   logerror("mapper231_w, offset: %04x, data: %02x\n", offset, data);
4191#endif
4088   LOG_MMC(("mapper231_w, offset: %04x, data: %02x\n", offset, data));
41924089
41934090   bank = (data & 0x03) | ((data & 0x80) >> 5);
41944091   prg32 (bank);
src/mess/machine/pclpt.c
r1470r1471
1515
1616#define VERBOSE_LPT 1
1717
18#ifdef VERBOSE_LPT
1918#define LPT_LOG(n,m,a) LOG(VERBOSE_LPT,n,m,a)
20#else
21#define LPT_LOG(n,m,a)
22#endif
2319
2420#define STATUS_NOT_BUSY 0x80
2521#define STATUS_ACKNOWLEDGE 0x40
src/mess/machine/mc6846.c
r1470r1471
6565
6666
6767
68/******************* utilitiy function and macros ********************/
68/******************* utility function and macros ********************/
6969
70#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
7071
71#if VERBOSE
72#define LOG(x)   logerror x
73#else
74#define LOG(x)
75#endif
76
7772#define PORT                        \
7873   ((mc6846.pdr & mc6846.ddr) |               \
7974    ((mc6846.iface->in_port_func ? mc6846.iface->in_port_func(0) : 0) & \
r1470r1471
331326
332327   case 1:
333328   {
334#if VERBOSE
335      const char* cp2[8] =
329      static const char *const cp2[8] =
336330         {
337331         "in,neg-edge", "in,neg-edge,intr", "in,pos-edge", "in,pos-edge,intr",
338332         "out,intr-ack", "out,i/o-ack", "out,0", "out,1"
339333      };
340      const char* cp1[8] = {
334      static const char *const cp1[8] = {
341335         "neg-edge", "neg-edge,intr", "pos-edge", "pos-edge,intr",
342336         "latched,neg-edge", "latched,neg-edge,intr",
343337         "latcged,pos-edge", "latcged,pos-edge,intr"
r1470r1471
345339      LOG (( "$%04x %f: mc6846 PCR write $%02X reset=%i cp2=%s cp1=%s\n",
346340             activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data,
347341             (data >> 7) & 1, cp2[ (data >> 3) & 7 ], cp1[ data & 7 ] ));
348#endif
342
349343   }
350344   mc6846.pcr = data;
351345   if ( data & 0x80 )
r1470r1471
405399
406400   case 5:
407401   {
408#if VERBOSE
409      const char* mode[8] =
402      static const char *const mode[8] =
410403         {
411404            "continuous", "cascaded", "continuous", "one-shot",
412405            "freq-cmp", "freq-cmp", "pulse-cmp", "pulse-cmp"
r1470r1471
416409             (data >> 7) & 1, (data & 0x40) ? "extern" : "sys",
417410             (data & 0x40) ? 1 : 8, mode[ (data >> 1) & 7 ],
418411             (data & 1) ? "enabled" : "0" ));
419#endif
412
420413      mc6846.tcr = data;
421414      if ( mc6846.tcr & 1 )
422415      {
src/mess/machine/thomson.c
r1470r1471
3737
3838#define PRINT(x) mame_printf_info x
3939
40#if VERBOSE
41#define LOG(x)   logerror x
42#else
43#define LOG(x)
44#endif
40#define LOG(x)   do { if (VERBOSE) logerror x; } while (0)
41#define LOG_IRQ(x) do { if (VERBOSE_IRQ) logerror x; } while (0)
42#define LOG_KBD(x) do { if (VERBOSE_KBD) logerror x; } while (0)
43#define LOG_BANK(x) do { if (VERBOSE_BANK) logerror x; } while (0)
44#define LOG_VIDEO(x) do { if (VERBOSE_VIDEO) logerror x; } while (0)
45#define LOG_IO(x) do { if (VERBOSE_IO) logerror x; } while (0)
46#define LOG_MIDI(x) do { if (VERBOSE_MIDI) logerror x; } while (0)
4547
46
4748/*************************** utilities ********************************/
4849
4950
r1470r1471
6162
6263static void thom_set_irq ( int line, int state )
6364{
64
65#if VERBOSE_IRQ
6665   int old = thom_irq;
67#endif
6866
6967   if ( state )
7068      thom_irq |= 1 << line;
7169   else
7270      thom_irq &= ~(1 << line);
7371
74#if VERBOSE_IRQ
7572   if ( !old && thom_irq )
76      logerror( "%f thom_set_irq: irq line up %i\n", attotime_to_double(timer_get_time()), line );
73      LOG_IRQ(( "%f thom_set_irq: irq line up %i\n", attotime_to_double(timer_get_time()), line ));
7774   if ( old && !thom_irq )
78      logerror( "%f thom_set_irq: irq line down %i\n", attotime_to_double(timer_get_time()), line );
79#endif
75      LOG_IRQ(( "%f thom_set_irq: irq line down %i\n", attotime_to_double(timer_get_time()), line ));
8076
8177   cpunum_set_input_line( 0, M6809_IRQ_LINE, thom_irq ? ASSERT_LINE : CLEAR_LINE );
8278}
r1470r1471
8581
8682static void thom_set_firq ( int line, int state )
8783{
88
89#if VERBOSE_IRQ
9084   int old = thom_irq;
91#endif
9285
9386   if ( state )
9487      thom_firq |= 1 << line;
9588   else
9689      thom_firq &= ~(1 << line);
9790
98#if VERBOSE_IRQ
9991   if ( !old && thom_firq )
100      logerror( "%f thom_set_firq: firq line up %i\n", attotime_to_double(timer_get_time()), line );
92      LOG_IRQ(( "%f thom_set_firq: firq line up %i\n", attotime_to_double(timer_get_time()), line ));
10193   if ( old && !thom_firq )
102      logerror( "%f thom_set_firq: firq line down %i\n", attotime_to_double(timer_get_time()), line );
103#endif
94      LOG_IRQ(( "%f thom_set_firq: firq line down %i\n", attotime_to_double(timer_get_time()), line ));
10495
10596   cpunum_set_input_line( 0, M6809_FIRQ_LINE, thom_firq ? ASSERT_LINE : CLEAR_LINE );
10697}
r1470r1471
328319      memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0003, 0, 0, to7_cartridge_r );
329320   }
330321
331#if VERBOSE_BANK
332322   if ( bank != old_bank )
333      logerror( "to7_update_cart_bank: CART is cartridge bank %i\n", bank );
334#endif
323      LOG_BANK(( "to7_update_cart_bank: CART is cartridge bank %i\n", bank ));
335324
336325   memory_set_bank( THOM_CART_BANK, bank );
337326   old_bank = bank;
r1470r1471
426415   if ( ! to7_lightpen )
427416      return;
428417
429#if VERBOSE_VIDEO
430   logerror( "%f to7_lightpen_cb: step=%i\n", attotime_to_double(timer_get_time()), step );
431#endif
432
418   LOG_VIDEO(( "%f to7_lightpen_cb: step=%i\n", attotime_to_double(timer_get_time()), step ));
433419   pia_set_input_cb1( THOM_PIA_SYS, 1 );
434420   pia_set_input_cb1( THOM_PIA_SYS, 0 );
435421   to7_lightpen_step = step;
r1470r1471
445431{
446432   /* INIT signal wired to system PIA 6821 */
447433
448#if VERBOSE_VIDEO
449   logerror( "%f to7_set_init: init=%i\n", attotime_to_double(timer_get_time()), init );
450#endif
451
434   LOG_VIDEO(( "%f to7_set_init: init=%i\n", attotime_to_double(timer_get_time()), init ));
452435   pia_set_input_ca1( THOM_PIA_SYS, init );
453436}
454437
r1470r1471
570553   int tx  = data & 1;
571554   int dtr = ( data & 2 ) ? 1 : 0;
572555
573#if VERBOSE_IO
574   logerror( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n",  activecpu_get_previouspc(), attotime_to_double(timer_get_time()), tx, dtr );
575#endif
576
556   LOG_IO(( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n",  activecpu_get_previouspc(), attotime_to_double(timer_get_time()), tx, dtr ));
577557   if ( dtr )
578558      to7_io_line.State |=  SERIAL_STATE_DTR;
579559   else
r1470r1471
596576   else
597577      cts = ( centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY ) ? 1 : 0;
598578
599#if VERBOSE_IO
600   logerror( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), to7_io_mode(), cts, dsr, rd );
601#endif
579   LOG_IO(( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), to7_io_mode(), cts, dsr, rd ));
602580
603581   return (dsr ? 0x20 : 0) | (cts ? 0x40 : 0) | (rd ? 0x80: 0);
604582}
r1470r1471
609587{
610588   /* set 8-bit data */
611589
612#if VERBOSE_IO
613   logerror( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data );
614#endif
590   LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data ));
615591
616592   centronics_write_data( 0, data );
617593}
r1470r1471
620596
621597static WRITE8_HANDLER ( to7_io_cb2_out )
622598{
623  /* send STROBE to printer */
599   /* send STROBE to printer */
624600
625#if VERBOSE_IO
626   logerror( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data );
627#endif
601   LOG_IO(( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data ));
628602
629603   centronics_write_handshake( 0, data ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE );
630604}
r1470r1471
636610   /* our peer's state has changed */
637611   to7_io_line.input_state = state;
638612
639#if VERBOSE_IO
640   logerror( "%f to7_io_in_callback:  cts=%i dsr=%i rd=%i\n", attotime_to_double(timer_get_time()), (state & SERIAL_STATE_CTS) ? 1 : 0, (state & SERIAL_STATE_DSR) ? 1 : 0, (int)get_in_data_bit( state ) );
641#endif
642
613   LOG_IO(( "%f to7_io_in_callback:  cts=%i dsr=%i rd=%i\n", attotime_to_double(timer_get_time()), (state & SERIAL_STATE_CTS) ? 1 : 0, (state & SERIAL_STATE_DSR) ? 1 : 0, (int)get_in_data_bit( state ) ));
643614}
644615
645616
r1470r1471
741712
742713static void to7_modem_cb( int state )
743714{
744#if VERBOSE_IO
745   logerror ( "to7_modem_cb: called %i\n", state );
746#endif
715   LOG(( "to7_modem_cb: called %i\n", state ));
747716}
748717
749718
r1470r1471
11141083      /* bit 5:     overrun */
11151084      /* bit 6:     parity error (ignored) */
11161085      /* bit 7:     interrupt */
1117#if VERBOSE_MIDI
1118      logerror( "$%04x %f to7_midi_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, irq=%i)\n",
1086      LOG_MIDI(( "$%04x %f to7_midi_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, irq=%i)\n",
11191087           activecpu_get_previouspc(), attotime_to_double(timer_get_time()), to7_midi_status,
11201088           (to7_midi_status & ACIA_6850_RDRF) ? 1 : 0,
11211089           (to7_midi_status & ACIA_6850_TDRE) ? 1 : 0,
11221090           (to7_midi_status & ACIA_6850_OVRN) ? 1 : 0,
1123           (to7_midi_status & ACIA_6850_irq) ? 1 : 0 );
1124#endif
1091           (to7_midi_status & ACIA_6850_irq) ? 1 : 0 ));
11251092      return to7_midi_status;
11261093
11271094
r1470r1471
11341101      else
11351102         to7_midi_status &= ~ACIA_6850_OVRN;
11361103      to7_midi_overrun = 0;
1137#if VERBOSE_MIDI
1138      logerror( "$%04x %f to7_midi_r: read data $%02X\n",
1139           activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data );
1140#endif
1104      LOG_MIDI(( "$%04x %f to7_midi_r: read data $%02X\n",
1105           activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data ));
11411106      to7_midi_update_irq();
11421107      return data;
11431108   }
r1470r1471
11641129      if ( (data & 3) == 3 )
11651130      {
11661131         /* reset */
1167#if VERBOSE_MIDI
1168         logerror( "$%04x %f to7_midi_w: reset (data=$%02X)\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data );
1169#endif
1132         LOG_MIDI(( "$%04x %f to7_midi_w: reset (data=$%02X)\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data ));
11701133         to7_midi_overrun = 0;
11711134         to7_midi_status = 2;
11721135         to7_midi_intr = 0;
r1470r1471
11781141         /* bits 5-6: interrupt on transmit */
11791142         /* bit 7:    interrupt on receive */
11801143         to7_midi_intr = data >> 5;
1181#if VERBOSE_MIDI
11821144         {
11831145            static const int bits[8] = { 7,7,7,7,8,8,8,8 };
11841146            static const int stop[8] = { 2,2,1,1,2,1,1,1 };
11851147            static const char parity[8] = { 'e','o','e','o','-','-','e','o' };
1186            logerror( "$%04x %f to7_midi_w: set control to $%02X (bits=%i, stop=%i, parity=%c, intr in=%i out=%i)\n",
1148            LOG_MIDI(( "$%04x %f to7_midi_w: set control to $%02X (bits=%i, stop=%i, parity=%c, intr in=%i out=%i)\n",
11871149                 activecpu_get_previouspc(), attotime_to_double(timer_get_time()),
11881150                 data,
11891151                 bits[ (data >> 2) & 7 ],
11901152                 stop[ (data >> 2) & 7 ],
11911153                 parity[ (data >> 2) & 7 ],
11921154                 to7_midi_intr >> 2,
1193                 (to7_midi_intr & 3) ? 1 : 0);
1155                 (to7_midi_intr & 3) ? 1 : 0));
11941156         }
1195#endif
11961157      }
11971158      to7_midi_update_irq();
11981159      break;
11991160
12001161
12011162   case 1: /* output data */
1202#if VERBOSE_MIDI
1203      logerror( "$%04x %f to7_midi_w: write data $%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data );
1204#endif
1163      LOG_MIDI(( "$%04x %f to7_midi_w: write data $%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data ));
12051164      if ( data == 0x55 )
12061165         /* cable-detect: shortcut */
12071166         chardev_fake_in( to7_midi_chardev, 0x55 );
r1470r1471
14301389      return;
14311390   }
14321391
1433#if VERBOSE_BANK
14341392   if ( bank != old_bank )
1435      logerror( "to770_update_ram_bank: RAM bank change %i\n", bank );
1436#endif
1393      LOG_BANK(( "to770_update_ram_bank: RAM bank change %i\n", bank ));
14371394
14381395   memory_set_bank( THOM_RAM_BANK, bank );
14391396   memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xdfff, 0, 0,
r1470r1471
18061763      /* 64 KB ROM from "JANE" cartridge */
18071764      memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, MWA8_NOP );
18081765      bank = mo5_reg_cart & 3;
1809#if VERBOSE_BANK
18101766      if ( bank != old_bank )
1811         logerror( "mo5_update_cart_bank: CART is cartridge bank %i (A7CB style)\n", bank );
1812#endif
1767         LOG_BANK(( "mo5_update_cart_bank: CART is cartridge bank %i (A7CB style)\n", bank ));
18131768   }
18141769   else if ( rom_is_ram )
18151770   {
r1470r1471
18181773      bank = 4 + ( mo5_reg_cart & 3 );
18191774      memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, write_enable ?
18201775                      (write8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) :  MWA8_NOP );
1821#if VERBOSE_BANK
18221776      if ( bank != old_bank )
1823         logerror( "mo5_update_cart_bank: CART is nanonetwork RAM bank %i (write-enable=%i)\n", mo5_reg_cart & 3, write_enable ? 1 : 0 );
1824#endif
1777         LOG_BANK(( "mo5_update_cart_bank: CART is nanonetwork RAM bank %i (write-enable=%i)\n", mo5_reg_cart & 3, write_enable ? 1 : 0 ));
18251778   }
18261779   else
18271780   {
r1470r1471
18321785         bank = thom_cart_bank % thom_cart_nb_banks;
18331786         memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xbffc, 0xbfff, 0, 0, mo5_cartridge_r );
18341787      }
1835#if VERBOSE_BANK
18361788      if ( bank != old_bank )
1837         logerror( "mo5_update_cart_bank: CART is internal / cartridge bank %i\n", thom_cart_bank );
1838#endif
1789         LOG_BANK(( "mo5_update_cart_bank: CART is internal / cartridge bank %i\n", thom_cart_bank ));
18391790   }
18401791   memory_set_bank( THOM_CART_BANK, bank );
18411792   old_bank = bank;
r1470r1471
21022053
21032054WRITE8_HANDLER ( to9_vreg_w )
21042055{
2105#if VERBOSE_VIDEO
2106   logerror( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), offset, 0xe7da + offset, data );
2107#endif
2056   LOG_VIDEO(( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), offset, 0xe7da + offset, data ));
21082057
21092058   switch ( offset )
21102059   {
r1470r1471
21712120   case 0:
21722121      /* BASIC (64 KB) */
21732122      bank = 4 + to9_soft_bank;
2174#if VERBOSE_BANK
21752123      if ( bank != old_bank )
2176         logerror( "to9_update_cart_bank: CART is BASIC bank %i\n", to9_soft_bank );
2177#endif
2124         LOG_BANK(( "to9_update_cart_bank: CART is BASIC bank %i\n", to9_soft_bank ));
21782125      break;
21792126   case 1:
21802127      /* software 1 (32 KB) */
21812128      bank = 8 + (to9_soft_bank & 1);
2182#if VERBOSE_BANK
21832129      if ( bank != old_bank )
2184         logerror( "to9_update_cart_bank: CART is software 1 bank %i\n", to9_soft_bank );
2185#endif
2130         LOG_BANK(( "to9_update_cart_bank: CART is software 1 bank %i\n", to9_soft_bank ));
21862131      break;
21872132   case 2:
21882133      /* software 2 (32 KB) */
21892134      bank = 10 + (to9_soft_bank & 1);
2190#if VERBOSE_BANK
21912135      if ( bank != old_bank )
2192         logerror( "to9_update_cart_bank: CART is software 2 bank %i\n", to9_soft_bank );
2193#endif
2136         LOG_BANK(( "to9_update_cart_bank: CART is software 2 bank %i\n", to9_soft_bank ));
21942137      break;
21952138   case 3:
21962139      /* external cartridge */
r1470r1471
21992142         bank = thom_cart_bank % thom_cart_nb_banks;
22002143         memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0003, 0, 0, to7_cartridge_r );
22012144      }
2202#if VERBOSE_BANK
22032145      if ( bank != old_bank )
2204         logerror( "to9_update_cart_bank: CART is cartridge bank %i\n",  thom_cart_bank );
2205#endif
2146         LOG_BANK(( "to9_update_cart_bank: CART is cartridge bank %i\n",  thom_cart_bank ));
22062147      break;
22072148   }
22082149
r1470r1471
22702211      return;
22712212   }
22722213
2273#if VERBOSE_BANK
22742214   if ( old_bank != bank )
2275      logerror( "to9_update_ram_bank: bank %i selected (pia=$%02X disk=%i)\n", bank, portb & 0xf8, disk );
2276#endif
2215      LOG_BANK(( "to9_update_ram_bank: bank %i selected (pia=$%02X disk=%i)\n", bank, portb & 0xf8, disk ));
22772216
22782217   memory_set_bank( THOM_RAM_BANK, bank );
22792218   memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xdfff, 0, 0,
r1470r1471
23842323      /* bit 5:     overrun */
23852324      /* bit 6:     parity error */
23862325      /* bit 7:     interrupt */
2387#if VERBOSE_KBD
2388      logerror( "$%04x %f to9_kbd_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, pe=%i, irq=%i)\n",
2326
2327      LOG_KBD(( "$%04x %f to9_kbd_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, pe=%i, irq=%i)\n",
23892328           activecpu_get_previouspc(), attotime_to_double(timer_get_time()), to9_kbd_status,
23902329           (to9_kbd_status & ACIA_6850_RDRF) ? 1 : 0,
23912330           (to9_kbd_status & ACIA_6850_TDRE) ? 1 : 0,
23922331           (to9_kbd_status & ACIA_6850_OVRN) ? 1 : 0,
23932332           (to9_kbd_status & ACIA_6850_PE) ? 1 : 0,
2394           (to9_kbd_status & ACIA_6850_irq) ? 1 : 0 );
2395#endif
2333           (to9_kbd_status & ACIA_6850_irq) ? 1 : 0 ));
23962334      return to9_kbd_status;
23972335
23982336   case 1: /* get input data */
r1470r1471
24022340      else
24032341         to9_kbd_status &= ~(ACIA_6850_OVRN | ACIA_6850_RDRF);
24042342      to9_kbd_overrun = 0;
2405#if VERBOSE_KBD
2406      logerror( "$%04x %f to9_kbd_r: read data $%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), to9_kbd_in );
2407#endif
2343      LOG_KBD(( "$%04x %f to9_kbd_r: read data $%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), to9_kbd_in ));
24082344      to9_kbd_update_irq();
24092345      return to9_kbd_in;
24102346
r1470r1471
24312367         to9_kbd_overrun = 0;
24322368         to9_kbd_status = ACIA_6850_TDRE;
24332369         to9_kbd_intr = 0;
2434#if VERBOSE_KBD
2435         logerror( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data );
2436#endif
2370         LOG_KBD(( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data ));
24372371      }
24382372      else
24392373      {
r1470r1471
24452379         /* bits 5-6: interrupt on transmit */
24462380         /* bit 7:    interrupt on receive */
24472381         to9_kbd_intr = data >> 5;
2448#if VERBOSE_KBD
2449         logerror( "$%04x %f to9_kbd_w: set control to $%02X (parity=%i, intr in=%i out=%i)\n",
2382
2383         LOG_KBD(( "$%04x %f to9_kbd_w: set control to $%02X (parity=%i, intr in=%i out=%i)\n",
24502384              activecpu_get_previouspc(), attotime_to_double(timer_get_time()),
24512385              data, to9_kbd_parity, to9_kbd_intr >> 2,
2452              (to9_kbd_intr & 3) ? 1 : 0 );
2453#endif
2386              (to9_kbd_intr & 3) ? 1 : 0 ));
24542387      }
24552388      to9_kbd_update_irq();
24562389      break;
r1470r1471
25072440   {
25082441      /* overrun will be set when the current valid byte is read */
25092442      to9_kbd_overrun = 1;
2510#if VERBOSE_KBD
2511      logerror( "%f to9_kbd_send: overrun => drop data=$%02X, parity=%i\n", attotime_to_double(timer_get_time()), data, parity );
2512#endif
2443      LOG_KBD(( "%f to9_kbd_send: overrun => drop data=$%02X, parity=%i\n", attotime_to_double(timer_get_time()), data, parity ));
25132444   }
25142445   else
25152446   {
r1470r1471
25202451         to9_kbd_status &= ~ACIA_6850_PE; /* parity OK */
25212452      else
25222453         to9_kbd_status |= ACIA_6850_PE;  /* parity error */
2523#if VERBOSE_KBD
2524      logerror( "%f to9_kbd_send: data=$%02X, parity=%i, status=$%02X\n", attotime_to_double(timer_get_time()), data, parity, to9_kbd_status );
2525#endif
2454      LOG_KBD(( "%f to9_kbd_send: data=$%02X, parity=%i, status=$%02X\n", attotime_to_double(timer_get_time()), data, parity, to9_kbd_status ));
25262455   }
25272456   to9_kbd_update_irq();
25282457}
r1470r1471
26392568         to9_kbd_key_count++;
26402569         if ( to9_kbd_key_count < TO9_KBD_REPEAT_DELAY || (to9_kbd_key_count - TO9_KBD_REPEAT_DELAY) % TO9_KBD_REPEAT_PERIOD )
26412570            return 0;
2642#if VERBOSE_KBD
2643         logerror( "to9_kbd_get_key: repeat key $%02X '%c'\n", asc, asc );
2644#endif
2571         LOG_KBD(( "to9_kbd_get_key: repeat key $%02X '%c'\n", asc, asc ));
26452572         return asc;
26462573      }
26472574      else {
26482575         to9_kbd_last_key = key;
26492576         to9_kbd_key_count = 0;
2650#if VERBOSE_KBD
2651         logerror( "to9_kbd_get_key: key down $%02X '%c'\n", asc, asc );
2652#endif
2577         LOG_KBD(( "to9_kbd_get_key: key down $%02X '%c'\n", asc, asc ));
26532578         return asc;
26542579      }
26552580   }
r1470r1471
27682693   centronics_write_data( 0, data );
27692694   centronics_write_handshake( 0, (b & 2) ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE );
27702695
2771#if VERBOSE_IO
2772   logerror( "$%04x %f to9_update_centronics: data=$%02X strobe=%i\n",
2696   LOG_IO(( "$%04x %f to9_update_centronics: data=$%02X strobe=%i\n",
27732697        activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data,
2774        (b & 2) ? 1 : 0 );
2775#endif
2698        (b & 2) ? 1 : 0 ));
27762699}
27772700
27782701
r1470r1471
27812704{
27822705   UINT8 ktest = to9_kbd_ktest();
27832706
2784#if VERBOSE_KBD
2785   logerror( "to9_sys_porta_in: ktest=%i\n", ktest );
2786#endif
2707   LOG_KBD(( "to9_sys_porta_in: ktest=%i\n", ktest ));
27872708
27882709   return ktest;
27892710}
r1470r1471
28022723   to9_update_centronics(); /* bits 0-1: printer */
28032724   to9_update_ram_bank();
28042725
2805#if VERBOSE
28062726   if ( data & 4 ) /* bit 2: video overlay (TODO) */
2807      logerror( "to9_sys_portb_out: video overlay not handled\n" );
2808#endif
2727      LOG(( "to9_sys_portb_out: video overlay not handled\n" ));
28092728}
28102729
28112730
r1470r1471
30853004{
30863005   attotime d;
30873006
3088#if VERBOSE_KBD
3089   logerror( "%f to8_kbd_timer_cb: step=%i ack=%i data=$%03X\n", attotime_to_double(timer_get_time()), to8_kbd_step, to8_kbd_ack, to8_kbd_data );
3090#endif
3007   LOG_KBD(( "%f to8_kbd_timer_cb: step=%i ack=%i data=$%03X\n", attotime_to_double(timer_get_time()), to8_kbd_step, to8_kbd_ack, to8_kbd_data ));
30913008
30923009   if( ! to8_kbd_step )
30933010   {
r1470r1471
31053022      else
31063023      {
31073024         /* got key! */
3108#if VERBOSE_KBD
3109         logerror( "to8_kbd_timer_cb: got key $%03X\n", k );
3110#endif
3025         LOG_KBD(( "to8_kbd_timer_cb: got key $%03X\n", k ));
31113026         to8_kbd_data = k;
31123027         to8_kbd_step = 1;
31133028         d = ATTOTIME_IN_USEC( 100 );
r1470r1471
31743089   if ( data )
31753090   {
31763091      double len = attotime_to_double(timer_timeelapsed( to8_kbd_signal )) * 1000. - 2.;
3177#if VERBOSE_KBD
3178      logerror( "%f to8_kbd_set_ack: CPU end ack, len=%f\n", attotime_to_double(timer_get_time()), len );
3179#endif
3092      LOG_KBD(( "%f to8_kbd_set_ack: CPU end ack, len=%f\n", attotime_to_double(timer_get_time()), len ));
31803093      if ( to8_kbd_data == 0xfff )
31813094      {
31823095         /* end signal from CPU */
r1470r1471
32323145         timer_adjust( to8_kbd_timer, ATTOTIME_IN_USEC( 400 ), 0, attotime_never );
32333146         timer_adjust( to8_kbd_signal, attotime_never, 0, attotime_never );
32343147      }
3235#if VERBOSE_KBD
3236      logerror( "%f to8_kbd_set_ack: CPU ack, data=$%03X\n", attotime_to_double(timer_get_time()), to8_kbd_data );
3237#endif
3148      LOG_KBD(( "%f to8_kbd_set_ack: CPU ack, data=$%03X\n", attotime_to_double(timer_get_time()), to8_kbd_data ));
32383149   }
32393150}
32403151
r1470r1471
32853196{
32863197   static int old_bank = -1;
32873198   int bank = (to8_reg_sys1 & 0x80) ? to7_floppy_bank : (to8_bios_bank + TO7_NB_FLOP_BANK);
3288#if VERBOSE_BANK
3199
32893200   if ( bank != old_bank )
3290      logerror( "to8_update_floppy_bank: floppy ROM is %s bank %i\n",
3201      LOG_BANK(( "to8_update_floppy_bank: floppy ROM is %s bank %i\n",
32913202           (to8_reg_sys1 & 0x80) ? "external" : "internal",
3292           bank % TO7_NB_FLOP_BANK );
3293#endif
3203           bank % TO7_NB_FLOP_BANK ));
32943204   memory_set_bank( THOM_FLOP_BANK, bank );
32953205   old_bank = bank;
32963206}
r1470r1471
33043214   if ( to8_reg_sys1 & 0x10 )
33053215   {
33063216      bank = to8_reg_ram & 31;
3307#if VERBOSE_BANK
33083217      if ( bank != to8_data_vpage )
3309         logerror( "to8_update_ram_bank: select bank %i (new style)\n", bank );
3310#endif
3218         LOG_BANK(( "to8_update_ram_bank: select bank %i (new style)\n", bank ));
33113219   }
33123220   else
33133221   {
r1470r1471
33273235         logerror( "to8_update_ram_bank: unknown RAM bank=$%02X\n", portb & 0xf8 );
33283236         return;
33293237      }
3330#if VERBOSE_BANK
33313238      if ( bank != to8_data_vpage )
3332         logerror( "to8_update_ram_bank: select bank %i (old style)\n", bank  );
3333#endif
3239         LOG_BANK(( "to8_update_ram_bank: select bank %i (old style)\n", bank  ));
33343240   }
33353241
33363242   /*  due to adressing distortion, the 16 KB banked memory space is
r1470r1471
33753281                      (to8_cart_vpage <= 4) ? to8_vcart_w :
33763282                      (write8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) :
33773283                      MWA8_NOP );
3378#if VERBOSE_BANK
33793284      if ( bank != old_bank )
3380         logerror( "to8_update_cart_bank: CART is RAM bank %i (write-enable=%i)\n", to8_cart_vpage, (to8_reg_cart & 0x40) ? 1 : 0 );
3381#endif
3285         LOG_BANK(( "to8_update_cart_bank: CART is RAM bank %i (write-enable=%i)\n", to8_cart_vpage, (to8_reg_cart & 0x40) ? 1 : 0 ));
33823286   }
33833287   else
33843288   {
r1470r1471
33873291      {
33883292         /* internal software ROM space */
33893293         bank = 4 + to8_soft_bank;
3390#if VERBOSE_BANK
33913294         if ( bank != old_bank )
3392            logerror( "to8_update_cart_bank: CART is internal bank %i\n",
3393                 to8_soft_bank );
3394#endif
3295            LOG_BANK(( "to8_update_cart_bank: CART is internal bank %i\n",
3296                 to8_soft_bank ));
33953297      }
33963298      else
33973299      {
r1470r1471
34033305
34043306         }
34053307
3406#if VERBOSE_BANK
34073308         if ( bank != old_bank )
3408            logerror( "to8_update_cart_bank: CART is external cartridge bank %i\n", thom_cart_bank );
3409#endif
3309            LOG_BANK(( "to8_update_cart_bank: CART is external cartridge bank %i\n", thom_cart_bank ));
34103310      }
34113311   }
34123312   memory_set_bank( THOM_CART_BANK, bank );
r1470r1471
35483448      res = 0;
35493449   }
35503450
3551#if VERBOSE_VIDEO
3552   logerror( "$%04x %f to8_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n",
3451   LOG_VIDEO(( "$%04x %f to8_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n",
35533452        activecpu_get_previouspc(), attotime_to_double(timer_get_time()),
3554        offset, 0xe7e4 + offset, res, to7_lightpen );
3555#endif
3453        offset, 0xe7e4 + offset, res, to7_lightpen ));
35563454
35573455   return res;
35583456}
r1470r1471
35613459
35623460WRITE8_HANDLER ( to8_gatearray_w )
35633461{
3564#if VERBOSE_VIDEO
3565   logerror( "$%04x %f to8_gatearray_w: off=%i ($%04X) data=$%02X\n",
3462   LOG_VIDEO(( "$%04x %f to8_gatearray_w: off=%i ($%04X) data=$%02X\n",
35663463        activecpu_get_previouspc(), attotime_to_double(timer_get_time()),
3567        offset, 0xe7e4 + offset, data );
3568#endif
3464        offset, 0xe7e4 + offset, data ));
35693465
35703466   switch ( offset )
35713467   {
r1470r1471
36443540
36453541WRITE8_HANDLER ( to8_vreg_w )
36463542{
3647#if VERBOSE_VIDEO
3648   logerror( "$%04x %f to8_vreg_w: off=%i ($%04X) data=$%02X\n",
3543   LOG_VIDEO(( "$%04x %f to8_vreg_w: off=%i ($%04X) data=$%02X\n",
36493544        activecpu_get_previouspc(), attotime_to_double(timer_get_time()),
3650        offset, 0xe7da + offset, data );
3651#endif
3545        offset, 0xe7da + offset, data ));
36523546
36533547   switch ( offset )
36543548   {
r1470r1471
37033597{
37043598   int ktest = to8_kbd_ktest ();
37053599
3706#if VERBOSE_KBD
3707   logerror( "$%04x %f: to8_sys_porta_in ktest=%i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), ktest );
3708#endif
3600   LOG_KBD(( "$%04x %f: to8_sys_porta_in ktest=%i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), ktest ));
37093601
37103602   return ktest;
37113603}
r1470r1471
37163608{
37173609   to9_update_centronics(); /* bits 0-1: printer */
37183610   to8_update_ram_bank();
3719#if VERBOSE
3611
37203612   if ( data & 4 ) /* bit 2: video overlay (TODO) */
3721      logerror( "to8_sys_portb_out: video overlay not handled\n" );
3722#endif
3613      LOG(( "to8_sys_portb_out: video overlay not handled\n" ));
37233614}
37243615
37253616
r1470r1471
40843975   if ( to8_reg_sys1 & 0x10 )
40853976   {
40863977      bank = to8_reg_ram & 7; /* 128 KB RAM only = 8 pages */
4087#if VERBOSE_BANK
40883978      if ( bank != to8_data_vpage )
4089         logerror( "mo6_update_ram_bank: select bank %i (new style)\n", bank );
4090#endif
3979         LOG_BANK(( "mo6_update_ram_bank: select bank %i (new style)\n", bank ));
40913980   }
40923981   to8_data_vpage = bank;
40933982   memory_set_bank( TO8_DATA_LO, to8_data_vpage );
r1470r1471
41154004         memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0,
41164005                         (to8_reg_cart & 0x40) ? (to8_cart_vpage <= 4) ? to8_vcart_w :
41174006                         (write8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) : MWA8_NOP );
4118#if VERBOSE_BANK
41194007         if ( bank != old_bank )
4120            logerror( "mo6_update_cart_bank: CART is RAM bank %i (write-enable=%i)\n", to8_cart_vpage, (to8_reg_cart & 0x40) ? 1 : 0 );
4121#endif
4008            LOG_BANK(( "mo6_update_cart_bank: CART is RAM bank %i (write-enable=%i)\n", to8_cart_vpage, (to8_reg_cart & 0x40) ? 1 : 0 ));
41224009      }
41234010      else if ( thom_cart_nb_banks == 4 )
41244011      {
41254012         /* "JANE"-style cartridge bank switching */
41264013         memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, MWA8_NOP );
41274014         bank = mo5_reg_cart & 3;
4128#if VERBOSE_BANK
41294015         if ( bank != old_bank )
4130            logerror( "mo6_update_cart_bank: CART is external cartridge bank %i (A7CB style)\n", bank );
4131#endif
4016            LOG_BANK(( "mo6_update_cart_bank: CART is external cartridge bank %i (A7CB style)\n", bank ));
41324017      }
41334018      else
41344019      {
r1470r1471
41384023         bank = 8 + to8_cart_vpage;
41394024         memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, write_enable ?
41404025                         (write8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) :  MWA8_NOP );
4141#if VERBOSE_BANK
41424026         if ( bank != old_bank )
4143            logerror( "mo6_update_cart_bank: CART is RAM bank %i (write-enable=%i) (MO5 compat.)\n", to8_cart_vpage, write_enable ? 1 : 0 );
4144#endif
4027            LOG_BANK(( "mo6_update_cart_bank: CART is RAM bank %i (write-enable=%i) (MO5 compat.)\n", to8_cart_vpage, write_enable ? 1 : 0 ));
41454028      }
41464029   }
41474030   else
r1470r1471
41554038            bank = b + 6; /* BASIC 128 */
41564039         else
41574040            bank = b + 4;                      /* BASIC 1 */
4158#if VERBOSE_BANK
41594041         if ( bank != old_bank )
4160            logerror( "mo6_update_cart_bank: CART is internal ROM bank %i\n", b );
4161#endif
4042            LOG_BANK(( "mo6_update_cart_bank: CART is internal ROM bank %i\n", b ));
41624043      }
41634044      else
41644045      {
r1470r1471
41694050            bank = thom_cart_bank % thom_cart_nb_banks;
41704051            memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xbffc, 0xbfff, 0, 0, mo6_cartridge_r );
41714052         }
4172#if VERBOSE_BANK
41734053         if ( bank != old_bank )
4174            logerror( "mo6_update_cart_bank: CART is external cartridge bank %i\n", bank );
4175#endif
4054            LOG_BANK(( "mo6_update_cart_bank: CART is external cartridge bank %i\n", bank ));
41764055      }
41774056   }
41784057
r1470r1471
44284307      res = 0;
44294308   }
44304309
4431#if VERBOSE_VIDEO
4432   logerror( "$%04x %f mo6_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n",
4310   LOG_VIDEO(( "$%04x %f mo6_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n",
44334311        activecpu_get_previouspc(), attotime_to_double(timer_get_time()),
4434        offset, 0xa7e4 + offset, res, to7_lightpen );
4435#endif
4312        offset, 0xa7e4 + offset, res, to7_lightpen ));
44364313
44374314   return res;
44384315}
r1470r1471
44414318
44424319WRITE8_HANDLER ( mo6_gatearray_w )
44434320{
4444#if VERBOSE_VIDEO
4445   logerror( "$%04x %f mo6_gatearray_w: off=%i ($%04X) data=$%02X\n",
4321   LOG_VIDEO(( "$%04x %f mo6_gatearray_w: off=%i ($%04X) data=$%02X\n",
44464322        activecpu_get_previouspc(), attotime_to_double(timer_get_time()),
4447        offset, 0xa7e4 + offset, data );
4448#endif
4323        offset, 0xa7e4 + offset, data ));
44494324
44504325   switch ( offset )
44514326   {
r1470r1471
45104385
45114386WRITE8_HANDLER ( mo6_vreg_w )
45124387{
4513#if VERBOSE_VIDEO
4514   logerror( "$%04x %f mo6_vreg_w: off=%i ($%04X) data=$%02X\n",
4388   LOG_VIDEO(( "$%04x %f mo6_vreg_w: off=%i ($%04X) data=$%02X\n",
45154389        activecpu_get_previouspc(), attotime_to_double(timer_get_time()),
4516        offset, 0xa7da + offset, data );
4517#endif
4390        offset, 0xa7da + offset, data ));
45184391
45194392   switch ( offset )
45204393   {
src/mess/machine/rriot.c
r1470r1471
1313#include "driver.h"
1414#include "rriot.h"
1515
16#if 0
17#define LOG(a) logerror(a)
18#else
19#define LOG(a) ((void) 0)
20#endif
16#define VERBOSE 0
2117
18#define LOG(a) do { if (VERBOSE) logerror a; } while (0)
19
2220/*
2321  riot 6530
2422
r1470r1471
8179   rriot[nr].config = config;
8280   rriot[nr].timer = timer_alloc(rriot_timer_cb, NULL);
8381
84    LOG("RRIOT - successfully initialised\n");
82    LOG(("RRIOT - successfully initialised\n"));
8583}
8684
8785void rriot_reset(int nr)
src/mess/machine/astrocde.c
r1470r1471
1010#include "cpu/z80/z80.h"
1111#include "includes/astrocde.h"
1212
13#ifdef MAME_DEBUG
14#define VERBOSE 1
15#else
16#define VERBOSE 0
17#endif
18#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
19
20
1321/****************************************************************************
1422 * Scanline Interrupt System
1523 ****************************************************************************/
r1470r1471
3947   lightpen_interrupts_enabled = data & 0x02;
4048   lightpen_interrupt_mode = data & 0x01;
4149
42#ifdef MAME_DEBUG
43    logerror("Interrupt Flag set to %02x\n",data & 0x0f);
44#endif
50       LOG(("Interrupt Flag set to %02x\n",data & 0x0f));
4551}
4652
4753WRITE8_HANDLER ( astrocade_interrupt_w )
4854{
4955   /* A write to 0F triggers an interrupt at that scanline */
5056
51#ifdef MAME_DEBUG
52   logerror("Scanline interrupt set to %02x\n",data);
53#endif
57   LOG(("Scanline interrupt set to %02x\n",data));
5458
5559    NextScanInt = data;
5660}
src/mess/machine/sst39vfx.c
r1470r1471
1212#include "sst39vfx.h"
1313
1414#define LOG_LEVEL  1
15#define _logerror(level,...)  if (LOG_LEVEL > level) logerror(__VA_ARGS__)
15#define _logerror(level,x)  if (LOG_LEVEL > level) logerror x
1616
1717typedef struct
1818{
r1470r1471
2727
2828void sst39vfx_init( int type, int cpu_datawidth, int cpu_endianess)
2929{
30   _logerror( 0, "sst39vfx_init (%d)\n", type);
30   _logerror( 0, ("sst39vfx_init (%d)\n", type));
3131   memset( &flash, 0, sizeof( flash));
3232   switch (type)
3333   {
r1470r1471
4545
4646void sst39vfx_exit( void)
4747{
48   _logerror( 0, "sst39vfx_exit\n");
48   _logerror( 0, ("sst39vfx_exit\n"));
4949   free( flash.data);
5050}
5151
5252void sst39vfx_reset( void)
5353{
54   _logerror( 0, "sst39vfx_reset\n");
54   _logerror( 0, ("sst39vfx_reset\n"));
5555}
5656
5757static void sst39vfx_state_save( void)
r1470r1471
7878/*
7979READ8_HANDLER( sst39vfx_r )
8080{
81   _logerror( 1, "sst39vfx_r (%08X)\n", offset);
81   _logerror( 1, ("sst39vfx_r (%08X)\n", offset));
8282   if (flash.swap) offset = OFFSET_SWAP( offset, flash.swap);
8383   return flash.data[offset];
8484}
r1470r1471
8787/*
8888WRITE8_HANDLER( sst39vfx_w )
8989{
90   _logerror( 1, "sst39vfx_w (%08X/%02X)\n", offset, data);
90   _logerror( 1, ("sst39vfx_w (%08X/%02X)\n", offset, data));
9191   if (flash.swap) offset = OFFSET_SWAP( offset, flash.swap);
9292   flash.data[offset] = data;
9393}
r1470r1471
107107
108108void sst39vfx_load( mame_file *file)
109109{
110   _logerror( 0, "sst39vfx_load (%p)\n", file);
110   _logerror( 0, ("sst39vfx_load (%p)\n", file));
111111   mame_fread( file, flash.data, flash.size);
112112   if (flash.swap) sst39vfx_swap();
113113}
114114
115115void sst39vfx_save( mame_file *file)
116116{
117   _logerror( 0, "sst39vfx_save (%p)\n", file);
117   _logerror( 0, ("sst39vfx_save (%p)\n", file));
118118   if (flash.swap) sst39vfx_swap();
119119   mame_fwrite( file, flash.data, flash.size);
120120   if (flash.swap) sst39vfx_swap();
r1470r1471
123123/*
124124NVRAM_HANDLER( sst39vfx )
125125{
126   _logerror( 0, "nvram_handler_sst39vfx (%p/%d)\n", file, read_or_write);
126   _logerror( 0, ("nvram_handler_sst39vfx (%p/%d)\n", file, read_or_write));
127127   if (read_or_write)
128128   {
129129      sst39vfx_save( file);
src/mess/machine/ay3600.c
r1470r1471
2020#include "includes/apple2.h"
2121
2222#ifdef MAME_DEBUG
23#define LOG(x)   logerror x
23#define VERBOSE 1
2424#else
25#define LOG(x)
25#define VERBOSE 0
2626#endif /* MAME_DEBUG */
2727
28#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
29
2830static TIMER_CALLBACK(AY3600_poll);
2931
3032static int AY3600_keyboard_queue_chars(const unicode_char *text, size_t text_len);
src/mess/machine/mekd2.c
r1470r1471
1313
1414#include "includes/mekd2.h"
1515
16#ifndef VERBOSE
17#define VERBOSE 1
18#endif
16#define VERBOSE 0
17#define LOG(x)   do { if (VERBOSE) logerror x; } while (0)
1918
20#if VERBOSE
21#define LOG(x)   logerror(x)
22#else
23#define LOG(x)                     /* x */
24#endif
25
2619DRIVER_INIT( mekd2 )
2720{
2821   UINT8 *dst;
r1470r1471
585578   image_fread(image, &size, 2);
586579   size = LITTLE_ENDIANIZE_INT16(size);
587580   image_fread(image, &ident, 1);
588/*         LOG(( "mekd2_rom_load: $%04X $%04X $%02X\n", addr, size, ident)); */
581   LOG(( "mekd2_rom_load: $%04X $%04X $%02X\n", addr, size, ident));
589582   while (size-- > 0)
590583      image_fread(image, &RAM[addr++], 1);
591584
src/mess/machine/vc20.c
r1470r1471
284284
285285static WRITE8_HANDLER( vc20_via1_write_portb )
286286{
287/*  if( errorlog ) fprintf(errorlog, "via1_write_portb: $%02X\n", data); */
287/*  logerror("via1_write_portb: $%02X\n", data); */
288288   vc20_tape_write (data & 8 ? 1 : 0);
289289   via1_portb = data;
290290}
src/mess/machine/mc6843.c
r1470r1471
9595
9696
9797
98#if VERBOSE
99static const char* mc6843_cmd[16] =
98static const char *const mc6843_cmd[16] =
10099{
101100   "---", "---", "STZ", "SEK", "SSR", "SSW", "RCR", "SWD",
102101   "---", "---", "FFR", "FFW", "MSR", "MSW", "---", "---",
103102};
104#endif
105103
106104
107105/******************* utility function and macros ********************/
108106
109#if VERBOSE
110#define LOG(x)  logerror x
111#else
112#define LOG(x)
113#endif
107#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
114108
115109
116110
src/mess/machine/ibmpc.c
r1470r1471
99
1010#define VERBOSE_DBG 0       /* general debug messages */
1111
12#if VERBOSE_DBG
1312#define DBG_LOG(N,M,A) \
14   if(VERBOSE_DBG>=N){ if( M )logerror("%11.6f: %-24s",timer_get_time(),(char*)M ); logerror A; }
15#else
16#define DBG_LOG(n,m,a)
17#endif
13   if(VERBOSE_DBG>=N){ if( M )logerror("%11.6f: %-24s",attotime_to_double(timer_get_time()),(char*)M ); logerror A; }
1814
19#if VERBOSE_PIO
2015#define PIO_LOG(N,M,A) \
21   if(VERBOSE_PIO>=N){ if( M )logerror("%11.6f: %-24s",timer_get_time(),(char*)M ); logerror A; }
22#else
23#define PIO_LOG(n,m,a)
24#endif
16   if(VERBOSE_PIO>=N){ if( M )logerror("%11.6f: %-24s",attotime_to_double(timer_get_time()),(char*)M ); logerror A; }
2517
2618/*
2719ibm xt bios
src/mess/machine/cbmdrive.c
r1470r1471
505505  */
506506void c1551_state (CBM_Drive * c1551)
507507{
508#if VERBOSE_DBG
509508   static int oldstate;
510509
511510   oldstate = c1551->i.iec.state;
512#endif
513511
514512   switch (c1551->i.iec.state)
515513   {
r1470r1471
670668      }
671669      break;
672670   }
673#if VERBOSE_DBG
671
674672   if (oldstate != c1551->i.iec.state)
675      logerror ("state %d->%d %d\n", oldstate, c1551->i.iec.state, c1551->state);
676#endif
673      if (VERBOSE_DBG >= 1) logerror("state %d->%d %d\n", oldstate, c1551->i.iec.state, c1551->state);
677674}
678675
679676static int vc1541_time_greater(CBM_Drive * vc1541, attotime threshold)
r1470r1471
685682
686683void vc1541_state (CBM_Drive * vc1541)
687684{
688#if VERBOSE_DBG
689685   int oldstate = vc1541->i.serial.state;
690686
691#endif
692
693687   switch (vc1541->i.serial.state)
694688   {
695689   case 0:
r1470r1471
12871281      vc1541->i.serial.state = 0;
12881282      break;
12891283   }
1290#if VERBOSE_DBG
1284
12911285   if (oldstate != vc1541->i.serial.state)
1292      logerror ("%d state %d->%d %d %s %s %s\n",
1286      if (VERBOSE_DBG >= 1) logerror("%d state %d->%d %d %s %s %s\n",
12931287             vc1541->i.serial.device,
12941288             oldstate,
12951289             vc1541->i.serial.state, vc1541->state,
12961290             cbm_serial.atn[0] ? "ATN" : "atn",
12971291             cbm_serial.clock[0] ? "CLOCK" : "clock",
12981292             cbm_serial.data[0] ? "DATA" : "data");
1299#endif
13001293}
13011294
13021295/* difference between vic20 and pet (first series)
r1470r1471
13041297
13051298void c2031_state(CBM_Drive *drive)
13061299{
1307#if VERBOSE_DBG
13081300   int oldstate = drive->i.ieee.state;
1309#endif
13101301   int data;
13111302
13121303   switch (drive->i.ieee.state)
r1470r1471
14461437      break;
14471438   }
14481439
1449#if VERBOSE_DBG
14501440   if (oldstate != drive->i.ieee.state)
1451      logerror("%d state %d->%d %d\n",
1441      if (VERBOSE_DBG >= 1) logerror("%d state %d->%d %d\n",
14521442             drive->i.ieee.device,
14531443             oldstate,
14541444             drive->i.ieee.state, drive->state
14551445             );
1456#endif
14571446}
src/mess/machine/z80dart.c
r1470r1471
2020
2121#define VERBOSE      1
2222
23#if VERBOSE
24#define VPRINTF(x) logerror x
25#else
26#define VPRINTF(x)
27#endif
23#define VPRINTF(x) do { if (VERBOSE) logerror x; } while (0)
2824
2925
3026
src/mess/machine/microtan.c
r1470r1471
2121#define VERBOSE 0
2222#endif
2323
24#if VERBOSE
25#define LOG(x)  logerror x
26#else
27#define LOG(x)  /* x */
28#endif
24#define LOG(x)  do { if (VERBOSE) logerror x; } while (0)
2925
3026static UINT8 microtan_keypad_column;
3127static UINT8 microtan_keyboard_ascii;
r1470r1471
290286/**************************************************************
291287 * VIA read wrappers
292288 **************************************************************/
293#if VERBOSE
289
294290static const char *const via_name[16] = {
295291    "PB  ","PA  ","DDRB","DDRA",
296292    "T1CL","T1CH","T1LL","T1LH",
297293    "T2CL","T2CH","SR  ","ACR ",
298294    "PCR ","IFR ","IER ","PANH"
299295};
300#endif
301296
302297 READ8_HANDLER( microtan_via_0_r )
303298{
r1470r1471
357352{
358353   double level = cassette_input(cassette_device_image());
359354
360   LOG(("microtan_read_cassette: %+5d\n", level));
355   LOG(("microtan_read_cassette: %g\n", level));
361356   if (level < -0.07)
362357      via_set_input_cb2(0,0);
363358   else if (level > +0.07)
src/mess/machine/sms.c
r1470r1471
66#include "sound/2413intf.h"
77#include "machine/eeprom.h"
88
9#define VERBOSE 0
10#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
11
912#define CF_CODEMASTERS_MAPPER   0x01
1013#define CF_KOREAN_MAPPER   0x02
1114#define CF_93C46_EEPROM      0x04
r1470r1471
375378         if (data & 0x08) { /* it's ram */
376379            sms_cartridge[sms_current_cartridge].sram_save = 1;         /* SRAM should be saved on exit. */
377380            if (data & 0x04) {
378#ifdef LOG_PAGING
379               logerror("ram 1 paged.\n");
380#endif
381               LOG(("ram 1 paged.\n"));
381382               SOURCE = sms_cartridge[sms_current_cartridge].cartSRAM + 0x4000;
382383            } else {
383#ifdef LOG_PAGING
384               logerror("ram 0 paged.\n");
385#endif
384               LOG(("ram 0 paged.\n"));
386385               SOURCE = sms_cartridge[sms_current_cartridge].cartSRAM;
387386            }
388387            memory_set_bankptr( 4, SOURCE );
r1470r1471
395394               page = (smsBiosPageCount > 0) ? sms_mapper[3] % smsBiosPageCount : 0;
396395               SOURCE = sms_banking_bios[4];
397396            }
398#ifdef LOG_PAGING
399            logerror("rom 2 paged in %x.\n", page);
400#endif
397            LOG(("rom 2 paged in %x.\n", page));
401398            memory_set_bankptr( 4, SOURCE );
402399            memory_set_bankptr( 5, SOURCE + 0x2000 );
403400         }
404401         break;
405402      case 1: /* Select 16k ROM bank for 0400-3FFF */
406#ifdef LOG_PAGING
407         logerror("rom 0 paged in %x.\n", page);
408#endif
403         LOG(("rom 0 paged in %x.\n", page));
409404         sms_banking_bios[2] = SOURCE_BIOS + 0x0400;
410405         sms_banking_cart[2] = SOURCE_CART + 0x0400;
411406         if ( IS_GAMEGEAR ) {
r1470r1471
414409         memory_set_bankptr( 2, SOURCE + 0x0400 );
415410         break;
416411      case 2: /* Select 16k ROM bank for 4000-7FFF */
417#ifdef LOG_PAGING
418         logerror("rom 1 paged in %x.\n", page);
419#endif
412         LOG(("rom 1 paged in %x.\n", page));
420413         sms_banking_bios[3] = SOURCE_BIOS;
421414         sms_banking_cart[3] = SOURCE_CART;
422415         if ( IS_GAMEGEAR ) {
r1470r1471
437430            sms_banking_cart[4] = SOURCE_CART;
438431         }
439432         if ( ! ( sms_mapper[0] & 0x08 ) ) { /* is RAM disabled? */
440#ifdef LOG_PAGING
441            logerror("rom 2 paged in %x.\n", page);
442#endif
433            LOG(("rom 2 paged in %x.\n", page));
443434            memory_set_bankptr( 4, SOURCE );
444435            memory_set_bankptr( 5, SOURCE + 0x2000 );
445436         }
r1470r1471
500491      sms_banking_cart[4] = sms_cartridge[sms_current_cartridge].ROM + page * 0x4000;
501492      memory_set_bankptr( 4, sms_banking_cart[4] );
502493      memory_set_bankptr( 5, sms_banking_cart[4] + 0x2000 );
503#ifdef LOG_PAGING
504      logerror("rom 2 paged in %x dodgeball king.\n", page);
505#endif
494      LOG(("rom 2 paged in %x dodgeball king.\n", page));
506495   }
507496}
508497
r1470r1471
525514         sms_banking_cart[4] = sms_cartridge[sms_current_cartridge].ROM + page * 0x4000;
526515         memory_set_bankptr( 4, sms_banking_cart[4] );
527516         memory_set_bankptr( 5, sms_banking_cart[4] + 0x2000 );
528#ifdef LOG_PAGING
529         logerror("rom 2 paged in %x codemasters.\n", page);
530#endif
517         LOG(("rom 2 paged in %x codemasters.\n", page));
531518      } else if ( sms_cartridge[sms_current_cartridge].features & CF_ONCART_RAM ) {
532519         sms_cartridge[sms_current_cartridge].cartRAM[offset & ( sms_cartridge[sms_current_cartridge].ram_size - 1 ) ] = data;
533520      } else {
src/mess/machine/cybiko.c
r1470r1471
5555#endif
5656
5757#define LOG_LEVEL  1
58#define _logerror(level,...)  if (LOG_LEVEL > level) logerror(__VA_ARGS__)
58#define _logerror(level,x)  if (LOG_LEVEL > level) logerror x
5959
6060/////////////////////////
6161// FUNCTION PROTOTYPES //
r1470r1471
8787
8888DRIVER_INIT( cybikov1 )
8989{
90   _logerror( 0, "init_cybikov1\n");
90   _logerror( 0, ("init_cybikov1\n"));
9191   init_ram_handler( 0x200000, mess_ram_size, 0x200000);
9292}
9393
9494DRIVER_INIT( cybikov2 )
9595{
96   _logerror( 0, "init_cybikov2\n");
96   _logerror( 0, ("init_cybikov2\n"));
9797   init_ram_handler( 0x200000, mess_ram_size, 0x200000);
9898}
9999
100100DRIVER_INIT( cybikoxt )
101101{
102   _logerror( 0, "init_cybikoxt\n");
102   _logerror( 0, ("init_cybikoxt\n"));
103103   init_ram_handler( 0x400000, mess_ram_size, 0x200000);
104104}
105105
r1470r1471
110110/*
111111NVRAM_HANDLER( cybikov1 )
112112{
113   _logerror( 0, "nvram_handler_cybikov1 (%p/%d)\n", file, read_or_write);
113   _logerror( 0, ("nvram_handler_cybikov1 (%p/%d)\n", file, read_or_write));
114114   nvram_handler_at45dbxx( machine, file, read_or_write);
115115   nvram_handler_pcf8593( machine, file, read_or_write);
116116}
r1470r1471
119119/*
120120NVRAM_HANDLER( cybikov2 )
121121{
122   _logerror( 0, "nvram_handler_cybikov2 (%p/%d)\n", file, read_or_write);
122   _logerror( 0, ("nvram_handler_cybikov2 (%p/%d)\n", file, read_or_write));
123123   nvram_handler_at45dbxx( machine, file, read_or_write);
124124   nvram_handler_sst39vfx( machine, file, read_or_write);
125125   nvram_handler_pcf8593( machine, file, read_or_write);
r1470r1471
129129/*
130130NVRAM_HANDLER( cybikoxt )
131131{
132   _logerror( 0, "nvram_handler_cybikoxt (%p/%d)\n", file, read_or_write);
132   _logerror( 0, ("nvram_handler_cybikoxt (%p/%d)\n", file, read_or_write));
133133   nvram_handler_sst39vfx( machine, file, read_or_write);
134134   nvram_handler_pcf8593( machine, file, read_or_write);
135135}
r1470r1471
184184
185185MACHINE_START( cybikov1 )
186186{
187   _logerror( 0, "machine_start_cybikov1\n");
187   _logerror( 0, ("machine_start_cybikov1\n"));
188188   // real-time clock
189189   pcf8593_init();
190190   nvram_system_load( machine, "rtc", pcf8593_load, 0);
r1470r1471
199199
200200MACHINE_START( cybikov2 )
201201{
202   _logerror( 0, "machine_start_cybikov2\n");
202   _logerror( 0, ("machine_start_cybikov2\n"));
203203   // real-time clock
204204   pcf8593_init();
205205   nvram_system_load( machine, "rtc", pcf8593_load, 0);
r1470r1471
218218
219219MACHINE_START( cybikoxt )
220220{
221   _logerror( 0, "machine_start_cybikoxt\n");
221   _logerror( 0, ("machine_start_cybikoxt\n"));
222222   // real-time clock
223223   pcf8593_init();
224224   nvram_system_load( machine, "rtc", pcf8593_load, 0);
r1470r1471
238238
239239MACHINE_RESET( cybikov1 )
240240{
241   _logerror( 0, "machine_reset_cybikov1\n");
241   _logerror( 0, ("machine_reset_cybikov1\n"));
242242   pcf8593_reset();
243243   at45dbxx_reset();
244244   cybiko_rs232_reset();
r1470r1471
246246
247247MACHINE_RESET( cybikov2 )
248248{
249   _logerror( 0, "machine_reset_cybikov2\n");
249   _logerror( 0, ("machine_reset_cybikov2\n"));
250250   pcf8593_reset();
251251   at45dbxx_reset();
252252   sst39vfx_reset();
r1470r1471
255255
256256MACHINE_RESET( cybikoxt )
257257{
258   _logerror( 0, "machine_reset_cybikoxt\n");
258   _logerror( 0, ("machine_reset_cybikoxt\n"));
259259   pcf8593_reset();
260260   sst39vfx_reset();
261261   cybiko_rs232_reset();
r1470r1471
267267
268268MACHINE_STOP( cybikov1 )
269269{
270   _logerror( 0, "machine_stop_cybikov1\n");
270   _logerror( 0, ("machine_stop_cybikov1\n"));
271271   // real-time clock
272272   nvram_system_save( machine, "rtc", pcf8593_save);
273273   pcf8593_exit();
r1470r1471
280280
281281MACHINE_STOP( cybikov2 )
282282{
283   _logerror( 0, "machine_stop_cybikov2\n");
283   _logerror( 0, ("machine_stop_cybikov2\n"));
284284   // real-time clock
285285   nvram_system_save( machine, "rtc", pcf8593_save);
286286   pcf8593_exit();
r1470r1471
296296
297297MACHINE_STOP( cybikoxt )
298298{
299   _logerror( 0, "machine_stop_cybikoxt\n");
299   _logerror( 0, ("machine_stop_cybikoxt\n"));
300300   // real-time clock
301301   nvram_system_save( machine, "rtc", pcf8593_save);
302302   pcf8593_exit();
r1470r1471
328328
329329static void cybiko_rs232_init( void)
330330{
331   _logerror( 0, "cybiko_rs232_init\n");
331   _logerror( 0, ("cybiko_rs232_init\n"));
332332   memset( &rs232, 0, sizeof( rs232));
333333//   timer_pulse( TIME_IN_HZ( 10), NULL, 0, rs232_timer_callback);
334334}
335335
336336static void cybiko_rs232_exit( void)
337337{
338   _logerror( 0, "cybiko_rs232_exit\n");
338   _logerror( 0, ("cybiko_rs232_exit\n"));
339339}
340340
341341static void cybiko_rs232_reset( void)
342342{
343   _logerror( 0, "cybiko_rs232_reset\n");
343   _logerror( 0, ("cybiko_rs232_reset\n"));
344344}
345345
346346static void cybiko_rs232_write_byte( UINT8 data)
r1470r1471
352352
353353static void cybiko_rs232_pin_sck( int data)
354354{
355   _logerror( 3, "cybiko_rs232_pin_sck (%d)\n", data);
355   _logerror( 3, ("cybiko_rs232_pin_sck (%d)\n", data));
356356   // clock high-to-low
357357   if ((rs232.pin.sck == 1) && (data == 0))
358358   {
r1470r1471
380380
381381static void cybiko_rs232_pin_txd( int data)
382382{
383   _logerror( 3, "cybiko_rs232_pin_txd (%d)\n", data);
383   _logerror( 3, ("cybiko_rs232_pin_txd (%d)\n", data));
384384   rs232.pin.txd = data;
385385}
386386
387387static int cybiko_rs232_pin_rxd( void)
388388{
389   _logerror( 3, "cybiko_rs232_pin_rxd\n");
389   _logerror( 3, ("cybiko_rs232_pin_rxd\n"));
390390   return rs232.pin.rxd;
391391}
392392
r1470r1471
417417{
418418   UINT8 data = 0xFF;
419419   int i;
420   _logerror( 2, "cybiko_key_r_byte (%08X)\n", offset);
420   _logerror( 2, ("cybiko_key_r_byte (%08X)\n", offset));
421421   // A11
422422   if (!(offset & (1 << 11))) data &= 0xFE;
423423   // A1 .. A9
r1470r1471
431431READ16_HANDLER( cybiko_key_r )
432432{
433433   UINT16 data = 0;
434   _logerror( 2, "cybiko_key_r (%08X/%04X)\n", offset, mem_mask);
434   _logerror( 2, ("cybiko_key_r (%08X/%04X)\n", offset, mem_mask));
435435   if ACCESSING_MSB16 data = data | (cybiko_key_r_byte( offset * 2 + 0) << 8);
436436   if ACCESSING_LSB16 data = data | (cybiko_key_r_byte( offset * 2 + 1) << 0);
437   _logerror( 2, "%04X\n", data);
437   _logerror( 2, ("%04X\n", data));
438438   return data;
439439}
440440
441441READ8_HANDLER( cybiko_io_reg_r )
442442{
443443   UINT8 data = 0;
444   _logerror( 2, "cybiko_io_reg_r (%08X)\n", offset);
444   _logerror( 2, ("cybiko_io_reg_r (%08X)\n", offset));
445445   switch (offset)
446446   {
447447      // keyboard
r1470r1471
474474
475475WRITE8_HANDLER( cybiko_io_reg_w )
476476{
477   _logerror( 2, "cybiko_io_reg_w (%08X/%02X)\n", offset, data);
477   _logerror( 2, ("cybiko_io_reg_w (%08X/%02X)\n", offset, data));
478478   switch (offset)
479479   {
480480      // speaker
r1470r1471
502502
503503READ8_HANDLER( cybikov1_io_reg_r )
504504{
505   _logerror( 2, "cybikov1_io_reg_r (%08X)\n", offset);
505   _logerror( 2, ("cybikov1_io_reg_r (%08X)\n", offset));
506506   return cybiko_io_reg_r( offset);
507507}
508508
509509READ8_HANDLER( cybikov2_io_reg_r )
510510{
511   _logerror( 2, "cybikov2_io_reg_r (%08X)\n", offset);
511   _logerror( 2, ("cybikov2_io_reg_r (%08X)\n", offset));
512512   return cybiko_io_reg_r( offset);
513513}
514514
515515READ8_HANDLER( cybikoxt_io_reg_r )
516516{
517517   UINT8 data = 0;
518   _logerror( 2, "cybikoxt_io_reg_r (%08X)\n", offset);
518   _logerror( 2, ("cybikoxt_io_reg_r (%08X)\n", offset));
519519   switch (offset)
520520   {
521521      // rs232
r1470r1471
528528
529529WRITE8_HANDLER( cybikov1_io_reg_w )
530530{
531   _logerror( 2, "cybikov1_io_reg_w (%08X/%02X)\n", offset, data);
531   _logerror( 2, ("cybikov1_io_reg_w (%08X/%02X)\n", offset, data));
532532   cybiko_io_reg_w( offset, data);
533533}
534534
535535WRITE8_HANDLER( cybikov2_io_reg_w )
536536{
537   _logerror( 2, "cybikov2_io_reg_w (%08X/%02X)\n", offset, data);
537   _logerror( 2, ("cybikov2_io_reg_w (%08X/%02X)\n", offset, data));
538538   cybiko_io_reg_w( offset, data);
539539}
540540
541541WRITE8_HANDLER( cybikoxt_io_reg_w )
542542{
543   _logerror( 2, "cybikoxt_io_reg_w (%08X/%02X)\n", offset, data);
543   _logerror( 2, ("cybikoxt_io_reg_w (%08X/%02X)\n", offset, data));
544544   switch (offset)
545545   {
546546      // rs232
src/mess/machine/trs80.c
r1470r1471
1818#define VERBOSE 0
1919#endif
2020
21#if VERBOSE
22#define LOG(x)   logerror x
23#else
24#define LOG(x)
25#endif
21#define LOG(x)   do { if (VERBOSE) logerror x; } while (0)
2622
2723
2824UINT8 trs80_port_ff = 0;
src/mess/machine/apple2.c
r1470r1471
2626#include "profiler.h"
2727
2828#ifdef MAME_DEBUG
29#define LOG(x)   logerror x
29#define VERBOSE 1
3030#else
31#define LOG(x)
31#define VERBOSE 0
3232#endif /* MAME_DEBUG */
3333
34#define LOG(x)   do { if (VERBOSE) logerror x; } while (0)
35
3436#define PROFILER_C00X   PROFILER_USER2
3537#define PROFILER_C01X   PROFILER_USER2
3638#define PROFILER_C08X   PROFILER_USER2
src/mess/machine/msm8251.c
r1470r1471
33#include "includes/msm8251.h"
44#include "includes/serial.h"
55
6/* uncomment to enable verbose comments */
7#define VERBOSE
6#define VERBOSE 1
87
9#ifdef VERBOSE
10#define LOG(x)   logerror("MSM8251: "x)
11#else
12#define LOG(x)
13#endif
8#define LOG(x)   do { if (VERBOSE) logerror x; } while (0)
149
1510static struct msm8251 uart;
1611static void msm8251_receive_character(UINT8 ch);
r1470r1471
198193
199194void   msm8251_reset(void)
200195{
201   LOG("MSM8251 Reset\n");
196   LOG(("MSM8251: Reset\n"));
202197
203198   /* what is the default setup when the 8251 has been reset??? */
204199
r1470r1471
239234   {
240235      if (uart.flags & MSM8251_EXPECTING_SYNC_BYTE)
241236      {
242         LOG("Sync byte\n");
237         LOG(("MSM8251: Sync byte\n"));
243238
244#ifdef VERBOSE
245         logerror("Sync byte: %02x\n", data);
246#endif
239         LOG(("Sync byte: %02x\n", data));
247240         /* store sync byte written */
248241         uart.sync_bytes[uart.sync_byte_offset] = data;
249242         uart.sync_byte_offset++;
r1470r1471
258251      }
259252      else
260253      {
261         LOG("Mode byte\n");
254         LOG(("MSM8251: Mode byte\n"));
262255
263256         uart.mode_byte = data;
264257
r1470r1471
290283                  3 = x64
291284            */
292285
293            LOG("Asynchronous operation\n");
286            LOG(("MSM8251: Asynchronous operation\n"));
294287
295#ifdef VERBOSE
296                logerror("Character length: %d\n", (((data>>2) & 0x03)+5));
288            LOG(("Character length: %d\n", (((data>>2) & 0x03)+5)));
297289
298290            if (data & (1<<4))
299291            {
300               logerror("enable parity checking\n");
292               LOG(("enable parity checking\n"));
301293            }
302294            else
303295            {
304               logerror("parity check disabled\n");
296               LOG(("parity check disabled\n"));
305297            }
306298
307299            if (data & (1<<5))
308300            {
309               logerror("even parity\n");
301               LOG(("even parity\n"));
310302            }
311303            else
312304            {
313               logerror("odd parity\n");
305               LOG(("odd parity\n"));
314306            }
315307
316308            {
r1470r1471
323315                  case 0:
324316                  {
325317                     /* inhibit */
326                     logerror("stop bit: inhibit\n");
318                     LOG(("stop bit: inhibit\n"));
327319                  }
328320                  break;
329321
330322                  case 1:
331323                  {
332324                     /* 1 */
333                     logerror("stop bit: 1 bit\n");
325                     LOG(("stop bit: 1 bit\n"));
334326                  }
335327                  break;
336328
337329                  case 2:
338330                  {
339331                     /* 1.5 */
340                     logerror("stop bit: 1.5 bits\n");
332                     LOG(("stop bit: 1.5 bits\n"));
341333                  }
342334                  break;
343335
344336                  case 3:
345337                  {
346338                     /* 2 */
347                     logerror("stop bit: 2 bits\n");
339                     LOG(("stop bit: 2 bits\n"));
348340                  }
349341                  break;
350342               }
351343            }
352#endif
353344
354345            uart.data_form.word_length = ((data>>2) & 0x03)+5;
355346            uart.data_form.parity = SERIAL_PARITY_NONE;
r1470r1471
408399                  3 = 8 bits
409400               bit 1,0 = 0
410401            */
411            LOG("Synchronous operation\n");
402            LOG(("MSM8251: Synchronous operation\n"));
412403
413404            /* setup for sync byte(s) */
414405            uart.flags |= MSM8251_EXPECTING_SYNC_BYTE;
r1470r1471
428419   else
429420   {
430421      /* command */
431      LOG("Command byte\n");
422      LOG(("MSM8251: Command byte\n"));
432423
433424      uart.command = data;
434#ifdef VERBOSE
435      logerror("Command byte: %02x\n", data);
436425
426      LOG(("Command byte: %02x\n", data));
427
437428      if (data & (1<<7))
438429      {
439         logerror("hunt mode\n");
430         LOG(("hunt mode\n"));
440431      }
441432
442433      if (data & (1<<5))
443434      {
444         logerror("/rts set to 0\n");
435         LOG(("/rts set to 0\n"));
445436      }
446437      else
447438      {
448         logerror("/rts set to 1\n");
439         LOG(("/rts set to 1\n"));
449440      }
450441
451442      if (data & (1<<2))
452443      {
453         logerror("receive enable\n");
444         LOG(("receive enable\n"));
454445      }
455446      else
456447      {
457         logerror("receive disable\n");
448         LOG(("receive disable\n"));
458449      }
459450
460451      if (data & (1<<1))
461452      {
462         logerror("/dtr set to 0\n");
453         LOG(("/dtr set to 0\n"));
463454      }
464455      else
465456      {
466         logerror("/dtr set to 1\n");
457         LOG(("/dtr set to 1\n"));
467458      }
468459
469460      if (data & (1<<0))
470461      {
471         logerror("transmit enable\n");
462         LOG(("transmit enable\n"));
472463      }
473464      else
474465      {
475         logerror("transmit disable\n");
466         LOG(("transmit disable\n"));
476467      }
477468
478469
479#endif
480
481
482470      /*   bit 7:
483471            0 = normal operation
484472            1 = hunt mode
r1470r1471
547535/* read status */
548536 READ8_HANDLER(msm8251_status_r)
549537{
550#ifdef VERBOSE
551   logerror("status: %02x\n", uart.status);
552#endif
538   LOG(("status: %02x\n", uart.status));
553539
554540   return uart.status;
555541}
src/mess/machine/tms5501.c
r1470r1471
1919
2020#define DEBUG_TMS5501   0
2121
22#if DEBUG_TMS5501
23   #define LOG_TMS5501(n, message, data) logerror ("TMS5501 %d: %s %02x\n", n, message, data)
24#else
25   #define LOG_TMS5501(n, message, data)
26#endif
22#define LOG_TMS5501(n, message, data) do { if (DEBUG_TMS5501) logerror ("TMS5501 %d: %s %02x\n", n, message, data); } while (0)
2723
2824#define MAX_TMS5501         1
2925
src/mess/machine/galaxy.c
r1470r1471
1414
1515#define DEBUG_GALAXY_LATCH   0
1616
17#if DEBUG_GALAXY_LATCH
18   #define LOG_GALAXY_LATCH_R(_port, _data) logerror ("Galaxy latch read : %04x, Data: %02x\n", _port, _data)
19   #define LOG_GALAXY_LATCH_W(_port, _data) logerror ("Galaxy latch write: %04x, Data: %02x\n", _port, _data)
20#else
21   #define LOG_GALAXY_LATCH_R(_port, _data)
22   #define LOG_GALAXY_LATCH_W(_port, _data)
23#endif
17#define LOG_GALAXY_LATCH_R(_port, _data) do { if (DEBUG_GALAXY_LATCH) logerror ("Galaxy latch read : %04x, Data: %02x\n", _port, _data); } while (0)
18#define LOG_GALAXY_LATCH_W(_port, _data) do { if (DEBUG_GALAXY_LATCH) logerror ("Galaxy latch write: %04x, Data: %02x\n", _port, _data); } while (0)
2419
2520int galaxy_interrupts_enabled = TRUE;
2621
src/mess/machine/bbc.c
r1470r1471
11521152
11531153static WRITE8_HANDLER( bbcb_via_system_write_ca2 )
11541154{
1155  //if( errorlog ) fprintf(errorlog, "via_system_write_ca2: $%02X\n", data);
1155  //logerror("via_system_write_ca2: $%02X\n", data);
11561156}
11571157
11581158/* this is wired as in input port so writing to this port would be bad */
11591159
11601160static WRITE8_HANDLER( bbcb_via_system_write_cb2 )
11611161{
1162  //if( errorlog ) fprintf(errorlog, "via_system_write_cb2: $%02X\n", data);
1162  //logerror("via_system_write_cb2: $%02X\n", data);
11631163}
11641164
11651165
src/mess/machine/kc.c
r1470r1471
99#include "sound/speaker.h"
1010#include "image.h"
1111
12#define KC_DEBUG
12#define KC_DEBUG 1
13#define LOG(x) do { if (KC_DEBUG) logerror x; } while (0)
1314
1415static int kc85_pio_data[2];
1516
r1470r1471
322323{
323324   int port_upper;
324325   int module_index;
325#ifdef KC_DEBUG
326   logerror("kc85 module r: %04x\n",offset);
327#endif
328326
327   LOG(("kc85 module r: %04x\n",offset));
328
329329   port_upper = (offset>>8) & 0x0ff;
330330
331331   /* module is accessed at every 4th address. 0x00,0x04,0x08,0x0c etc */
r1470r1471
480480/* The basic transmit proceedure is working, keys are received */
481481/* Todo: Key-repeat, and allowing the same key to be pressed twice! */
482482
483//#define KC_KEYBOARD_DEBUG
483#define KC_KEYBOARD_DEBUG 0
484#define LOG_KBD(x) do { if (KC_KEYBOARD_DEBUG) logerror x; } while (0)
484485
485486/*
486487
r1470r1471
856857      /* get current pulse state */
857858      pulse_state = (keyboard_data.transmit_buffer[pulse_byte_count]>>pulse_bit_count) & 0x01;
858859
859#ifdef KC_KEYBOARD_DEBUG
860      logerror("kc keyboard sending pulse: %02x\n",pulse_state);
861#endif
860      LOG_KBD(("kc keyboard sending pulse: %02x\n",pulse_state));
862861
863862      /* set pulse */
864863      z80pio_bstb_w(0,pulse_state & kc_brdy);
r1470r1471
10691068
10701069               /* generate fake code */
10711070               code = (i<<3) | b;
1072#ifdef KC_KEYBOARD_DEBUG
1073               logerror("code: %02x\n",code);
1074#endif
1071               LOG_KBD(("code: %02x\n",code));
10751072               kc_keyboard_queue_scancode(code);
10761073            }
10771074         }
r1470r1471
11551152      }
11561153      else
11571154      {
1158#ifdef KC_DEBUG
1159         logerror("RAM8 write enabled\n");
1160#endif
1155         LOG(("RAM8 write enabled\n"));
1156
11611157         /* ram8 is enabled and write enabled */
11621158         memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xa7ff, 0, 0, MWA8_BANK9);
11631159         memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xa800, 0xbfff, 0, 0, MWA8_BANK10);
r1470r1471
11671163    }
11681164    else
11691165    {
1170#ifdef KC_DEBUG
1171      logerror("no memory at ram8\n");
1172#endif
1166      LOG(("no memory at ram8\n"));
1167
11731168      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xa7ff, 0, 0, MRA8_NOP);
11741169      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xa800, 0xbfff, 0, 0, MRA8_NOP);
11751170      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xa7ff, 0, 0, MWA8_NOP);
r1470r1471
12021197   /* access ram? */
12031198   if (kc85_pio_data[0] & (1<<1))
12041199   {
1205#ifdef KC_DEBUG
1206      logerror("ram0 enabled\n");
1207#endif
1200      LOG(("ram0 enabled\n"));
12081201
12091202      /* yes; set address of bank */
12101203      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, MRA8_BANK1);
r1470r1471
12141207      if ((kc85_pio_data[0] & (1<<3))==0)
12151208      {
12161209         /* yes */
1217#ifdef KC_DEBUG
1218         logerror("ram0 write protected\n");
1219#endif
1210         LOG(("ram0 write protected\n"));
12201211
12211212         /* ram is enabled and write protected */
12221213         memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, MWA8_ROM);
12231214      }
12241215      else
12251216      {
1226#ifdef KC_DEBUG
1227         logerror("ram0 write enabled\n");
1228#endif
1217         LOG(("ram0 write enabled\n"));
12291218
12301219         /* ram is enabled and write enabled; and set address of bank */
12311220         memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, MWA8_BANK7);
r1470r1471
12341223   }
12351224   else
12361225   {
1237#ifdef KC_DEBUG
1238      logerror("no memory at ram0!\n");
1239#endif
1226      LOG(("no memory at ram0!\n"));
12401227
12411228//      memory_set_bankptr(1,memory_region(REGION_CPU1) + 0x013000);
12421229      /* ram is disabled */
r1470r1471
12671254      if ((kc85_86_data & (1<<1))==0)
12681255      {
12691256         /* yes */
1270#ifdef KC_DEBUG
1271         logerror("ram4 write protected\n");
1272#endif
1257         LOG(("ram4 write protected\n"));
12731258
12741259         /* ram is enabled and write protected */
12751260         wh = MWA8_NOP;
12761261      }
12771262      else
12781263      {
1279#ifdef KC_DEBUG
1280         logerror("ram4 write enabled\n");
1281#endif
1264         LOG(("ram4 write enabled\n"));
1265
12821266         /* ram is enabled and write enabled */
12831267         wh = MWA8_BANK8;
12841268         /* set address of bank */
r1470r1471
12871271   }
12881272   else
12891273   {
1290#ifdef KC_DEBUG
1291      logerror("no memory at ram4!\n");
1292#endif
1274      LOG(("no memory at ram4!\n"));
1275
12931276      /* ram is disabled */
12941277      rh = MRA8_NOP;
12951278      wh = MWA8_NOP;
r1470r1471
13071290   if (kc85_86_data & (1<<7))
13081291   {
13091292      /* CAOS rom takes priority */
1310#ifdef KC_DEBUG
1311      logerror("CAOS rom 0x0c000\n");
1312#endif
1293      LOG(("CAOS rom 0x0c000\n"));
1294
13131295      memory_set_bankptr(5,memory_region(REGION_CPU1) + 0x012000);
13141296      rh = MRA8_BANK5;
13151297   }
13161298   else if (kc85_pio_data[0] & (1<<7))
13171299   {
1318#ifdef KC_DEBUG
13191300      /* BASIC takes next priority */
1320        logerror("BASIC rom 0x0c000\n");
1321#endif
1301           LOG(("BASIC rom 0x0c000\n"));
13221302
13231303        memory_set_bankptr(5, memory_region(REGION_CPU1) + 0x010000);
13241304      rh = MRA8_BANK5;
r1470r1471
13271307   {
13281308      if (kc85_module_rom)
13291309      {
1330         logerror("module rom at 0xc000\n");
1310         LOG(("module rom at 0xc000\n"));
13311311
13321312         memory_set_bankptr(5, kc85_module_rom);
13331313         rh = MRA8_BANK5;
r1470r1471
13351315      else
13361316      {
13371317
1338#ifdef KC_DEBUG
1339         logerror("No roms 0x0c000\n");
1340#endif
1318         LOG(("No roms 0x0c000\n"));
1319
13411320         rh = MRA8_NOP;
13421321      }
13431322   }
r1470r1471
13521331   if (kc85_pio_data[0] & (1<<0))
13531332   {
13541333      /* enable CAOS rom in memory range 0x0e000-0x0ffff */
1355#ifdef KC_DEBUG
1356      logerror("CAOS rom 0x0e000\n");
1357#endif
1334      LOG(("CAOS rom 0x0e000\n"));
13581335      /* read will access the rom */
13591336      memory_set_bankptr(6,memory_region(REGION_CPU1) + 0x013000);
13601337      rh = MRA8_BANK6;
13611338   }
13621339   else
13631340   {
1364#ifdef KC_DEBUG
1365      logerror("no rom 0x0e000\n");
1366#endif
1341      LOG(("no rom 0x0e000\n"));
1342
13671343      rh = MRA8_NOP;
13681344   }
13691345   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, rh);
r1470r1471
14301406
14311407WRITE8_HANDLER ( kc85_4_86_w )
14321408{
1433#ifdef KC_DEBUG
1434   logerror("0x086 W: %02x\n",data);
1435#endif
1409   LOG(("0x086 W: %02x\n",data));
14361410
14371411   kc85_86_data = data;
14381412
r1470r1471
14481422
14491423WRITE8_HANDLER ( kc85_4_84_w )
14501424{
1451#ifdef KC_DEBUG
1452   logerror("0x084 W: %02x\n",data);
1453#endif
1425   LOG(("0x084 W: %02x\n",data));
1426
14541427   kc85_84_data = data;
14551428
14561429   kc85_4_video_ram_select_bank(data & 0x01);
r1470r1471
14711444
14721445   if (kc85_pio_data[0] & (1<<7))
14731446   {
1474#ifdef KC_DEBUG
14751447      /* BASIC takes next priority */
1476      logerror("BASIC rom 0x0c000\n");
1477#endif
1448      LOG(("BASIC rom 0x0c000\n"));
1449
14781450      memory_set_bankptr(4, memory_region(REGION_CPU1) + 0x010000);
14791451      rh = MRA8_BANK4;
14801452   }
14811453   else
14821454   {
1483#ifdef KC_DEBUG
1484      logerror("No roms 0x0c000\n");
1485#endif
1455      LOG(("No roms 0x0c000\n"));
1456
14861457      rh = MRA8_NOP;
14871458   }
14881459   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, rh);
r1470r1471
14951466
14961467   if (kc85_pio_data[0] & (1<<0))
14971468   {
1498#ifdef KC_DEBUG
14991469      /* enable CAOS rom in memory range 0x0e000-0x0ffff */
1500      logerror("CAOS rom 0x0e000\n");
1501#endif
1470      LOG(("CAOS rom 0x0e000\n"));
1471
15021472      memory_set_bankptr(5,memory_region(REGION_CPU1) + 0x012000);
15031473        rh = MRA8_BANK5;
15041474   }
15051475   else
15061476   {
1507#ifdef KC_DEBUG
1508      logerror("no rom 0x0e000\n");
1509#endif
1477      LOG(("no rom 0x0e000\n"));
1478
15101479      rh = MRA8_NOP;
15111480   }
15121481   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, rh);
r1470r1471
15231492   /* access ram? */
15241493   if (kc85_pio_data[0] & (1<<1))
15251494   {
1526#ifdef KC_DEBUG
1527      logerror("ram0 enabled\n");
1528#endif
1495      LOG(("ram0 enabled\n"));
1496
15291497      /* yes */
15301498      rh = MRA8_BANK1;
15311499      /* set address of bank */
r1470r1471
15351503      if ((kc85_pio_data[0] & (1<<3))==0)
15361504      {
15371505         /* yes */
1538#ifdef KC_DEBUG
1539         logerror("ram0 write protected\n");
1540#endif
1506         LOG(("ram0 write protected\n"));
15411507
15421508         /* ram is enabled and write protected */
15431509         wh = MWA8_NOP;
15441510      }
15451511      else
15461512      {
1547#ifdef KC_DEBUG
1548      logerror("ram0 write enabled\n");
1549#endif
1513         LOG(("ram0 write enabled\n"));
15501514
15511515         /* ram is enabled and write enabled */
15521516         wh = MWA8_BANK6;
r1470r1471
15561520   }
15571521   else
15581522   {
1559#ifdef KC_DEBUG
1560      logerror("no memory at ram0!\n");
1561#endif
1523      LOG(("no memory at ram0!\n"));
15621524
15631525      /* ram is disabled */
15641526      rh = MRA8_NOP;
r1470r1471
15801542    if (kc85_pio_data[0] & (1<<2))
15811543    {
15821544        /* IRM enabled */
1583#ifdef KC_DEBUG
1584        logerror("IRM enabled\n");
1585#endif
1545        LOG(("IRM enabled\n"));
15861546      ram_page = mess_ram+0x08000;
15871547
15881548      memory_set_bankptr(3, ram_page);
r1470r1471
15941554    else if (kc85_pio_data[1] & (1<<5))
15951555    {
15961556      /* RAM8 ACCESS */
1597#ifdef KC_DEBUG
1598      logerror("RAM8 enabled\n");
1599#endif
1557      LOG(("RAM8 enabled\n"));
16001558      ram_page = mess_ram + 0x04000;
16011559
16021560      memory_set_bankptr(3, ram_page);
r1470r1471
16051563      /* write protect RAM8 ? */
16061564      if ((kc85_pio_data[1] & (1<<6))==0)
16071565      {
1608#ifdef KC_DEBUG
1609         logerror("RAM8 write protected\n");
1610#endif
1566         LOG(("RAM8 write protected\n"));
16111567         /* ram8 is enabled and write protected */
16121568         wh = MWA8_NOP;
16131569      }
16141570      else
16151571      {
1616#ifdef KC_DEBUG
1617         logerror("RAM8 write enabled\n");
1618#endif
1572         LOG(("RAM8 write enabled\n"));
16191573         /* ram8 is enabled and write enabled */
16201574         wh = MWA8_BANK8;
16211575         memory_set_bankptr(8,ram_page);
r1470r1471
16231577    }
16241578    else
16251579    {
1626#ifdef KC_DEBUG
1627      logerror("no memory at ram8!\n");
1628#endif
1580      LOG(("no memory at ram8!\n"));
16291581      rh = MRA8_NOP;
16301582      wh = MWA8_NOP;
16311583    }
r1470r1471
17551707   unsigned char data;
17561708
17571709   data = z80ctc_0_r(offset);
1758//#ifdef KC_KEYBOARD_DEBUG
1759   //logerror("ctc data r:%02x\n",data);
1760//#endif
1710   //LOG_KBD(("ctc data r:%02x\n",data));
17611711   return data;
17621712}
17631713
r1470r1471
17841734static void   kc85_pio_ardy_callback(int state)
17851735{
17861736   kc_ardy = state & 0x01;
1787#ifdef KC_DEBUG
1737
17881738   if (state)
17891739   {
1790      logerror("PIO A Ready\n");
1740      LOG(("PIO A Ready\n"));
17911741   }
1792#endif
1793
17941742}
17951743
17961744/* callback for brdy output from PIO */
r1470r1471
17981746static void kc85_pio_brdy_callback(int state)
17991747{
18001748   kc_brdy = state & 0x01;
1801#ifdef KC_DEBUG
1749
18021750   if (state)
18031751   {
1804      logerror("PIO B Ready\n");
1752      LOG(("PIO B Ready\n"));
18051753   }
1806#endif
18071754}
18081755
18091756static const z80pio_interface kc85_pio_intf =
src/mess/machine/corvushd.c
r1470r1471
6767#include "devices/harddriv.h"
6868#include "includes/corvushd.h"
6969#include "timer.h"
70#include <ctype.h>
7071
7172#define VERBOSE 0
7273#define VERBOSE_RESPONSES 0
r1470r1471
8182#define INTERBYTE_DELAY 5      // Inter-byte delay in microseconds communicating between controller and host
8283#define INTERSECTOR_DELAY 25000   // 25ms delay between sectors (4800 RPM = 80 Rev/Second.  Maximum 2 sectors transferred / Rev)
8384
85#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
86#define LOG_BUFFER(p,s) do { if (VERBOSE) dump_buffer(p,s); } while (0)
8487//
8588// Structures
8689//
r1470r1471
378381
379382
380383
381#if VERBOSE
382384//
383385// Dump_Buffer
384386//
r1470r1471
391393// Returns:
392394//      nada
393395//
394void dump_buffer(UINT8 *buffer, UINT16 length) {
396static void dump_buffer(UINT8 *buffer, UINT16 length) {
395397
396#include <ctype.h>
397
398398   UINT16   offset;
399399   char   ascii_dump[16];
400   int      cpos;
401400
402401   logerror("dump_buffer: Dump of %d bytes:\n", length);
403402   logerror("Base  00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ASCII\n");
r1470r1471
417416      logerror("%.*s", (16 - (offset % 16)) * 3, "                                                     ");
418417   logerror("%.*s\n", offset % 16 ? offset % 16 : 16, ascii_dump);
419418}
420#endif
421419
422420
423421
r1470r1471
442440
443441   c->awaiting_modifier = FALSE;            // This is the case by definition
444442
445   #if VERBOSE
446   logerror("parse_hdc_command: Called with data: 0x%2.2x, Prep mode is: %d\n", data, c->prep_mode);
447   #endif
443   LOG(("parse_hdc_command: Called with data: 0x%2.2x, Prep mode is: %d\n", data, c->prep_mode));
448444
449445   if(!c->prep_mode) {
450446      switch(data) {
r1470r1471
470466         case PREP_MODE_SELECT:
471467            c->recv_bytes = corvus_cmd[data][0].recv_bytes;
472468            c->xmit_bytes = corvus_cmd[data][0].xmit_bytes;
473            #if VERBOSE
474            logerror("parse_hdc_command: Single byte command recoginized: 0x%2.2x, to recv: %d, to xmit: %d\n", data,
475               c->recv_bytes, c->xmit_bytes);
476            #endif
469            LOG(("parse_hdc_command: Single byte command recoginized: 0x%2.2x, to recv: %d, to xmit: %d\n", data,
470               c->recv_bytes, c->xmit_bytes));
477471            break;
478472         //
479473         // Double-byte commands
r1470r1471
495489      //   case DELACTIVENUM_OMNI_CODE:
496490      //   case FINDACTIVE_CODE:
497491            c->awaiting_modifier = TRUE;
498            #if VERBOSE
499            logerror("parse_hdc_command: Double byte command recoginized: 0x%2.2x\n", data);
500            #endif
492            LOG(("parse_hdc_command: Double byte command recoginized: 0x%2.2x\n", data));
501493            break;
502494
503495         default:                     // This is an INVALID command
504496            c->recv_bytes = 1;
505497            c->xmit_bytes = 1;
506            #if VERBOSE
507            logerror("parse_hdc_command: Invalid command detected: 0x%2.2x\n", data);
508            #endif
498            LOG(("parse_hdc_command: Invalid command detected: 0x%2.2x\n", data));
509499            return TRUE;
510500      }
511501   } else {
r1470r1471
522512         case PREP_WRITE_FIRMWARE:
523513            c->recv_bytes = corvus_prep_cmd[data].recv_bytes;
524514            c->xmit_bytes = corvus_prep_cmd[data].xmit_bytes;
525            #if VERBOSE
526            logerror("parse_hdc_command: Prep command recognized: 0x%2.2x, to recv: %d, to xmit: %d\n", data,
527               c->recv_bytes, c->xmit_bytes);
528            #endif
515            LOG(("parse_hdc_command: Prep command recognized: 0x%2.2x, to recv: %d, to xmit: %d\n", data,
516               c->recv_bytes, c->xmit_bytes));
529517            break;
530518
531519         default:                     // This is an INVALID prep command
532520            c->recv_bytes = 1;
533521            c->xmit_bytes = 1;
534            #if VERBOSE
535            logerror("parse_hdc_command: Invalid Prep command detected: 0x%2.2x\n", data);
536            #endif
522            LOG(("parse_hdc_command: Invalid Prep command detected: 0x%2.2x\n", data));
537523            return TRUE;
538524      }
539525   }   // if(!prep_mode)
r1470r1471
566552   UINT8   tbuffer[512];      // Buffer to hold an entire sector
567553   UINT16   cylinder;         // Cylinder this sector resides on
568554
569   #if VERBOSE
570   logerror("corvus_write_sector: Write Drive: %d, physical sector: 0x%5.5x\n", drv, sector);
571   #endif
555   LOG(("corvus_write_sector: Write Drive: %d, physical sector: 0x%5.5x\n", drv, sector));
572556
573557   if(drv >= device_count(IO_HARDDISK)) {
574558      logerror("corvus_write_sector: Attempt to write to non-existant drive: %d\n", drv);
r1470r1471
604588
605589   c->last_cylinder = cylinder;
606590
607   #if VERBOSE
608   logerror("corvus_write_sector: Full sector dump on a write of %d bytes follows:\n", len);
609   dump_buffer(len == 512 ? buffer : tbuffer, 512);
610   #endif
591   LOG(("corvus_write_sector: Full sector dump on a write of %d bytes follows:\n", len));
592   LOG_BUFFER(len == 512 ? buffer : tbuffer, 512);
611593
612594   return STAT_SUCCESS;
613595}
r1470r1471
646628   drv = (dadr->address_msn_and_drive & 0x0f) - 1;
647629   sector = (dadr->address_msn_and_drive & 0xf0 << 12) | (dadr->address_mid << 8) | dadr->address_lsb;
648630
649   #if VERBOSE
650   logerror("corvus_write_logical_sector: Writing based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n",
651      dadr->address_msn_and_drive << 16 | dadr->address_lsb << 8 | dadr->address_mid, sector, drv);
652   #endif
631   LOG(("corvus_write_logical_sector: Writing based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n",
632      dadr->address_msn_and_drive << 16 | dadr->address_lsb << 8 | dadr->address_mid, sector, drv));
653633
654634   //
655635   // Shift the logical sector address forward by the number of firmware cylinders (2) + the number of spare tracks (7)
r1470r1471
688668   UINT8   tbuffer[512];      // Buffer to store full sector results in
689669   UINT16   cylinder;
690670
691   #if VERBOSE
692   logerror("corvus_read_sector: Read Drive: %d, physical sector: 0x%5.5x\n", drv, sector);
693   #endif
671   LOG(("corvus_read_sector: Read Drive: %d, physical sector: 0x%5.5x\n", drv, sector));
694672
695673   if(drv >= device_count(IO_HARDDISK)) {
696674      logerror("corvus_read_sector: Attempt to read from non-existant drive: %d\n", drv);
r1470r1471
715693
716694   c->last_cylinder = cylinder;
717695
718   #if VERBOSE
719   logerror("corvus_read_sector: Data read follows:\n");
720   dump_buffer(tbuffer, len);
721   #endif
696   LOG(("corvus_read_sector: Data read follows:\n"));
697   LOG_BUFFER(tbuffer, len);
722698
723699   return STAT_SUCCESS;
724700}
r1470r1471
757733   drv = (dadr->address_msn_and_drive & 0x0f) - 1;
758734   sector = (dadr->address_msn_and_drive & 0xf0 << 12) | (dadr->address_mid << 8) | dadr->address_lsb;
759735
760   #if VERBOSE
761   logerror("corvus_read_logical_sector: Reading based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n",
762      dadr->address_msn_and_drive << 16 | dadr->address_lsb << 8 | dadr->address_mid, sector, drv);
763   #endif
736   LOG(("corvus_read_logical_sector: Reading based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n",
737      dadr->address_msn_and_drive << 16 | dadr->address_lsb << 8 | dadr->address_mid, sector, drv));
764738
765739   //
766740   // Shift the logical sector address forward by the number of firmware cylinders (2) + the number of spare tracks (7)
r1470r1471
10561030   c->buffer.drive_param_response.physical_capacity.midb = (raw_capacity & 0x00ff00) >> 8;
10571031   c->buffer.drive_param_response.physical_capacity.lsb = (raw_capacity & 0x0000ff);
10581032
1059   #if VERBOSE
1060   logerror("corvus_get_drive_parameters: Drive Parameter packet follows:\n");
1061   dump_buffer(c->buffer.raw_data, 110);
1062   #endif
1033   LOG(("corvus_get_drive_parameters: Drive Parameter packet follows:\n"));
1034   LOG_BUFFER(c->buffer.raw_data, 110);
10631035
10641036   return STAT_SUCCESS;
10651037}
r1470r1471
10811053
10821054   corvus_hdc_t   *c = &corvus_hdc;         // Pick up global controller structure
10831055
1084   #if VERBOSE
1085   logerror("corvus_read_boot_block: Reading boot block: %d\n", block);
1086   #endif
1056   LOG(("corvus_read_boot_block: Reading boot block: %d\n", block));
10871057
10881058   return corvus_read_sector(0, 25 + block, c->buffer.read_512_response.data, 512);
10891059
r1470r1471
11121082
11131083   relative_sector = head * c->sectors_per_track + sector;
11141084
1115   #if VERBOSE
1116   logerror("corvus_read_firmware_block: Reading firmware head: 0x%2.2x, sector: 0x%2.2x, relative_sector: 0x%2.2x\n",
1117      head, sector, relative_sector);
1118   #endif
1085   LOG(("corvus_read_firmware_block: Reading firmware head: 0x%2.2x, sector: 0x%2.2x, relative_sector: 0x%2.2x\n",
1086      head, sector, relative_sector));
11191087
11201088   status = corvus_read_sector(0, relative_sector, c->buffer.read_512_response.data, 512);      // TODO: Which drive should Prep Mode talk to ???
11211089   return status;
r1470r1471
11451113
11461114   relative_sector = head * c->sectors_per_track + sector;
11471115
1148   #if VERBOSE
1149   logerror("corvus_write_firmware_block: Writing firmware head: 0x%2.2x, sector: 0x%2.2x, relative_sector: 0x%2.2x\n",
1150      head, sector, relative_sector);
1151   #endif
1116   LOG(("corvus_write_firmware_block: Writing firmware head: 0x%2.2x, sector: 0x%2.2x, relative_sector: 0x%2.2x\n",
1117      head, sector, relative_sector));
11521118
11531119   status = corvus_write_sector(0, relative_sector, buffer, 512);   // TODO: Which drive should Prep Mode talk to ???
11541120   return status;
r1470r1471
11871153      len = 512;
11881154   }
11891155
1190   #if VERBOSE
1191   logerror("corvus_format_drive: Formatting drive with 0x%5.5x sectors, pattern buffer (passed length: %d)follows\n", max_sector, len);
1192   dump_buffer(pattern, 512);
1193   #endif
1156   LOG(("corvus_format_drive: Formatting drive with 0x%5.5x sectors, pattern buffer (passed length: %d)follows\n", max_sector, len));
1157   LOG_BUFFER(pattern, 512);
11941158
11951159   for(sector = 0; sector <= max_sector; sector++) {
11961160      status = corvus_write_sector(0, sector, pattern, 512);
r1470r1471
12451209
12461210   corvus_hdc_t   *c = &corvus_hdc;
12471211
1248   #if VERBOSE && VERBOSE_RESPONSES
1249   logerror("corvus_hdc_data_w: Complete packet received.  Dump follows:\n");
1250   dump_buffer(c->buffer.raw_data, c->offset);
1251   #endif
1212   if (VERBOSE_RESPONSES)
1213   {
1214      LOG(("corvus_hdc_data_w: Complete packet received.  Dump follows:\n"));
1215      LOG_BUFFER(c->buffer.raw_data, c->offset);
1216   }
12521217
12531218   if(!invalid_command_flag) {
12541219      if(!c->prep_mode) {
r1470r1471
13591324               logerror("corvus_hdc_data_w: Unimplemented Prep command, returning FATAL FAULT status!\n");
13601325         }
13611326      }
1362      #if VERBOSE && VERBOSE_RESPONSES
1363      logerror("corvus_hdc_data_w: Command execution complete, status: 0x%2.2x.  Response dump follows:\n",
1364         c->buffer.single_byte_response.status);
1365      dump_buffer(c->buffer.raw_data, c->xmit_bytes);
1366      #endif
1327      if (VERBOSE_RESPONSES)
1328      {
1329         LOG(("corvus_hdc_data_w: Command execution complete, status: 0x%2.2x.  Response dump follows:\n",
1330            c->buffer.single_byte_response.status));
1331         LOG_BUFFER(c->buffer.raw_data, c->xmit_bytes);
1332      }
13671333
13681334   } // if(!invalid_command_flag)
13691335
r1470r1471
13841350   //
13851351   c->offset = 0;                           // Point to beginning of buffer for response
13861352
1387   #if VERBOSE
1388   logerror("corvus_hdc_data_w: Setting one-time mame timer of %d microseconds to simulate disk function\n", c->delay);
1389   #endif
1353   LOG(("corvus_hdc_data_w: Setting one-time mame timer of %d microseconds to simulate disk function\n", c->delay));
13901354
13911355   //
13921356   // Set up timers for command completion and timeout from host
r1470r1471
14201384         c->status |= CONTROLLER_DIRECTION;            // Set to Controller-to-Host, Ready mode
14211385         c->status &= ~(CONTROLLER_BUSY);
14221386
1423         #if VERBOSE
1424         logerror("corvus_hdc_callback: Callback executed with function CALLBACK_CTH_MODE\n");
1425         #endif
1387         LOG(("corvus_hdc_callback: Callback executed with function CALLBACK_CTH_MODE\n"));
14261388
14271389         break;
14281390      case CALLBACK_HTC_MODE:
14291391         c->status &= ~(CONTROLLER_DIRECTION |
14301392            CONTROLLER_BUSY);                     // Set to Host-to-Controller, Ready mode
14311393
1432         #if VERBOSE
1433         logerror("corvus_hdc_callback: Callback executed with function CALLBACK_HTC_MODE\n");
1434         #endif
1394         LOG(("corvus_hdc_callback: Callback executed with function CALLBACK_HTC_MODE\n"));
14351395
14361396         break;
14371397      case CALLBACK_SAME_MODE:
r1470r1471
14471407            c->xmit_bytes = 1;
14481408            logerror("corvus_hdc_callback: Exceeded four-second timeout for data from host, resetting communications\n");
14491409         } else { // if(c->recv_bytes == 0)                This was a variable-size command
1450            #if VERBOSE
1451            logerror("corvus_hdc_callback: Executing variable-length command via four-second timeout\n");
1452            #endif
1410            LOG(("corvus_hdc_callback: Executing variable-length command via four-second timeout\n"));
14531411            corvus_process_command_packet(0);         // Process the command
14541412         }
14551413         break;
r1470r1471
15001458   timer_adjust(c->timeout_timer, ATTOTIME_IN_SEC(4), CALLBACK_TIMEOUT, attotime_zero);
15011459   timer_enable(c->timeout_timer, 0);      // Start this timer out disabled
15021460
1503   #if VERBOSE
1504   logerror("corvus_hdc_init: Attached to drive image: H:%d, C:%d, S:%d\n", info->heads, info->cylinders, info->sectors);
1505   #endif
1461   LOG(("corvus_hdc_init: Attached to drive image: H:%d, C:%d, S:%d\n", info->heads, info->cylinders, info->sectors));
15061462
15071463   //
15081464   // Define all of the packet sizes for the commands
r1470r1471
16021558   corvus_prep_cmd[PREP_WRITE_FIRMWARE].recv_bytes = 514;
16031559   corvus_prep_cmd[PREP_WRITE_FIRMWARE].xmit_bytes = 1;
16041560
1605   #if VERBOSE
1606   logerror("corvus_hdc_init: Drive structures initialized\n");
1607   #endif
1561   LOG(("corvus_hdc_init: Drive structures initialized\n"));
16081562
16091563   return TRUE;
16101564}
r1470r1471
16621616   result = c->buffer.raw_data[c->offset++];
16631617
16641618   if(c->offset == c->xmit_bytes) {
1665      #if VERBOSE
1666      logerror("corvus_hdc_data_r: Finished transmitting %d bytes of data.  Returning to idle mode.\n", c->xmit_bytes);
1667      #endif
1619      LOG(("corvus_hdc_data_r: Finished transmitting %d bytes of data.  Returning to idle mode.\n", c->xmit_bytes));
16681620
16691621      c->offset = 0;         // We've reached the end of valid data
16701622      c->xmit_bytes = 0;      // We don't have anything more to say
r1470r1471
17201672   // We're supposed to be paying attention.  Make a decision about the data received
17211673   //
17221674   if(c->offset == 0)   {                                       // First byte of a packet
1723      #if VERBOSE
1724      logerror("corvus_hdc_data_w: Received a byte with c->offset == 0.  Processing as command: 0x%2.2x\n", data);
1725      #endif
1675      LOG(("corvus_hdc_data_w: Received a byte with c->offset == 0.  Processing as command: 0x%2.2x\n", data));
17261676      invalid_command_flag = parse_hdc_command(data);
17271677      timer_reset(c->timeout_timer, (ATTOTIME_IN_SEC(4)));
17281678      timer_enable(c->timeout_timer, 1);                        // Start our four-second timer
17291679   } else if(c->offset == 1 && c->awaiting_modifier) {                  // Second byte of a packet
1730      #if VERBOSE
1731      logerror("corvus_hdc_data_w: Received a byte while awaiting modifier with c->offset == 0.  Processing as modifier: 0x%2.2x\n", data);
1732      #endif
1680      LOG(("corvus_hdc_data_w: Received a byte while awaiting modifier with c->offset == 0.  Processing as modifier: 0x%2.2x\n", data));
17331681      c->awaiting_modifier = FALSE;
17341682      c->recv_bytes = corvus_cmd[c->buffer.command.code][data].recv_bytes;
17351683      c->xmit_bytes = corvus_cmd[c->buffer.command.code][data].xmit_bytes;
src/mess/formats/mz_cas.c
r1470r1471
11#include <string.h>
22#include "mz_cas.h"
3#include "driver.h"
34
45#ifndef VERBOSE
56#define VERBOSE 0
67#endif
78
8#if VERBOSE
99#define LOG(N,M,A)   \
10   if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s",timer_get_time(), (const char*)M ); logerror A; }
11#else
12#define LOG(N,M,A)
13#endif
10   if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s",attotime_to_double(timer_get_time()), (const char*)M ); logerror A; }
1411
1512#define LO  -32768
1613#define HI   +32767
src/mess/formats/thom_dsk.c
r1470r1471
1717
1818#define PRINT(x) mame_printf_info x
1919
20#if VERBOSE > 1
21#define LOG(x)   logerror x
22#define VLOG(x)   logerror x
23#elif VERBOSE > 0
24#define LOG(x)   logerror x
25#define VLOG(x)
26#else
27#define LOG(x)
28#define VLOG(x)
29#endif
20#define LOG(x)   do { if (VERBOSE > 0) logerror x; } while (0)
21#define VLOG(x)   do { if (VERBOSE > 1) logerror x; } while (0)
3022
3123
3224/********************* floppy image / drive *********************/
r1470r1471
160152       (d->density == DEN_FM_LO) ? "FM" : "MFM",
161153       d->tracks, d->sectors,
162154       (d->sides * d->tracks * d->sectors * d->sector_size) / 1024 ));
163   LOG (( "thom_floppy: drive %li loaded\n", d - thom_floppy_drives ));
155   LOG (( "thom_floppy: drive %d loaded\n", d - thom_floppy_drives ));
164156
165157   if ( d->data )
166158   {
r1470r1471
225217      physical_track = 0;
226218   if ( physical_track >= 80 )
227219      physical_track = 79;
228   LOG(( "%f thom_floppy_seek: dev=%li track=%i\n", attotime_to_double(timer_get_time()), d - thom_floppy_drives, physical_track ));
220   LOG(( "%f thom_floppy_seek: dev=%d track=%i\n", attotime_to_double(timer_get_time()), d - thom_floppy_drives, physical_track ));
229221   d->cur_track = physical_track;
230222}
231223
r1470r1471
249241   int trk =  d->cur_track;
250242   if ( trk >= d->tracks )
251243      trk = d->tracks - 1;
252   VLOG(( "thom_floppy_get_id: dev=%li track=%i idx=%i phy-side=%i dens=%s/%s\n",
244   VLOG(( "thom_floppy_get_id: dev=%d track=%i idx=%i phy-side=%i dens=%s/%s\n",
253245          d - thom_floppy_drives, trk, id_index, physical_side,
254246          (thom_density == DEN_FM_LO) ? "FM" : "MFM",
255247          (d->density == DEN_FM_LO) ? "FM" : "MFM" ));
r1470r1471
293285   thom_floppy_drive* d = thom_floppy_drive_of_image( image );
294286   UINT8* src = thom_floppy_sector_ptr( d, index1, d->cur_track, 0 );
295287   thom_floppy_active( 0 );
296   LOG(( "thom_floppy_read_sector_data_into_buffer: dev=%li track=%i idx=%i side=%i len=%i\n", d - thom_floppy_drives, d->cur_track, index1, side, length ));
288   LOG(( "thom_floppy_read_sector_data_into_buffer: dev=%d track=%i idx=%i side=%i len=%i\n", d - thom_floppy_drives, d->cur_track, index1, side, length ));
297289   if ( length > d->sector_size )
298290   {
299291      logerror( "thom_floppy_read_sector_data_into_buffer: sector size %i truncated to %i\n", length, d->sector_size );
r1470r1471
310302   thom_floppy_drive* d = thom_floppy_drive_of_image( image );
311303   UINT8* dst = thom_floppy_sector_ptr( d, data_id, d->cur_track, 0 );
312304   thom_floppy_active( 1 );
313   LOG(( "thom_floppy_write_sector_data_into_buffer: dev=%li track=%i idx=%i side=%i ddam=%i len=%i\n", d - thom_floppy_drives, d->cur_track, data_id, side, ddam, length ));
305   LOG(( "thom_floppy_write_sector_data_into_buffer: dev=%d track=%i idx=%i side=%i ddam=%i len=%i\n", d - thom_floppy_drives, d->cur_track, data_id, side, ddam, length ));
314306   if ( length > d->sector_size )
315307   {
316308      logerror( "thom_floppy_write_sector_data_from_buffer: sector size %i truncated to %i\n", length, d->sector_size );
r1470r1471
331323   int sector_size = 128 << n;
332324   UINT8* dst;
333325   thom_floppy_active( 1 );
334   LOG(( "thom_floppy_format_sector: dev=%li track=%i/%i side=%i/%i idx=%i/%i c=%i h=%i r=%i n=%i filler=$%02X\n",
326   LOG(( "thom_floppy_format_sector: dev=%d track=%i/%i side=%i/%i idx=%i/%i c=%i h=%i r=%i n=%i filler=$%02X\n",
335327         d - thom_floppy_drives,
336328         d->cur_track, d->tracks, side, d->sides, sector_index, d->sectors,
337329         c, h, r, n, filler ));
src/mess/formats/oric_tap.c
r1470r1471
11#include "oric_tap.h"
22#include "driver.h"
33
4#define ORIC_WAV_DEBUG 1
5#define LOG(x) do { if (ORIC_WAV_DEBUG) logerror x; } while (0)
6
47/* this code based heavily on tap2wav by Fabrice Frances */
58#define ORIC_SYNC_BYTE   0x016
69
r1470r1471
318321
319322               end = (((header[4] & 0x0ff)<<8) | (header[5] & 0x0ff));
320323               start = (((header[6] & 0x0ff)<<8) | (header[7] & 0x0ff));
321//#ifdef ORIC_WAV_DEBUG
322               logerror("start (from header): %02x\n",start);
323               logerror("end (from header): %02x\n",end);
324//#endif
324               LOG(("start (from header): %02x\n",start));
325               LOG(("end (from header): %02x\n",end));
325326                                        oric_data_length =end - start + 1;
326327            }
327328         }
r1470r1471
459460
460461               end = (((header[4] & 0x0ff)<<8) | (header[5] & 0x0ff));
461462               start = (((header[6] & 0x0ff)<<8) | (header[7] & 0x0ff));
462//#ifdef ORIC_WAV_DEBUG
463               logerror("start (from header): %02x\n",start);
464               logerror("end (from header): %02x\n",end);
465//#endif
463               LOG(("start (from header): %02x\n",start));
464               LOG(("end (from header): %02x\n",end));
466465                                        oric_data_length = end - start + 1;
467466            }
468467         }
src/mess/formats/thom_cas.c
r1470r1471
3636
3737#define PRINT(x) mame_printf_info x
3838
39#if VERBOSE > 1
40#define LOG(x)   logerror x
41#define VLOG(x)   logerror x
42#elif VERBOSE > 0
43#define LOG(x)   logerror x
44#define VLOG(x)
45#else
46#define LOG(x)
47#define VLOG(x)
48#endif
39#define LOG(x)   do { if (VERBOSE > 0) logerror x; } while (0)
40#define VLOG(x)   do { if (VERBOSE > 1) logerror x; } while (0)
4941
5042
5143
src/mess/drivers/nc.c
r1470r1471
104104#include "devices/cartslot.h"
105105#include "sound/beep.h"
106106
107/* uncomment for verbose debugging information */
108/* #define VERBOSE */
109107
110#define NC200_DEBUG
108#define VERBOSE 0
109#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
111110
111#define NC200_DEBUG 1
112#define LOG_DEBUG(x) do { if (NC200_DEBUG) logerror x; } while (0)
113
114
112115#include "includes/centroni.h"
113116#include "devices/printer.h"
114117
r1470r1471
313316
314317static TIMER_CALLBACK(nc_keyboard_timer_callback)
315318{
316#ifdef VERBOSE
317      logerror("keyboard int\n");
318#endif
319      LOG(("keyboard int\n"));
319320
320321        /* set int */
321322        nc_irq_status |= (1<<3);
r1470r1471
361362         memory_set_bankptr(bank+1, addr);
362363
363364         write_handler = MWA8_NOP;
364#ifdef VERBOSE
365         logerror("BANK %d: ROM %d\n",bank,mem_bank);
366#endif
365         LOG(("BANK %d: ROM %d\n",bank,mem_bank));
367366      }
368367      break;
369368
r1470r1471
380379         memory_set_bankptr(bank+5, addr);
381380
382381         write_handler = nc_bankhandler_w[bank];
383#ifdef VERBOSE
384         logerror("BANK %d: RAM\n",bank);
385#endif
382         LOG(("BANK %d: RAM\n",bank));
386383      }
387384      break;
388385
r1470r1471
413410               write_handler = MWA8_NOP;
414411            }
415412
416#ifdef VERBOSE
417            logerror("BANK %d: CARD-RAM\n",bank);
418#endif
413            LOG(("BANK %d: CARD-RAM\n",bank));
419414         }
420415         else
421416         {
r1470r1471
457452   if (!file)
458453      return;
459454
460#ifdef VERBOSE
461   logerror("restoring nc memory\n");
462#endif
455   LOG(("restoring nc memory\n"));
463456   /* get size of memory data stored */
464457   mame_fread(file, &stored_size, sizeof(unsigned long));
465458
r1470r1471
480473   if (!file)
481474      return;
482475
483#ifdef VERBOSE
484   logerror("storing nc memory\n");
485#endif
476   LOG(("storing nc memory\n"));
486477   /* write size of memory data */
487478   mame_fwrite(file, &mess_ram_size, sizeof(unsigned long));
488479
r1470r1471
539530         {
540531            case NC_TYPE_1xx:
541532            {
542#ifdef VERBOSE
543                 logerror("nmi triggered\n");
544#endif
533                 LOG(("nmi triggered\n"));
545534                cpunum_set_input_line(0, INPUT_LINE_NMI, PULSE_LINE);
546535            }
547536            break;
r1470r1471
628617
629618static WRITE8_HANDLER(nc_memory_management_w)
630619{
631#ifdef VERBOSE
632   logerror("Memory management W: %02x %02x\n",offset,data);
633#endif
620   LOG(("Memory management W: %02x %02x\n",offset,data));
634621        nc_memory_config[offset] = data;
635622
636623        nc_refresh_memory_config();
r1470r1471
638625
639626static WRITE8_HANDLER(nc_irq_mask_w)
640627{
641#ifdef VERBOSE
642   logerror("irq mask w: %02x\n", data);
643#endif
644#ifdef NC200_DEBUG
645   logerror("irq mask nc200 w: %02x\n",data & ((1<<4) | (1<<5) | (1<<6) | (1<<7)));
646#endif
628   LOG(("irq mask w: %02x\n", data));
629   LOG_DEBUG(("irq mask nc200 w: %02x\n",data & ((1<<4) | (1<<5) | (1<<6) | (1<<7))));
647630
648631   /* writing mask clears ints that are to be masked? */
649632   nc_irq_mask = data;
r1470r1471
653636
654637static WRITE8_HANDLER(nc_irq_status_w)
655638{
656#ifdef VERBOSE
657   logerror("irq status w: %02x\n", data);
658#endif
639   LOG(("irq status w: %02x\n", data));
659640    data = data^0x0ff;
660641
661642   if (nc_type == NC_TYPE_200)
r1470r1471
734715
735716static WRITE8_HANDLER(nc_sound_w)
736717{
737#ifdef VERBOSE
738   logerror("sound w: %04x %02x\n", offset, data);
739#endif
718   LOG(("sound w: %04x %02x\n", offset, data));
719
740720   switch (offset)
741721   {
742722      case 0x0:
r1470r1471
827807/* same for nc100 and nc200 */
828808static WRITE8_HANDLER(nc_printer_data_w)
829809{
830#ifdef VERBOSE
831   logerror("printer write %02x\n",data);
832#endif
810   LOG(("printer write %02x\n",data));
833811   centronics_write_data(0,data);
834812}
835813
r1470r1471
862840   /* bit 3-0: not used */
863841   nc_display_memory_start = (data & 0x0f0)<<(12-4);
864842
865#ifdef VERBOSE
866   logerror("disp memory w: %04x\n", (int) nc_display_memory_start);
867#endif
868
843   LOG(("disp memory w: %04x\n", (int) nc_display_memory_start));
869844}
870845
871846
r1470r1471
913888   {
914889      if (state)
915890      {
916//   #ifdef VERBOSE
917891         logerror("tx ready\n");
918//   #endif
919892         nc_irq_latch |= (1<<1);
920893      }
921894   }
r1470r1471
931904   {
932905      if (state)
933906      {
934//#ifdef VERBOSE
935907         logerror("rx ready\n");
936//#endif
937908         nc_irq_latch |= (1<<0);
938909      }
939910   }
r1470r1471
1028999   /* bits 7-1: not used */
10291000   /* bit 0: 1 = no effect, 0 = power off */
10301001   nc_poweroff_control = data;
1031#ifdef VERBOSE
1032   logerror("nc poweroff control: %02x\n",data);
1033#endif
1002   LOG(("nc poweroff control: %02x\n",data));
10341003}
10351004
10361005
r1470r1471
10841053
10851054static WRITE8_HANDLER(nc100_memory_card_wait_state_w)
10861055{
1087#ifdef VERBOSE
1088   logerror("nc100 memory card wait state: %02x\n",data);
1089#endif
1056   LOG(("nc100 memory card wait state: %02x\n",data));
10901057}
10911058
10921059
r1470r1471
12551222   /* bit 4-0: not used */
12561223   nc_display_memory_start = (data & 0x0e0)<<(12-4);
12571224
1258#ifdef VERBOSE
1259   logerror("disp memory w: %04x\n", (int) nc_display_memory_start);
1260#endif
1225   LOG(("disp memory w: %04x\n", (int) nc_display_memory_start));
12611226}
12621227#endif
12631228
r1470r1471
13651330#ifdef UNUSED_FUNCTION
13661331static void nc200_floppy_drive_index_callback(int drive_id)
13671332{
1368#ifdef NC200_DEBUG
1369   logerror("nc200 index pulse\n");
1370#endif
1333   LOG_DEBUG(("nc200 index pulse\n"));
13711334//   nc_irq_status |= (1<<4);
13721335
13731336//   nc_update_interrupts();
r1470r1471
15191482   }
15201483
15211484   /* bit 5 is used in disk interface */
1522#ifdef NC200_DEBUG
1523   logerror("bit 5: PC: %04x %02x\n",activecpu_get_pc(), data & (1<<5));
1524#endif
1485   LOG_DEBUG(("bit 5: PC: %04x %02x\n",activecpu_get_pc(), data & (1<<5)));
15251486}
15261487
15271488
r1470r1471
15391500
15401501static WRITE8_HANDLER(nc200_memory_card_wait_state_w)
15411502{
1542#ifdef NC200_DEBUG
1543   logerror("nc200 memory card wait state: PC: %04x %02x\n",activecpu_get_pc(),data);
1544#endif
1503   LOG_DEBUG(("nc200 memory card wait state: PC: %04x %02x\n",activecpu_get_pc(),data));
15451504   floppy_drive_set_motor_state(0,1);
15461505   floppy_drive_set_ready_state(0,1,1);
15471506
r1470r1471
15531512/* bit 0 seems to be the same as nc100 */
15541513static WRITE8_HANDLER(nc200_poweroff_control_w)
15551514{
1556#ifdef NC200_DEBUG
1557   logerror("nc200 power off: PC: %04x %02x\n", activecpu_get_pc(),data);
1558#endif
1515   LOG_DEBUG(("nc200 power off: PC: %04x %02x\n", activecpu_get_pc(),data));
15591516
15601517   nc200_video_set_backlight(((data^(1<<2))>>2) & 0x01);
15611518}
src/mess/drivers/sord.c
r1470r1471
3636#include "formats/basicdsk.h"
3737
3838
39#define SORD_DEBUG
39#define SORD_DEBUG 1
40#define LOG(x) do { if (SORD_DEBUG) logerror x; } while (0)
4041
4142/*********************************************************************************************/
4243/* FD5 disk interface */
r1470r1471
7071   cpu_yield();
7172
7273   fd5_port_0x020_data = data;
73#ifdef SORD_DEBUG
74   logerror("fd5 0x020: %02x %04x\n",data,activecpu_get_pc());
75#endif
74   LOG(("fd5 0x020: %02x %04x\n",data,activecpu_get_pc()));
7675}
7776
7877static  READ8_HANDLER(fd5_communication_r)
r1470r1471
8281   cpu_yield();
8382
8483   data = (obfa<<3)|(ibfa<<2)|2;
85#ifdef SORD_DEBUG
86   logerror("fd5 0x030: %02x %04x\n",data, activecpu_get_pc());
87#endif
84   LOG(("fd5 0x030: %02x %04x\n",data, activecpu_get_pc()));
8885
8986   return data;
9087}
r1470r1471
9390{
9491   cpu_yield();
9592
96#ifdef SORD_DEBUG
97   logerror("fd5 0x010 r: %02x %04x\n",fd5_databus,activecpu_get_pc());
98#endif
93   LOG(("fd5 0x010 r: %02x %04x\n",fd5_databus,activecpu_get_pc()));
9994
10095   ppi8255_set_portC(0, 0x50);
10196   ppi8255_set_portC(0, 0x10);
r1470r1471
106101
107102static WRITE8_HANDLER(fd5_data_w)
108103{
109#ifdef SORD_DEBUG
110   logerror("fd5 0x010 w: %02x %04x\n",data,activecpu_get_pc());
111#endif
104   LOG(("fd5 0x010 w: %02x %04x\n",data,activecpu_get_pc()));
112105
113106   fd5_databus = data;
114107
r1470r1471
129122   else
130123      state = 1;
131124
132#ifdef SORD_DEBUG
133   logerror("fd5 drive state w: %02x\n",state);
134#endif
125   LOG(("fd5 drive state w: %02x\n",state));
135126
136127   floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), state);
137128   floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), state);
r1470r1471
219210{
220211   cpu_yield();
221212
222#ifdef SORD_DEBUG
223   logerror("m5 read from pi5 port b %04x\n",activecpu_get_pc());
224#endif
213   LOG(("m5 read from pi5 port b %04x\n",activecpu_get_pc()));
225214
226215   return 0x0ff;
227216}
r1470r1471
230219{
231220   cpu_yield();
232221
233#ifdef SORD_DEBUG
234   logerror("m5 read from pi5 port c %04x\n",activecpu_get_pc());
235#endif
222   LOG(("m5 read from pi5 port c %04x\n",activecpu_get_pc()));
236223
237224/* from fd5 */
238225/* 00 = 0000 = write */
r1470r1471
279266      cpunum_set_input_line(1, INPUT_LINE_RESET, ASSERT_LINE);
280267      cpunum_set_input_line(1, INPUT_LINE_RESET, CLEAR_LINE);
281268   }
282#ifdef SORD_DEBUG
283   logerror("m5 write to pi5 port b: %02x %04x\n",data,activecpu_get_pc());
284#endif
269   LOG(("m5 write to pi5 port b: %02x %04x\n",data,activecpu_get_pc()));
285270}
286271
287272/* A,  B,  C,  D,  E,   F,  G,  H,  I,  J, K,  L,  M,   N, O, P, Q, R,   */
r1470r1471
297282   ibfa = (data & 0x20) ? 1 : 0;
298283
299284   cpu_yield();
300#ifdef SORD_DEBUG
301   logerror("m5 write to pi5 port c: %02x %04x\n",data,activecpu_get_pc());
302#endif
285   LOG(("m5 write to pi5 port c: %02x %04x\n",data,activecpu_get_pc()));
303286}
304287
305288static const ppi8255_interface sord_ppi8255_interface =
src/mess/drivers/mbee.c
r1470r1471
4949#include "mslegacy.h"
5050#include "cpu/z80/z80daisy.h"
5151
52#define VERBOSE 1
53
54#if VERBOSE
55#define LOG(x)  logerror x
56#else
57#define LOG(x)  /* x */
58#endif
59
6052static ADDRESS_MAP_START(mbee_mem, ADDRESS_SPACE_PROGRAM, 8)
6153   AM_RANGE(0x0000, 0x7fff) AM_RAM AM_READ( mbee_lowram_r ) AM_BASE( &mbee_workram )
6254   AM_RANGE(0x8000, 0xbfff) AM_ROM
src/mess/drivers/kim1.c
r1470r1471
6666#include "driver.h"
6767#include "includes/kim1.h"
6868
69#ifndef VERBOSE
70#define VERBOSE 1
71#endif
72
73#if VERBOSE
74#define LOG(x)   if( errorlog ) fprintf x
75#else
76#define LOG(x)   /* x */
77#endif
78
7969static ADDRESS_MAP_START ( kim1_map , ADDRESS_SPACE_PROGRAM, 8)
8070   AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0xe000) AM_RAM
8171   AM_RANGE(0x1700, 0x173f) AM_MIRROR(0xe000) AM_READWRITE( m6530_003_r, m6530_003_w )
src/mess/drivers/mz700.c
r1470r1471
6868#include "formats/mz_cas.h"
6969#include "mslegacy.h"
7070
71#ifndef VERBOSE
72#define VERBOSE 1
73#endif
74
75#if VERBOSE
76#define LOG(N,M,A)   \
77   if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s",timer_get_time(),(char*)M ); logerror A; }
78#else
79#define LOG(N,M,A)
80#endif
81
8271static ADDRESS_MAP_START( mz700_mem, ADDRESS_SPACE_PROGRAM, 8)
8372   AM_RANGE( 0x00000, 0x00fff) AM_RAMBANK(1)
8473   AM_RANGE( 0x01000, 0x0cfff) AM_RAM
src/mess/drivers/pcw.c
r1470r1471
102102#include "image.h"
103103#include "sound/beep.h"
104104
105// uncomment for debug log output
106//#define VERBOSE
105#define VERBOSE 0
106#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
107107
108108static void pcw_fdc_interrupt(int);
109109
r1470r1471
391391
392392static WRITE8_HANDLER(pcw_bank_select_w)
393393{
394#ifdef VERBOSE
395   logerror("BANK: %2x %x\n",offset, data);
396#endif
394   LOG(("BANK: %2x %x\n",offset, data));
397395   pcw_banks[offset] = data;
398396
399397   pcw_update_mem(offset, data);
r1470r1471
431429
432430static WRITE8_HANDLER(pcw_system_control_w)
433431{
434#ifdef VERBOSE
435   logerror("SYSTEM CONTROL: %d\n",data);
436#endif
432   LOG(("SYSTEM CONTROL: %d\n",data));
437433
438434   switch (data)
439435   {
src/mess/drivers/mekd2.c
r1470r1471
3131#include "devices/cartslot.h"
3232#include "includes/mekd2.h"
3333
34#ifndef VERBOSE
35#define VERBOSE 1
36#endif
37
38#if VERBOSE
39#define LOG(x)   logerror(x)
40#else
41#define LOG(x)   /* x */
42#endif
43
4434#ifdef UNUSED_FUNCTION
4535static  READ8_HANDLER(mekd2_pia_r) { return 0xff; }
4636static  READ8_HANDLER(mekd2_cas_r) { return 0xff; }
src/mess/drivers/channelf.c
r1470r1471
1919#define VERBOSE 0
2020#endif
2121
22#define LOG(x)   do { if (VERBOSE) logerror x; } while (0)
2223
23#if VERBOSE
24#define LOG(x)   logerror x
25#else
26#define LOG(x)   /* x */
27#endif
28
2924/* The F8 has latches on its port pins
3025 * These mimic's their behavior
3126 * [0]=port0, [1]=port1, [2]=port4, [3]=port5
src/mess/drivers/a310.c
r1470r1471
3737#include "sound/dac.h"
3838#include "image.h"
3939
40#ifndef VERBOSE
41#define VERBOSE 0
42#endif
43
44#if VERBOSE
45#define LOG(x)   logerror x
46#else
47#define LOG(x)   /* x */
48#endif
49
5040// interrupt register stuff
5141#define A310_IRQA_PRINTER_BUSY (0x01)
5242#define A310_IRQA_SERIAL_RING  (0x02)
src/mess/drivers/psx.c
r1470r1471
8888      }
8989
9090      memory_set_opbase_handler( 0, NULL );
91#ifdef MAME_DEBUG
91
9292      DEBUGGER_BREAK;
9393      CALL_MAME_DEBUG;
94#endif
94
9595      return ~0;
9696   }
9797   return address;
src/mess/drivers/vtech2.c
r1470r1471
7070#include "devices/cassette.h"
7171#include "formats/vt_cas.h"
7272
73#define VERBOSE 0
74
75#if VERBOSE
76#define LOG(x)   logerror x
77#else
78#define LOG(x)   /* x */
79#endif
80
8173static ADDRESS_MAP_START(vtech2_mem, ADDRESS_SPACE_PROGRAM, 8 )
8274   AM_RANGE(0x0000, 0x3fff) AM_READWRITE(MRA8_BANK1, MWA8_BANK1)
8375   AM_RANGE(0x4000, 0x7fff) AM_READWRITE(MRA8_BANK2, MWA8_BANK2)
docs/messnew.txt
r1470r1471
2929- The core is based on MAME 0.122u2.  This incorporates all features of the
3030  update to this core.  [MAME team]
3131
32- Conditional logging cleanups.  [Atari Ace]
3233
3334
35
34360.122
3537
3638New System Drivers Supported (in no particular order):

Previous 15994 Revisions Next


© 1998-2018 The MESS Team