[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Applesoft BASIC PRINTs 7 bit data?
Heynony (nospam@noway.com) wrote:
: "Joel" <joelbuckley54.nospam.@hotmail.com> wrote:
: > If you just want to do file transfer to another computer, there are plenty
: > of modem programs to handle that.
: No, I'm running a program that periodically needs to talk to a device
: that has a hard wired and immutable 8 bit data length. At least
: apparently immutable, I'm looking into that as well.
Applesoft does all kinds of bit-banging on output, and I am not certain at
what stage that bit-banging is happening. Recall that for the screen,
low-bit ASCII is flashing text, high-bit ASCII is normal. I think
Applesoft *sends* 8 bits, but bit 7 bears no resemblance to reality. 8-)
In any case, the solution to your problem should be an easy one. If you
are able to talk to your device using a PRINT statement, then clearly your
device has hooked itself into CSW ($36-37). If that is the case, then a
quick bit of assembly code should solve your problem:
*300: 00 DS 1 ;Character to be sent
*301: AD 00 03 LDA $0300 ;Get character from $0300 = 768
*304: 20 ED FD JSR $FDED ;Send it to COUT
*307: 60 RTS ;Back to BASIC
Alternatively, it's short enough to POKE into place:
]1 POKE 769,173:POKE 770,0:POKE 771,3:POKE 772,32:POKE 773,237:POKE
774,253:POKE 775,96
To use it, POKE your 8-bit character into 768 and CALL 769:
60000 CH%=ASC(Q1$)+128:POKE 768,CH%:CALL 769:RETURN
If your device is following the rules, then upon initialization it should
insert itself into the output hook at CSW (which is called by COUT at
$FDED) and then return control to the previously installed device at CSW
(usually DOS or BASIC.SYSTEM). In fact, I think DOS/BASIC.SYSTEM re-hook
themselves to be first in line, but they pass the unmunged character value
to your character handler. So no fancy machine code is needed, just a
call to COUT that bypasses Applesoft.
Normally PRINT does its own bit-banging and then calls COUT; by bypassing
PRINT and calling COUT directly you can control the value that comes out.
I hope that makes some kind of sense! I've been trying to write this
message for the past three hours now, but I can't seem to get five minutes
of uninterrupted keyboard time today...
--Dave Althoff, ][.
--
/-\ _ _ *** Thanks for a great season!! ***
/XXX\ /X\ /X\_ _ /X\__ _ _ _____
/XXXXX\ /XXX\ _/XXXX\_ /X\ /XXXXX\ /X\ /X\ /XXXXX
_/XXXXXXX\__/XXXXX\/XXXXXXXX\_/XXX\_/XXXXXXX\__/XXX\_/XXX\_/\_/XXXXXX