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 ;                                                      END HISTORY COMMENTS
 14 
 15 ;/* PROCEDURE FUNCTION (prime_rs232_out)
 16 ;
 17 ; Send a BYTE string of specified length to the RS232 port.  This has the effect
 18 ; of forcing transmit holding register empty interrupts when the character has
 19 ; been sent where the hard_int can send out the next character to be transmitted.
 20 ;*/
 21 
 22 ;/* : NOTES
 23 ;
 24 ;       mov  cx,length
 25 ;       mov  ES,DS
 26 ;       mov  ax,offset string
 27 ;       mov  si,ax
 28 ;       call prime_RS232_out
 29 ;
 30 ; Arguments:
 31 ;       cx    - length of byte string
 32 ;       ES    - Data segment of byte string pointer
 33 ;       si    - Address of byte string into the Data segment
 34 ;*/
 35 
 36 include dos.mac
 37 
 38 page
 39 ;******************************************************************************
 40 ;                        DATA
 41 ;******************************************************************************
 42 dseg
 43 
 44 ;--------- External Declarations
 45 
 46 extrn   send_buffer:byte
 47 extrn   send_buffer_end:word
 48 extrn   send_buffer_head:word
 49 extrn   send_buffer_tail:word
 50 extrn   send_buffer_char_count:word
 51 extrn   send_buffer_flag:word
 52 
 53 ;--------- Public Declarations
 54 
 55 public    prime_RS232_out
 56 
 57 endds
 58 
 59 page
 60 ;******************************************************************************
 61 ;                        MAIN
 62 ;******************************************************************************
 63 pseg
 64 
 65 ;--------- External Procedures
 66 extrn     RS232_out:near
 67 
 68 prime_RS232_out proc near
 69 
 70 ;/* pc:: Send a character in the send_buffer to RS232 port */
 71 
 72         push ax                       ;save used registers
 73         push cx
 74         push si
 75         mov  si, send_buffer_head     ;get buffer position of character to send
 76         mov  cx, send_buffer_char_count
 77                                       ;get number of characters in buffer
 78         cmp  cx, 0                    ;if buffer empty, do nothing
 79         je   empty
 80 
 81 ;   /* pc:: Call RS232_out to send the character to the RS232 port */
 82 
 83         mov  al, byte ptr ds:[si]     ;get next character to send from
 84                                       ;byte string
 85         push si                       ;save used registers
 86         push cx
 87         call RS232_out                ;RS232_out(al)
 88         pop  cx                       ;restore registers used
 89         pop  si
 90 
 91         call incptr                   ;after sending character,
 92                                       ;set up for next character
 93         mov  send_buffer_head, si     ;update pointer to next character to send
 94         mov  send_buffer_char_count, cx
 95                                       ;update number of characters to send
 96 
 97 ;   /* pc:: After character has been sent, exit routine */
 98 
 99 empty:
100         pop  si                       ;restore registers and return
101         pop  cx
102         pop  ax
103         ret
104 
105 prime_RS232_out endp
106 
107 ;/* : PROCEDURE FUNCTION (incptr)
108 ;
109 ;Increment the buffer pointer for the transmit characters.
110 ;*/
111 
112 incptr  proc near
113         dec  cx                    ;decrement count of characters in buffer
114         inc  si                    ;increment pointer to next character to send
115         cmp  si, offset send_buffer_end
116                                    ;if not at end of buffer, return
117         jne  IP100
118         mov  si, offset send_buffer
119                                    ;end of buffer, set pointer to buffer start
120 IP100:  ret
121 
122 incptr  endp
123         endps
124         end
125 ^Z