From e808d8d754d0ee33a5ebce4e601b571643e90cdf Mon Sep 17 00:00:00 2001 From: kbongers Date: Mon, 4 Feb 2002 05:43:16 +0000 Subject: [PATCH] use sim trap git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1899 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- device/examples/xa51/hello.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/device/examples/xa51/hello.c b/device/examples/xa51/hello.c index ed9cabf7..bbe19657 100755 --- a/device/examples/xa51/hello.c +++ b/device/examples/xa51/hello.c @@ -32,13 +32,28 @@ void external_startup(void) { //PSWH &= 0xf0; /* start interupt system */ } +#define SIMULATOR 1 + +#ifdef SIMULATOR +void putchar(char c) { + _asm + mov.b r0l, [r7+2] + trap #0EH; + _endasm; +} +void exit_simulator(void) { + _asm + trap #0FH; + _endasm; +} +#else void putchar(char c) { while(!TI0) ; S0BUF = c; TI0 = 0; } - +#endif char getchar(void) { char c; @@ -61,5 +76,10 @@ int kbhit(void) { } void main(void) { + putchar('1'); + putchar('2'); + putchar('3'); + putchar('\n'); puts ("Hello world.\n\r"); + exit_simulator(); } -- 2.30.2