;
;===================================================
;
;               EIGHT NUMBER
;             TELEPHONE DIALER
;
;                  6/2/92
;
;===================================================
; DIALER.ASM ---------------- is a program
; that stores 8 preselected telephone numbers
; inside EPROM memory. When selected by the
; grounding of any PORT1 pin, pulses out
; the chosen number with a normally closed
; 5V relay (driven by a 2N4402 transistor) connected
; to PORT3.2. Relay contacts are connected IN
; SERIES with either the RED or GREEN wires
; of an incoming telephone line.
;
; Dialer.Asm was designed around Suncoast Technologies'
; inexpensive 8031/51 based Single Board Computer.
; The 70691C can be purchased Assembled/Tested for
; $38.00 Or in kit form for only $27.00 (plus $3.00
; to cover the cost of US Priority Mail).
;
;              Suncoast Technologies
;                 P.O. Box 5835
;           Spring Hill, Florida 34606
;            Voice/Fax (904) 596-7599
;
;            VISA/MASTERCARD Accepted
;
; Use the A51 program to assembly the Dialer.Asm
; program. Type "A51 Dialer" <Enter>. Dialer.Obj
; will be created. Then take this .OBJ file and 
; further convert it to .BIN using HEXBIN.COM
; Type "Hexbin Dialer.Obj" <Enter>. Dialer.Bin will
; be created. Take this .BIN file and "Burn" it into
; a standard 2764 EPROM. Place the now programmed
; 2764 EPROM into the IC3 location on the 70691C
; Single Board Computer. Install the relay, spring
; return switches ans 2N4402 Xsistor. Apply power.
; Short and PORT1 pin to ground; relay will Pulse
; Out the pre-programmed telephone number.
;
; --------------------------------------------------
;
       .ORG     h'0000
       .EQU     ESC,h'1B
        MOV     PSW,#h'0
        MOV     SCON,#h'5A
        MOV     TMOD,#h'10
        MOV     TCON,#h'54
        SETB    TR1
START:  CLR     A
        MOV     P1,#d'255
        SETB    P3.2
        SETB    P3.3
LP1:    MOV     A,P1
        CJNE    A,#d'255,HOLD
        SJMP    LP1
HOLD:   MOV     R5,#d'50
        LCALL   DELAY
AA:     CJNE    A,#d'254,BB
        LJMP    DIAL_1
BB:     CJNE    A,#d'253,CC
        LJMP    DIAL_2
CC:     CJNE    A,#d'251,DD
        LJMP    DIAL_3
DD:     CJNE    A,#d'247,EE
        LJMP    DIAL_4
EE:     CJNE    A,#d'239,FF
        LJMP    DIAL_5
FF:     CJNE    A,#d'223,GG
        LJMP    DIAL_6
GG:     CJNE    A,#d'191,HH
        LJMP    DIAL_7
HH:     CJNE    A,#d'127,II
        LJMP    DIAL_8
II:     LJMP    START
;
DIAL_1: LCALL   XSTRING
;
; Place first tel. # in line JJ
;
; Format   "x-xxx-xxx-xxxx   OR
;             "xxx-xxxx"
;
JJ:     .DB     "1-800-562-5725"
        .DB     ESC
        LJMP    START
DIAL_2: LCALL   XSTRING
;
; Place second # in line KK
;
KK:     .DB     "1-714-259-7733"
        .DB     ESC
        LJMP    START
DIAL_3: LCALL   XSTRING
;
; Place third # in line LL
;
LL:     .DB     "1-214-271-5546"
        .DB     ESC
        LJMP    START
DIAL_4: LCALL   XSTRING
; Place fourth # in line MM
;
MM:     .DB     "596-8830"
        .DB     ESC
        LCALL   START
DIAL_5: LCALL   XSTRING
;
; Place fifth # in line NN:
;
NN:     .DB     "1-313-744-1330"
        .DB     ESC
        LCALL   START
DIAL_6: LCALL   XSTRING
;
; Place sixth # in line PP
;
PP:     .DB     "1-800-344-4539"
        .DB     ESC
        LCALL   START
DIAL_7: LCALL   XSTRING
;
; Place seventh # in line QQ
;
QQ:     .DB     "1-800-826-5432"
        .DB     ESC
        LCALL   START
DIAL_8: LCALL   XSTRING
;
; Place eight # in line SS
;
SS:     .DB     "596-6632"
        .DB     ESC
        LCALL   START
;
;     Read Each Number
;
XSTRING:
        CLR     P3.3
        POP     DPH
        POP     DPL
XSTR_1: CLR     A
        MOVC    A,@A+DPTR
XSTR_2: LJMP    CONVERT
;
;   Pulse out number
;
DIAL:   CLR     P3.2
        MOV     R5,#d'2
        LCALL   DELAY
        SETB    P3.2
        MOV     R5,#d'2
        LCALL   DELAY
        DJNZ    R0,DIAL
        MOV     R5,#d'15
        LCALL   DELAY
NEXT:   INC     DPTR
        CLR     A
        MOVC    A,@A+DPTR
        CJNE    A,#ESC,XSTR_2
        MOV     A,#1
        JMP     @A+DPTR
;
;  Jump to read next digit
;
CONVERT:
;
; Convert Port1 ASCII character
; to decimal number & stroe in R0
;
        CJNE    A,#'-',DIGIT_1
        LJMP    NEXT
DIGIT_1:
        CJNE    A,#'1',DIGIT_2
        MOV     R0,#d'1
DIGIT_2:
        CJNE    A,#'2',DIGIT_3
        MOV     R0,#d'2
DIGIT_3:
        CJNE    A,#'3',DIGIT_4
        MOV     R0,#d'3
DIGIT_4:
        CJNE    A,#'4',DIGIT_5
        MOV     R0,#d'4
DIGIT_5:
        CJNE    A,#'5',DIGIT_6
        MOV     R0,#d'5
DIGIT_6:
        CJNE    A,#'6',DIGIT_7
        MOV     R0,#d'6
DIGIT_7:
        CJNE    A,#'7',DIGIT_8
        MOV     R0,#d'7
DIGIT_8:
        CJNE    A,#'8',DIGIT_9
        MOV     R0,#d'8
DIGIT_9:
        CJNE    A,#'9',DIGIT_0
        MOV     R0,#d'9
DIGIT_0:
        CJNE    A,#'0',RETURN
        MOV     R0,#d'10
RETURN: LJMP    DIAL

END:    SJMP    END
;
; Delay loop for Pulse Train
;        duration
;
DELAY:  NOP
LOOP1:  DJNZ    R5,LOOP2
        RET
LOOP2:  MOV     R6,#d'240
LOOP3:  MOV     R7,#d'90
        DJNZ    R7,*
        DJNZ    R6,LOOP3
        LJMP    LOOP1
       .END 
