[comp.sys.apple] How does the PCPI Applicard manipulate the Apple? ** ANSWERS **

binder@asd.dec.com (NOW willya gimme some fightin' room?) (11/25/86)

Netlanders,

My query for Applicard information brought a flurry of "Please post whatever 
you learn" requests, together with one reply from Jim Gilbert containing lots
of stuff that he's assembled over time, which I've digested here.

First, info on PCPI itself.  The company is still alive and well, but no 
longer marketing Apple stuff, preferring to concentrate on the more lucrative 
(Aagghhh!) IBM market.  They still support the Applicard, and apparently very 
well.

There is an OEM technical support package available from PCPI for about
$50.00.  It includes a couple of disks with sample drivers for all device
classes, a 6502 cross-assembler that runs on the Z80, and other software, 
together with documentation.  I have ordered a copy of this package - I'll
know the exact cost when it gets here.  It was $50.00 when Jim Gilbert's 
information was gathered.  There is very little information available about
the hardware, but the PCPI Technical Support people seem to be willing to
answer questions in as much detail as you want.  Keep your queries to hardware
- if it's software info you're after, spring for the OEM package. 

The USnail address for PCPI is:

PCPI
1150 West Bernardo Ct
San Diego, CA  92127

Phone is (619) 485-8411

The Piggyback RAM card is still available, from (among others) the Laing 
Electronics BBS, at (714) 534-1547.  I imagine Laing has a USnail address and 
maybe a peoplefone as well, but I don't have that info.

The GFRN BBS in Garden Grove, CA, phone (714) 534-1547, has a fair amount of
Applicard goodies on drive E8:.  At the end of this message is a sample driver 
that came from GFRN.  GFRN is a CP/M BBS that runs on an Apple with an
Applicard. 

You can find interesting drivers for RAMDISKs and PCPI hop-ups of various
kinds by reading the ads in the right section of Computer Shopper.  There is
at least one small software house that has specialized in this kind of stuff. 

Cheers,
Dick Binder   (The Stainless Steel Rat)

DEC Enet:	ASD::BINDER
UUCP:		{ decvax, allegra, ucbvax... }!decwrl!asd.dec.com!binder
ARPA:		binder%asd.DEC@decwrl.ARPA

------------------------------------------------------------------------------
Following is the sample driver.  I don't vouch for this code - I haven't tried 
it.  But it looks reasonable.
------------------------------------------------------------------------------

;	Sample CP/M-80 (8080) TPA-resident Serial I/O driver
;		for Apple // with CCS 7710 I/O card

;	Modifications for PCPI Applicard
;		by Daniel Hickey   03/12/83

;	Recommented by Dick Binder  11/24/86

slot	equ	2		; slot number of card

offset	equ	slot*16		; offset
base	equ	0C080h		; slot 0 base location

cstat	equ	base+offset
cdata	equ	cstat+1

rrf	equ	01		; character ready bit
tre	equ	02		; transmitter ready

creset	equ	03h
cinit	equ	15h

rdbyte	equ	0ffe0h		; read a byte from apple (a = byte)
wrbyte	equ	0ffe3h		; write a byte to apple (c = byte)
rdword	equ	0ffe6h		; read 2 bytes from apple (de = bytes)
wrword	equ	0ffe9h		; write 2 bytes to apple (de = bytes)
rdnbyts	equ	0ffech		; read n bytes (de = count, hl = buffer)
wrnbyts	equ	0ffefh		; write n bytes (de = count, hl = buffer)

peek1byte equ	6		; command to peek 1 byte in the apple
poke1byte equ	7		; command to poke 1 byte in the apple


	org	100h

	jmp	init		; *** initialize com device

	org	110h

stat:
	lxi	d,cstat  	; *** return ready status
	call	peek
	ani	rrf		; mask rrf bit...
	ret			; ...and return

	org	120h

sin:
sin1:
	lxi	d,cstat  	; *** read one character
	call	peek		; get status
	ani	rrf		; rrf set?
	jz	sin1		; no, loop
	jmp	sinext		; yes, get character

	org	130h

sout:
	push	psw		; save char to be output

sout1:
	lxi	d,cstat  	; *** output one char
	call	peek		; get status
	ani	tre		; ready?
	jz	sout1		; no, loop
	jmp	sotext		; yes, put char out

scar:
	org	140h
	nop
	nop
	ret

; NOTE:  This return must be here

init:

; ********************************************************************
; 	This code corrects an error in Crosstalk 2.0s.
; 	If using another version this code may be removed
; 
	lxi	h,0201bh
	mov	a,m
	cpi	02ch
	jnz	init1
	mvi	m,030h
; ********************************************************************

init1:
	mvi	a,creset	; reset UART
	lxi	d,cstat   
	call	poke
	mvi	a,cinit		; initialize UART
	call	poke
	jmp	0200h		; jump to xtalk - *** EXTERNAL CODE ***

; peek at 1 byte in the apple
; entry: de = address
; exit:	a = data
peek:
	mvi	c,peek1byte
	call	wrbyte
	call	wrword
	call	rdbyte
	ret

; poke 1 byte into the apple
; entry: de = address
; 	 a  = data
poke:
	mov	b,a
	mvi	c,poke1byte
	call	wrbyte
	call	wrword
	mov	c,b
	call	wrbyte
	ret

sinext:	lxi	d,cdata  
	call	peek		; get char
	ret			; return

sotext:	pop	psw		; fetch saved char
	lxi	d,cdata  
	call	poke		; output char
	ret			; return

	end