home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ENTERPRS / CPM / SIGM / SIGMV800.ARK / M7-C1660.ASM < prev    next >
Assembly Source File  |  1986-02-01  |  15KB  |  653 lines

  1.     title    'M7-C1660 (MDM) C1660 and C1650 overlay for C128   31 Oct 85'
  2.  
  3.  
  4. ; M7-C1660.ASM -- Commodore 128 overlay file for MDM7xx.
  5. ;
  6. ; overlay setup by Von Ertwine for C128 using 1650 or 1660 modem
  7. ;    10/31/85
  8. ;
  9. ;    The default modem type (1650 or 1660) can be setected by
  10. ;    setting parmater at 15Ch (modem$type)
  11. ;
  12. ;
  13. ;    build new system by using to following:
  14. ;
  15. ;    MAC M7-C1670 $pz-s
  16. ;    MLOAD MDM7x0.com=MDM7x0.COM,M7-C1670.HEX
  17. ;
  18. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  19.  
  20.     page
  21.  
  22. $*MACRO        ; only show code produced by MAC not MACRO expansion
  23.  
  24.  
  25. ;
  26. eom        equ    00h        ; end of message
  27. bell        equ    07h        ; bell
  28. lf        equ    0Ah        ; linefeed
  29. cr        equ    0Dh        ; carriage return
  30. esc        equ    1Bh        ; escape
  31.  
  32. no        equ    0
  33. yes        equ    not(no)
  34.  
  35.     page
  36. ;
  37. ;    C128 info
  38. ;
  39. dev$no:        equ    6
  40. XxD$config:    equ    0fd4Eh
  41. ;        bit 7    0=no parity    1=parity
  42. ;        bit 6    0=mark/space    1=odd/even
  43. ;        bit 5    0=space/even    1=mark/odd
  44. ;        bit 1    0=1 stop bit    1=2 stop bits
  45. ;        bit 0    0=7 data bits    1=8 data bits
  46. RS232$status:    equ    XxD$config+1
  47. ;        bit 7    1=send data, 0=no data
  48. ;        bit 6    1=sending data now
  49. ;        bit 5    1=recv que active
  50. ;        bit 4    1=parity error
  51. ;        bit 3    1=framing error
  52. ;        bit 2    not used
  53. ;        bit 1    receiving data now
  54. ;        bit 0    data byte ready
  55. xmit$data:    equ    RS232$status+1
  56. recv$data:    equ    xmit$data+1
  57. ;
  58. MODRCVB:    EQU    01H        ; bit to test for receive
  59. MODRCVR:    EQU    01H        ; value when receive ready
  60. MODSNDB:    EQU    80H        ; bit to test for send
  61. MODSNDR:    EQU    00H        ; value when send ready        
  62.  
  63. data$port$a    equ    0DD00h
  64. ;        bit 2    TxD Data (output)
  65.  
  66. data$port$b    equ    data$port$a+1
  67. data$port$b$dir    equ    data$port$b+2
  68. ;        bit 7    Data Set Ready (input)
  69. ;        bit 6    Clear to Send (input)
  70. ;        bit 5    Place Phone On Hook (active low output)
  71. ;        bit 4    Carrier Detect (active low input)
  72. ;        bit 3    Ring Indicator (active low input)
  73. ;        bit 2    Data Terminal Ready (active hi output)
  74. ;        bit 1    Request to Send (active hi output)
  75. ;        bit 0    Received Data (input)
  76.  
  77.     page
  78. ;
  79. setb    macro    ?N,?R
  80.     db    0cbh,?N*8+?R+0C0h
  81.     endm
  82.  
  83. res    macro    ?N,?R
  84.     db    0cbh,?N*8+?R+80h
  85.     endm
  86.  
  87. bit    macro    ?N,?R
  88.     db    0cbh,?N*8+?R+40h
  89.     endm
  90.  
  91. exx    macro
  92.     db    0D9h
  93.     endm
  94.  
  95. @chk    macro    ?DD
  96.     if (?DD GT 7Fh) and (?DD LT 0FF80h)
  97.     'Displacement Error'
  98.     endif
  99.     endm
  100.  
  101. jr    macro    ?N
  102.     db    18h,?N-$-1
  103.     @chk    ?N-$
  104.     endm
  105.  
  106. jrz    macro    ?N
  107.     db    28h,?N-$-1
  108.     @chk    ?N-$
  109.     endm
  110.  
  111. jrnz    macro    ?N
  112.     db    20h,?N-$-1
  113.     @chk    ?N-$
  114.     endm
  115.  
  116. jrc    macro    ?N
  117.     db    38h,?N-$-1
  118.     @chk    ?N-$
  119.     endm
  120.  
  121. jrnc    macro    ?N
  122.     db    30h,?N-$-1
  123.     @chk    ?N-$
  124.     endm
  125.  
  126. inp    macro    ?R
  127.     db    0EDh,?R*8+40h
  128.     endm
  129.  
  130. outp    macro    ?R
  131.     db    0EDh,?R*8+41h
  132.     endm
  133.  
  134. cpir    macro
  135.     db    0edh,0b1h
  136.     endm
  137.  
  138.     page
  139.  
  140.         ORG    100H
  141.  
  142.         DS    3    ;(for  "JMP   START" instruction)
  143. ;
  144. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  145. SMARTMODEM:    DB    yes    ;yes=HAYES Smartmodem, no=non-PMMI    104H
  146. TOUCHPULSE:    DB    'P'    ;T=touch, P=pulse (Smartmodem-only)    105H
  147. CLOCK:        DB    17    ;clock speed in MHz x10, 25.5 MHz max.    106H
  148.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  149. MSPEED:        DB    1    ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  150.                 ;6=2400 7=4800 8=9600 9=19200 default
  151. BYTDLY:        DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    108H
  152.                 ;default time to send character in ter-
  153.                 ;minal mode file transfer for slow BBS.
  154. CRDLY:        DB    5    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  155.                 ;default time for extra wait after CRLF
  156.                 ;in terminal mode file transfer
  157. NOOFCOL:    DB    5    ;number of DIR columns shown        10AH
  158. SETUPTST:    DB    YES    ;yes=user-added Setup routine        10BH
  159. SCRNTEST:    DB    yes    ;Cursor control routine         10CH
  160. ACKNAK:        DB    YES    ;yes=resend a record after any non-ACK    10DH
  161.                 ;no=resend a record after a valid NAK
  162. BAKUPBYTE:    DB    no    ;yes=change any file same name to .BAK    10EH
  163. CRCDFLT:    DB    YES    ;yes=default to CRC checking        10FH
  164. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  165. CONVBKSP:    DB    no    ;yes=convert backspace to rub        111H
  166. TOGGLEBK:    DB    YES    ;yes=allow toggling of bksp to rub    112H
  167. ADDLF:        DB    YES    ;no=no LF after CR to send file in    113H
  168.                 ;terminal mode (added by remote echo)
  169. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  170. TRANLOGON:    DB    YES    ;yes=allow transmission of logon    115H
  171.                 ;write logon sequence at location LOGON
  172. SAVCCP:        DB    YES    ;yes=do not overwrite CCP        116H
  173. LOCONEXTCHR:    DB    no    ;yes=local command if EXTCHR precedes    117H
  174.                 ;no=external command if EXTCHR precedes
  175. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  176. LSTTST:        DB    no    ;yes=printer available on printer port    119H
  177. XOFFTST:    DB    YES    ;yes=check for XOFF from remote    while    11AH
  178.                 ;sending a file in terminal mode
  179. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  180.                 ;sending a file in terminal mode
  181. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  182. IGNORCTL:    DB    no    ;yes=CTL-chars above ^M not displayed    11DH
  183. EXTRA1:        DB    0    ;for future expansion            11EH
  184. EXTRA2:        DB    0    ;for future expansion            11FH
  185. BRKCHR:        DB    'V'-40H    ;^V(^@) = Send a 300 ms. break tone    120H
  186. NOCONNCT:    DB    'N'-40H    ;^N = Disconnect from the phone line    121H
  187. LOGCHR:        DB    'L'-40H    ;^L = Send logon            122H
  188. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            123H
  189. UNSAVE:        DB    'R'-40H    ;^R = Close input text buffer        124H
  190. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote        125H
  191. SAVECHR:    DB    'Y'-40H    ;^Y = Open input text buffer        126H
  192. EXTCHR:        DB    'O'-40H    ;^O(^^) = Send next character        127H
  193. ;
  194. ;
  195.         DS    2        ; used by PMMI                    128H
  196. IN$MODCTL1:                ; get the status bits        12AH
  197.     lda    on$hook$flag
  198.     ora    a
  199.     jz    read$status        ; return modem status if off hook
  200.     jmp    modem$ring$test        ; test modem? ringing
  201. ;
  202. ;
  203. ;
  204. OUT$MODDATP:                ;out modem data port        134H
  205.     push    psw
  206.     lda    on$hook$flag        ; 0FFh=on hook, 0=off hook
  207.     ora    a
  208.     jrz    modem$out$cont        ; send to modem if off hook
  209.     jmp    modem$cmd        ; modem command if on hook
  210.  
  211. IN$MODDATP:                ; in modem data port        13EH
  212.     lda    recv$data
  213.     push    h
  214.     lxi    h,RS232$status
  215.     jmp    in$moddtp$cont
  216.  
  217. ANI$MODRCVB:    ANI    MODRCVB    ! RET    ; bit to test for receive ready    148H
  218. CPI$MODRCVR:    CPI    MODRCVR ! RET    ; value of receive bit when rdy    14BH
  219. ANI$MODSNDB:    ANI    MODSNDB    ! RET    ; bit to test for send ready    14EH
  220. CPI$MODSNDR:    CPI    MODSNDR    ! RET    ; value of send bit when ready    151H
  221.  
  222. ;    PMMI Modem Vectors (not used by C128)
  223.         DS    6        ;                154H
  224.  
  225. OUT$MODCTL1:    ret            ; out modem control port     15AH
  226. on$hook$flag:    db    yes        ; yes=0FFh=on hook, no=00=off hook
  227. modem$type:    db    0ffh        ; 0ffh=1660(no DTR) 0feh=1660(DTR)
  228.                     ; 000h=1650            15CH
  229. OUT$MODCTL2:    ret  !  nop  !  nop    ; out modem status port        15DH
  230. LOGONPTR:    DW    LOGON        ; for user message.        160H
  231. jmp$dial    ds    3        ;                162H
  232. ;jmp$disconnect    ds    3        ;                165H
  233.         ret            ;                165H
  234. data$format:    db    1        ; number bits and parity
  235.                     ; 7 bits add 0, 8 bits add 1
  236.                     ; None=0, Odd=E0, Even=C0
  237.                     ; Mark=A0, Space=80
  238.         db    0        ; not used
  239. JMP$GOODBYE:    JMP    GOODBYE        ;                168H
  240. JMP$INITMOD:    JMP    INITMOD        ; go to user written routine    16BH
  241.         RET  !    NOP  !    NOP    ; (by-passes PMMI routine)    16EH
  242.         RET  !    NOP  !    NOP    ; (by-passes PMMI routine)    171H
  243.         RET  !    NOP  !    NOP    ; (by-passes PMMI routine)    174H
  244. JMP$SETUPR:    JMP    SETUPR        ;                177H
  245. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  246. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  247. JMP$BREAK:    JMP    SENDBRK        ;                180H
  248. ;
  249. ; Do not change the following six lines.
  250. ;
  251. JMP$ILPRT:    DS    3        ;                183H
  252. JMP$INBUF    DS    3        ;                186H
  253. JMP$INLNCOMP:    DS    3        ;                189H
  254. JMP$INMODEM    DS    3        ;                18CH
  255. JMP$NXTSCRN:    DS    3        ;                18FH
  256. JMP$TIMER:    DS    3        ;                192H
  257. ;
  258. ;
  259. ; Clear sequences -- CLREOS is clear to end of screen, CLRSCRN is clear
  260. ; entire screen.  Last entry must be 0.  Any other 0's act as NOP's.
  261. ;
  262. CLREOS:
  263.     CALL    JMP$ILPRT        ;                195H
  264.     DB    esc,'Y',eom
  265. SPCLMENU:
  266.     ret
  267.     db    0,0
  268. ;
  269. CLRSCRN:
  270.     CALL    JMP$ILPRT        ;                19EH
  271.     DB    'Z'-40h,eom
  272.     ret
  273. modem$out$cont:
  274.     jmp    modem$out        
  275. ;
  276. ;
  277. ;
  278. SYSVER:
  279.     CALL    JMP$ILPRT        ;                1A7H
  280.     db    'C-128 Ver. for 1650 or 1660',cr,lf,eom
  281.     RET
  282. ;.....
  283. ;
  284. ;
  285. ;-----------------------------------------------------------------------
  286. ;
  287. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  288. ;     end of your last routine should terminate by 0400H 
  289. ;
  290. ;-----------------------------------------------------------------------
  291. ;
  292. ;
  293. ;
  294. in$moddtp$cont:
  295.     res    0,m
  296.     pop    h
  297.     ret
  298. ;
  299. ;
  300. modem$out:
  301.     pop    psw
  302.     sta    xmit$data
  303.     push    h
  304.     lxi    h,RS232$status
  305.     setb    7,m
  306.     pop    h
  307.     ret
  308. ;
  309. ;
  310. ;
  311. modem$ring$test:
  312.     exx                ; save HLDEBC
  313.     lxi    b,data$port$b
  314.     inp    a
  315.     bit    3,a            ; ring indicator bit (active low)
  316.     jrnz    ring$cont
  317. recieved$carrier:
  318.     xri    20h            ; toggle on/off hook bit
  319.     outp    a            ; take off hook
  320.     mvi    a,no            ; set phone off hook
  321.     sta    on$hook$flag
  322.     lda    modem$type        ; LSB=0 if suports DTR
  323.     ani    1            ; =1 if no support
  324.     mov    l,a
  325. carrier$yet:
  326.     dcr    l            ; 1st time =0ffh if no support
  327.     jrz    ring$cont
  328.     inp    a
  329.     ani    10h            ; test if carrier present
  330.     jrz    ring$cont        ; 
  331.     call    delay            ; delay .16 seconds
  332.     jr    carrier$yet        ; will wait .16*255 = 40.8 seconds
  333. ;
  334. ;
  335. ;
  336. read$status:
  337.     lda    modem$type        ; LSB=0 if suports DTR
  338.     ani    1
  339.     jrnz    read$status$cont
  340.     exx                ; save HLDEBC
  341.     lxi    b,data$port$B
  342.     inp    a
  343.     ani    10h            ; test if carrier present
  344.     cnz    phone$on$hook        ; lost carrier, hang up the phone
  345. ring$cont:
  346.     exx                ; restore HLDEBC
  347. read$status$cont:
  348.     lda    RS232$status
  349.     ret
  350.  
  351. ;
  352. ;
  353. intersept$inmodem:
  354.     mvi    a,00
  355.     ora    a
  356. exit$intersept:
  357.     jz    0000            ; address filled in by INIT
  358.     exx                ; save HLDEBC
  359.     lxi    h,RS232$status
  360.     setb    0,m            ; set data advaliable flag
  361.     mvi    l,low(recv$data)    ; point to recv$data
  362.     mov    m,a
  363.     exx                ; restore HLDEBC
  364.     xra    a
  365.     sta    intersept$inmodem+1    ; set no intersept
  366.     stc                ; tell caller 'no input data'
  367.     ret
  368. ;
  369. ; This routine sends a 300 ms. break tone and sets DTR low for the same
  370. ; length of time to disconnect some modems such as the Bell 212A, etc.    
  371. ;
  372. GOODBYE:                  ; TURN OFF DTR
  373.     push    b
  374.     call    phone$on$hook        ; hang-up the phone
  375.     ani    not(6)            ; clear DTR bit
  376.     outp    a
  377.     call    sendbrk            ; send 300ms break
  378.     inp    a
  379.     ori    6
  380.     outp    a            ; set DTR
  381.     pop    b
  382.     ret
  383. ;
  384. ; This routine allows a 300 ms. break tone to be sent to reset some
  385. ; time-shar computers.
  386. ;
  387. SENDBRK: 
  388.     di
  389.     push    b
  390.     lxi    b,data$port$a
  391.     inp    a
  392.     ani    0FBh            ; send a break tone will be cleared
  393.     outp    a            ; ..when interrupts turned on
  394.     pop    b
  395.     mvi    a,30            ; WAIT FOR 300 MS.
  396.     jmp    delay            ; re-enables interrupts and returns
  397. ;
  398. ; Setup routine to allow changing modem speed with the SET command.
  399. ;
  400. SETUPR:
  401.     CALL    JMP$ILPRT
  402.     DB    'Modem (1650,1660) ',0
  403.     call    read$buffer
  404.     CALL    JMP$INLNCOMP        ; compare to  BAUDBUF+2
  405.     DB    '1650',0
  406.     mvi    l,0
  407.     jrnc    set$type        ; Cy=0 if match
  408.     CALL    JMP$INLNCOMP        ; compare to BAUDBUF+2 
  409.     DB    '1660',0
  410.     jrc    setupr
  411. test$carrier:
  412.     CALL    JMP$ILPRT
  413.     DB    'Support carrier detect (Y,N) ',eom
  414.     call    read$buffer
  415.     ldax    d
  416.     dcr    l            ; L=0FFh=1660 modem without
  417.     cpi    'N'
  418.     jrz    set$type        ; ..carrier detect
  419.     cpi    'Y'
  420.     jrnz    test$carrier
  421.     dcr    l            ; L=0FEh=1660 modem with
  422. set$type:                ; ..carrier detect
  423.     mov    a,l
  424.     sta    modem$type
  425.     lda    on$hook$flag        ; =FF if on hook
  426.     ora    a
  427.     rz                ; hang-up the phone (only if on hook)
  428. ;
  429. ;
  430. ;
  431. phone$on$hook:
  432.     mvi    a,yes
  433.     sta    on$hook$flag
  434.     lxi    b,data$port$b
  435.     lda    modem$type        ; 0fxh=1660, 000h=1650
  436.     ora    a
  437.     jrz    type$1650
  438. ;    
  439. type$1660:
  440.     inp    a
  441.     ori    20h            ; set, phone on hook (1660)
  442.     jr    on$hook$cont
  443. ;
  444. type$1650:
  445.     inp    a
  446.     ani    not(20h)        ; set, phone on hook (1650)
  447. on$hook$cont:
  448.     outp    a
  449.     ret
  450.  
  451. ;    
  452. ; C128 initialization -- set baudrate.
  453. ;
  454. INITMOD:
  455.     lda    data$format        ; set number bits and parity
  456.     sta    XxD$config
  457.  
  458.     mvi    e,3ch            ; offset to jmp devtbl
  459.     call    vector$1        ; rets HL=char device table start
  460.     lxi    d,dev$no*8+7        ; offset to RS232 baud rate
  461.     dad    d            ; point to RS232 baud rate byte
  462.     mvi    m,6            ; change baud rate to 300
  463.     mvi    c,dev$no        ; init RS232 baud rate
  464.     mvi    e,3fh            ; offset to jmp ?cinit (change
  465.     call    vector$1        ; ..the rate)
  466.  
  467.     lxi    b,data$port$b$dir
  468.     mvi    a,26h            ; set data dir to output
  469.     outp    a
  470.     call    phone$on$hook
  471.     ori    6            ; set DTR and CTS (active hi)
  472.     outp    a
  473.  
  474.     lhld    jmp$inmodem+1
  475.     shld    exit$intersept+1
  476.     lxi    h,intersept$inmodem
  477.     shld    jmp$inmodem+1
  478.     mvi    a,(RET)
  479.     sta    initmod
  480.     ret
  481.  
  482. vector$1:
  483.     lhld    01
  484.     mov    l,e
  485.     pchl
  486.  
  487.  
  488. ;
  489. ;
  490. ;
  491. read$buffer:
  492.     LXI    D,BAUDBUF        ; POINT TO INPUT BUFFER
  493.     CALL    JMP$INBUF
  494.     inx    d
  495.     inx    d
  496.     ret
  497. ;
  498. ;
  499. ;
  500. BAUDBUF:
  501.     DB    6,0
  502.     DS    6
  503. ;
  504. ;
  505. ;
  506. modem$cmd:
  507.     pop    psw
  508.     exx                ; save HLDEBC
  509. next$dial$state    equ    $+1
  510.     call    dial$state$A
  511.     exx                ; restore HLDEBC
  512.     ret
  513.  
  514. dial$state$A:
  515.     cpi    'A'
  516.     call    set$next$state$test
  517.     cpi    'T'
  518.     call    set$next$state$test
  519.     cpi    'D'
  520.     call    set$next$state$test
  521.     cpi    'P'
  522.     call    set$next$state$test
  523.  
  524. ; 'A' will be a space at this point "ATDP 1234567"
  525.     lxi    b,data$port$b
  526.     inp    a
  527.     xri    20h            ; take phone off the hook
  528.     outp    a            ; take phone off hook
  529.     mvi    a,200
  530.     call    delay            ; delay 2 seconds
  531.     call    set$next$state
  532.  
  533.     cpi    cr
  534.     jrz    done$dialing
  535.     cpi    ','
  536.     jrz    delay$1$sec
  537. not$comma:
  538.     sui    '0'
  539.     jrc    abort$dial
  540.     jrnz    not$10
  541.     mvi    a,10
  542. not$10:
  543.     cpi    10+1
  544.     jrnc    abort$dial
  545.     mov    d,a
  546. ;
  547. ;    dial number in D
  548. ;
  549. dial$digit:
  550.     lxi    b,data$port$b        ; point to CIA
  551.     di
  552.     inp    a            ; get phone off hook value
  553.     mov    e,a
  554. dial$digit$cont:
  555.     xri    20h            ; toggle dial port bit
  556.     outp    a            ; output phone on hook value
  557.     mvi    a,6
  558.     call    delay            ; delay 0.06 seconds
  559.     outp    e            ; phone back off hook
  560.     mvi    a,4
  561.     call    delay            ; delay 0.04 seconds
  562.     mov    a,e
  563.     dcr    d
  564.     jrnz    dial$digit$cont
  565. delay$1$sec:
  566.     mvi    a,100            ; delay 1 second
  567. ;
  568. ;    delay for the number of 0.01 seconds in A
  569. ;        20,455 T states per 10 mSecond
  570. ; 4+10+7ah+7ahl+4ahl+12ahl-5ah+4ah+12ah-5a+4a+12a-5+10+4+10=23ahl+18ah+11a+29
  571. ;    if H=19, L=46 then
  572. ;        # T states = 20455a+33
  573. delay:
  574.     di                ;4
  575.     push    h            ;10
  576. delay$more:
  577.     mvi    h,19            ;7ah
  578. outer$delay:
  579.     mvi    l,46            ;7ahl
  580. inter$delay:
  581.     dcr    l            ;4ahl
  582.     jrnz    inter$delay        ;12ah(l-1)+7ah = 12ahl-5ah
  583.     dcr    h            ;4ah
  584.     jrnz    outer$delay        ;12a(h-1)+7a = 12ah-5a
  585.  
  586.     dcr    a            ;4a
  587.     jrnz    delay$more        ;12(a-1)+7 = 12a-5
  588.     pop    h            ;10
  589.     ei                ;4
  590.     ret                ;10
  591. ;
  592. ;
  593. ;
  594. set$next$state$test:
  595.     jrz    set$next$state
  596.     pop    h
  597. set$start$state:
  598.     lxi    h,dial$state$A
  599.     push    h
  600. set$next$state:
  601.     pop    h
  602.     shld    next$dial$state
  603.     ret
  604. ;
  605. ;
  606. ;
  607. done$dialing:
  608.     lda    modem$type
  609.     ani    1            ; lsb=0 if it supports carrier detect
  610.     jrnz    send$C$responce
  611.     lxi    h,45000
  612. wait$carrier:
  613.     lxi    b,data$port$b
  614.     inp    a
  615.     ani    10h
  616.     jrz    send$C$responce
  617.     mvi    c,6            ; direct console I/O
  618.     mvi    e,0ffh            ; input data/status
  619.     push    h
  620.     call    5
  621.     pop    h
  622.     cpi    'X'-40h            ; test for ^X
  623.     jrz    abort$dial
  624.     dcx    h
  625.     mov    a,h
  626.     ora    l
  627.     jrnz    wait$carrier
  628. abort$dial:
  629.     mvi    a,'N'            ; send NO CARRIER to MDM7XX
  630.     db    21            ; LXI H,(MVI A,'C')
  631. send$C$responce:
  632.     mvi    a,'C'            ; send CONNECT message to MDM7XX
  633. send$responce:
  634.     lxi    h,on$hook$flag
  635.     mvi    m,no
  636. send$responce$error:
  637.     sta    intersept$inmodem+1
  638.     jr    set$start$state
  639.  
  640. ;
  641. ; You can put in a message at this location which can be called up with
  642. ; CTL-L if TRANLOGON has been set TRUE.  You can put in several lines if
  643. ; desired.  End with a 0.
  644. ;
  645. LOGON:        DB    'C128 running MDM7x0 under CP/M Plus',CR,LF,eom
  646. ;
  647. ;
  648. ;
  649. ; NOTE:  MUST TERMINATE PRIOR TO 0400H (with Smartmodem)
  650. ;
  651.       END
  652. ;
  653.