home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / utils / asmutl / asmlib.lbr / XYPRINT.AZM / XYPRINT.ASM
Encoding:
Assembly Source File  |  1991-06-25  |  1.8 KB  |  69 lines

  1. ;----------------------------------------------------------------
  2. ;         This is a module in the ASMLIB library
  3. ;
  4. ; This module will read a string which follows the return address
  5. ; and uses the first 2 bytes as a CURSOR address to print the
  6. ; string. This makes it easy to print strings at a screen
  7. ; location. 
  8. ;
  9. ; The second entry point will take the string --> by DE and use the two
  10. ; bytes at the start of it for a acreen address.
  11. ;
  12. ;            Written        R.C.H.          18/8/83
  13. ;            Last Update    R.C.H.        22/10/83
  14. ;----------------------------------------------------------------
  15. ;
  16.     name    'xyprint'
  17. ;
  18.     public    xyinline,xypstring
  19.     extrn    setxy,dispatch
  20.     maclib    z80
  21. ;
  22. xyinline:
  23.     xthl            ; HL -> string, old hl in stack
  24.     xchg            ; now DE --> string
  25.     call    setxy        ; set it up
  26.     xchg            ; now hl --> string start again
  27.     call    print
  28.     xthl            ; hl = original value, stack = return address
  29.     ret
  30. ;
  31. ;----------------------------------------------------------------
  32. ; Print the string --> by DE. Use the two bytes at the start of it
  33. ; as a screen address.
  34. ;----------------------------------------------------------------
  35. ;
  36. xypstring:
  37.     push    h
  38.     call    setxy            ; set up screen
  39.     xchg                ; now hl --> string start
  40.     call    print
  41.     xchg                ; Restore DE --> past end of string
  42.     pop    h
  43.     ret
  44. ;
  45. ;       ---- Utility to print s atring till a $. ----
  46. ; On return HL -> to next byte after the string (code maybe)
  47. print:
  48.     push    psw
  49.     inx    h
  50.     inx    h        ; skip over cursor address
  51. print2:
  52.     mov    a,m
  53.     inx    h        ; Point to next character
  54.     ora    a        ; null is allowed to end a string
  55.     jz    print3
  56.     cpi    '$'        ; End of string ?
  57.     jz    print3
  58.     call    dispatch
  59.     jr    print2
  60. print3:
  61.     pop    psw
  62.     ret
  63. ;
  64.     end
  65.  
  66.  
  67.  
  68.  
  69.