home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
genie-commodore-file-library
/
C64Telecom
/
DARKTERM4B.ARC
/
DT4.1670.PAL
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2019-04-13
|
4KB
|
197 lines
1000 REM * DARKTERM 4.0 (C) 1986 D.S.S.
1010 REM * 1670 MODEM MODULE SOURCE
1020 REM *
1030 OPEN2,8,1,"@0:DT4.MODEM 1670"
1040 SYS700
1050 .OPT O2
1060 ;
1070 CHKIN =$FFC6 ; KERNAL EQUATES
1080 CHKOUT =$FFC9
1090 CHRIN =$FFCF
1100 CHROUT =$FFD2
1110 CLRCHN =$FFCC
1120 CLOSE =$FFC3
1130 OPEN =$FFC0
1140 SETLFS =$FFBA
1150 SETNAM =$FFBD
1160 GETIN =$FFE4
1170 READST =$FFB7
1180 PLOT =$FFF0
1190 ;
1200 TEXT =18 ; WE'LL USE THIS FOR PTR
1210 ST =120 ; USE TOP OF INPUT BUFFER
1220 ;
1230 DDELAY =878 ; SETUP EQUATES
1240 CDELAY =880
1250 HDELAY =881
1260 ;
1270 MILLI =$090C ; ACCESS ROUTINES
1280 TIWAIT =$090F
1290 ;
1300 *=$4600 ; START HERE
1310 JMP AUTODIAL
1320 JMP AANSWER
1330 JMP ONLINE ; PICK UP
1340 JMP OFFLINE ; HANG UP
1350 ;
1360 ; * NOTE PULSE DIAL DELAY OF
1370 ; * OF ZERO TONE DIALS, NON-ZERO
1380 ; * WILL PULSE DIAL
1390 ;
1400 AUTODIAL STX TEXT ; SAVE ADDRESS
1410 STY TEXT+1 ; OF DIAL TEXT STRING
1420 JSR RETURN ; SEND COUPLE RETURNS
1430 LDA HDELAY ; WAIT HDELAY SECONDS
1440 JSR WAIT
1450 LDX #5
1460 JSR CHKOUT ; GET READY TO DIAL
1470 LDA #"A" ; SEND AT FIRST
1480 JSR CHROUT
1490 JSR HOLD
1500 LDA #"T"
1510 JSR CHROUT
1520 JSR HOLD
1530 LDA #"D"
1540 JSR CHROUT
1550 JSR HOLD
1560 LDA DDELAY ; CHECK PULSE OR TONE
1570 BNE PDIAL
1580 LDA #"T" ; TONE
1590 .BYT $2C
1600 PDIAL LDA #"P" ; PULSE
1610 JSR CHROUT
1620 JSR HOLD
1630 LDY #0 ; INDEX TO START
1640 AUTO1 LDA (TEXT),Y ; GET STRING
1650 CMP #32 ; SKIP SPACES
1660 BEQ NEXT
1670 AND #127 ; MASK FOR ASCII UPCASE
1680 JSR CHROUT ; SEND CHARACTER
1690 JSR HOLD ; AND WAIT
1700 NEXT INY
1710 CPY #18 ; DONE ALL 18 CHARS
1720 BNE AUTO1 ; NO, (null) BACK
1730 LDA #13 ; SEND RETURN
1740 JSR CHROUT
1750 JSR HOLD
1760 JSR CLRCHN
1770 LDA CDELAY ; WAIT OUT THE DELAY
1780 JSR WAIT
1790 JSR RETURN ; SEND COUPLE RETURNS
1800 LDA 56577 ; HAVE A CARRIER
1810 AND #16
1820 BEQ AUTO4 ; YES, SIGNAL IT
1830 SEC ; NO, SET ZERO FLAG TRUE
1840 LDA #0 ; AND SET CARRY (NOT ABORT)
1850 RTS
1860 AUTO4 SEC ; HAVE CARRIER, SET
1870 LDA #1 ; ZERO FALSE
1880 RTS ; EXIT
1890 ABORT LDA 145 ; CHECK STOP KEY
1900 CMP #$7F
1910 BNE ABO1 ; NO, (null) BACK
1920 ABO0 PLA ; PULL RETURN ADDRESS
1930 PLA
1940 CLC ; CLEAR THE CARRY
1950 ABO1 RTS ; AND EXIT TO TERM
1960 WAIT TAX ; 1 SECOND COUNTER
1970 W0 LDA #0
1980 STA 160
1990 STA 161
2000 STA 162
2010 W1 LDA 145 ; CHECK FOR ABORT
2020 CMP #$7F ; DURING THE WAIT
2030 BEQ ABO0
2040 LDA 162
2050 CMP #60
2060 BCC W1
2070 DEX
2080 BMI W2
2090 BNE W0
2100 W2 RTS
2110 OFFLINE LDA #70 ; WAIT >1 SECOND
2120 JSR TIWAIT
2130 LDX #5
2140 JSR CHKOUT ; SEND "+++" SEQUENCE
2150 LDA #"+"
2160 JSR CHROUT
2170 JSR CHROUT
2180 JSR CHROUT ; 3 TIMES
2190 JSR CLRCHN
2200 LDA #70 ; WAIT ANOTHER >1 SEC
2210 JMP TIWAIT ; AND EXIT
2220 ;
2230 ; * ON LINE - SEND ATA COMMAND
2240 ;
2250 ONLINE JSR SMART
2260 .ASC "ATA" ; DO IT
2270 .BYT 13,0
2280 RTS ; EXIT
2290 ;
2300 ; * ANSWER ROUTINE
2310 ; (MAKE SURE PHONE IS ON-HOOK)
2320 ;
2330 AANSWER JSR SMART
2340 .ASC "AT S0=1" ; RINGS TO ONE
2350 .BYT 13,0
2360 ANS1 LDA 56577 ; WE'LL CHECK
2370 AND #16 ; CARRIER BIT
2380 BEQ ANS2
2390 LDA 145 ; CHECK STOP KEY
2400 CMP #$7F
2410 BNE ANS1 ; NO
2420 CLC
2430 RTS ; ABORT
2440 ANS2 SEC ; CARRIER DETECTED
2450 RTS
2460 ;
2470 ; * SEND SMART COMMAND
2480 ;
2490 SMART LDA 56577
2500 AND #16 ; MAKE SURE NO CARRIER
2510 BNE SM1
2520 JSR OFFLINE ; HANG UP
2530 JMP SMART ; AND (null) BACK
2540 SM1 PLA
2550 STA ST ; SAVE START ADDR
2560 PLA
2570 STA ST+1
2580 LDX #5
2590 JSR CHKOUT
2600 LDA #40 ; WAIT .5 SEC
2610 JSR TIWAIT
2620 SM2 INC ST
2630 BNE SM3
2640 INC ST+1
2650 SM3 LDY #0
2660 JSR HOLD ; IDLE RS232
2670 LDA (ST),Y
2680 BEQ SM4
2690 JSR CHROUT
2700 JMP SM2 ; CONTINUE
2710 SM4 JSR CLRCHN
2720 LDA #40 ; WAIT .5 SEC AGAIN
2730 JSR TIWAIT
2740 LDA ST+1
2750 PHA
2760 LDA ST
2770 PHA
2780 RTS ; AND EXIT
2790 ;
2800 ; * IDLE RS-232 TRANSMIT BUFFER
2810 ;
2820 HOLD LDA $2A1
2830 LSR
2840 BCS HOLD
2850 RTS
2860 ;
2870 RETURN LDX #5
2880 JSR CHKOUT
2890 LDA #13
2900 JSR CHROUT
2910 JSR HOLD
2920 LDA #13
2930 JSR CHROUT
2940 JSR HOLD
2950 JMP CLRCHN