let kbbuff = vec(25), kbbs = 0, kbbe = 0, kbbn = 0, kbbmax = 99, kbblines = 0; ... let kbbadd(c) be { if kbbn >= kbbmax then resultis 0; byte kbbe of kbbuff := c; if c = '\n' then kbblines +:= 1; kbbn +:= 1; kbbe +:= 1; if kbbe > kbbmax then kbbe := 0; resultis 1 } ... let kbbremove() be { let c; if kbblines = 0 then resultis 0; c := byte kbbs of kbbuff; kbbn -:= 1; kbbs +:= 1; if kbbs > kbbmax then kbbs := 0; if c = '\n' then kbblines -:= 1; resultis c } let getchar() be { ... c := kbbremove(); ... } let keyboard_handler() be { ... kbbadd(c) ... }