diff --git a/cpu/z80/dev/rs232.c b/cpu/z80/dev/rs232.c index b785ded39..4b7cd924e 100644 --- a/cpu/z80/dev/rs232.c +++ b/cpu/z80/dev/rs232.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: rs232.c,v 1.2 2007/09/11 12:03:20 matsutsuka Exp $ + * $Id: rs232.c,v 1.3 2007/09/19 12:47:55 matsutsuka Exp $ * */ /* @@ -48,7 +48,7 @@ PROCESS_THREAD(rs232_process, ev, data) { static struct etimer timer; char ch; - unsigned char i; + unsigned char i, stat; PROCESS_BEGIN(); rs232_arch_init(RS232_BAUD_RATE); @@ -59,8 +59,8 @@ PROCESS_THREAD(rs232_process, ev, data) if (etimer_expired(&timer)) { for (i = 0; i < RS232_BUFSIZE; i++) { - ch = rs232_arch_poll(); - if (ch == 0) { + ch = rs232_arch_poll(&stat); + if (stat == 0) { break; } /* We have an input data */ diff --git a/cpu/z80/dev/rs232.h b/cpu/z80/dev/rs232.h index d2c29c3c4..4ec951952 100644 --- a/cpu/z80/dev/rs232.h +++ b/cpu/z80/dev/rs232.h @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: rs232.h,v 1.2 2007/09/11 12:03:20 matsutsuka Exp $ + * $Id: rs232.h,v 1.3 2007/09/19 12:47:55 matsutsuka Exp $ * */ /* @@ -51,9 +51,9 @@ void rs232_arch_init(unsigned long ubr); /* * An architecture-depend implementation of RS-232C polling. - * @return character, zero if no input. + * @return character, stat == zero if no input. */ -unsigned char rs232_arch_poll(void); +unsigned char rs232_arch_poll(unsigned char* stat); /* * An architecture-depend implementation of RS-232C writing a byte. diff --git a/platform/pc-6001/dev/rs232-asm.S b/platform/pc-6001/dev/rs232-asm.S index f57799d9f..9a17db01c 100644 --- a/platform/pc-6001/dev/rs232-asm.S +++ b/platform/pc-6001/dev/rs232-asm.S @@ -7,7 +7,7 @@ ;;; ;;; @author Takahide Matsutsuka ;;; -;;; $Id: rs232-asm.S,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $ +;;; $Id: rs232-asm.S,v 1.2 2007/09/19 12:47:19 matsutsuka Exp $ ;;; ;; definitions of PC-6001 BIOS routines @@ -37,18 +37,25 @@ _rs232_arch_writeb: ret ;; --------------------------------- - ;; unsigned char rs232_arch_poll(); - ;; Stack; retl reth - ;; AFBC__HL____ - ;; return input byte (zero if no input) + ;; unsigned char rs232_arch_poll(unsigned char *stat); + ;; Stack; retl reth statl stath + ;; AFBCDEHL____ + ;; return input byte (*stat == 0 if no input) ;; --------------------------------- _rs232_arch_poll: - ld a,#0x01 + ld hl, #2 + add hl, sp + ld e, (hl) + inc hl + ld d, (hl) + ld a, #0x01 + ld (de), a di call #_char_input_sub ; read from buffer ei jr nz, _rs232_arch_poll_ret xor a ; we have no data in the buffer + ld (de), a _rs232_arch_poll_ret: ld l, a ret