Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!rex!samsung!uunet!jarthur!nntp-server.caltech.edu!tybalt.caltech.edu!toddpw From: toddpw@tybalt.caltech.edu (Todd P. Whitesel) Newsgroups: comp.sys.apple2 Subject: Re: Bitwise operaters in Applesoft Keywords: Applesoft AND Message-ID: <1990Aug21.180348.16003@laguna.ccsf.caltech.edu> Date: 21 Aug 90 18:03:48 GMT References: <1774@oucsace.cs.OHIOU.EDU> Sender: news@laguna.ccsf.caltech.edu Organization: California Institute of Technology Lines: 31 bchurch@oucsace.cs.OHIOU.EDU (Bob Church) writes: >All of this talk about using the serial port from Applesoft got >me curious (again). I've never had any luck with PR#2 or IN#2 from >within an Applesoft program so I decided to try using peeks and pokes >to go about it in a more direct way. The snag is in reading the status >register. I have to check the status of bits 3 and 4 regularly and cannot >figure out a way to do in in Applesoft. Any hints or clues? I normally >use Assembler, ML or C but decided to try it for old times sake. Bit-flicking in Applesloth is not something you want to do realtime (S L O W) but you can get the value of bit n (0..7) in the variable byte from: ( INT(byte/2^n)/2 = INT(INT(byte/2^n)/2) ) what this does is int divide out the bits below the one you want, and then test to see if the result is even or odd (which depends on the bit you want). note that you can improve on this generic routine quite a bit. A far better method would be to poke a tiny machine language subroutine that tests the bits you want or splits them up into seperate bytes so you can use CALL serial_status : IF PEEK(rx_full) THEN character received but I still feel that Apple sloth is too slow for the actual character routines -- far better to use ML to provide an interrupt driven, buffered interface that uses either ampersand routines or I/O hooks. Todd Whitesel toddpw @ tybalt.caltech.edu