[Coco] X10 Protocol for communicating with the CM11A

Bruce W. Calkins brucewcalkins at charter.net
Sun Sep 26 05:28:17 EDT 2010


I don't remember if I played with the Basic version or the OS-9 version, but 
I do remember sending individual codes that functioned.  I just never got to 
writing a program to use the codes, which has me thinking it was most 
probably the OS-9 version, since I never did get to writing OS-9 programs.


Bruce W.



----- Original Message ----- 
From: "Aaron Wolfe"


Here is the source to the OS9 utility on the disk Bruce sent me.
FWIW, it does make my older gray PnP controller's data light flash,
but doesn't seem to make anything happen on my outlets.  Could be my
coco 3 with 6309 is effecting the timing, could be my PnP controller
is shot, could be my outlets are DOA, could be this code only works on
the white PnP controller... no idea yet.

(slightly edited so it would assemble with mamou)

*
*
******************************
******************************
**                          **
** PLUG'N POWER CONTROLER   **
** MODULE FOR COCO OS-9     **
**    BY                    **
**    BRIAN HICKEY          **
**    [73125,770]           **
**    1600 PULLEN RD #9F    **
**    TALLAHASSEE ,FL 32303 **
**                          **
******************************
******************************
*
*        INSTRUCTIONS
*
* CALLING FORMAT IS PNP A 1 BRI 2
*
*   WHERE A=   HOUSE CODE (UPPER CASE A-P)
*         1=   UNIT # IN HEX (1-9,A-F) OR SET,CLEAR
*         BRI= COMMAND (ON,OFF,BRI,DIM)
*         2=   # OF STEPS TO BRI OR DIM
*
*   ALL PAREMETERS MUST BE UPPER CASE
*   WITH A SPACE BETWEEN EACH
*
*
 NAM PNP
 ttl blah

ifp1
 use   defsfile
endc

tylg     set   Prgrm+Objct
atrv     set   ReEnt+rev
rev      set   $00
edition  set   10

*
 MOD FINISH,NAME,tylg,atrv,START,SIZE
*
NAME FCS /PNP/
*
FLAG RMB 2
RCNTR RMB 1
 RMB 200
SIZE EQU .
*
START EQU *
 PSHS X,Y
 LDA #$03
 CLRB
 STD <FLAG
 PSHS Y
 LDA ,X++
 PSHS X
 LEAY COD1TBL,PCR
 LEAX LETABL,PCR
FIND1 CMPA ,X+
 BEQ OUT1
 LEAY 01,Y
 INCB
 CMPB #$0F
 BNE FIND1
 PULS X
 LBRA FMTERR
OUT1 LDA 0,Y
 STA <FLAG+1
 PULS X
 LDA ,X++
 CMPA #'S
 BNE CONT1
 LDA #$01
 PULS Y
 BRA DONE
CONT1 CMPA #'C
 BNE CONT2
 LDA #$00
 PULS Y
 BRA DONE
CONT2 PSHS X
 CLRB
 LEAY COD2TBL,PCR
 LEAX NUMTBL,PCR
FIND2 CMPA ,X+
 BEQ OUT2
 LEAY 01,Y
 INCB
 CMPB #$0F
 BNE FIND2
 PULS X
 BRA FMTERR
OUT2 LDA 0,Y
 ORA <FLAG+1
 STA <FLAG+1
 LBSR SENPKT
 LDX #$2000
DELAY LEAX -1,X
 BNE DELAY
 LDA <FLAG+1
 ANDA #$F0
 STA <FLAG+1
 PULS X
 LDD ,X
 CMPD #$4F4E
 BNE OFF
 LDA #$02
 PULS Y
 BRA DONE
OFF CMPD #$4F46
 BNE DIM
 LDA #$03
 PULS Y
 BRA DONE
DIM CMPD #$4449
 BNE BRIGHT
 LDA #$04
 BRA GETCTR
BRIGHT CMPD #$4252  BR
 BNE FMTERR
 LDA #$05
GETCTR PULS Y
 LDB -2,Y
 ANDB #$0F
 STB <FLAG
*
DONE ORA <FLAG+1
 STA <FLAG+1
 LDA #$40
 ORA <FLAG
 STA <FLAG
 LBSR SENPKT
 PULS X,Y
 CLRB
 OS9 F$EXIT
*
FMTERR PULS Y
 PULS X,Y
 LDB #230
 OS9 F$EXIT
*
LETABL FCC /ABCDEFGHIJKLMNOP/
COD1TBL FCB $60,$E0,$20,$A0,$10,$90
 FCB $50,$D0,$70,$F0,$30,$B0,$00,$80,$40,$C0
NUMTBL FCC /123456789ABCDEF/
COD2TBL FCB $06,$0E,$02,$0A,$01,$09
 FCB $05,$0D,$07,$0F,$03,$0B,$00,$08,$04,$0C
*
* THIS SECTION ADAPTED FROM
* "X10 PROTOCAL THEORY"
* BY A.B.TREVOR AND C.YAHN
* 6/83 RAINBOW P102
*
BSRSTA EQU $FF20
*
SENPKT LDD <FLAG
 ANDA #$3F
 STA <RCNTR
HEADER ORCC #$50
 BSR BURST
 BSR BURST
 BSR BURST
 BSR PAUSE
* SEND DATA
SEND LDA <FLAG+1
 LDX #8
 BSR BITFLD
* SEND UNIT/CMD FLG
SENF LDA <FLAG
 ROLA
 LDX #1
 BSR BITFLD
 ANDCC #$AF
 DEC <RCNTR
 BNE HEADER
 RTS
*
BSROFF FCB 0
BSRON FCB $FC
* TRANSMIT A BYTE
BITFLD ROLA
 BCS S1
 BSR PAUSE
 BSR BURST
 BRA BITDN
S1 BSR BURST
 BSR PAUSE
BITDN LEAX -1,X
 BNE BITFLD
 RTS
*
* SEND PAUSE
PAUSE LEAY BSROFF,PCR
 BRA BUR1
* SEND BURST
BURST LEAY BSRON,PCR
BUR1 PSHS A,X
BUR2 LDA BSRSTA
 BITA #1
 BEQ BUR2
 LDA #$34
BUR3 DECA
 BNE BUR3
 LDB #3
BUR4 LDA 0,Y
 STA BSRSTA
 LDA #$B2
BUR5 DECA
 BNE BUR5
 CLR BSRSTA
 DECB
 BEQ EXIT
BUR7 LDA #$F8
BUR8 NOP
 DECA
 BNE BUR8
 BRA BUR4
*
EXIT PULS X,A,PC
 EMOD
FINISH EQU *
 END




More information about the Coco mailing list