[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Relay control w/ parallel interface
Nicolas Rey <nicorey@club-internet.fr> wrote:
> Setting up my Apple IIe with a EPSON parallel interface to control our
> optical printer I ran into two problems. I thought using the 8 data pins
> to control a relay each, but :
>
> a) Pin #9 doesn't seem to be active when I try to print a character with
> an ASCII code of 128 or higher. Is there a possibility to change that ?
Applesoft BASIC _always_ sets bit 7 when outputting via the PRINT
statement. PRINT CHR$(65); and PRINT CHR$(193); will both output an "A"
with the high order bit set (bit pattern of 11000001). For output to
the screen, this is modified by the INVERSE and FLASH statements, but
these have no effect on output to another device such as a printer card.
The printer card may have a facility for masking off bit 7, in which
case you can never arrange for it to be set.
To get around the first problem, you need to output characters via a
machine code routine which calls the COUT routine (at $FDED).
The following code is sufficient:
0300: A9 00 LDA #$00
0302: 4C ED FD JMP $FDED
Your BASIC program can POKE this program into memory, then use a POKE
followed by a CALL to output each character:
1000 REM Poke in the program
1010 POKE 768,169: POKE 770,76: POKE 771,237: POKE 772,253
2000 REM Output a character given ASCII value in A
2010 POKE 769,A: CALL 768
To get around the second problem would be rather tricky, and depend on
finding out how to bypass this feature of the printer card.
> b) PRODOS interprets a "? CHR$(4);" instruction in a program line as the
> preamble for a disk command. Anyway I can actually print a CHR$(4) to
> activate pin #4 ?
For starters, it wouldn't activate pin 4, it would activate pin 2 (4 is
2^2).
You can't safely output this character from BASIC. Using the same
machine code subroutine above would fix this.
It still wouldn't work if you were running under DOS 3.3, since DOS
actually watches the characters as they are output (from either BASIC or
machine code), and will recognise CHR$(4) as the prefix for a disk
command if the current horizontal cursor position is zero.
ProDOS instead looks for a PRINT statement with the first output
character being CHR$(4), and isn't triggered by machine code outputting
characters.
> Oh, and one final question. I forgot: is there a PRODOS command to
> initialize disks, or is it compulsory to go through the Utilities disk?
No. You have to use a utility program.
--
David Empson
dempson@actrix.gen.nz
Snail mail: P O Box 27-103, Wellington, New Zealand