RE: pack in colorForth
"howerd.oakford" <[email protected]>
| Newsgroups | gmane.comp.lang.forth.colorforth |
|---|---|
| Message-ID | <[email protected]> |
Thanks Mark! Howerd -----Original Message----- From: Mark Slicker [mailto:[email protected]] Sent: 11 April 2005 04:58 To: [email protected] Subject: [colorforth] pack in colorForth The following is mostly the same as 'pack' in the assembler source. Instead of left justifing the word after it is full of characters, I always keep the word justified, this makes the data flow much simpler in Forth. variable bits variable words : 2xs for 2x next ; : shift dup [ bits ] ! 4 + 2xs ; : full swap 28 + shift 1 [ words ] +! ; : chop 1 ? if drop drop full ; then 2/ 1 u+ if chop ; then swap shift nip nip or ; : room negate swap over [ bits ] @ + ; : put room -if over chop ; then shift nip or ; : pack -16 ? if 80 + 7 put ; then 8 ? if 8 + 5 put ; then 4 put ; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] Main web page - http://www.colorforth.com