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 / BSTAM / UKAYPRO.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  4KB  |  130 lines

  1. ;
  2. ;    UKAYPRO.ASM ver 1.0 as of 9/18/82
  3. ;       by Dave Hardy
  4. ;       From Keith Petersen's UPMMI.ASM
  5. ;
  6. ;This is the user area for BSTAM version 4.3 as used with
  7. ; the serial port on a KAYPRO via an external modem.
  8. ;
  9. ;    If you wish to use other registers such as HL,BC,DE
  10. ;    (not including SP register), be sure to push BSTAM's
  11. ;    registers onto the stack and pop them back off before
  12. ;    returning to BSTAM.  There is ample room to push all
  13. ;    registers onto BSTAM's stack, plus room for 10 levels
  14. ;    of CALLs.
  15. ;
  16. ;    There are 300 bytes of user space available to you.
  17. ;
  18. ;    THE JUMP'S CODED AT THE BEGINNING OF THIS PROGRAM
  19. ;    CANNOT BE MOVED IN ANY WAY.
  20. ;
  21. ;  Define ports and masks
  22. KPSTAT    EQU    06H    ;KayPro UART Status port
  23. KPDATA    EQU    04H    ;KayPro UART Data port
  24. KPTBE    EQU    04H    ;KayPro Transmit Buffer Empty bit in UART
  25. KPRDA    EQU    01H    ;KayPro Received Data Available bit in UART
  26. ;
  27. ;  Define ASCII characters used
  28. CR    EQU    0DH    ;Carriage Return
  29. LF    EQU    0AH    ;Linefeed
  30. ;
  31. BEGIN:    ORG    103H
  32. ;
  33. INITIL    JMP    INITIU    ;UART/USART Initialization entry point
  34. INSPORT JMP    INSPRU    ;Status port read entry point
  35. ERRSET    JMP    ERRSTU    ;UART/USART error reset entry point
  36. INPORT    JMP    INPRTU    ;Read data port entry point
  37. OUTPORT JMP    OUTPRU    ;Write data port entry point
  38. ;
  39. ;
  40. ;    This is the UART/USART Initialization routine.
  41. ;    To be compatible with most BSTAM users, use the
  42. ;    following Initialization Guide Lines:
  43. ;    1. USE 1 STOP BIT    (OPTIONAL - 2)
  44. ;    2. USE 8 DATA BITS    (MUST)
  45. ;    3. USE 1 START BIT    (MUST)
  46. ;    4. USE 16X FOR CLOCK RATE    (MUST)
  47. ;    5. USE ASYNCHRONOUS MODE ONLY    (MUST)
  48. ;
  49. ;  NO INITIALIZATION IS DONE IN THIS VERSION OF UKAYPRO
  50. INITIU: CALL    SIGNON    ;Tell version number to user
  51.     RET        ;Return to BSTAM
  52. ;
  53. ;
  54. ;    This is the STATUS READ PORT routine.
  55. ;    When exiting this routine, BSTAM expects in register A
  56. ;    the following BITS to be set IF NEEDED:
  57. ;    1. 20 BIT SET IF FRAMING ERROR
  58. ;    2. 10 BIT SET IF OVERRUN ERROR
  59. ;    3. 08 BIT SET IF PARITY  ERROR
  60. ;    4. 04 BIT SET IF TRANSMITTER EMPTY (TEOC)
  61. ;    5. 02 BIT SET IF RECEIVER READY (DAV)
  62. ;    6. 01 BIT SET IF TRANSMITTER READY (TBMT)
  63. ;    7. DO NOT SET THE 80 BIT OR 40 BIT
  64. ;
  65. ;    Now get UART status for BSTAM.
  66. ;    In this case, we discard all error test bits
  67. INSPRU:    PUSH    B
  68.     MVI    C,0    ;Init all flags
  69.     IN    KPSTAT    ;Get Serial UART status
  70.     MOV    B,A    ;Save it in B
  71.     ANI    01H
  72.     CNZ    SETRDA    ;Set RDA bit
  73.     MOV    A,B
  74.     ANI    04H
  75.     CNZ    SETTBE
  76.     MOV    A,C    ;Get flags into A
  77.     POP    B
  78.     RET
  79. ;
  80. SETRDA    MVI    C,02H    ;Set RDA flag
  81.     RET
  82. ;
  83. SETTBE    MOV    A,C
  84.     ORI    05H    ;Set TBE and TEOC flags
  85.     MOV    C,A
  86.     RET
  87. ;
  88. ;    This is the ERROR RESET FOR UART/USART routine.
  89. ;    No resetting is done in this version
  90. ERRSTU: RET        ;Return to BSTAM
  91. ;
  92. ;
  93. ;    This is the READ DATA PORT routine.
  94. ;    Before this routine is entered, the 02 BIT of
  95. ;    the STATUS READ routine MUST HAVE BEEN SET.
  96. ;    Do NOT clear the 80 BIT from the DATA INPUT port.
  97. ;    Return with REGISTER A loaded with input data.
  98. ;
  99. INPRTU: IN    KPDATA    ;Get data from port
  100.     RET        ;Return to BSTAM
  101. ;
  102. ;
  103. ;    This is the WRITE DATA PORT routine.
  104. ;    Before this routine is entered, the 04 BIT and 01 BIT
  105. ;    of STATUS READ MUST BE SET.
  106. ;    Do NOT clear the 80 BIT from the data output port.
  107. ;    REGISTER A contains the output data.
  108. ;
  109. OUTPRU: OUT    KPDATA    ;Send data to remote CPU
  110.     RET        ;Return to BSTAM
  111. ;
  112. ;
  113. ;  The SIGN-ON routine called from the INIT routines.
  114. SIGNON:    PUSH    B
  115.     PUSH    D
  116.     PUSH    H
  117.     LXI    D,MESSGE
  118.     MVI    C,9
  119.     CALL    5         ;ANNOUNCE VERSION TO USER
  120.     POP    H
  121.     POP    D
  122.     POP    B
  123.     RET
  124. ;
  125. MESSGE: DB    CR,LF,CR,LF
  126.     DB    'KayPro serial port ver 1.0 - no initialization done,'
  127.     DB    CR,LF,'$'
  128. ;
  129.     END    BEGIN
  130.