diff --git a/BaS_GNU/BaS_GNU/sources/bas_printf.c b/BaS_GNU/BaS_GNU/sources/bas_printf.c index 86bae74..9d9b500 100644 --- a/BaS_GNU/BaS_GNU/sources/bas_printf.c +++ b/BaS_GNU/BaS_GNU/sources/bas_printf.c @@ -66,7 +66,7 @@ static void xputchar(int c) "bsr printf_helper\n\t" /* output */: /* input */: "r" (c) - /* clobber */: "d0","a0" + /* clobber */: "d0","d2","a0" ); } @@ -380,3 +380,12 @@ void xvsnprintf(char *str, size_t size, const char *fmt, va_list va) *xstring++ = '\0'; } + +void display_progress() +{ + static int _progress_index; + char progress_char[] = "|/-\\"; + xputchar(progress_char[_progress_index++ % strlen(progress_char)]); + xputchar('\r'); +} + diff --git a/BaS_GNU/BaS_GNU/sources/printf_helper.S b/BaS_GNU/BaS_GNU/sources/printf_helper.S index 964952e..7bb8a12 100644 --- a/BaS_GNU/BaS_GNU/sources/printf_helper.S +++ b/BaS_GNU/BaS_GNU/sources/printf_helper.S @@ -3,6 +3,10 @@ .global printf_helper printf_helper: .extern __MBAR - lea __MBAR+0x860C,a0 - move.b d0,(a0) +.wait_txready: + move.w __MBAR+0x8604,d2 // PSCSCR0 status register + btst #10,d2 // space left in TX fifo? + beq.s .wait_txready // no, loop + lea __MBAR+0x860C,a0 // PSCSTB0 transmitter buffer register + move.b d0,(a0) // send byte rts