1 ; ***********************************************************
  2 ; *                                                         *
  3 ; * Copyright, (C) Honeywell Bull Inc., 1987                *
  4 ; *                                                         *
  5 ; * Copyright, (C) Honeywell Information Systems Inc., 1986 *
  6 ; *                                                         *
  7 ; ***********************************************************
  8 
  9 ; HISTORY COMMENTS:
 10 ;  1) change(86-01-01,McGinn), approve(87-07-13,MCR7580),
 11 ;     audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
 12 ;     Created.
 13 ;  2) change(86-04-29,Westcott), approve(87-07-13,MCR7580),
 14 ;     audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
 15 ;     Support for circular buffers.
 16 ;                                                      END HISTORY COMMENTS
 17 
 18 ;/* : PROCEDURE FUNCTION (send_terminal_data)
 19 ;
 20 ;Send a BYTE string of specified length to the RS232 port while ignoring
 21 ;protocol procedures.
 22 ;*/
 23 
 24 ;/* : NOTES
 25 ;
 26 ;Syntax:
 27 ;          mov  cx,length
 28 ;          mov  ES,DS
 29 ;          mov  ax,offset string
 30 ;          mov  si,ax
 31 ;          call send_terminal_data
 32 ;
 33 ;Arguments:
 34 ;          cx    - length of byte string
 35 ;          ES    - Data segment of byte string pointer
 36 ;          si    - Address of byte string into the Data segment
 37 ;
 38 ; Returns: ax = 0, if successful
 39 ;          ax = 1, if not successful (buffer full)
 40 ;*/
 41 
 42 include dos.mac
 43 include mowsdefs.mac
 44 include ws_buf.mac
 45 page
 46 ;******************************************************************************
 47 ;                                       DATA
 48 ;******************************************************************************
 49 dseg
 50 
 51 ;--------- External Declarations
 52 extrn   send_buffer:word
 53 extrn   transmit_active:word
 54 
 55 ;--------- Public Declarations
 56 public    send_terminal_data
 57 
 58 endds
 59 
 60 page
 61 ;******************************************************************************
 62 ;                                       MAIN
 63 ;******************************************************************************
 64 pseg
 65 
 66 ;--------- External Procedures
 67 extrn     RS232_OUT:near
 68 
 69 send_terminal_data proc near
 70 
 71 ;/* : return if not enough room for message in send buffer
 72 
 73         len_buf send_buffer
 74         cmp     ax,cx                  ; ax = room left, cx = amount to send
 75         ja      next_out               ; if room
 76         mov     ax,1                   ; if no room in buffer
 77         ret                            ; if no room in send buffer
 78 
 79 ;/* : Stuff characters to send to RS232 port in a buffer */
 80 
 81 next_out:
 82         mov     al, byte ptr es:[si]    ;get next character to send from
 83                                         ;byte string
 84         put_buf send_buffer             ;RS232_out(al)
 85         inc     si
 86 
 87 
 88         loopne  next_out                ;loop until character count = 0
 89 
 90 ;/* : If (transmit not active) call prime_RS232_out() */
 91 
 92         cmp     transmit_active,0
 93         jnz     noprime                 ;if transmit interrupt will pick up new data
 94         inc     transmit_active
 95 
 96 ;/* : Call RS232_out to send the character to the RS232 port */
 97 
 98         get_buf send_buffer
 99         jnc     noprime                 ; if send buffer empty
100         call    RS232_out               ;RS232_out(al)
101 
102 noprime:
103         xor     ax,ax                   ;show send successful
104         ret
105 
106 send_terminal_data endp
107         endps
108         end
109 ^Z