Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!rutgers!rochester!cornell!wayner From: wayner@kama.cs.cornell.edu (Peter Wayner) Newsgroups: comp.sys.mac.programmer Subject: Reading Text With Pointers... Message-ID: <50164@cornell.UUCP> Date: 30 Dec 90 20:43:13 GMT Sender: nobody@cornell.UUCP Organization: Cornell Univ. CS Dept. Ithaca NY Lines: 38 If I read in a file of text, each character fills a byte. The problem is that the 68000 doesn't allow unalligned access, but the 68020/30 does. What is the best way to pull of characters one by one? Does the routine need to look like: Globals: lastword:16bits lasthigh:boolean position:pointer; function nextchar:char; begin if lasthigh then begin pointer:=pointer+2; lastword:=pointer^; lasthigh:=false; nextchar:=BAND($ff,lastword); {Keep the lower eightbits via a bitwise AND.} end else begin lasthigh:=true; nextchar:=BAND($ff,BSR(lastword,8)); {Keep the top eight bits by first shifting right 8 bits and then anding.} end; end;{nextchar} Is there a better way to do this? -Peter Peter Wayner Department of Computer Science Cornell Univ. Ithaca, NY 14850 EMail:wayner@cs.cornell.edu Office: 607-255-9202 or 255-1008 Home: 116 Oak Ave, Ithaca, NY 14850 Phone: 607-277-6678