Subject: Re: memory mapped locations ($0CXXX) needed for printer, serial ports.
From: [email-masked] (David Empson)
Date: 31 Aug 91 14:39:48 GMT
Newsgroups: comp.sys.apple2

In article <[email-masked]> [email-masked] (Kevin Stanton) writes:
> 
> 	I am attempting to use my Apple II+ as a printer buffer (serial in,
> parallel out).  However, my Super Serial Card manual is rather sparse on
> details, as it is strictly a users manual.

I'm assuming you are using assembly language here.

Is this a real Apple Super Serial Card, or a clone of it?  Even the
clone SSCs that I've seen come with a full manual.

> It gives certain entry points, but they are blocking, not polling.

Which entry points are these?  The BASIC interface is entirely
blocking (JSR $Cn00 to set up, then use COUT and RDKEY to get or send
bytes).  The Pascal interface's I/O calls are also blocking, but there
is a status call, which you can ask 'are you ready for output' and 'do
you have any input available'.

To confirm that your card has the Pascal interface, check the
following bytes (assuming the card is in slot 's'):

Signature bytes: $Cs05 = $38, $Cs07 = $18, $Cs0B = $01.

The entry points for the Pascal interface are contained in a lookup
table starting at $Cs0D.  Each table entry contains the low byte of
the start address of the corresponding routine.  The high byte is $Cs.

$Cs0D  offset to INITIALIZE routine
$Cs0E  offset to READ routine
$Cs0F  offset to WRITE routine
$Cs10  offset to STATUS routine

For example, if $Cs0D contains the number $44, the initialize routine
starts at $Cs44.

All the routines must be called with X containing $Cs and Y containing
$s0 (e.g. $C2 and $20 for slot 2).

WRITE: A contains byte to write
READ:  Byte read is returned in A
STATUS: A=0 for 'are you ready for output', A=1 for 'do you have input
ready'.  In both cases, the SSC will return with carry set if the
answer to the question is 'yes'.

You could go down to the hardware level if you want.  Use the serial
firmware to initialize the card (baud rate, etc.)

To transmit:

	LDX	#$s0		; s is slot number, e.g. $20 for slot 2
	LDA	$C089,X		; read status register
	AND	#$10		; test Transmitter Empty flag
	BEQ	IsBusy
	LDA	Byte_to_send	; get the byte you want to transmit
	STA	$C088,X		; stick it in the transmit data register

To receive:

	LDX	#$s0		; s is slot number, as above
	LDA	$C089,X		; read status register
	AND	#$08		; test Receive Full flag
	BEQ	NoByte
	LDA	$C088,X		; get the received byte
	STA	Byte_received

> I also seem to be unclear in regard to initializing the devices (can
> both the printer card and the SSC be active at the the same time?

Using the BASIC interface, you can only have one input device and one
output device.  For example, in Applesoft BASIC, you can do a PR#1 to
output to slot 1, and an IN#2 to input from slot 2.

If you use the PASCAL interface or talk to the hardware directly, you
can do simultaneous I/O to as many slots as you like.

> The printer card is an Apple Dumpling, and is equally spare in
> details.  All it gives is a sample 12 line driver which I can't seem
> to get to work.

Sorry, I know nothing about this card.  Check the above ID bytes to
see if it supports the Pascal interface.  If it does, you're home
free.  If it doesn't,...  I've given you half the solution, anyway.

-- 
David Empson

USENET: [email-masked]