From 31155ac8672e72db0d3cab3e4167a3c00f73a2bc Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Sat, 20 Mar 2010 19:07:45 +0000 Subject: [PATCH] Fix syntax errors in ascii to int conversion --- src/EmuConsole.hpp | 79 -------------- src/cpu8051.c | 2 +- src/disasm.hpp | 232 ---------------------------------------- src/emugtk.c | 259 ++++++++++++++++++++++----------------------- src/emugtk.h | 29 ----- src/exceptions.hpp | 37 ------- src/filemenu.c | 1 - src/gtksizes.h | 6 +- src/hexfile.c | 4 +- 9 files changed, 133 insertions(+), 516 deletions(-) delete mode 100644 src/EmuConsole.hpp delete mode 100644 src/disasm.hpp delete mode 100644 src/exceptions.hpp diff --git a/src/EmuConsole.hpp b/src/EmuConsole.hpp deleted file mode 100644 index 42329d4..0000000 --- a/src/EmuConsole.hpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * EmuConsole.hpp - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _EMUCONSOLE_HPP_ -#define _EMUCONSOLE_HPP_ - -#include "CPU8051.hpp" -#include -#include "exceptions.hpp" - -using namespace std; - - -////////////////////////////////////////////////////////////////////////////// -// EmuConsole -// Implements the Console User Interface as an Object -////////////////////////////////////////////////////////////////////////////// -class EmuConsole { -public: - - EmuConsole( int argc, char **argv, CPU8051 *mCPU ); - ~EmuConsole( ); - - CPU8051 *CPU; - - void Main( ); - - void Reset( ); - void Trace( string Address ); - void Exec( string Address, string NumberInst ); - void ShowBreakpoints( ); - void SetBreakpoint( unsigned int Address ); - void ClearBreakpoint( unsigned int Address ); - int IsBreakpoint( unsigned int Address ); - void Disasm( string Address, string NumberInst ); - void DisasmN( unsigned int Address, int NumberInst ); - void DumpPGM( string Address ); - void DumpD( string Address ); - void DumpInt( string Address ); - void DumpExt( string Address ); - void DumpI( string Address ); - void ShowRegisters( ); - void SetRegister( string Register, string NewValue ); - - - -private: - int NbBreakpoints; - unsigned int Breakpoints[ MAXBP ]; - - void Capitalize( string *InputString ); - void RemoveSpaces( string *InputString ); - -}; - - - -#endif - - - diff --git a/src/cpu8051.c b/src/cpu8051.c index 2f22df4..d8e69cb 100644 --- a/src/cpu8051.c +++ b/src/cpu8051.c @@ -389,7 +389,7 @@ cpu8051_Exec(void) } /* - * Addressing modes defined in the order as they appear in disasm.hpp + * Addressing modes defined in the order as they appear in disasm.h * from table argstext[] */ #define ADDR11 0 diff --git a/src/disasm.hpp b/src/disasm.hpp deleted file mode 100644 index 99e5820..0000000 --- a/src/disasm.hpp +++ /dev/null @@ -1,232 +0,0 @@ -/* - * disasm.hpp - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __DISASM_HPP_ -#define __DISASM_HPP_ -// Do not modify this file directly, it was created by Opcode2cpp.pl -// Any modification made directly on this file will be lost - - -// For all 256 opcodes, the value in this table gives the instruction type -// ex.: MOV, INC, CLR, CPL,... -// To know what is the instruction type, use the number as an offset in the InstTextTbl[] -static int InstTypesTbl[] = { - 0, 1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 5, 6, 7, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 10, 1, 11, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 14, 6, 15, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 18, 1, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 20, 6, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 22, 1, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 24, 6, 19, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 27, 1, 21, 28, 29, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 6, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 19, 1, 26, 4, 31, 32, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 21, 6, 33, 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 35, 1, 36, 36, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, - 39, 6, 40, 40, 41, 42, 43, 43, 42, 42, 42, 42, 42, 42, 42, 42, - 44, 1, 44, 44, 36, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 44, 6, 44, 44, 33, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26 -}; - - -// Size(in bytes) of each instruction (offset in table is instruction opcode) -static int InstSizesTbl[] = { - 1, 2, 3, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 3, 2, 3, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 3, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 3, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 1, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 1, 1, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 3, 2, 2, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 1, 1, 3, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, - 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 -}; - - -// List of instructions types referenced by InstTypesTbl[] -#define InstTextTblLength 45 -static char *InstTextTbl[] = { - "NOP", - "AJMP", - "LJMP", - "RR", - "INC", - "JBC", - "ACALL", - "LCALL", - "RRC", - "DEC", - "JB", - "RET", - "RL", - "ADD", - "JNB", - "RETI", - "RLC", - "ADDC", - "JC", - "ORL", - "JNC", - "ANL", - "JZ", - "XRL", - "JNZ", - "JMP", - "MOV", - "SJMP", - "MOVC", - "DIV", - "SUBB", - "MUL", - "INVALID", - "CPL", - "CJNE", - "PUSH", - "CLR", - "SWAP", - "XCH", - "POP", - "SETB", - "DA", - "DJNZ", - "XCHD", - "MOVX" -}; - - -// Table describing all arguments types of an instruction -// The table is indexed InstArgTbl[ opcode * 4] -// InstArgTbl[opcode*4 + 1] gives the number of arguments the instruction has -// InstArgTbl[opcode*4 + i] for i=1,2 and 3 give the type of each argument -// for most instructions, the 3rd argument isn't used -// the argument type is referecing to ArgsTextTbl[] -#define InstArgTblLength 256 -static int InstArgTbl[] = { - 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 2, 0, 0, - 1, 2, 0, 0, 1, 3, 0, 0, 1, 4, 0, 0, 1, 5, 0, 0, - 1, 6, 0, 0, 1, 7, 0, 0, 1, 8, 0, 0, 1, 9, 0, 0, - 1, 10, 0, 0, 1, 11, 0, 0, 1, 12, 0, 0, 1, 13, 0, 0, - 2, 14, 15, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 2, 0, 0, - 1, 2, 0, 0, 1, 3, 0, 0, 1, 4, 0, 0, 1, 5, 0, 0, - 1, 6, 0, 0, 1, 7, 0, 0, 1, 8, 0, 0, 1, 9, 0, 0, - 1, 10, 0, 0, 1, 11, 0, 0, 1, 12, 0, 0, 1, 13, 0, 0, - 2, 14, 15, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, - 2, 2, 16, 0, 2, 2, 3, 0, 2, 2, 4, 0, 2, 2, 5, 0, - 2, 2, 6, 0, 2, 2, 7, 0, 2, 2, 8, 0, 2, 2, 9, 0, - 2, 2, 10, 0, 2, 2, 11, 0, 2, 2, 12, 0, 2, 2, 13, 0, - 2, 14, 15, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, - 2, 2, 16, 0, 2, 2, 3, 0, 2, 2, 4, 0, 2, 2, 5, 0, - 2, 2, 6, 0, 2, 2, 7, 0, 2, 2, 8, 0, 2, 2, 9, 0, - 2, 2, 10, 0, 2, 2, 11, 0, 2, 2, 12, 0, 2, 2, 13, 0, - 1, 15, 0, 0, 1, 0, 0, 0, 2, 3, 2, 0, 2, 3, 16, 0, - 2, 2, 16, 0, 2, 2, 3, 0, 2, 2, 4, 0, 2, 2, 5, 0, - 2, 2, 6, 0, 2, 2, 7, 0, 2, 2, 8,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, 2, 4, 2, 0, 2, 5, 2, 0, - 1, 2, 0, 0, 2, 3, 2, 0, 2, 4, 2, 0, 2, 5, 2, 0, - 2, 6, 2, 0, 2, 7, 2, 0, 2, 8, 2, 0, 2, 9, 2, 0, - 2, 10, 2, 0, 2, 11, 2, 0, 2, 12, 2, 0, 2, 13, 2, 0 -}; - - -// List all types of arguments available to instructions -// Referenced by InstArgsTbl[] -#define ArgsTextTblLength 25 -static char *ArgsTextTbl[] = { - "addr11", - "addr16", - "A", - "direct", - "@R0", - "@R1", - "R0", - "R1", - "R2", - "R3", - "R4", - "R5", - "R6", - "R7", - "bitaddr", - "reladdr", - "#data", - "C", - "@A+DPTR", - "@A+PC", - "AB", - "DPTR", - "#data16", - "/bitaddr", - "@DPTR" -}; - - - - -#endif diff --git a/src/emugtk.c b/src/emugtk.c index e6d98dd..3b5677f 100644 --- a/src/emugtk.c +++ b/src/emugtk.c @@ -41,8 +41,8 @@ #include "pgmwin.h" #include "memwin.h" -static int RunningState; -static int RunFuncTag; +static int running; +static int running_function_tag; static GtkWidget *mainwin; /* Signal DestroyEvent */ @@ -56,6 +56,50 @@ WindowDestroyEvent(GtkWidget *widget, gpointer data) gtk_main_quit(); } +/* Step out of running state */ +static void +emugtk_stop_running() +{ + if (running) { +#ifdef EMU8051_DEBUG + printf("emugtk_StopRunning()\n"); +#endif + gtk_idle_remove(running_function_tag); + running = 0; + regwin_Show(); + pgmwin_Disasm(); + memwin_DumpD("00"); + } +} + +/* Running function called when idle from gtk_main */ +static gboolean +emugtk_running(gpointer data) +{ + cpu8051_Exec(); + if (IsBreakpoint(cpu8051.pc)) { +#ifdef EMU8051_DEBUG + g_print("Breakpoint Hit, stopping!\n"); +#endif + emugtk_stop_running(); + } + + return TRUE; +} + +/* Get in the running state */ +static void +emugtk_start_running(void) +{ + if (!running) { +#ifdef EMU8051_DEBUG + printf("emugtk_StartRunning()\n"); +#endif + running_function_tag = gtk_idle_add(emugtk_running, 0); + running = 1; + } +} + /* Taken from the Gxine source code. */ static GtkWidget * AddPixButton(GtkWidget *box, gchar **pixmap_array) @@ -77,6 +121,71 @@ AddPixButton(GtkWidget *box, gchar **pixmap_array) return button; } +/* CPU reset and Gtk UI update */ +static void +emugtk_Reset(void) +{ + cpu8051_Reset(); + regwin_Show(); + pgmwin_Disasm(); + memwin_DumpD("00"); +} + +/* Signal ResetEvent (ResetButton) */ +static void +emugtk_ResetEvent(GtkWidget *widget, GdkEvent *event, gpointer data) +{ +#ifdef EMU8051_DEBUG + g_print("emugtk_ResetEvent(...)\n"); +#endif + emugtk_stop_running(); + emugtk_Reset(); +} + +/* CPU Step and Gtk UI update */ +static void +emugtk_Step(void) +{ + cpu8051_Exec(); + regwin_Show(); + pgmwin_Disasm(); + memwin_DumpD("00"); +} + +/* Signal RunEvent (RunButton) */ +static void +emugtk_RunEvent(GtkWidget *widget, GdkEvent *event, gpointer data) +{ +#ifdef EMU8051_DEBUG + g_print("emugtk_RunEvent(...)\n"); +#endif + if (running) + emugtk_stop_running(); + else + emugtk_start_running(); +} + +/* Signal StopEvent (StopButton) */ +static void +emugtk_StopEvent(GtkWidget *widget, GdkEvent *event, gpointer data) +{ +#ifdef EMU8051_DEBUG + g_print("emugtk_StopEvent(...)\n"); +#endif + emugtk_stop_running(); +} + +/* Signal StepEvent (StepButton) */ +static void +emugtk_StepEvent(GtkWidget *widget, GdkEvent *event, gpointer data) +{ +#ifdef EMU8051_DEBUG + g_print("emugtk_StepEvent(...)\n"); +#endif + emugtk_stop_running(); + emugtk_Step(); +} + /* Creates the Reset, Run, Stop and Step buttons. */ static GtkWidget * AddButtons(void) @@ -114,7 +223,7 @@ AddButtons(void) return button_hbox; } -GtkWidget * +static GtkWidget * AddMenu(void) { GtkWidget *menu_bar; @@ -203,10 +312,22 @@ emugtk_window_init(void) gtk_widget_show_all(mainwin); } +static void +emugtk_UpdateDisplay(void) +{ +#ifdef EMU8051_DEBUG + g_print("emugtk_UpdateDisplay()\n"); +#endif + + regwin_Show(); + pgmwin_Disasm(); + memwin_DumpD("00"); +} + void emugtk_new_file(char *file) { - emugtk_StopRunning(); + emugtk_stop_running(); LoadHexFile(file); @@ -223,7 +344,7 @@ main(int argc, char **argv) cpu8051_init(); - RunningState = 0; + running = 0; gtk_init(&argc, &argv); @@ -249,131 +370,3 @@ AddMenuSeparator(GtkWidget *menu) item = gtk_menu_item_new(); gtk_menu_append(GTK_MENU(menu), item); } - -void -emugtk_UpdateDisplay(void) -{ -#ifdef EMU8051_DEBUG - g_print("emugtk_UpdateDisplay()\n"); -#endif - - regwin_Show(); - pgmwin_Disasm(); - memwin_DumpD("0x00"); -} - -/* CPU reset and Gtk UI update */ -void -emugtk_Reset(void) -{ - cpu8051_Reset(); - regwin_Show(); - pgmwin_Disasm(); - memwin_DumpD("0x00"); -} - -/* CPU Step and Gtk UI update */ -void -emugtk_Step(void) -{ - cpu8051_Exec(); - regwin_Show(); - pgmwin_Disasm(); - memwin_DumpD("0x00"); -} - -/* Signal ResetEvent (ResetButton) */ -void -emugtk_ResetEvent(GtkWidget *widget, GdkEvent *event, gpointer data) -{ -#ifdef EMU8051_DEBUG - g_print("emugtk_ResetEvent(...)\n"); -#endif - emugtk_StopRunning(); - emugtk_Reset(); -} - -/* Signal RunEvent (RunButton) */ -void -emugtk_RunEvent(GtkWidget *widget, GdkEvent *event, gpointer data) -{ -#ifdef EMU8051_DEBUG - g_print("emugtk_RunEvent(...)\n"); -#endif - if (RunningState) - emugtk_StopRunning(); - else - emugtk_StartRunning(); -} - -/* Signal StopEvent (StopButton) */ -void -emugtk_StopEvent(GtkWidget *widget, GdkEvent *event, gpointer data) -{ -#ifdef EMU8051_DEBUG - g_print("emugtk_StopEvent(...)\n"); -#endif - emugtk_StopRunning(); -} - -/* Signal StepEvent (StepButton) */ -void -emugtk_StepEvent(GtkWidget *widget, GdkEvent *event, gpointer data) -{ -#ifdef EMU8051_DEBUG - g_print("emugtk_StepEvent(...)\n"); -#endif - emugtk_StopRunning(); - emugtk_Step(); -} - -/* Running called by RunningFunction() */ -void -emugtk_Running() -{ - cpu8051_Exec(); - if (IsBreakpoint(cpu8051.pc)) { -#ifdef EMU8051_DEBUG - g_print("Breakpoint Hit, stopping!\n"); -#endif - emugtk_StopRunning(); - } -} - -/* RunningFunction called when idle from gtk_main */ -gboolean -RunningFunction(gpointer data) -{ - emugtk_Running(); - return TRUE; -} - -/* Get in the RunningState */ -void -emugtk_StartRunning(void) -{ - if (!RunningState) { -#ifdef EMU8051_DEBUG - printf("emugtk_StartRunning()\n"); -#endif - RunFuncTag = gtk_idle_add(RunningFunction, 0); - - RunningState = 1; - } -} - -/* Step out of RunningState */ -void -emugtk_StopRunning() -{ - if (RunningState) { -#ifdef EMU8051_DEBUG - printf("emugtk_StopRunning()\n"); -#endif - gtk_idle_remove(RunFuncTag); - RunningState = 0; - regwin_Show(); - pgmwin_Disasm(); - memwin_DumpD("0x00"); - } -} diff --git a/src/emugtk.h b/src/emugtk.h index fe13a45..105411e 100644 --- a/src/emugtk.h +++ b/src/emugtk.h @@ -31,33 +31,4 @@ AddMenuSeparator(GtkWidget *menu); void emugtk_new_file(char *file); -void -emugtk_StopRunning(void); - -void -emugtk_Reset(void); - -void -emugtk_UpdateDisplay(void); - -void emugtk_Step(void); - -void -emugtk_ResetEvent(GtkWidget *widget, GdkEvent *event, gpointer data); - -void -emugtk_RunEvent(GtkWidget *widget, GdkEvent *event, gpointer data); - -void -emugtk_StopEvent(GtkWidget *widget, GdkEvent *event, gpointer data); - -void -emugtk_StepEvent(GtkWidget *widget, GdkEvent *event, gpointer data); - -void -emugtk_StartRunning(void); - -void -emugtk_Running(void); - #endif /* EMUGTK_H */ diff --git a/src/exceptions.hpp b/src/exceptions.hpp deleted file mode 100644 index 57dc407..0000000 --- a/src/exceptions.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Exceptions.hpp - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _EXCEPTION_HPP_ -#define _EXCEPTION_HPP_ - -class ShowOptions { /* ... */ }; -class FinishedLoading { /* ... */ }; -class ErrorOpeningFile { /* ... */ }; -class ErrorHexFileFormat { /* ... */ }; -class SyntaxError { /* ... */ }; -class InvalidAddress { /* ... */ }; -class MissingParameter { /* ... */ }; -class InvalidParameter { /* ... */ }; -class InvalidRegister { /* ... */ }; -class TooMuchParameters { /* ... */ }; -class ResetRequest { /* ... */ }; - -#endif diff --git a/src/filemenu.c b/src/filemenu.c index bb7489c..ded4a5c 100644 --- a/src/filemenu.c +++ b/src/filemenu.c @@ -101,7 +101,6 @@ FileQuitEvent(gchar *string) g_print("%s\n", string); #endif - emugtk_StopRunning(); gtk_main_quit(); } diff --git a/src/gtksizes.h b/src/gtksizes.h index e3aafdf..ec802e1 100644 --- a/src/gtksizes.h +++ b/src/gtksizes.h @@ -19,8 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef _GTKSIZES_HPP_ -#define _GTKSIZES_HPP_ +#ifndef _GTKSIZES_H_ +#define _GTKSIZES_H_ #define NUMBER_OF_BUTTONS 5 #define BUTTON_WIDTH 60 @@ -42,4 +42,4 @@ #define MAIN_WIN_WIDTH (REG_WIN_WIDTH + PGM_WIN_WIDTH) #define MAIN_WIN_HEIGHT (BUTTONS_BAR_HEIGHT + REG_WIN_HEIGHT + MEM_WIN_HEIGHT) -#endif +#endif /* _GTKSIZES_H_ */ diff --git a/src/hexfile.c b/src/hexfile.c index 9716aad..5ec2055 100644 --- a/src/hexfile.c +++ b/src/hexfile.c @@ -59,8 +59,10 @@ Ascii2Hex(char *istring, int length) result <<= 4; result += ascii_code; - } else + } else { printf("%s: In Ascii2Hex(), syntax error.\n", PACKAGE); + printf(" str=%s, length=%d\n", istring, length); + } } return result; } -- 2.20.1