1 " ***********************************************************
 2 " *                                                         *
 3 " * Copyright, (C) Honeywell Information Systems Inc., 1982 *
 4 " *                                                         *
 5 " * Copyright (c) 1972 by Massachusetts Institute of        *
 6 " * Technology and Honeywell Information Systems, Inc.      *
 7 " *                                                         *
 8 " ***********************************************************
 9 
10 "fast_put: proc(iocb_ptr,buff_ptr,buff_len,code);
11           name      fast_put
12           segdef    fast_put
13 fast_put: epp1      pr0|2,*             pr1 gets addr of first arg
14           epp1      pr1|0,*             pr1->iocb
15           epp1      pr1|open_data_ptr,* pr1->cb_uns_file
16 
17 "len=max(buff_len,0);
18           ldq       pr0|6,*             q gets arg2
19           tpl       2,ic                done if buff_len is > 0
20           ldq       0,dl                else set len to zero
21 
22 "cb_uns_file.write_pos=cb_uns_file.write_pos+len;
23           lda       pr1|write_pos       save old value of write pos
24           sta       pr0|8,*             use last arg for temp
25           asq       pr1|write_pos       advance write position
26 
27 "if write_pos<=cb_uns_file.write_limit then do;
28           lda       pr1|write_pos       a gets new write pos
29           cmpa      pr1|write_limit     write_pos::write_limit
30           tpnz      slow_put            exception--make external call
31 
32      "record_write=buffer;
33           epp2      pr0|4,*             pr2 gets addr of buff_ptr arg
34           epp2      pr2|0,*             pr2->buffer
35           lda       pr0|8,*             get saved write position
36           epp3      pr1|seg_ptr,*       pr3->segment base
37           mlr       (pr,rl),(pr,rl,al),fill(040)  copy buffer into the file
38           desc9a    pr2|0,ql            output buffer descrip
39           desc9a    pr3|-1(3),ql        file position descrip
40 
41      "code=0. return, end;
42           stz       pr0|8,*             arg4<--0
43           short_return                  done with put_chars operation
44 
45 "write_pos=write_pos-len;
46 slow_put: lda       pr0|8,*             a<--saved write position
47           sta       pr1|write_pos       restores write pos to former value
48 
49 "call open_uns_file$put_chars_uns_file(iocb_ptr,buff_ptr,buff_len,code);
50           fld       4*2048,dl           set up arg count for external call
51           callsp    <open_uns_file>|[put_chars_uns_file] handles exceptional cases
52           short_return
53 
54 "declarations:
55           equ       open_data_ptr,18    in iocb
56           equ       write_pos,10        in cb_uns_file
57           equ       write_limit,2            "
58           equ       seg_ptr,0                "
59           end