RE: [stella] compact send-only serial subroutine

Subject: RE: [stella] compact send-only serial subroutine
From: "Fred Quimby" <c9r@xxxxxxxxxxx>
Date: Fri, 12 Aug 2005 20:04:08 -0400
I'm not sure what all those ROR's are for.  Since serial comms sends bytes 
from LSB to MSB, it seems to me that you could just connect the serial port 
to right joystick up, and do this:

OUT232b
	STA	SWCHA
	LDY	#BIT2		; wait 1 bit
	JSR	WSYNCY	; send the next bit
	ROR			; rotate out next bit
	STA	SWCHA
	ROR			; rotate out next bit
	LDY	#BIT1		; wait 1 bit
	JSR	WSYNCY	; output next bit
	DEX			; decrement counter
	BNE	OUT232b	; loop until 8 bits sent

As for a cable, I would think that you'd just need to connect two wires: 
GND-GND and right joystick up to RxD on the PC.   This seems to be:

2600 Pin		PC pin (9 pin serial)
----------------------------------------------------
Pin 8 (gnd)		Pin 5 (gnd)
Pin 1 (up)		Pin 2 (RxD)



>From: Glenn Saunders <mos6507@xxxxxxxxx>
>Reply-To: stella@xxxxxxxxxxxxxxxxxx
>To: stella@xxxxxxxxxxxxxxxxxx
>Subject: [stella] compact send-only serial subroutine
>Date: Fri, 12 Aug 2005 17:42:36 -0400
>
>I'd like to do some kind of proof of concept to get
>the 2600 to send 1 byte through a joystick port to the
>PC reliably.
>
>Anyone have a webpage that shows how to create a cable
>for this?
>
>I think I found a good code snippet to use from here:
>
>http://xi6.com/files/7800dump.asm
>
>I chopped out the register save/restore and
>flag-clearing and the use of a temp byte of RAM.  Let
>me know if you see any problems with it or if it can
>be compressed further.
>
>
>
>
>;	Configure joystick port for OUT232 once
>
>RELCODE	LDA	#$40		; configure bit 6 for output
>	STA	SWACNT
>
>;-----------------------------------------------------------------------;
>;	Output a character as RS-232 through the joystick
>port
>;
>; note: 6.5 lines = approx one 2400 baud bit
>;        13 lines = approx one 1200 baud bit
>;-----------------------------------------------------------------------;
>
>;	These constants add up to two bit times
>
>;BIT1	EQU	13		; 1200 baud
>;BIT2	EQU	13
>
>BIT1	EQU	7		; 2400 baud
>BIT2	EQU	6
>
>
>
>OUT232	LDX	#0		; output low for start bit
>	STX	SWCHA
>	LDX	#4		; init count for 4 bit pairs
>	LDY	#BIT1		; wait 1 bit
>	JSR	WSYNCY		; send the start bit
>
>OUT232b	ROR			; rotate out next bit
>	ROR
>	ROR
>	STA	SWCHA
>	LDY	#BIT2		; wait 1 bit
>	JSR	WSYNCY	; send the next bit
>	ROR			; rotate out next bit
>	ROR
>	ROR
>	STA	SWCHA
>	LDY	#BIT1		; wait 1 bit
>	JSR	WSYNCY	; output next bit
>	DEX			; decrement counter
>	BNE	OUT232b	; loop until 8 bits sent
>;	STA	WSYNC		; adjust timing a little bit
>	LDA	#$FF		; output high for stop bit
>	STA	SWCHA
>	LDY	#BIT1		; wait 1 bit
>	JSR	WSYNCY	; send the stop bit
>
>	RTS
>
>;-----------------------------------------------------------------------;
>; wait for number of scan lines specified in Y
>register
>;-----------------------------------------------------------------------;
>
>WSYNCY	STY	WSYNC		; wait a line
>	DEY			; decrement line counter
>	BNE	WSYNCY		; loop until done
>	RTS
>
>
>
>
>____________________________________________________
>Start your day with Yahoo! - make it your home page
>http://www.yahoo.com/r/hs
>
>Archives (includes files) at http://www.biglist.com/lists/stella/archives/
>Unsub & more at http://stella.biglist.com
>


Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://stella.biglist.com

Current Thread