home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / asmutl / buffers.lbr / SBCALLOC.MAC < prev    next >
Encoding:
Text File  |  1987-01-15  |  512 b   |  24 lines

  1.     extrn    .salloc
  2. ;
  3. ; Allocate space for (bc) bytes on stack, rounding up to next 16
  4. ; at exit (sp)+2 points to allocated space.  See salloc.
  5. ; Exit with carry set if space requested too large (over 4k).
  6. ; Note that this does not check for stack overflow.
  7. ; a,f (sp)
  8. .sbcalloc::
  9.     xra    a
  10.     sub    c
  11.     mvi    a,010h;        i.e. 4k
  12.     sbb    b
  13.     rc;            too large a request
  14.     push    h
  15.     lxi    h,15
  16.     dad    b;        round up
  17.     dad    h
  18.     dad    h
  19.     dad    h
  20.     dad    h;        shift into h
  21.     mov    a,h
  22.     pop    h
  23.     jmp    .salloc
  24. ≈