segment padpart; const {$I ISO.CST } {$I SOFT.CST } {$I SSMP.CST } type {$I ISO.TYP } {$I HARDWARE.TYP } {$I SOFT.TYP } {$I SSMP.TYP } {$I DRIVERS.EXT } {$I SOFT2.EXT } function linegetc(var c : character) : boolean; var loop : word; begin loop := 0; c := 0; repeat loop := loop + 1 until (loop > 10000) or ZLDATA; if (loop > 10000) then linegetc := false else begin c := ZLGET; if (c > 127) then c := c - 128; linegetc := true end end; {#PUBLIC detectpad -- discover the PAD type } procedure detectpad; var pad : smallint; procedure promptpad; var c : character; begin { Remove any junk before trying PAD commands } while ZLDATA do c := ZLGET; { Tickle PAD with CTRL/P A } putc(CTRLP); putc(LETA); ZSWAIT(300); { For PAD to respond } { Examine response from PAD for first of > : CTRL/G } pad := 0; while (pad = 0) and linegetc(c) do begin if (c = GREATER) then pad := 1 else if (c = COLON) then pad := 3 else if (c = CTRLG) then pad := 4 end; { NUNET PAD detected so remove A } if (pad = 3) then putc(CTRLX); { Try CTRL/M on the end } putc(CTRLM); ZSWAIT(300); { For PAD to respond } { Examine response from PAD for first of > or CTRL/J } while (pad = 0) and linegetc(c) do begin if (c = GREATER) then pad := 1 else if (c = CTRLJ) then pad := 2 end end; begin if autopad then begin { Try to discover PAD type by chatting to it } promptpad; if (pad = 0) { Still ! } then begin { Perhaps NUNET session resumed after interruption so } pad := 3; setpadcmds(pad); txendsession; ZSWAIT(1000); { For PAD to respond } pad := 0; { Try to re-discover pad type } promptpad; if pad = 0 then pad := 1 { Assume JNT PAD } end; if (pad >= 1) and (pad <= 3) then setpadcmds(pad) end end; begin end.