From b8d87b2f2468d66177d2f79e13e211d4523f8aac Mon Sep 17 00:00:00 2001 From: johanknol Date: Sat, 19 Aug 2000 15:29:05 +0000 Subject: [PATCH] Fixed %p format for flat24 (non-ansi, but usefull for debugging) git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@324 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- device/lib/vprintf.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/device/lib/vprintf.c b/device/lib/vprintf.c index 505576ef..9977d8ab 100644 --- a/device/lib/vprintf.c +++ b/device/lib/vprintf.c @@ -35,6 +35,10 @@ extern void putchar(const char); typedef char _generic *ptr_t; +#ifdef toupper +#undef toupper +#endif + //#define toupper(c) ((c)&=~0x20) #define toupper(c) ((c)&=0xDF) @@ -235,11 +239,23 @@ get_conversion_spec: case 'P': PTR = va_arg(ap,ptr_t); +#ifdef SDCC_MODEL_FLAT24 + output_char(memory_id[(value.byte[3] > 3) ? 4 : value.byte[3]] ); + output_char(':'); + output_char('0'); + output_char('x'); + output_2digits(value.byte[2]); + output_2digits(value.byte[1]); + output_2digits(value.byte[0]); +#else output_char( memory_id[(value.byte[2] > 3) ? 4 : value.byte[2]] ); - output_char( ':' ); - if ((value.byte[2] != 0x00) && (value.byte[2] != 0x03)) + output_char(':'); + output_char('0'); + output_char('x'); + if ((value.byte[2] != 0x00 /* DSEG */) && (value.byte[2] != 0x03 /* SSEG */)) output_2digits( value.byte[1] ); output_2digits( value.byte[0] ); +#endif break; case 'D': -- 2.47.2