home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l196 / 3.ddi / MXSHKA.AS$ / MXSHKA.bin
Encoding:
Text File  |  1990-06-24  |  2.2 KB  |  55 lines

  1. ;*************************** SHAKESPEARE ******************************
  2. ; This program creates two strings and passes them to a BASIC procedure
  3. ; called addstring (in file MXADSTB.BAS).  This procedure concatenates
  4. ; the strings and passes the result to MASM which prints it.
  5.  
  6.     .model    medium,basic        ;Use same memory model as BASIC.
  7.     extrn    ADDSTRING:far
  8.         .stack
  9.         .data                       ;Create the data.
  10. phrase1         db      "To be or not to be;"
  11. phrase1len      dw      $-phrase1
  12. phrase1off      dw      phrase1
  13. phrase2         db      " that is the question."
  14. phrase2len      dw      $-phrase2
  15. phrase2off      dw      phrase2
  16. sentence        db      100 dup(0)  ;Make room for return data
  17. sentencelen     dw      0           ;and a length indicator.
  18. sentenceoff     dw      sentence
  19.  
  20.         .code
  21. SHAKESPEARE proc     uses si
  22.  
  23. ;First call BASIC to concatenate strings.
  24.         lea     ax,phrase1off       ;Push far address of
  25.         push    ax                  ;fixed-length string #1,
  26.         lea     ax,phrase1len       ;and its length.
  27.         push    ax
  28.         lea     ax,phrase2off       ;Do the same for the
  29.         push    ax                  ;address of string #2,
  30.         lea     ax,phrase2len       ;and its length.
  31.         push    ax
  32.         lea     ax,sentenceoff      ;Push far address of
  33.         push    ax                  ;the return string,
  34.         lea     ax,sentencelen      ;and its length.
  35.         push    ax
  36.     call    ADDSTRING        ;Call BASIC function to
  37.                     ;concatenate the strings and
  38.                                     ;put the result in the
  39.                                     ;fixed-length return string.
  40.  
  41. ;Call DOS to print string. The DOS string output routine (09H)
  42. ;requires that strings end with a "$" character.
  43.         mov     bx,sentencelen      ;Go to end of the result string
  44.         lea     si,sentence         ;and add a "$" (24h) character.
  45.         mov     byte ptr [bx + si],24h
  46.  
  47.         lea     dx,sentence         ;Set up registers
  48.         mov     ah,9                ;and call DOS to
  49.         int     21h                 ;print result string.
  50.         ret
  51.  
  52. SHAKESPEARE endp
  53.  
  54.         end
  55.