home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / DRIVERS / SRC / ptys.lzh / miscasm.a < prev    next >
Text File  |  1990-03-08  |  4KB  |  172 lines

  1. *        This software is copyright (C) 1989 by Reimer Mellin        *
  2. *                                                                    *
  3. *        Permission is granted to reproduce and distribute           *
  4. *        this package by any means so long as no fee is charged      *
  5. *        above a nominal handling fee and so long as this            *
  6. *        notice is always included in the copies.                    *
  7. *        Commerical use or incorporation into commercial software    *
  8. *        is prohibited without the written permission of the         *
  9. *        author.                                                     *
  10. *                                                                    *
  11. *        Other rights are reserved except as explicitly granted      *
  12. *        by written permission of the author.                        *
  13. *                Reimer Mellin                                       *
  14. *                                                                    *
  15. *                Sulenstr.8                                          *
  16. *                D-8000 Muenchen 71 (Federal Republic of Germany)    *
  17. *                                                                    *
  18. *           EMAIL:                                                   *
  19. *                mellin@lan.informatik.tu-muenchen.dbp.de            *
  20. *                ram@altger.UUCP                                     *
  21. *                ....!pyramid!tmpmbx!doitcr!ramsys!ram (home)        *
  22. *                                                                    *
  23. *
  24. * $Id: miscasm.a_v 1.2.1.1 89/09/04 13:13:33 ram Exp $
  25. *
  26. * $Log:    miscasm.a_v $
  27. * Revision 1.2.1.1  89/09/04  13:13:33  ram
  28. * added some comments
  29. * Revision 1.2  89/08/31  12:32:39  ram
  30. * copyright message added
  31. *
  32.  
  33.  use <iodev.a>
  34.  use ptydev.a
  35.  use defsfile
  36.  
  37.  psect miscasm,0,0,0,0,0
  38.  
  39. * Hilfs-Funktionen fuer Ptyman, da malloc() nicht verwendet werden kann
  40. *
  41. * _srqmem( size )
  42.  
  43. _srqmem:
  44.  move.l a2,-(sp)
  45.  
  46.  OS9 F$SRqMem
  47.  bcc.s _srqmem90
  48.  
  49.  move.l d1,errno(a6)
  50.  move.l (sp)+,a2
  51.  moveq.l #0,d0
  52.  rts
  53.  
  54. _srqmem90
  55.  move.l a2,d0
  56.  move.l (sp)+,a2
  57.  rts
  58.  
  59. * _srtmem(addr, size)
  60. _srtmem:
  61.  move.l a2,-(sp)
  62.  
  63.  move.l d0,a2
  64.  move.l d1,d0
  65.  OS9 F$SRtMem
  66.  bcc.s _srtmem90
  67.  
  68.  move.l d1,errno(a6)
  69.  
  70.  move.l (sp)+,a2
  71.  moveq.l #-1,d0
  72.  rts
  73.  
  74. _srtmem90
  75.  move.l (sp)+,a2
  76.  moveq.l #0,d0
  77.  rts
  78.  
  79. * wait for pid to finish I/O ( 0 --> free )
  80. iowait:
  81.     tst.w d0
  82.     beq.s io1
  83.     clr.l d1
  84.     os9 F$IOQu
  85.     move.l d1,d0
  86. io1
  87.     rts
  88.  
  89. * getctrlchar(ch) -- return control-char-index in d0
  90. getctrlchar:
  91.  tst.b d0
  92.  beq.s g1
  93.  cmp.b #32,d0
  94.  bge.s g1
  95.  lea PD_BSP(a6),a0  * start of ctl-char array
  96.  moveq.l #8,d1      * length
  97. g2
  98.  cmp.b (a0)+,d0
  99.  beq.s g3
  100.  
  101.  dbra d1,g2
  102. g1
  103.  clr.l d0
  104.  rts
  105. g3
  106.  neg d1             * compute index
  107.  add.w #9,d1
  108.  move.w d1,d0
  109.  rts
  110.  
  111. strcmp: 
  112.  movea.l d0,a1      * simple strcmp
  113.  movea.l d1,a0
  114.  moveq.l #0,d0 :2
  115.  move.l d0,d1
  116.  bra.s _6
  117. _4 tst.b (a1) :2
  118.  beq.s _3
  119. _9
  120. _7
  121. _6 cmpm.b (a0)+,(a1)+ :2
  122.  beq.s _4
  123. _5
  124.  subq.l #1,a0
  125.  subq.l #1,a1
  126.  move.b (a0),d0 :2
  127.  move.b (a1),d1 :2
  128.  sub.l d0,d1 :2
  129.  move.l d1,d0 :2
  130. _3 rts :2
  131.  
  132. memcpy:
  133.     move.l d0,a1        * simple memcpy
  134.     move.l d1,a0
  135.     move.l 4(a7),d0
  136. m1
  137.     move.b (a0)+,(a1)+
  138.     dbra d0,m1
  139.     rts
  140.  
  141. * initbuf
  142. initbuf:
  143.     move.l d0,a0            * dont change this Function !!!!!
  144.     lea in2(pc),a1
  145. in1
  146.     move.b (a1)+,d0
  147.     not.b d0
  148.     cmpi.b #$d,d0
  149.     beq.s in3
  150.     move.b d0,(a0)+
  151.     dbra d1,in1
  152. in3
  153.     move.b d0,(a0)+
  154.     dbra d1,in3
  155.     rts
  156. in2
  157.     dc.b ^' ',^'b',^'y',^' ',^'R',^'e',^'i',^'m'    * dont change !!
  158.     dc.b ^'e',^'r',^' ',^'A',^'.',^' ',^'M',^'e'
  159.     dc.b ^'l',^'l',^'i',^'n',^$d
  160.     align
  161.  
  162. kill:
  163.     tst.w d0
  164.     beq.s k1
  165.     os9 F$Send
  166. k1
  167.     rts
  168.  
  169.  ends
  170.