123236Smckusick /* 229305Smckusick * Copyright (c) 1982, 1986 Regents of the University of California. 323236Smckusick * All rights reserved. The Berkeley software License Agreement 423236Smckusick * specifies the terms and conditions for redistribution. 523236Smckusick * 6*49106Sbostic * @(#)prf.c 7.8 (Berkeley) 05/04/91 723236Smckusick */ 8324Sbill 945803Sbostic #include "sys/param.h" 10324Sbill 1145803Sbostic #include "../include/mtpr.h" 129186Ssam #include "../vax/cons.h" 139186Ssam 14324Sbill /* 15324Sbill * Print a character on console. 16324Sbill */ putchar(c)17324Sbillputchar(c) 183262Swnj register c; 19324Sbill { 20324Sbill register s, timo; 2135402Stef #if VAX630 || VAX650 2234659Smarc extern (*v_putc)(); 23324Sbill 2434659Smarc if (v_putc) { 2534659Smarc (*v_putc)(c); 2634659Smarc if (c == '\n') 2734659Smarc (*v_putc)('\r'); 2834659Smarc return; 2934659Smarc } 3034659Smarc #endif 31324Sbill timo = 30000; 32324Sbill /* 33324Sbill * Try waiting for the console tty to come ready, 34324Sbill * otherwise give up after a reasonable time. 35324Sbill */ 36324Sbill while((mfpr(TXCS)&TXCS_RDY) == 0) 37324Sbill if(--timo == 0) 38324Sbill break; 39324Sbill if(c == 0) 40324Sbill return; 41324Sbill s = mfpr(TXCS); 42324Sbill mtpr(TXCS,0); 43324Sbill mtpr(TXDB, c&0xff); 44324Sbill if(c == '\n') 45324Sbill putchar('\r'); 46324Sbill putchar(0); 47324Sbill mtpr(TXCS, s); 48324Sbill } 49324Sbill scankbd()50*49106Sbosticscankbd() 51*49106Sbostic {} 52*49106Sbostic getchar()53324Sbillgetchar() 54324Sbill { 55324Sbill register c; 5635402Stef #if VAX630 || VAX650 5734659Smarc extern (*v_getc)(); 58324Sbill 5934659Smarc if (v_getc) { 6034659Smarc c = (*v_getc)(); 6134659Smarc } else { 6234659Smarc #endif 63324Sbill while((mfpr(RXCS)&RXCS_DONE) == 0) 64324Sbill ; 65324Sbill c = mfpr(RXDB)&0177; 6635402Stef #if VAX630 || VAX650 6734659Smarc } 6834659Smarc #endif 69324Sbill if (c=='\r') 70324Sbill c = '\n'; 7129978Skarels if (c != '\b' && c != '\177') 7229978Skarels putchar(c); 73324Sbill return(c); 74324Sbill } 75