home *** CD-ROM | disk | FTP | other *** search
/ Dream 57 / Amiga_Dream_57.iso / Amiga / Programmation / Assembleur / ESA.readme < prev   
Text File  |  1998-11-09  |  2KB  |  52 lines

  1. Short:    Extended Syntax Assembly v1.5
  2. Author:   Simone Bevilacqua
  3. Uploader: bevilacq@cli.di.unipi.it (Simone Bevilacqua)
  4. Type:     dev/asm
  5. Requires: 020+ CPU
  6. Replaces: dev/asm/ESA.lha
  7.  
  8. Ever heard of "inline asm" inside C, Pascal, etc. ?
  9. Well, here we have "inline C, Pascal, etc." inside asm!
  10.  
  11.  
  12. Look below: that's a small sample of ESA code!!!
  13.  
  14.  
  15. *******************************************************************************
  16. * CpyQtd v1.0.0
  17. *******************************************************************************
  18. * INFO          copies a string enclosed between two quotes: it is considered
  19. *               a "quote" the first char of the string;
  20. *               the copy is NULL-terminated;
  21. *               it fails at the first ENTER or BLANK
  22. * SYNOPSIS      CpyQtd{StrPtr,DstBuf}
  23. *                      a1     a2
  24. * IN            StrPtr       ptr to string (filename)
  25. *               DstBuf       adr of destination buffer
  26. * MODIFIES      a0.l         ptr after string (NULL if ERROR!)
  27. * WARNING       be careful there is *no* check!!!
  28. *******************************************************************************
  29.  
  30.                 procedure CpyQtd{a1-a2},d0-d1/a1-a2
  31.                 move.b       (a1)+,d0                 ;get "quote"
  32.                 repeat
  33.                  move.b      (a1)+,d1
  34.  
  35.                  switch.s d1.b
  36.                  -> d0                                ;successful copy
  37.                     clr.b    (a1)                     ;NULL-termination
  38.                     moveq.l  #0,d1                    ;exit loop
  39.                  -> #0                                ;unvalid char, exit loop
  40.                     suba.l   a1,a1                    ;please, let it be...
  41.                  -> #10                               ;unvalid char
  42.                     moveq.l  #0,d1                    ;exit loop
  43.                     suba.l   a1,a1                    ;please, let it be...
  44.                  def
  45.                     move.b   d1,(a2)+                 ;copy char
  46.                  eswitch
  47.  
  48.                 until.s ~d1.b
  49.                 movea.l      a1,a0                    ;new string ptr
  50.  
  51.                 eproc
  52.