Revision ff5928d0 target-unicore32/helper.c

b/target-unicore32/helper.c
13 13
#include "gdbstub.h"
14 14
#include "helper.h"
15 15
#include "host-utils.h"
16
#include "console.h"
16 17

  
17 18
#undef DEBUG_UC32
18 19

  
......
186 187
    return 0;
187 188
}
188 189

  
190
#ifdef CONFIG_CURSES
191
/*
192
 * FIXME:
193
 *     1. curses windows will be blank when switching back
194
 *     2. backspace is not handled yet
195
 */
196
static void putc_on_screen(unsigned char ch)
197
{
198
    static WINDOW *localwin;
199
    static int init;
200

  
201
    if (!init) {
202
        /* Assume 80 * 30 screen to minimize the implementation */
203
        localwin = newwin(30, 80, 0, 0);
204
        scrollok(localwin, TRUE);
205
        init = TRUE;
206
    }
207

  
208
    if (isprint(ch)) {
209
        wprintw(localwin, "%c", ch);
210
    } else {
211
        switch (ch) {
212
        case '\n':
213
            wprintw(localwin, "%c", ch);
214
            break;
215
        case '\r':
216
            /* If '\r' is put before '\n', the curses window will destroy the
217
             * last print line. And meanwhile, '\n' implifies '\r' inside. */
218
            break;
219
        default: /* Not handled, so just print it hex code */
220
            wprintw(localwin, "-- 0x%x --", ch);
221
        }
222
    }
223

  
224
    wrefresh(localwin);
225
}
226
#else
227
#define putc_on_screen(c)               do { } while (0)
228
#endif
229

  
189 230
void helper_cp1_putc(target_ulong x)
190 231
{
191
    /* TODO: curses display should be added here for screen output. */
192
    DPRINTF("%c", x);
232
    putc_on_screen((unsigned char)x);   /* Output to screen */
233
    DPRINTF("%c", x);                   /* Output to stdout */
193 234
}
194 235
#endif
195 236

  

Also available in: Unified diff