From 109dd226aad40f4f2f122e6ccfc7f038610a5ceb Mon Sep 17 00:00:00 2001 From: drdani Date: Tue, 4 Dec 2001 07:55:57 +0000 Subject: [PATCH] fix printf is a macro in gcc 3 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1660 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- sim/ucsim/avr.src/avr.cc | 38 ++++++++--------- sim/ucsim/cmd.src/bp.cc | 14 +++--- sim/ucsim/cmd.src/cmdconf.cc | 19 ++++----- sim/ucsim/cmd.src/cmdgui.cc | 4 +- sim/ucsim/cmd.src/cmdset.cc | 36 ++++++++-------- sim/ucsim/cmd.src/cmduc.cc | 78 +++++++++++++++++----------------- sim/ucsim/cmd.src/get.cc | 12 +++--- sim/ucsim/cmd.src/info.cc | 22 +++++----- sim/ucsim/cmd.src/newcmd.cc | 40 ++++++++--------- sim/ucsim/cmd.src/newcmdcl.h | 4 +- sim/ucsim/cmd.src/set.cc | 14 +++--- sim/ucsim/cmd.src/show.cc | 4 +- sim/ucsim/cmd.src/timer.cc | 41 +++++++++--------- sim/ucsim/s51.src/interrupt.cc | 38 ++++++++--------- sim/ucsim/s51.src/port.cc | 20 ++++----- sim/ucsim/s51.src/serial.cc | 30 ++++++------- sim/ucsim/s51.src/timer0.cc | 20 ++++----- sim/ucsim/s51.src/timer1.cc | 20 ++++----- sim/ucsim/s51.src/timer2.cc | 29 +++++++------ sim/ucsim/s51.src/uc390.cc | 47 ++++++++++---------- sim/ucsim/s51.src/uc51.cc | 23 +++++----- sim/ucsim/sim.src/hw.cc | 2 +- sim/ucsim/sim.src/mem.cc | 16 +++---- sim/ucsim/sim.src/option.cc | 8 ++-- sim/ucsim/sim.src/sim.cc | 24 +++++------ sim/ucsim/sim.src/uc.cc | 44 ++++++++++--------- sim/ucsim/z80.src/z80.cc | 56 ++++++++++++------------ 27 files changed, 354 insertions(+), 349 deletions(-) diff --git a/sim/ucsim/avr.src/avr.cc b/sim/ucsim/avr.src/avr.cc index 6e62f66a..74ac188a 100644 --- a/sim/ucsim/avr.src/avr.cc +++ b/sim/ucsim/avr.src/avr.cc @@ -277,32 +277,32 @@ cl_avr::print_regs(class cl_console *con) ram->dump(0, 31, 16, con); - con->printf("ITHSVNZC SREG= 0x%02x %3d %c\n", - sreg, sreg, isprint(sreg)?sreg:'.'); - con->printf("%c%c%c%c%c%c%c%c ", - (sreg&BIT_I)?'1':'0', - (sreg&BIT_T)?'1':'0', - (sreg&BIT_H)?'1':'0', - (sreg&BIT_S)?'1':'0', - (sreg&BIT_V)?'1':'0', - (sreg&BIT_N)?'1':'0', - (sreg&BIT_Z)?'1':'0', - (sreg&BIT_C)?'1':'0'); - con->printf("SP = 0x%06x\n", - ram->get(SPH)*256+ram->get(SPL)); + con->dd_printf("ITHSVNZC SREG= 0x%02x %3d %c\n", + sreg, sreg, isprint(sreg)?sreg:'.'); + con->dd_printf("%c%c%c%c%c%c%c%c ", + (sreg&BIT_I)?'1':'0', + (sreg&BIT_T)?'1':'0', + (sreg&BIT_H)?'1':'0', + (sreg&BIT_S)?'1':'0', + (sreg&BIT_V)?'1':'0', + (sreg&BIT_N)?'1':'0', + (sreg&BIT_Z)?'1':'0', + (sreg&BIT_C)?'1':'0'); + con->dd_printf("SP = 0x%06x\n", + ram->get(SPH)*256+ram->get(SPL)); x= ram->get(XH)*256 + ram->get(XL); data= ram->get(x); - con->printf("X= 0x%04x [X]= 0x%02x %3d %c ", x, - data, data, isprint(data)?data:'.'); + con->dd_printf("X= 0x%04x [X]= 0x%02x %3d %c ", x, + data, data, isprint(data)?data:'.'); y= ram->get(YH)*256 + ram->get(YL); data= ram->get(y); - con->printf("Y= 0x%04x [Y]= 0x%02x %3d %c ", y, - data, data, isprint(data)?data:'.'); + con->dd_printf("Y= 0x%04x [Y]= 0x%02x %3d %c ", y, + data, data, isprint(data)?data:'.'); z= ram->get(ZH)*256 + ram->get(ZL); data= ram->get(z); - con->printf("Z= 0x%04x [Z]= 0x%02x %3d %c\n", z, - data, data, isprint(data)?data:'.'); + con->dd_printf("Z= 0x%04x [Z]= 0x%02x %3d %c\n", z, + data, data, isprint(data)?data:'.'); print_disass(PC, con); } diff --git a/sim/ucsim/cmd.src/bp.cc b/sim/ucsim/cmd.src/bp.cc index 19c3e767..c951642b 100644 --- a/sim/ucsim/cmd.src/bp.cc +++ b/sim/ucsim/cmd.src/bp.cc @@ -83,7 +83,7 @@ COMMAND_DO_WORK_UC(cl_break_cmd) } else { - con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); + con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); return(DD_FALSE); } return(DD_FALSE); @@ -95,11 +95,11 @@ cl_break_cmd::do_fetch(class cl_uc *uc, { if (hit > 99999) { - con->printf("Hit value %d is too big.\n", hit); + con->dd_printf("Hit value %d is too big.\n", hit); return; } if (uc->fbrk->bp_at(addr)) - con->printf("Breakpoint at 0x%06x is already set.\n", addr); + con->dd_printf("Breakpoint at 0x%06x is already set.\n", addr); else { class cl_brk *b= new cl_fetch_brk(uc->make_new_brknr(), @@ -107,7 +107,7 @@ cl_break_cmd::do_fetch(class cl_uc *uc, b->init(); uc->fbrk->add_bp(b); char *s= uc->disass(addr, NULL); - con->printf("Breakpoint %d at 0x%06x: %s\n", b->nr, addr, s); + con->dd_printf("Breakpoint %d at 0x%06x: %s\n", b->nr, addr, s); free(s); } } @@ -123,7 +123,7 @@ cl_break_cmd::do_event(class cl_uc *uc, if (b) uc->ebrk->add_bp(b); else - con->printf("Couldn't make event breakpoint\n"); + con->dd_printf("Couldn't make event breakpoint\n"); } @@ -143,7 +143,7 @@ COMMAND_DO_WORK_UC(cl_clear_cmd) { if (!brk) { - con->printf("No breakpoint at this address.\n"); + con->dd_printf("No breakpoint at this address.\n"); return(0); } uc->fbrk->del_bp(uc->PC); @@ -159,7 +159,7 @@ COMMAND_DO_WORK_UC(cl_clear_cmd) return(DD_FALSE); addr= param->value.address; if (uc->fbrk->bp_at(addr) == 0) - con->printf("No breakpoint at 0x%06x\n", addr); + con->dd_printf("No breakpoint at 0x%06x\n", addr); else uc->fbrk->del_bp(addr); } diff --git a/sim/ucsim/cmd.src/cmdconf.cc b/sim/ucsim/cmd.src/cmdconf.cc index 3f69ef72..92aae0c2 100644 --- a/sim/ucsim/cmd.src/cmdconf.cc +++ b/sim/ucsim/cmd.src/cmdconf.cc @@ -48,23 +48,22 @@ COMMAND_DO_WORK_UC(cl_conf_cmd) { int i; - con->printf("ucsim version %s\n", VERSIONSTR); - con->printf("Type of microcontroller: %s\n", uc->id_string()); - con->printf("Controller has %d hardware element(s).\n", - uc->hws->count); + con->dd_printf("ucsim version %s\n", VERSIONSTR); + con->dd_printf("Type of microcontroller: %s\n", uc->id_string()); + con->dd_printf("Controller has %d hardware element(s).\n", uc->hws->count); for (i= 0; i < uc->hws->count; i++) { class cl_hw *hw= (class cl_hw *)(uc->hws->at(i)); - con->printf(" %s[%d]\n", hw->id_string, hw->id); + con->dd_printf(" %s[%d]\n", hw->id_string, hw->id); } - con->printf("Memories:\n"); + con->dd_printf("Memories:\n"); for (i= MEM_ROM; i < MEM_TYPES; i++) { class cl_mem *mem= (class cl_mem *)(uc->mems->at(i)); if (mem) - con->printf(" %s size= 0x%06x %6d width= %2d class= \"%s\"\n", - mem->id_string(), mem->size, mem->size, mem->width, - (mem->class_name)?(mem->class_name):"unknown"); + con->dd_printf(" %s size= 0x%06x %6d width= %2d class= \"%s\"\n", + mem->id_string(), mem->size, mem->size, mem->width, + (mem->class_name)?(mem->class_name):"unknown"); } return(0); } @@ -99,7 +98,7 @@ COMMAND_DO_WORK_UC(cl_conf_addmem_cmd) uc->mems->put_at(type, mem); } else - con->printf("Can not make memory \"%s\"\n", mem_class); + con->dd_printf("Can not make memory \"%s\"\n", mem_class); } return(DD_FALSE); } diff --git a/sim/ucsim/cmd.src/cmdgui.cc b/sim/ucsim/cmd.src/cmdgui.cc index 96d77951..cd10416e 100644 --- a/sim/ucsim/cmd.src/cmdgui.cc +++ b/sim/ucsim/cmd.src/cmdgui.cc @@ -65,8 +65,8 @@ COMMAND_DO_WORK_UC(cl_gui_start_cmd) } else { - con->printf("Error: wrong syntax\n" - "%s\n", short_help?short_help:"no help"); + con->dd_printf("Error: wrong syntax\n" + "%s\n", short_help?short_help:"no help"); } return(DD_FALSE);; diff --git a/sim/ucsim/cmd.src/cmdset.cc b/sim/ucsim/cmd.src/cmdset.cc index 59d6b2f4..d77702f9 100644 --- a/sim/ucsim/cmd.src/cmdset.cc +++ b/sim/ucsim/cmd.src/cmdset.cc @@ -60,25 +60,25 @@ COMMAND_DO_WORK_SIM(cl_run_cmd) if (params[0]) if (!(params[0]->get_address(sim->uc, &start))) { - con->printf("Error: wrong start address\n"); + con->dd_printf("Error: wrong start address\n"); return(DD_FALSE); } if (params[1]) if (!(params[1]->get_address(sim->uc, &end))) { - con->printf("Error: wromg end address\n"); + con->dd_printf("Error: wromg end address\n"); return(DD_FALSE); } if (params[0]) { if (!sim->uc->inst_at(start)) - con->printf("Warning: maybe not instruction at 0x%06lx\n", start); + con->dd_printf("Warning: maybe not instruction at 0x%06lx\n", start); sim->uc->PC= start; if (params[1]) { if (start == end) { - con->printf("Addresses must be different.\n"); + con->dd_printf("Addresses must be different.\n"); return(DD_FALSE); } if ((b= sim->uc->fbrk_at(end))) @@ -92,7 +92,7 @@ COMMAND_DO_WORK_SIM(cl_run_cmd) } } } - con->printf("Simulation started, PC=0x%06x\n", sim->uc->PC); + con->dd_printf("Simulation started, PC=0x%06x\n", sim->uc->PC); if (sim->uc->fbrk_at(start)) sim->uc->do_inst(1); sim->start(con); @@ -202,9 +202,9 @@ COMMAND_DO_WORK_APP(cl_help_cmd) { c= (class cl_cmd *)(cmdset->at(i)); if (c->short_help) - con->printf("%s\n", c->short_help); + con->dd_printf("%s\n", c->short_help); else - con->printf("%s\n", (char*)(c->names->at(0))); + con->dd_printf("%s\n", (char*)(c->names->at(0))); } } else if (cmdline->syntax_match(/*sim*/0, STRING)) { @@ -216,7 +216,7 @@ COMMAND_DO_WORK_APP(cl_help_cmd) matches++; } if (!matches) - con->printf("No such command\n"); + con->dd_printf("No such command\n"); else if (matches > 1) for (i= 0; i < cmdset->count; i++) { @@ -224,9 +224,9 @@ COMMAND_DO_WORK_APP(cl_help_cmd) if (!c->name_match(parm->value.string.string, DD_FALSE)) continue; if (c->short_help) - con->printf("%s\n", c->short_help); + con->dd_printf("%s\n", c->short_help); else - con->printf("%s\n", (char*)(c->names->at(0))); + con->dd_printf("%s\n", (char*)(c->names->at(0))); } else for (i= 0; i < cmdset->count; i++) @@ -235,22 +235,22 @@ COMMAND_DO_WORK_APP(cl_help_cmd) if (!c->name_match(parm->value.string.string, DD_FALSE)) continue; if (c->short_help) - con->printf("%s\n", c->short_help); + con->dd_printf("%s\n", c->short_help); else - con->printf("%s\n", (char*)(c->names->at(0))); + con->dd_printf("%s\n", (char*)(c->names->at(0))); int names; - con->printf("Names of command:"); + con->dd_printf("Names of command:"); for (names= 0; names < c->names->count; names++) - con->printf(" %s", (char*)(c->names->at(names))); - con->printf("\n"); + con->dd_printf(" %s", (char*)(c->names->at(names))); + con->dd_printf("\n"); if (c->long_help) - con->printf("%s\n", c->long_help); + con->dd_printf("%s\n", c->long_help); else - con->printf("%s\n", (char*)(c->names->at(0))); + con->dd_printf("%s\n", (char*)(c->names->at(0))); } } else - con->printf("%s\n", short_help?short_help:"Error: wrong syntax"); + con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax"); return(0); } diff --git a/sim/ucsim/cmd.src/cmduc.cc b/sim/ucsim/cmd.src/cmduc.cc index 0bd30a98..5c4bf67a 100644 --- a/sim/ucsim/cmd.src/cmduc.cc +++ b/sim/ucsim/cmd.src/cmduc.cc @@ -46,26 +46,26 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA // class cl_cmdline *cmdline, class cl_console *con) COMMAND_DO_WORK_UC(cl_state_cmd) { - con->printf("CPU state= %s PC= 0x%06x XTAL= %g\n", - get_id_string(cpu_states, uc->state), - uc->PC, - uc->xtal); - con->printf("Total time since last reset= %g sec (%lu clks)\n", - uc->get_rtime(), uc->ticks->ticks); - con->printf("Time in isr = %g sec (%lu clks) %3.2g%%\n", - uc->isr_ticks->get_rtime(uc->xtal), - uc->isr_ticks->ticks, - (uc->ticks->ticks == 0)?0.0: - (100.0*((double)(uc->isr_ticks->ticks)/ - (double)(uc->ticks->ticks)))); - con->printf("Time in idle= %g sec (%lu clks) %3.2g%%\n", - uc->idle_ticks->get_rtime(uc->xtal), - uc->idle_ticks->ticks, - (uc->ticks->ticks == 0)?0.0: - (100.0*((double)(uc->idle_ticks->ticks)/ - (double)(uc->ticks->ticks)))); - con->printf("Max value of stack pointer= 0x%06x, avg= 0x%06x\n", - uc->sp_max, uc->sp_avg); + con->dd_printf("CPU state= %s PC= 0x%06x XTAL= %g\n", + get_id_string(cpu_states, uc->state), + uc->PC, + uc->xtal); + con->dd_printf("Total time since last reset= %g sec (%lu clks)\n", + uc->get_rtime(), uc->ticks->ticks); + con->dd_printf("Time in isr = %g sec (%lu clks) %3.2g%%\n", + uc->isr_ticks->get_rtime(uc->xtal), + uc->isr_ticks->ticks, + (uc->ticks->ticks == 0)?0.0: + (100.0*((double)(uc->isr_ticks->ticks)/ + (double)(uc->ticks->ticks)))); + con->dd_printf("Time in idle= %g sec (%lu clks) %3.2g%%\n", + uc->idle_ticks->get_rtime(uc->xtal), + uc->idle_ticks->ticks, + (uc->ticks->ticks == 0)?0.0: + (100.0*((double)(uc->idle_ticks->ticks)/ + (double)(uc->ticks->ticks)))); + con->dd_printf("Max value of stack pointer= 0x%06x, avg= 0x%06x\n", + uc->sp_max, uc->sp_avg); return(0); } @@ -86,11 +86,11 @@ COMMAND_DO_WORK_UC(cl_file_cmd) if ((cmdline->param(0) == 0) || ((fname= cmdline->param(0)->get_svalue()) == NULL)) { - con->printf("File name is missing.\n"); + con->dd_printf("File name is missing.\n"); return(0); } if ((l= uc->read_hex_file(fname)) >= 0) - con->printf("%ld words read from %s\n", l, fname); + con->dd_printf("%ld words read from %s\n", l, fname); return(0); } @@ -109,7 +109,7 @@ COMMAND_DO_WORK_UC(cl_dl_cmd) long l; if ((l= uc->read_hex_file(NULL)) >= 0) - con->printf("%ld words loaded\n", l); + con->dd_printf("%ld words loaded\n", l); return(0); } @@ -132,13 +132,13 @@ COMMAND_DO_WORK_UC(cl_pc_cmd) { if (!(params[0]->get_address(uc, &addr))) { - con->printf("Error: wrong parameter\n"); + con->dd_printf("Error: wrong parameter\n"); return(DD_FALSE); } if (addr >= uc->get_mem_size(MEM_ROM)) addr= 0; if (!uc->inst_at(addr)) - con->printf("Warning: maybe not instruction at 0x%06x\n", addr); + con->dd_printf("Warning: maybe not instruction at 0x%06x\n", addr); uc->PC= addr; } uc->print_disass(uc->PC, con); @@ -194,16 +194,16 @@ COMMAND_DO_WORK_UC(cl_dump_cmd) mem, params[0]->value.bit.mem_address, params[0]->value.bit.mask); - con->printf("%10s ", sn?sn:""); - con->printf(mem->addr_format, params[0]->value.bit.mem_address); - con->printf(" "); - con->printf(mem->data_format, m); - con->printf(" %c\n", (m&(params[0]->value.bit.mask))?'1':'0'); + con->dd_printf("%10s ", sn?sn:""); + con->dd_printf(mem->addr_format, params[0]->value.bit.mem_address); + con->dd_printf(" "); + con->dd_printf(mem->data_format, m); + con->dd_printf(" %c\n", (m&(params[0]->value.bit.mask))?'1':'0'); i++; params[0]= cmdline->param(i); } if (params[0]) - con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); + con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); } else if (cmdline->syntax_match(uc, MEMORY)) { @@ -230,7 +230,7 @@ COMMAND_DO_WORK_UC(cl_dump_cmd) mem->dump(start, end, bpl, con); } else - con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); + con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); return(DD_FALSE);; } @@ -329,12 +329,12 @@ COMMAND_DO_WORK_UC(cl_dc_cmd) } if (start >= rom->size) { - con->printf("Error: start address is wrong\n"); + con->dd_printf("Error: start address is wrong\n"); return(DD_FALSE); } if (end >= rom->size) { - con->printf("Error: end address is wrong\n"); + con->dd_printf("Error: end address is wrong\n"); return(DD_FALSE); } @@ -382,13 +382,13 @@ COMMAND_DO_WORK_UC(cl_disassemble_cmd) } else { - con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); + con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); return(DD_FALSE); } if (lines < 1) { - con->printf("Error: wrong `lines' parameter\n"); + con->dd_printf("Error: wrong `lines' parameter\n"); return(DD_FALSE); } if (!uc->there_is_inst()) @@ -459,7 +459,7 @@ COMMAND_DO_WORK_UC(cl_fill_cmd) } } else - con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); + con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); return(DD_FALSE);; } @@ -485,7 +485,7 @@ cl_where_cmd::do_real_work(class cl_uc *uc, int len= params[1]->value.data_list.len; if (!len) { - con->printf("Error: nothing to search for\n"); + con->dd_printf("Error: nothing to search for\n"); return(DD_FALSE); } t_addr addr= 0; @@ -498,7 +498,7 @@ cl_where_cmd::do_real_work(class cl_uc *uc, } } else - con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); + con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); return(DD_FALSE); } diff --git a/sim/ucsim/cmd.src/get.cc b/sim/ucsim/cmd.src/get.cc index b3183da8..05712d38 100644 --- a/sim/ucsim/cmd.src/get.cc +++ b/sim/ucsim/cmd.src/get.cc @@ -56,7 +56,7 @@ COMMAND_DO_WORK_UC(cl_get_sfr_cmd) if (!mem) { - con->printf("Error: No SFR\n"); + con->dd_printf("Error: No SFR\n"); return(DD_FALSE); } for (i= 0, parm= cmdline->param(i); @@ -64,8 +64,8 @@ COMMAND_DO_WORK_UC(cl_get_sfr_cmd) i++, parm= cmdline->param(i)) { if (!parm->as_address(uc)) - con->printf("Warning: Invalid address %s\n", - (char*)cmdline->tokens->at(i+1)); + con->dd_printf("Warning: Invalid address %s\n", + (char*)cmdline->tokens->at(i+1)); else mem->dump(parm->value.address, parm->value.address, 1, con); } @@ -93,7 +93,7 @@ COMMAND_DO_WORK_UC(cl_get_option_cmd) s= parm->value.string.string; } else - con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); + con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); int i; for (i= 0; i < uc->options->count; i++) @@ -102,9 +102,9 @@ COMMAND_DO_WORK_UC(cl_get_option_cmd) if (!s || !strcmp(s, o->id)) { - con->printf("%s ", o->id); + con->dd_printf("%s ", o->id); o->print(con); - con->printf(" %s\n", o->help); + con->dd_printf(" %s\n", o->help); } } diff --git a/sim/ucsim/cmd.src/info.cc b/sim/ucsim/cmd.src/info.cc index 3c493589..9e04cc79 100644 --- a/sim/ucsim/cmd.src/info.cc +++ b/sim/ucsim/cmd.src/info.cc @@ -47,31 +47,31 @@ COMMAND_DO_WORK_UC(cl_info_bp_cmd) int i; char *s; - con->printf("Num Type Disp Hit Cnt Address What\n"); + con->dd_printf("Num Type Disp Hit Cnt Address What\n"); for (i= 0; i < uc->fbrk->count; i++) { class cl_brk *fb= (class cl_brk *)(uc->fbrk->at(i)); s= uc->disass(fb->addr, NULL); - con->printf("%-3d %-10s %s %-5d %-5d 0x%06x %s\n", fb->nr, - "fetch", (fb->perm==brkFIX)?"keep":"del ", - fb->hit, fb->cnt, - fb->addr, s); + con->dd_printf("%-3d %-10s %s %-5d %-5d 0x%06x %s\n", fb->nr, + "fetch", (fb->perm==brkFIX)?"keep":"del ", + fb->hit, fb->cnt, + fb->addr, s); free(s); } for (i= 0; i < uc->ebrk->count; i++) { class cl_ev_brk *eb= (class cl_ev_brk *)(uc->ebrk->at(i)); - con->printf("%-3d %-10s %s %-5d %-5d 0x%06x %s\n", eb->nr, - "event", (eb->perm==brkFIX)?"keep":"del ", - eb->hit, eb->cnt, - eb->addr, eb->id); + con->dd_printf("%-3d %-10s %s %-5d %-5d 0x%06x %s\n", eb->nr, + "event", (eb->perm==brkFIX)?"keep":"del ", + eb->hit, eb->cnt, + eb->addr, eb->id); } /*t_addr a; class cl_rom *r= (class cl_rom *)(sim->uc->mem(MEM_ROM)); for (a= 0; a < sim->uc->get_mem_size(MEM_ROM); a++) { if (r->bp_map->get(a)) - con->printf("0x%06x\n", a); + con->dd_printf("0x%06x\n", a); }*/ return(0); } @@ -111,7 +111,7 @@ COMMAND_DO_WORK_UC(cl_info_hw_cmd) hw->print_info(con); } else - con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); + con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); return(DD_FALSE); } diff --git a/sim/ucsim/cmd.src/newcmd.cc b/sim/ucsim/cmd.src/newcmd.cc index 8878c617..580af58d 100644 --- a/sim/ucsim/cmd.src/newcmd.cc +++ b/sim/ucsim/cmd.src/newcmd.cc @@ -195,7 +195,7 @@ cl_cmdline::split(void) if (*end == '"') end--; else - con->printf("Unterminated string\n"); + con->dd_printf("Unterminated string\n"); param_str= (char *)malloc(end-start+2); strncpy(param_str, start, 1+end-start); param_str[1+end-start]= '\0'; @@ -236,7 +236,7 @@ cl_cmdline::split(void) if (*dot == '\0') { bit= 0; - con->printf("Uncomplete bit address\n"); + con->dd_printf("Uncomplete bit address\n"); delete sfr; } else @@ -274,7 +274,7 @@ cl_cmdline::split(void) if (*dot == '\0') { aname= 0; - con->printf("Uncomplete array\n"); + con->dd_printf("Uncomplete array\n"); } else { @@ -290,7 +290,7 @@ cl_cmdline::split(void) *p= '\0'; if (strlen(dot) == 0) { - con->printf("Uncomplete array index\n"); + con->dd_printf("Uncomplete array index\n"); delete aname; } else @@ -611,21 +611,21 @@ cl_cmd::work(class cl_app *app, case operate_on_app: if (!app) { - con->printf("There is no application to work on!\n"); + con->dd_printf("There is no application to work on!\n"); return(DD_TRUE); } return(do_work(app, cmdline, con)); case operate_on_sim: if (!sim) { - con->printf("There is no simulator to work on!\n"); + con->dd_printf("There is no simulator to work on!\n"); return(DD_TRUE); } return(do_work(sim, cmdline, con)); case operate_on_uc: if (!sim) { - con->printf("There is no microcontroller to work on!\n"); + con->dd_printf("There is no microcontroller to work on!\n"); return(DD_TRUE); } return(do_work(uc, cmdline, con)); @@ -637,7 +637,7 @@ cl_cmd::work(class cl_app *app, int cl_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con) { - con->printf("Command \"%s\" does nothing.\n", + con->dd_printf("Command \"%s\" does nothing.\n", (char*)(names->at(0))); return(0); } @@ -646,7 +646,7 @@ int cl_cmd::do_work(class cl_app *app, class cl_cmdline *cmdline, class cl_console *con) { - con->printf("Command \"%s\" does nothing on application.\n", + con->dd_printf("Command \"%s\" does nothing on application.\n", (char*)(names->at(0))); return(0); } @@ -655,7 +655,7 @@ int cl_cmd::do_work(class cl_sim *sim, class cl_cmdline *cmdline, class cl_console *con) { - con->printf("Command \"%s\" does nothing on simulator.\n", + con->dd_printf("Command \"%s\" does nothing on simulator.\n", (char*)(names->at(0))); return(0); } @@ -664,7 +664,7 @@ int cl_cmd::do_work(class cl_uc *uc, class cl_cmdline *cmdline, class cl_console *con) { - con->printf("Command \"%s\" does nothing on microcontroller.\n", + con->dd_printf("Command \"%s\" does nothing on microcontroller.\n", (char*)(names->at(0))); return(0); } @@ -808,19 +808,19 @@ cl_super_cmd::work(class cl_app *app, if ((cmd= commands->get_cmd("_no_parameters_")) != 0) return(cmd->work(app, cmdline, con)); int i; - con->printf("\"%s\" must be followed by the name of a subcommand\n" - "List of subcommands:\n", (char*)(names->at(0))); + con->dd_printf("\"%s\" must be followed by the name of a subcommand\n" + "List of subcommands:\n", (char*)(names->at(0))); for (i= 0; i < commands->count; i++) { cmd= (class cl_cmd *)(commands->at(i)); - con->printf("%s\n", cmd->short_help); + con->dd_printf("%s\n", cmd->short_help); } return(0); } if ((cmd= commands->get_cmd(cmdline)) == NULL) { - con->printf("Undefined subcommand: \"%s\". Try \"help %s\".\n", - cmdline->name, (char*)(names->at(0))); + con->dd_printf("Undefined subcommand: \"%s\". Try \"help %s\".\n", + cmdline->name, (char*)(names->at(0))); return(0); } return(cmd->work(app, cmdline, con)); @@ -853,7 +853,7 @@ cl_console::cl_console(char *fin, char *fout, class cl_app *the_app): isatty(fileno(in))) flags|= CONS_INTERACTIVE; else - printf("Warning: non-interactive console\n"); + dd_printf("Warning: non-interactive console\n"); } cl_console::cl_console(FILE *fin, FILE *fout, class cl_app *the_app): @@ -869,7 +869,7 @@ cl_console::cl_console(FILE *fin, FILE *fout, class cl_app *the_app): isatty(fileno(in))) flags|= CONS_INTERACTIVE; else - printf("Warning: non-interactive console\n"); + dd_printf("Warning: non-interactive console\n"); } /* @@ -976,7 +976,7 @@ cl_console::print_prompt(void) } int -cl_console::printf(char *format, ...) +cl_console::dd_printf(char *format, ...) { va_list ap; int ret= 0; @@ -1345,7 +1345,7 @@ cl_commander::all_print(char *string, int length) */ int -cl_commander::printf(char *format, ...) +cl_commander::dd_printf(char *format, ...) { va_list ap; int ret= 0; diff --git a/sim/ucsim/cmd.src/newcmdcl.h b/sim/ucsim/cmd.src/newcmdcl.h index 5d8fd47f..96cd43d5 100644 --- a/sim/ucsim/cmd.src/newcmdcl.h +++ b/sim/ucsim/cmd.src/newcmdcl.h @@ -304,7 +304,7 @@ public: virtual void welcome(void); virtual void print_prompt(void); - virtual int printf(char *format, ...); + virtual int dd_printf(char *format, ...); virtual void print_bin(long data, int bits); virtual int match(int fdnum); virtual int get_in_fd(void); @@ -364,7 +364,7 @@ public: int all_printf(char *format, ...); // print to all consoles int all_print(char *string, int length); - int printf(char *format, ...); // print to actual_console + int dd_printf(char *format, ...); // print to actual_console int debug(char *format, ...); // print consoles with debug flag set int flag_printf(int iflags, char *format, ...); int input_avail(void); diff --git a/sim/ucsim/cmd.src/set.cc b/sim/ucsim/cmd.src/set.cc index 2e587737..48888480 100644 --- a/sim/ucsim/cmd.src/set.cc +++ b/sim/ucsim/cmd.src/set.cc @@ -62,7 +62,7 @@ COMMAND_DO_WORK_UC(cl_set_mem_cmd) int len= params[2]->value.data_list.len; if (len == 0) - con->printf("Error: no data\n"); + con->dd_printf("Error: no data\n"); else { int i; @@ -75,7 +75,7 @@ COMMAND_DO_WORK_UC(cl_set_mem_cmd) } } else - con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); + con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); return(DD_FALSE);; } @@ -110,7 +110,7 @@ COMMAND_DO_WORK_UC(cl_set_bit_cmd) mem->dump(mem_addr, mem_addr, 1, con); } else - con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); + con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); return(DD_FALSE);; } @@ -143,10 +143,10 @@ COMMAND_DO_WORK_UC(cl_set_port_cmd) l= params[1]->value.number; } else - con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); + con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); if (pn < 0 || pn > 3) - con->printf("Error: wrong port\n"); + con->dd_printf("Error: wrong port\n"); else uc->port_pins[pn]= l; return(DD_FALSE);; @@ -174,11 +174,11 @@ COMMAND_DO_WORK_UC(cl_set_option_cmd) s= params[1]->value.string.string; } else - con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); + con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); if (!id || !s) { - con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); + con->dd_printf("%s\n", short_help?short_help:"Error: wrong syntax\n"); return(DD_FALSE); } diff --git a/sim/ucsim/cmd.src/show.cc b/sim/ucsim/cmd.src/show.cc index 6a734cc8..99ba73a4 100644 --- a/sim/ucsim/cmd.src/show.cc +++ b/sim/ucsim/cmd.src/show.cc @@ -47,7 +47,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA // class cl_cmdline *cmdline, class cl_console *con) COMMAND_DO_WORK(cl_show_copying_cmd) { - con->printf("%s\n", copying); + con->dd_printf("%s\n", copying); return(DD_FALSE);; } @@ -62,7 +62,7 @@ COMMAND_DO_WORK(cl_show_copying_cmd) // class cl_cmdline *cmdline, class cl_console *con) COMMAND_DO_WORK(cl_show_warranty_cmd) { - con->printf("%s\n", warranty); + con->dd_printf("%s\n", warranty); return(DD_FALSE);; } diff --git a/sim/ucsim/cmd.src/timer.cc b/sim/ucsim/cmd.src/timer.cc index 7f47b094..17abb4c8 100644 --- a/sim/ucsim/cmd.src/timer.cc +++ b/sim/ucsim/cmd.src/timer.cc @@ -52,16 +52,16 @@ COMMAND_DO_WORK_UC(cl_timer_cmd) if (cmdline->param(0) == 0) { if (long_help) - con->printf("%s\n", long_help); + con->dd_printf("%s\n", long_help); else - con->printf("What to do?\n"); + con->dd_printf("What to do?\n"); return(0); } if ((s= cmdline->param(0)->get_svalue())) { if (cmdline->param(1) == 0) { - con->printf("Timer number is missing\n"); + con->dd_printf("Timer number is missing\n"); return(0); } set_ticker(uc, cmdline->param(1)); @@ -80,8 +80,8 @@ COMMAND_DO_WORK_UC(cl_timer_cmd) else if (strstr(s, "v") == s) return(val(uc, cmdline, con)); else - con->printf("Undefined timer command: \"%s\". Try \"help timer\"\n", - s); + con->dd_printf("Undefined timer command: \"%s\". Try \"help timer\"\n", + s); } return(0); } @@ -114,27 +114,28 @@ cl_timer_cmd::add(class cl_uc *uc, if (!name && what < 1) { - con->printf("Error: Timer id must be greater then zero or a string\n"); + con->dd_printf("Error: " + "Timer id must be greater then zero or a string\n"); return(DD_FALSE); } if (ticker) { if (name) - con->printf("Error: Timer \"%s\" already exists\n", name); + con->dd_printf("Error: Timer \"%s\" already exists\n", name); else - con->printf("Error: Timer %d already exists\n", what); + con->dd_printf("Error: Timer %d already exists\n", what); return(0); } if (params[2]) if (!params[2]->get_ivalue(&dir)) { - con->printf("Error: Wrong direction\n"); + con->dd_printf("Error: Wrong direction\n"); return(DD_FALSE); } if (params[3]) if (!params[3]->get_ivalue(&in_isr)) { - con->printf("Error: Wrong parameter\n"); + con->dd_printf("Error: Wrong parameter\n"); return(DD_FALSE); } @@ -163,9 +164,9 @@ cl_timer_cmd::del(class cl_uc *uc, if (!ticker) { if (name) - con->printf("Timer \"%s\" does not exist\n", name); + con->dd_printf("Timer \"%s\" does not exist\n", name); else - con->printf("Timer %d does not exist\n", what); + con->dd_printf("Timer %d does not exist\n", what); return(0); } if (name) @@ -213,9 +214,9 @@ cl_timer_cmd::run(class cl_uc *uc, if (!ticker) { if (name) - con->printf("Timer %d does not exist\n", name); + con->dd_printf("Timer %d does not exist\n", name); else - con->printf("Timer %d does not exist\n", what); + con->dd_printf("Timer %d does not exist\n", what); return(0); } ticker->options|= TICK_RUN; @@ -234,9 +235,9 @@ cl_timer_cmd::stop(class cl_uc *uc, if (!ticker) { if (name) - con->printf("Timer %d does not exist\n", name); + con->dd_printf("Timer %d does not exist\n", name); else - con->printf("Timer %d does not exist\n", what); + con->dd_printf("Timer %d does not exist\n", what); return(0); } ticker->options&= ~TICK_RUN; @@ -261,20 +262,20 @@ cl_timer_cmd::val(class cl_uc *uc, if (!ticker) { if (name) - con->printf("Error: Timer %d does not exist\n", name); + con->dd_printf("Error: Timer %d does not exist\n", name); else - con->printf("Error: Timer %d does not exist\n", what); + con->dd_printf("Error: Timer %d does not exist\n", what); return(0); } if (params[2]) { - con->printf("Error: Value is missing\n"); + con->dd_printf("Error: Value is missing\n"); return(DD_FALSE); } long val; if (!params[2]->get_ivalue(&val)) { - con->printf("Error: Wrong parameter\n"); + con->dd_printf("Error: Wrong parameter\n"); return(DD_FALSE); } ticker->ticks= val; diff --git a/sim/ucsim/s51.src/interrupt.cc b/sim/ucsim/s51.src/interrupt.cc index cbbcb66d..6cded082 100644 --- a/sim/ucsim/s51.src/interrupt.cc +++ b/sim/ucsim/s51.src/interrupt.cc @@ -49,34 +49,34 @@ cl_interrupt::print_info(class cl_console *con) int ie= uc->get_mem(MEM_SFR, IE); int i; - con->printf("Interrupts are %s. Interrupt sources:\n", - (ie&bmEA)?"enabled":"disabled"); - con->printf(" Handler En Pr Req Act Name\n"); + con->dd_printf("Interrupts are %s. Interrupt sources:\n", + (ie&bmEA)?"enabled":"disabled"); + con->dd_printf(" Handler En Pr Req Act Name\n"); for (i= 0; i < uc->it_sources->count; i++) { class cl_it_src *is= (class cl_it_src *)(uc->it_sources->at(i)); - con->printf(" 0x%06x", is->addr); - con->printf(" %-3s", (ie&(is->ie_mask))?"en":"dis"); - con->printf(" %2d", uc->it_priority(is->ie_mask)); - con->printf(" %-3s", - (uc->get_mem(MEM_SFR, is->src_reg)&(is->src_mask))? - "YES":"no"); - con->printf(" %-3s", (is->active)?"act":"no"); - con->printf(" %s", is->name); - con->printf("\n"); + con->dd_printf(" 0x%06x", is->addr); + con->dd_printf(" %-3s", (ie&(is->ie_mask))?"en":"dis"); + con->dd_printf(" %2d", uc->it_priority(is->ie_mask)); + con->dd_printf(" %-3s", + (uc->get_mem(MEM_SFR, is->src_reg)&(is->src_mask))? + "YES":"no"); + con->dd_printf(" %-3s", (is->active)?"act":"no"); + con->dd_printf(" %s", is->name); + con->dd_printf("\n"); } - con->printf("Active interrupt service(s):\n"); - con->printf(" Pr Handler PC Source\n"); + con->dd_printf("Active interrupt service(s):\n"); + con->dd_printf(" Pr Handler PC Source\n"); for (i= 0; i < uc->it_levels->count; i++) { class it_level *il= (class it_level *)(uc->it_levels->at(i)); if (il->level >= 0) { - con->printf(" %2d", il->level); - con->printf(" 0x%06x", il->addr); - con->printf(" 0x%06x", il->PC); - con->printf(" %s", (il->source)?(il->source->name):"nothing"); - con->printf("\n"); + con->dd_printf(" %2d", il->level); + con->dd_printf(" 0x%06x", il->addr); + con->dd_printf(" 0x%06x", il->PC); + con->dd_printf(" %s", (il->source)?(il->source->name):"nothing"); + con->dd_printf("\n"); } } } diff --git a/sim/ucsim/s51.src/port.cc b/sim/ucsim/s51.src/port.cc index e746bfa0..96ebb530 100644 --- a/sim/ucsim/s51.src/port.cc +++ b/sim/ucsim/s51.src/port.cc @@ -56,24 +56,24 @@ cl_port::print_info(class cl_console *con) { uchar data; - con->printf("%s[%d]\n", id_string, id); + con->dd_printf("%s[%d]\n", id_string, id); data= uc->get_mem(MEM_SFR, sfr); - con->printf("P%d ", id); + con->dd_printf("P%d ", id); con->print_bin(data, 8); - con->printf(" 0x%02x %3d %c (Value in SFR register)\n", - data, data, isprint(data)?data:'.'); + con->dd_printf(" 0x%02x %3d %c (Value in SFR register)\n", + data, data, isprint(data)?data:'.'); data= uc->port_pins[id]; - con->printf("Pin%d ", id); + con->dd_printf("Pin%d ", id); con->print_bin(data, 8); - con->printf(" 0x%02x %3d %c (Output of outside circuits)\n", - data, data, isprint(data)?data:'.'); + con->dd_printf(" 0x%02x %3d %c (Output of outside circuits)\n", + data, data, isprint(data)?data:'.'); data= uc->port_pins[id] & uc->get_mem(MEM_SFR, sfr); - con->printf("Port%d ", id); + con->dd_printf("Port%d ", id); con->print_bin(data, 8); - con->printf(" 0x%02x %3d %c (Value on the port pins)\n", - data, data, isprint(data)?data:'.'); + con->dd_printf(" 0x%02x %3d %c (Value on the port pins)\n", + data, data, isprint(data)?data:'.'); } diff --git a/sim/ucsim/s51.src/serial.cc b/sim/ucsim/s51.src/serial.cc index 5389c3df..a8e3985f 100644 --- a/sim/ucsim/s51.src/serial.cc +++ b/sim/ucsim/s51.src/serial.cc @@ -48,24 +48,24 @@ cl_serial::print_info(class cl_console *con) "9 bit UART timer clocked" }; int scon= uc->get_mem(MEM_SFR, SCON); - con->printf("%s[%d]", id_string, id); + con->dd_printf("%s[%d]", id_string, id); int mode= (scon&(bmSM0|bmSM1))>>6; - con->printf(" %s MultiProc=%s", modes[mode], - (mode&2)?((scon&bmSM2)?"ON":"OFF"):"none"); - con->printf(" irq=%s", (uc->get_mem(MEM_SFR, IE)&bmES)?"en":"dis"); - con->printf(" prio=%d", uc->it_priority(bmPS)); - con->printf("\n"); + con->dd_printf(" %s MultiProc=%s", modes[mode], + (mode&2)?((scon&bmSM2)?"ON":"OFF"):"none"); + con->dd_printf(" irq=%s", (uc->get_mem(MEM_SFR, IE)&bmES)?"en":"dis"); + con->dd_printf(" prio=%d", uc->it_priority(bmPS)); + con->dd_printf("\n"); - con->printf("Receiver"); - con->printf(" %s", (scon&bmREN)?"ON":"OFF"); - con->printf(" RB8=%c", (scon&bmRB8)?'1':'0'); - con->printf(" irq=%c", (scon&bmRI)?'1':'0'); - con->printf("\n"); + con->dd_printf("Receiver"); + con->dd_printf(" %s", (scon&bmREN)?"ON":"OFF"); + con->dd_printf(" RB8=%c", (scon&bmRB8)?'1':'0'); + con->dd_printf(" irq=%c", (scon&bmRI)?'1':'0'); + con->dd_printf("\n"); - con->printf("Transmitter"); - con->printf(" TB8=%c", (scon&bmTB8)?'1':'0'); - con->printf(" irq=%c", (scon&bmTI)?'1':'0'); - con->printf("\n"); + con->dd_printf("Transmitter"); + con->dd_printf(" TB8=%c", (scon&bmTB8)?'1':'0'); + con->dd_printf(" irq=%c", (scon&bmTI)?'1':'0'); + con->dd_printf("\n"); } diff --git a/sim/ucsim/s51.src/timer0.cc b/sim/ucsim/s51.src/timer0.cc index d1b7dd6b..56f326cb 100644 --- a/sim/ucsim/s51.src/timer0.cc +++ b/sim/ucsim/s51.src/timer0.cc @@ -46,23 +46,23 @@ cl_timer0::print_info(class cl_console *con) int tmod= uc->get_mem(MEM_SFR, TMOD); int on; - con->printf("%s[%d] 0x%04x", id_string, id, - 256*uc->get_mem(MEM_SFR, TH0)+uc->get_mem(MEM_SFR, TL0)); + con->dd_printf("%s[%d] 0x%04x", id_string, id, + 256*uc->get_mem(MEM_SFR, TH0)+uc->get_mem(MEM_SFR, TL0)); int mode= tmod & (bmM00|bmM10); - con->printf(" %s", modes[mode]); - con->printf(" %s", (tmod&bmC_T0)?"counter":"timer"); + con->dd_printf(" %s", modes[mode]); + con->dd_printf(" %s", (tmod&bmC_T0)?"counter":"timer"); if (tmod&bmGATE0) { - con->printf(" gated"); + con->dd_printf(" gated"); on= uc->get_mem(MEM_SFR, P3) & uc->port_pins[3] & bm_INT0; } else on= uc->get_mem(MEM_SFR, TCON) & bmTR0; - con->printf(" %s", on?"ON":"OFF"); - con->printf(" irq=%c", (uc->get_mem(MEM_SFR, TCON)&bmTF0)?'1':'0'); - con->printf(" %s", (uc->get_mem(MEM_SFR, IE)&bmET0)?"en":"dis"); - con->printf(" prio=%d", uc->it_priority(bmPT0)); - con->printf("\n"); + con->dd_printf(" %s", on?"ON":"OFF"); + con->dd_printf(" irq=%c", (uc->get_mem(MEM_SFR, TCON)&bmTF0)?'1':'0'); + con->dd_printf(" %s", (uc->get_mem(MEM_SFR, IE)&bmET0)?"en":"dis"); + con->dd_printf(" prio=%d", uc->it_priority(bmPT0)); + con->dd_printf("\n"); } diff --git a/sim/ucsim/s51.src/timer1.cc b/sim/ucsim/s51.src/timer1.cc index 30a924eb..e930b3e6 100644 --- a/sim/ucsim/s51.src/timer1.cc +++ b/sim/ucsim/s51.src/timer1.cc @@ -46,23 +46,23 @@ cl_timer1::print_info(class cl_console *con) int tmod= uc->get_mem(MEM_SFR, TMOD); int on; - con->printf("%s[%d] 0x%04x", id_string, id, - 256*uc->get_mem(MEM_SFR, TH1)+uc->get_mem(MEM_SFR, TL1)); + con->dd_printf("%s[%d] 0x%04x", id_string, id, + 256*uc->get_mem(MEM_SFR, TH1)+uc->get_mem(MEM_SFR, TL1)); int mode= (tmod & (bmM11|bmM01)) >> 4; - con->printf(" %s", modes[mode]); - con->printf(" %s", (tmod&bmC_T1)?"counter":"timer"); + con->dd_printf(" %s", modes[mode]); + con->dd_printf(" %s", (tmod&bmC_T1)?"counter":"timer"); if (tmod&bmGATE1) { - con->printf(" gated"); + con->dd_printf(" gated"); on= uc->get_mem(MEM_SFR, P3) & uc->port_pins[3] & bm_INT0; } else on= uc->get_mem(MEM_SFR, TCON) & bmTR1; - con->printf(" %s", on?"ON":"OFF"); - con->printf(" irq=%c", (uc->get_mem(MEM_SFR, TCON)&bmTF1)?'1':'0'); - con->printf(" %s", (uc->get_mem(MEM_SFR, IE)&bmET1)?"en":"dis"); - con->printf(" prio=%d", uc->it_priority(bmPT1)); - con->printf("\n"); + con->dd_printf(" %s", on?"ON":"OFF"); + con->dd_printf(" irq=%c", (uc->get_mem(MEM_SFR, TCON)&bmTF1)?'1':'0'); + con->dd_printf(" %s", (uc->get_mem(MEM_SFR, IE)&bmET1)?"en":"dis"); + con->dd_printf(" prio=%d", uc->it_priority(bmPT1)); + con->dd_printf("\n"); } diff --git a/sim/ucsim/s51.src/timer2.cc b/sim/ucsim/s51.src/timer2.cc index 2918eebb..9c7f59dc 100644 --- a/sim/ucsim/s51.src/timer2.cc +++ b/sim/ucsim/s51.src/timer2.cc @@ -44,26 +44,27 @@ cl_timer2::print_info(class cl_console *con) { int t2con= uc->get_mem(MEM_SFR, T2CON); - con->printf("%s[%d] 0x%04x", id_string, id, - 256*uc->get_mem(MEM_SFR, TH2)+uc->get_mem(MEM_SFR, TL2)); + con->dd_printf("%s[%d] 0x%04x", id_string, id, + 256*uc->get_mem(MEM_SFR, TH2)+uc->get_mem(MEM_SFR, TL2)); if (t2con & (bmRCLK|bmTCLK)) { - con->printf(" baud"); + con->dd_printf(" baud"); if (t2con & bmRCLK) - con->printf(" RCLK"); + con->dd_printf(" RCLK"); if (t2con & bmTCLK) - con->printf(" TCLK"); + con->dd_printf(" TCLK"); } else - con->printf(" %s", (t2con&bmCP_RL2)?"capture":"reload"); - con->printf(" 0x%04x", - 256*uc->get_mem(MEM_SFR, RCAP2H)+uc->get_mem(MEM_SFR, RCAP2L)); - con->printf(" %s", (t2con&bmC_T2)?"counter":"timer"); - con->printf(" %s", (t2con&bmTR2)?"ON":"OFF"); - con->printf(" irq=%c", (t2con&bmTF2)?'1':'0'); - con->printf(" %s", (uc->get_mem(MEM_SFR, IE)&bmET2)?"en":"dis"); - con->printf(" prio=%d", uc->it_priority(bmPT2)); - con->printf("\n"); + con->dd_printf(" %s", (t2con&bmCP_RL2)?"capture":"reload"); + con->dd_printf(" 0x%04x", + 256*uc->get_mem(MEM_SFR, RCAP2H)+ + uc->get_mem(MEM_SFR, RCAP2L)); + con->dd_printf(" %s", (t2con&bmC_T2)?"counter":"timer"); + con->dd_printf(" %s", (t2con&bmTR2)?"ON":"OFF"); + con->dd_printf(" irq=%c", (t2con&bmTF2)?'1':'0'); + con->dd_printf(" %s", (uc->get_mem(MEM_SFR, IE)&bmET2)?"en":"dis"); + con->dd_printf(" prio=%d", uc->it_priority(bmPT2)); + con->dd_printf("\n"); } diff --git a/sim/ucsim/s51.src/uc390.cc b/sim/ucsim/s51.src/uc390.cc index ec37e006..fdf11ef8 100644 --- a/sim/ucsim/s51.src/uc390.cc +++ b/sim/ucsim/s51.src/uc390.cc @@ -1286,38 +1286,39 @@ t_uc390::print_regs (class cl_console *con) iram->dump (start, start + 7, 8, con); start = sfr->get (PSW) & 0x18; data = iram->get (iram->get (start)); - con->printf ("%06x %02x %c", - iram->get (start), data, isprint (data) ? data : '.'); - con->printf (" ACC= 0x%02x %3d %c B= 0x%02x", - sfr->get (ACC), sfr->get (ACC), - isprint (sfr->get (ACC)) ? (sfr->get (ACC)) : '.', sfr->get (B)); + con->dd_printf("%06x %02x %c", + iram->get (start), data, isprint (data) ? data : '.'); + con->dd_printf(" ACC= 0x%02x %3d %c B= 0x%02x", + sfr->get (ACC), sfr->get (ACC), + isprint (sfr->get (ACC)) ? + (sfr->get (ACC)) : '.', sfr->get (B)); eram2xram (); data = get_mem (MEM_XRAM, sfr->get (DPX) * 256*256 + sfr->get (DPH) * 256 + sfr->get (DPL)); - con->printf (" DPTR= 0x%02x%02x%02x @DPTR= 0x%02x %3d %c\n", - sfr->get (DPX), sfr->get (DPH), sfr->get (DPL), - data, data, isprint (data) ? data : '.'); + con->dd_printf (" DPTR= 0x%02x%02x%02x @DPTR= 0x%02x %3d %c\n", + sfr->get (DPX), sfr->get (DPH), sfr->get (DPL), + data, data, isprint (data) ? data : '.'); data = iram->get (iram->get (start + 1)); - con->printf ("%06x %02x %c", iram->get (start + 1), data, - isprint (data) ? data : '.'); + con->dd_printf ("%06x %02x %c", iram->get (start + 1), data, + isprint (data) ? data : '.'); data= sfr->get (PSW); - con->printf (" PSW= 0x%02x CY=%c AC=%c OV=%c P=%c ", - data, - (data & bmCY) ? '1' : '0', (data & bmAC) ? '1' : '0', - (data & bmOV) ? '1' : '0', (data & bmP ) ? '1' : '0' - ); + con->dd_printf (" PSW= 0x%02x CY=%c AC=%c OV=%c P=%c ", + data, + (data & bmCY) ? '1' : '0', (data & bmAC) ? '1' : '0', + (data & bmOV) ? '1' : '0', (data & bmP ) ? '1' : '0' + ); /* show stack pointer */ if (sfr->get (ACON) & 0x04) /* SA: 10 bit stack */ - con->printf ("SP10 0x%03x %3d\n", - (sfr->get (ESP) & 3) * 256 + sfr->get (SP), - get_mem (MEM_IXRAM, (sfr->get (ESP) & 3) * 256 + sfr->get (SP)) - ); + con->dd_printf ("SP10 0x%03x %3d\n", + (sfr->get (ESP) & 3) * 256 + sfr->get (SP), + get_mem (MEM_IXRAM, (sfr->get (ESP) & 3) * 256 + sfr->get (SP)) + ); else - con->printf ("SP 0x%02x %3d\n", - sfr->get (SP), - iram->get (sfr->get (SP)) - ); + con->dd_printf ("SP 0x%02x %3d\n", + sfr->get (SP), + iram->get (sfr->get (SP)) + ); print_disass (PC, con); } /* End of s51.src/uc390.cc */ diff --git a/sim/ucsim/s51.src/uc51.cc b/sim/ucsim/s51.src/uc51.cc index 211bae73..0ea18fe6 100644 --- a/sim/ucsim/s51.src/uc51.cc +++ b/sim/ucsim/s51.src/uc51.cc @@ -381,23 +381,24 @@ t_uc51::print_regs(class cl_console *con) iram->dump(start, start+7, 8, con); start= sfr->get(PSW) & 0x18; data= iram->get(iram->get(start)); - con->printf("%06x %02x %c", - iram->get(start), data, isprint(data)?data:'.'); + con->dd_printf("%06x %02x %c", + iram->get(start), data, isprint(data)?data:'.'); - con->printf(" ACC= 0x%02x %3d %c B= 0x%02x", sfr->get(ACC), sfr->get(ACC), - isprint(sfr->get(ACC))?(sfr->get(ACC)):'.', sfr->get(B)); + con->dd_printf(" ACC= 0x%02x %3d %c B= 0x%02x", + sfr->get(ACC), sfr->get(ACC), + isprint(sfr->get(ACC))?(sfr->get(ACC)):'.', sfr->get(B)); eram2xram(); data= get_mem(MEM_XRAM, sfr->get(DPH)*256+sfr->get(DPL)); - con->printf(" DPTR= 0x%02x%02x @DPTR= 0x%02x %3d %c\n", sfr->get(DPH), - sfr->get(DPL), data, data, isprint(data)?data:'.'); + con->dd_printf(" DPTR= 0x%02x%02x @DPTR= 0x%02x %3d %c\n", sfr->get(DPH), + sfr->get(DPL), data, data, isprint(data)?data:'.'); data= iram->get(iram->get(start+1)); - con->printf("%06x %02x %c", iram->get(start+1), data, - isprint(data)?data:'.'); + con->dd_printf("%06x %02x %c", iram->get(start+1), data, + isprint(data)?data:'.'); data= sfr->get(PSW); - con->printf(" PSW= 0x%02x CY=%c AC=%c OV=%c P=%c\n", data, - (data&bmCY)?'1':'0', (data&bmAC)?'1':'0', - (data&bmOV)?'1':'0', (data&bmP)?'1':'0'); + con->dd_printf(" PSW= 0x%02x CY=%c AC=%c OV=%c P=%c\n", data, + (data&bmCY)?'1':'0', (data&bmAC)?'1':'0', + (data&bmOV)?'1':'0', (data&bmP)?'1':'0'); print_disass(PC, con); } diff --git a/sim/ucsim/sim.src/hw.cc b/sim/ucsim/sim.src/hw.cc index ab0f5cfb..b876327a 100644 --- a/sim/ucsim/sim.src/hw.cc +++ b/sim/ucsim/sim.src/hw.cc @@ -85,7 +85,7 @@ cl_hw::tick(int cycles) void cl_hw::print_info(class cl_console *con) { - con->printf("%s[%d]\n", id_string, id); + con->dd_printf("%s[%d]\n", id_string, id); } diff --git a/sim/ucsim/sim.src/mem.cc b/sim/ucsim/sim.src/mem.cc index 0bb7e6d2..24849b4c 100644 --- a/sim/ucsim/sim.src/mem.cc +++ b/sim/ucsim/sim.src/mem.cc @@ -481,14 +481,14 @@ cl_mem::dump(t_addr start, t_addr stop, int bpl, class cl_console *con) while ((start <= stop) && (start < size)) { - con->printf(addr_format, start); con->printf(" "); + con->dd_printf(addr_format, start); con->dd_printf(" "); for (i= 0; (i < bpl) && (start+i < size) && (start+i <= stop); i++) { - con->printf(data_format, read(start+i)); con->printf(" "); + con->dd_printf(data_format, read(start+i)); con->dd_printf(" "); } while (i < bpl) { @@ -496,7 +496,7 @@ cl_mem::dump(t_addr start, t_addr stop, int bpl, class cl_console *con) j= width/4 + ((width%4)?1:0) + 1; while (j) { - con->printf(" "); + con->dd_printf(" "); j--; } i++; @@ -507,15 +507,15 @@ cl_mem::dump(t_addr start, t_addr stop, int bpl, class cl_console *con) i++) { long c= get(start+i); - con->printf("%c", isprint(255&c)?(255&c):'.'); + con->dd_printf("%c", isprint(255&c)?(255&c):'.'); if (width > 8) - con->printf("%c", isprint(255&(c>>8))?(255&(c>>8)):'.'); + con->dd_printf("%c", isprint(255&(c>>8))?(255&(c>>8)):'.'); if (width > 16) - con->printf("%c", isprint(255&(c>>16))?(255&(c>>16)):'.'); + con->dd_printf("%c", isprint(255&(c>>16))?(255&(c>>16)):'.'); if (width > 24) - con->printf("%c", isprint(255&(c>>24))?(255&(c>>24)):'.'); + con->dd_printf("%c", isprint(255&(c>>24))?(255&(c>>24)):'.'); } - con->printf("\n"); + con->dd_printf("\n"); dump_finished= start+i; start+= bpl; } diff --git a/sim/ucsim/sim.src/option.cc b/sim/ucsim/sim.src/option.cc index 2b237a3a..b7abc207 100644 --- a/sim/ucsim/sim.src/option.cc +++ b/sim/ucsim/sim.src/option.cc @@ -73,9 +73,9 @@ void cl_bool_opt::print(class cl_console *con) { if (*(bool *)option) - con->printf("TRUE"); + con->dd_printf("TRUE"); else - con->printf("FALSE"); + con->dd_printf("FALSE"); } bool @@ -125,9 +125,9 @@ cl_cons_debug_opt::print(class cl_console *con) { if (/*sim->cmd->actual_console && sim->cmd->actual_console*/con->flags & CONS_DEBUG) - con->printf("TRUE"); + con->dd_printf("TRUE"); else - con->printf("FALSE"); + con->dd_printf("FALSE"); } bool diff --git a/sim/ucsim/sim.src/sim.cc b/sim/ucsim/sim.src/sim.cc index 98253298..602a9f32 100644 --- a/sim/ucsim/sim.src/sim.cc +++ b/sim/ucsim/sim.src/sim.cc @@ -157,39 +157,39 @@ cl_sim::stop(int reason) if (reason == resUSER && cmd->frozen_console->input_avail()) cmd->frozen_console->read_line(); - cmd->frozen_console->printf("Stop at 0x%06x: (%d) ", uc->PC, reason); + cmd->frozen_console->dd_printf("Stop at 0x%06x: (%d) ", uc->PC, reason); switch (reason) { case resHALT: - cmd->frozen_console->printf("Halted\n"); + cmd->frozen_console->dd_printf("Halted\n"); break; case resINV_ADDR: - cmd->frozen_console->printf("Invalid address\n"); + cmd->frozen_console->dd_printf("Invalid address\n"); break; case resSTACK_OV: - cmd->frozen_console->printf("Stack overflow\n"); + cmd->frozen_console->dd_printf("Stack overflow\n"); break; case resBREAKPOINT: - cmd->frozen_console->printf("Breakpoint\n"); + cmd->frozen_console->dd_printf("Breakpoint\n"); break; case resINTERRUPT: - cmd->frozen_console->printf("Interrupt\n"); + cmd->frozen_console->dd_printf("Interrupt\n"); break; case resWDTRESET: - cmd->frozen_console->printf("Watchdog reset\n"); + cmd->frozen_console->dd_printf("Watchdog reset\n"); break; case resUSER: - cmd->frozen_console->printf("User stopped\n"); + cmd->frozen_console->dd_printf("User stopped\n"); break; case resINV_INST: - cmd->frozen_console->printf("Invalid instruction 0x%04x\n", - uc->get_mem(MEM_ROM, uc->PC)); + cmd->frozen_console->dd_printf("Invalid instruction 0x%04x\n", + uc->get_mem(MEM_ROM, uc->PC)); break; default: - cmd->frozen_console->printf("Unknown reason\n"); + cmd->frozen_console->dd_printf("Unknown reason\n"); break; } - cmd->frozen_console->printf("F 0x%06x\n", uc->PC); // for sdcdb + cmd->frozen_console->dd_printf("F 0x%06x\n", uc->PC); // for sdcdb //if (cmd->actual_console != cmd->frozen_console) cmd->frozen_console->flags&= ~CONS_FROZEN; cmd->frozen_console->print_prompt(); diff --git a/sim/ucsim/sim.src/uc.cc b/sim/ucsim/sim.src/uc.cc index 09a41fbf..bae85328 100644 --- a/sim/ucsim/sim.src/uc.cc +++ b/sim/ucsim/sim.src/uc.cc @@ -94,11 +94,11 @@ cl_ticker::get_rtime(double xtal) void cl_ticker::dump(int nr, double xtal, class cl_console *con) { - con->printf("timer #%d(\"%s\") %s%s: %g sec (%lu clks)\n", - nr, name?name:"unnamed", - (options&TICK_RUN)?"ON":"OFF", - (options&TICK_INISR)?",ISR":"", - get_rtime(xtal), ticks); + con->dd_printf("timer #%d(\"%s\") %s%s: %g sec (%lu clks)\n", + nr, name?name:"unnamed", + (options&TICK_RUN)?"ON":"OFF", + (options&TICK_INISR)?",ISR":"", + get_rtime(xtal), ticks); } @@ -627,7 +627,7 @@ cl_uc::read_hex_file(const char *name) if (!name) { sim->app->get_commander()-> - printf("cl_uc::read_hex_file File name not specified\n"); + dd_printf("cl_uc::read_hex_file File name not specified\n"); return(-1); } else @@ -700,18 +700,19 @@ cl_uc::read_hex_file(const char *name) if (sim->app->args->get_iarg('V', 0) && rtyp != 1) sim->app->get_commander()-> - printf("Unknown record type %d(0x%x)\n", rtyp, rtyp); + dd_printf("Unknown record type %d(0x%x)\n", + rtyp, rtyp); } else if (sim->app->args->get_iarg('V', 0)) sim->app->get_commander()-> - printf("Checksum error (%x instead of %x) in " - "record %ld.\n", chk, sum, recnum); + dd_printf("Checksum error (%x instead of %x) in " + "record %ld.\n", chk, sum, recnum); } else if (sim->app->args->get_iarg('V', 0)) sim->app->get_commander()-> - printf("Read error in record %ld.\n", recnum); + dd_printf("Read error in record %ld.\n", recnum); } } if (get_mem_width(MEM_ROM) > 8 && @@ -721,7 +722,8 @@ cl_uc::read_hex_file(const char *name) if (name) fclose(f); if (sim->app->args->get_iarg('V', 0)) - sim->app->get_commander()->printf("%ld records have been read\n", recnum); + sim->app->get_commander()->dd_printf("%ld records have been read\n", + recnum); analyze(0); return(written); } @@ -943,16 +945,16 @@ cl_uc::print_disass(t_addr addr, class cl_console *con) b= fbrk_at(addr); dis= disass(addr, NULL); if (b) - con->printf("%c", (b->perm == brkFIX)?'F':'D'); + con->dd_printf("%c", (b->perm == brkFIX)?'F':'D'); else - con->printf(" "); - con->printf("%c ", inst_at(addr)?' ':'?'); - con->printf(rom->addr_format, addr); con->printf(" "); - con->printf(rom->data_format, code); + con->dd_printf(" "); + con->dd_printf("%c ", inst_at(addr)?' ':'?'); + con->dd_printf(rom->addr_format, addr); con->dd_printf(" "); + con->dd_printf(rom->data_format, code); for (i= 1; i < inst_length(code); i++) { - con->printf(" "); - con->printf(rom->data_format, get_mem(MEM_ROM, addr+i)); + con->dd_printf(" "); + con->dd_printf(rom->data_format, get_mem(MEM_ROM, addr+i)); } int li= longest_inst(); while (i < li) @@ -960,17 +962,17 @@ cl_uc::print_disass(t_addr addr, class cl_console *con) int j; j= rom->width/4 + ((rom->width%4)?1:0) + 1; while (j) - con->printf(" "), j--; + con->dd_printf(" "), j--; i++; } - con->printf(" %s\n", dis); + con->dd_printf(" %s\n", dis); free(dis); } void cl_uc::print_regs(class cl_console *con) { - con->printf("No registers\n"); + con->dd_printf("No registers\n"); } int diff --git a/sim/ucsim/z80.src/z80.cc b/sim/ucsim/z80.src/z80.cc index 6ea06537..3c7cc119 100644 --- a/sim/ucsim/z80.src/z80.cc +++ b/sim/ucsim/z80.src/z80.cc @@ -259,34 +259,34 @@ cl_z80::disass(t_addr addr, char *sep) void cl_z80::print_regs(class cl_console *con) { - con->printf("SZ-A--P-C Flags= 0x%02x %3d %c ", - regs.F, regs.F, isprint(regs.F)?regs.F:'.'); - con->printf("A= 0x%02x %3d %c\n", - regs.A, regs.A, isprint(regs.A)?regs.A:'.'); - con->printf("%c%c-%c--%c-%c\n", - (regs.F&BIT_S)?'1':'0', - (regs.F&BIT_Z)?'1':'0', - (regs.F&BIT_A)?'1':'0', - (regs.F&BIT_P)?'1':'0', - (regs.F&BIT_C)?'1':'0'); - con->printf("BC= 0x%04x [BC]= %02x %3d %c ", - regs.BC, ram->get(regs.BC), ram->get(regs.BC), - isprint(ram->get(regs.BC))?ram->get(regs.BC):'.'); - con->printf("DE= 0x%04x [DE]= %02x %3d %c ", - regs.DE, ram->get(regs.DE), ram->get(regs.DE), - isprint(ram->get(regs.DE))?ram->get(regs.DE):'.'); - con->printf("HL= 0x%04x [HL]= %02x %3d %c\n", - regs.HL, ram->get(regs.HL), ram->get(regs.HL), - isprint(ram->get(regs.HL))?ram->get(regs.HL):'.'); - con->printf("IX= 0x%04x [IX]= %02x %3d %c ", - regs.IX, ram->get(regs.IX), ram->get(regs.IX), - isprint(ram->get(regs.IX))?ram->get(regs.IX):'.'); - con->printf("IY= 0x%04x [IY]= %02x %3d %c ", - regs.IY, ram->get(regs.IY), ram->get(regs.IY), - isprint(ram->get(regs.IY))?ram->get(regs.IY):'.'); - con->printf("SP= 0x%04x [SP]= %02x %3d %c\n", - regs.SP, ram->get(regs.SP), ram->get(regs.SP), - isprint(ram->get(regs.SP))?ram->get(regs.SP):'.'); + con->dd_printf("SZ-A--P-C Flags= 0x%02x %3d %c ", + regs.F, regs.F, isprint(regs.F)?regs.F:'.'); + con->dd_printf("A= 0x%02x %3d %c\n", + regs.A, regs.A, isprint(regs.A)?regs.A:'.'); + con->dd_printf("%c%c-%c--%c-%c\n", + (regs.F&BIT_S)?'1':'0', + (regs.F&BIT_Z)?'1':'0', + (regs.F&BIT_A)?'1':'0', + (regs.F&BIT_P)?'1':'0', + (regs.F&BIT_C)?'1':'0'); + con->dd_printf("BC= 0x%04x [BC]= %02x %3d %c ", + regs.BC, ram->get(regs.BC), ram->get(regs.BC), + isprint(ram->get(regs.BC))?ram->get(regs.BC):'.'); + con->dd_printf("DE= 0x%04x [DE]= %02x %3d %c ", + regs.DE, ram->get(regs.DE), ram->get(regs.DE), + isprint(ram->get(regs.DE))?ram->get(regs.DE):'.'); + con->dd_printf("HL= 0x%04x [HL]= %02x %3d %c\n", + regs.HL, ram->get(regs.HL), ram->get(regs.HL), + isprint(ram->get(regs.HL))?ram->get(regs.HL):'.'); + con->dd_printf("IX= 0x%04x [IX]= %02x %3d %c ", + regs.IX, ram->get(regs.IX), ram->get(regs.IX), + isprint(ram->get(regs.IX))?ram->get(regs.IX):'.'); + con->dd_printf("IY= 0x%04x [IY]= %02x %3d %c ", + regs.IY, ram->get(regs.IY), ram->get(regs.IY), + isprint(ram->get(regs.IY))?ram->get(regs.IY):'.'); + con->dd_printf("SP= 0x%04x [SP]= %02x %3d %c\n", + regs.SP, ram->get(regs.SP), ram->get(regs.SP), + isprint(ram->get(regs.SP))?ram->get(regs.SP):'.'); print_disass(PC, con); } -- 2.30.2