[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applesoft BASIC PRINTs 7 bit data?



dalloff@gcfn.org (Dave Althoff Jr) wrote:

> 60000 CH%=ASC(Q1$)+128:POKE 768,CH%:CALL 769:RETURN

I've succeeded due to the help I got here and I'm leaving this message 
so that anyone who has a similar problem in the future can find this 
thread and profit from the process. Some of this summary will be 
repetitious:

The answer to my original question, this thread title, is "no." The 
Apple PRINTs out 8 data bits to the communications ports just fine, in 
terms of communication protocol, but Applesoft BASIC uses the 8th bit 
(bit 7 as in 0-7, or the "high bit") for its own internal purposes 
(flash, inverse). That 8th bit is garbage in the real world when it gets 
out. No problem communicating with PRINT statements to most devices 
because the 8th bit is not normally used for anything and even though 
the devices may be set for 8 data bits the 8th is usually masked or 
ignored when the data is actually processed.

For devices where the 8th bit _is_ a problem (for example pc termial 
programs), setting that device to 7 bits is a brute force solution. For 
devices which _cannot_ be set to 7 bits (my problem) Dave's 
implementation earlier in this thread of bypassing Applesoft's PRINT 
command and putting the data out to the port directly works fine; but 
you _don't_ add the 128 as he suggested. The original ASCII value is 
fine, you just don't want to give Applesoft BASIC the opportunity to 
mangle it with an 8th bit that is garbage to the outside world.

Also, I found that I was getting some occasional over-writing at $300 so 
I moved the routine up a few bytes. I didn't bother researching (or 
trying to remember from the old days) where the absolutely safe areas 
are under ProDOS BASIC, but at $305+ it's been working fine. Probably 
$300 is safe, and I just have something elsewhere in my program (long 
since forgotten) using a few bytes there.

I still woudn't mind a cleaner method than this ML subroutine, if 
anybody has further thoughts, as my program's print function has now 
become a tedious process (breaking down the output data into strings and 
then shipping each string one ascii value at a time to the subroutine) 
but I'm just happy it's working.

Thanks for the help and special thanks to Dave Althoff Jr.