// Fork a simulation process which will get chars typed into the simulation terminal and transmit them on the simulation uartPin.fork{uartPin#=truewhile(true){// System.in is the java equivalent of the C's stdin.if(System.in.available()!=0){valbuffer=System.in.read()uartPin#=falsesleep(baudPeriod)for(bitId<-0to7){uartPin#=((buffer>>bitId)&1)!=0sleep(baudPeriod)}uartPin#=truesleep(baudPeriod)}else{sleep(baudPeriod*10)// Sleep a little while to avoid polling System.in too often.}}}