#include "machine/mtpr.h"
* Scaled down version of C Library printf.
* Used to print diagnostic information directly on console tty.
* Since it is not interrupt driven, all system activities are
* suspended. Printf should not be used for chit-chat.
* One additional format: %b is supported to decode error registers.
* printf("reg=%b\n", regval, "<base><arg>*");
* Where <base> is the output base expressed as a control character,
* e.g. \10 gives octal; \20 gives hex. Each arg is a sequence of
* characters, the first of which gives the bit number to be inspected
* (origin 1), and the next characters (up to a control character, i.e.
* a character <= 32), give the name of the register. Thus
* printf("reg=%b\n", 3, "\10\2BITTWO\1BITONE\n");
while ((c
= *fmt
++) != '%') {
/* THIS CODE IS VAX DEPENDENT IN HANDLING %l? AND %c */
case 'u': /* what a joke */
for (i
= 24; i
>= 0; i
-= 8)
for (; (c
= *s
) > 32; s
++)
* Print a character on console.
/* console requires even parity */
for (par
= 0, mask
= 1; mask
!= 0200; mask
<<= 1, par
<<= 1)
cpout
.cp_hdr
.cp_unit
= CPCONS
; /* Resets done bit */
cpout
.cp_hdr
.cp_comm
= CPWRITE
;
cpout
.cp_hdr
.cp_count
= 1;
time
= 100000; /* Delay loop */
uncache(&cpout
.cp_hdr
.cp_unit
);
if (cpout
.cp_hdr
.cp_unit
& CPDONE
)
cpin
.cp_hdr
.cp_unit
= CPCONS
; /* Resets done bit */
cpin
.cp_hdr
.cp_comm
= CPREAD
;
cpin
.cp_hdr
.cp_count
= 1;
while ((cpin
.cp_hdr
.cp_unit
& CPDONE
) == 0)
uncache(&cpin
.cp_hdr
.cp_unit
);
uncache(&cpin
.cpi_buf
[0]);
c
= cpin
.cpi_buf
[0] & 0x7f;
if (c
!= '\b' && c
!= '\177')
/* Return *(addr-0x4000); DIRTY assumes this address is valid */