Well, really you shouldn't HAVE any terminal-dependent code. That's what termcap/terminfo is all about! (Actually, beasties like the 5620 necessarily use terminal-dependent code, but your emulation is VERY unlikely to be able to emulate these on other terminals.)