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 / CPM / MODEMS / MODEM / UBPMMI.AQM / UBPMMI.ASM
Assembly Source File  |  2000-06-30  |  5KB  |  170 lines

  1. ;    UBPMMI.ASM ver 1.1 as of 3/24/81
  2. ;       by Keith Petersen, W8SDZ
  3. ;
  4. ;This is the user area for BSTMS version 1.2
  5. ;for use with a PMMI MM-103 modem.
  6. ;
  7. ;If you wish to use other registers such as HL,BC,DE
  8. ;(not including  SP  register) be sure to push BSTMS'S
  9. ;registers on to stack and pop them back off before
  10. ;returning to BSTMS.  There is ample room to push all
  11. ;registers onto BSTMS's stack, plus room for 10 levels
  12. ;of calls.
  13. ;
  14. ;There are 300 bytes of user space available to you.
  15. ;
  16. ;The jumps coded at the beginning of this program
  17. ;cannot be moved in any way.
  18. ;
  19. ;Define ports
  20. ;
  21. PMCTL1    EQU    0C0H    ;PMMI UART STATUS PORT
  22. PMDATA    EQU    PMCTL1+1 ;PMMI UART DATA PORT
  23. PMMDMS    EQU    PMCTL1+2 ;PMMI MODEM CHIP STATUS PORT
  24. PMCTL2    EQU    PMCTL1+3 ;PMMI MODEM CHIP CONTROL PORT
  25. ;
  26. ;Conditional assembly switch
  27. ;
  28. FASTCLK    EQU    1    ;0 = 2 MHZ, 1 = 4 MHZ SYSTEM CLOCK
  29. ;
  30. ;Define ASCII characters used
  31. ;
  32. CR    EQU    0DH    ;CARRIAGE RETURN
  33. LF    EQU    0AH    ;LINE FEED
  34. ;
  35. BEGIN:    ORG    103H
  36. ;
  37. INITIL    JMP    INITIU    ;UART/USART INITIALIZATION ENTRY POINT
  38. INSPORT    JMP    INSPRU    ;STATUS PORT READ ENTRY POINT
  39. ERRSET    JMP    ERRSTU    ;UART/USART ERROR RESET ENTRY POINT
  40. INPORT    JMP    INPRTU    ;READ DATA PORT ENTRY POINT
  41. OUTPORT    JMP    OUTPRU    ;WRITE DATA PORT ENTRY POINT
  42. ;
  43. ;
  44. ;This is the UART/USART initialization routine.
  45. ;To be compatible with most BSTMS users use following
  46. ;initialization guide lines:
  47. ;    1. Use 1 stop bit        (optional - 2)
  48. ;    2. Use 8 data bits        (must)
  49. ;    3. Use 1 start bit        (must)
  50. ;    4. Use 16X for clock rate     (must)
  51. ;    5. Use asynchronous mode only    (must)
  52. ;
  53. ;We will not initialize the PMMI modem.  That can be done
  54. ;with other programs like MODEM or DIAL.
  55. ;
  56. INITIU:    CALL    SIGNON    ;TELL USER WHAT'S IMPLEMENTED
  57.     IN    PMDATA    ;CLEAR INPUT PORT
  58.     IN    PMDATA    ;AGAIN TO MAKE SURE
  59.     RET        ;RETURN TO BSTMS
  60. ;
  61. ;This is the status read port routine.
  62. ;When exiting this routine BSTMS expects in register A
  63. ;the following bits to be set if needed:
  64. ;    1. 20 bit set if framing error
  65. ;    2. 10 bit set if overrun error
  66. ;    3. 08 bit set if parity  error
  67. ;    4. 04 bit set if transmitter empty (TEOC)
  68. ;    5. 02 bit set if receiver ready (DAV)
  69. ;    6. 01 bit set if transmitter ready (TBMT)
  70. ;    7. Do not set the 80 bit or 40 bit
  71. ;
  72. ;Before we do the UART status check we will check
  73. ;to see if carrier is lost.
  74. ;
  75. INSPRU:    PUSH    B    ;SAVE REGISTERS USED
  76.     PUSH    D
  77. ;
  78.     IF    NOT FASTCLK ;FOR 2MHZ SYSTEM CLOCK
  79.     MVI    B,15    ;WAIT UP TO 15 SECONDS
  80.     ENDIF
  81. ;
  82.     IF    FASTCLK    ;FOR 4MHZ SYSTEM CLOCK
  83.     MVI    B,30    ;WAIT UP TO 15 SECONDS
  84.     ENDIF
  85. ;
  86. ;One second time delay routine. Enter with desired
  87. ;number of seconds in B register.
  88. ;
  89. ONESEC:    LXI    D,50000 ;VALUE FOR 2 MHZ CLOCK
  90. ;
  91. TLOOP:    IN    PMMDMS    ;GET MODEM CHIP STATUS
  92.     ANI    04H    ;GET CTS (CARRIER DETECT) BIT
  93. TLPAT:    JZ    CARROK    ;CARRIER NOT LOST, EXIT AND RETURN
  94.     DCR    E    ;DECREMENT TIME DELAY VALUE
  95.     JNZ    TLOOP    ;NOT DONE, DO ANOTHER LOOP
  96.     DCR    D    ;DECREMENT TIME DELAY VALUE
  97.     JNZ    TLOOP    ;NOT DONE, DO ANOTHER LOOP
  98.     DCR    B    ;DECREMENT NUMBER OF SECONDS
  99.     JNZ    ONESEC    ;NOT DONE, DO ANOTHER ONE SEC DELAY
  100. ;
  101. ;If we get to here, we have lost carrier for 15 seconds
  102. ;
  103.     XRA    A
  104.     OUT    PMCTL1    ;CAUSE MODEM TO...
  105.     OUT    PMCTL2    ;...HANG UP
  106.     LXI    D,LSTMSG ;POINT TO MESSAGE
  107.     MVI    C,9
  108.     CALL    5    ;PRINT IT
  109.     MVI    A,(JMP)    ;GET OPCODE FOR JMP
  110.     STA    TLPAT    ;SET BYPASS OF CARRIER CHECK
  111.     IN    PMDATA    ;CLEAR INPUT PORT
  112.     IN    PMDATA    ;AGAIN TO MAKE SURE
  113.     JMP    CARROK    ;EXIT
  114. ;
  115. LSTMSG:    DB    CR,LF,'    ++CARRIER LOST++'
  116.     DB    CR,LF,'The modem is now DISCONNECTED'
  117.     DB    CR,LF,'$'
  118. ;
  119. ;Carrier is not lost
  120. ;
  121. CARROK:    POP    D    ;RESTORE DE REGS
  122.     POP    B
  123. ;
  124. ;Get UART status for BSTMS.  In this case we discard all error
  125. ;test bits because the PMMI modem has no way to reset the error
  126. ;flags once they are up, causing a continuous display of error
  127. ;messages in BSTMS.
  128. ;
  129.     IN    PMCTL1    ;GET PMMI UART STATUS
  130.     ANI    07H    ;STRIP ALL BUT TEOC, DAV AND TBMT BITS
  131.     RET
  132. ;
  133. ;This is the error reset for UART/USART routine.
  134. ;The PMMI modem has no way to reset the error flags,
  135. ;so we clear the input port and return.
  136. ;
  137. ERRSTU:    IN    PMDATA    ;CLEAR INPUT PORT
  138.     IN    PMDATA    ;AGAIN TO MAKE SURE
  139.     RET        ;RETURN TO BSTMS
  140. ;
  141. ;This is the read data port routine.
  142. ;
  143. INPRTU:    IN    PMDATA    ;GET DATA FROM PORT
  144.     ANI    7FH    ;STRIP PARITY BIT
  145.     RET        ;RETURN TO BSTMS
  146. ;
  147. ;This is the write data port routine.
  148. ;
  149. OUTPRU:    ANI    7FH    ;STRIP PARITY BIT
  150.     OUT    PMDATA    ;SEND DATA TO REMOTE CPU
  151.     RET        ;RETURN TO BSTMS
  152. ;
  153. SIGNON:    PUSH    B
  154.     PUSH    D
  155.     PUSH    H
  156.     LXI    D,MESSGE
  157.     MVI    C,9
  158.     CALL    5        ;ANNOUNCE VERSION TO USER
  159.     POP    H
  160.     POP    D
  161.     POP    B
  162.     RET
  163. ;
  164. MESSGE:    DB    CR,LF,CR,LF
  165.     DB    'PMMI Modem ver 1.1 - no initialization done,'
  166.     DB    ' tests for loss of carrier.'
  167.     DB    CR,LF,'$'
  168. ;
  169.     END
  170.