|
|
1.1 ! root 1: /* motion.c 4.1 83/03/09 */ ! 2: /* ! 3: * Move the pen to x, y. We assume we are already in ESCP mode. ! 4: */ ! 5: ! 6: #include "2648.h" ! 7: ! 8: motion(x, y) ! 9: { ! 10: char lox, loy, hix, hiy; ! 11: int delx, dely; ! 12: ! 13: delx = x-_penx; dely = y-_peny; ! 14: if (-16 <= delx && delx <= 15 && -16 <= dely && dely <= 15) { ! 15: /* ! 16: * Optimization: if within 15 in both directions, can use ! 17: * HP short incremental mode, only 3 bytes. ! 18: */ ! 19: outchar('j'); ! 20: outchar(32 + (delx & 31)); ! 21: outchar(32 + (dely & 31)); ! 22: } else { ! 23: /* ! 24: * Otherwise must use binary absolute mode, 5 bytes. ! 25: * We never use ascii mode or binary incremental, since ! 26: * those both take many more bytes. ! 27: */ ! 28: outchar('i'); ! 29: outchar(32+ ((x>>5) & 31)); ! 30: outchar(32+ (x&31)); ! 31: outchar(32+ ((y>>5) & 31)); ! 32: outchar(32+ (y&31)); ! 33: } ! 34: _penx = x; ! 35: _peny = y; ! 36: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.