home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d136 / asmtoolbox.lha / AsmToolBox / test2.asm < prev    next >
Assembly Source File  |  1988-03-19  |  2KB  |  69 lines

  1. ; TEST2.ASM by Warren A. Ring
  2. ;
  3. ; This program shows how the LEFT$, MID$, and RIGHT$ routines
  4. ; work.  You enter a character string, followed by two numbers, m and n.
  5. ; On the first line, it displays the left-most m characters.  On the second
  6. ; line, it displays n characters from character m in the string.  On the
  7. ; third line, it displays the right-most m characters.
  8.  
  9.    section code
  10.  
  11.    include "macros.asm"
  12.  
  13.    Start               ;Perform startup housekeeping
  14. X1
  15.    Scanw   #Word1      ;Set A$, m, and n,
  16.    Scanw   #Word2      ; to the first three words
  17.    AtoI    #Word2,I    ; found on the command
  18.    Scanw   #Word3      ; line, respectively
  19.    AtoI    #Word3,J
  20.  
  21.    Display <'Left$("'> ;Display "Left$(A$,m)="
  22.    WritCon #Word1
  23.    Display <'",'>
  24.    WritCon #Word2
  25.    Display <')="'>
  26.    Left    #Word1,I,#Word4;Calculate B$, and
  27.    WritCon #Word4      ; display it
  28.    Display <'"'>
  29.    Crlf
  30.  
  31.    Display <'Mid$("'>  ;Display "Mid$(A$,m,n)="
  32.    WritCon #Word1
  33.    Display <'",'>
  34.    WritCon #Word2
  35.    Display <','>
  36.    WritCon #Word3
  37.    Display <')="'>
  38.    Mid     #Word1,I,J,#Word4;Calculate B$,
  39.    WritCon #Word4      ; and display it
  40.    Display <'"'>
  41.    Crlf
  42.  
  43.    Display <'Right$("'>;Display "Right$(A$,m)="
  44.    WritCon #Word1
  45.    Display <'",'>
  46.    WritCon #Word2
  47.    Display <')="'>
  48.    Right   #Word1,I,#Word4;Calculate B$,
  49.    WritCon #Word4      ; and display it
  50.    Display <'"'>
  51.    Crlf
  52.  
  53.    Exit                ;Perform ending house keeping, and exit
  54.  
  55.    include "warlib.asm"
  56.  
  57.    section data
  58.  
  59.    StrBuf  Buffer,80
  60.    StrBuf  Word1,16
  61.    StrBuf  Word2,16
  62.    StrBuf  Word3,16
  63.    StrBuf  Word4,16
  64.  
  65. I      DS.L    1
  66. J      DS.L    1
  67.  
  68.    end
  69.