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

Re: Apple Game Server - updates



On Jan 13, 1:18 am, BLuRry <brendan.rob...@gmail.com> wrote:
> > The serial port part isn't particularly hard, having done that kind of
> > thing before. :-)  I started that work a while ago, but got bogged
> > down in trying to detect (remotely, automatically) which kind of Apple
> > is at the other end.  It would be a whole lot easier if one just
> > picked ahead of time which kind of device one were talking to.
>
> You wouldn't happen to have a sample of a polling read loop would
> you?
Why, yes.  From:
http://adtpro.cvs.sourceforge.net/viewvc/adtpro/adtpro/client/src/prodos/serial/iigsscc.asm?view=markup

;---------------------------------------------------------
; ZCCG - Get a character from the SCC serial port (XY unchanged)
;---------------------------------------------------------

ZCCG:
	LDA GSCMDB	; DUMMY READ TO RESET 8530 POINTER TO 0

pollSCC:
	lda $C000
	cmp #CHR_ESC	; Escape = abort
	bne SCCNEXT
	jmp PABORT

SCCNEXT:
	LDA GSCMDB	; READ 8530 READ REGISTER 0
	AND #$01        ; BIT 0 MEANS RX CHAR AVAILABLE
	cmp #$01
	bne pollSCC

			;  THERE'S A CHAR IN THE 8530 RX BUFFER
pullIt:
	LDA #$01	;  SET 'POINTER' TO rr1
	STA GSCMDB
	LDA GSCMDB	;  READ THE 8530 READ REGISTER 1
	AND #$20	;  CHECK FOR bit 5=RX OVERRUN
	BEQ itsOK
	ldx #$30	; Clear Receive overrun
	stx GSCMDB
	ldx #$00
	stx GSCMDB

itsOK:
	LDA #$08	;  WE WANT TO READ rr8
	STA GSCMDB	;  SET 'POINTER' TO rr8
	LDA GSCMDB	;  READ rr8
	rts

Where:
PABORT = (some abort code)
GSCMDB	= $C038
CHR_ESC =  $9B

> Also, on a similar note (i have now 2 hours of 65816 asm experience
> under my belt), if I enable emulation mode that automatically sets the
> accumulator and index registers to 8-bit right?

I suppose so.  The GS starts up in 8-bit mode under normal DOSes, so I
don't generally worry about 65816 mode, myself.  It must start up that
way too, since serial bootstrapping operations work normally on power-
up.