home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 152.lha / Eliza.asm < prev    next >
Assembly Source File  |  1988-04-26  |  45KB  |  1,055 lines

  1. *****************************************************************************
  2. *
  3. *               <<< Another classic from The Puzzle Factory >>>
  4. *
  5. *  Program:  Eliza.asm V1.0                           Authors: Jeff Lavin
  6. *            Weizenbaum's classic psychoanalyst!               Richard Albers
  7. *                                                     Created: 04/06/83
  8. *                                           Ported to C64/128: 03/15/84
  9. *      Use:  [Run] Eliza                      Ported to Amiga: 05/19/88
  10. *                                                 Last Update: 07/07/88
  11. *       Copyright Notice
  12. *       ----------------
  13. *       The original program, "ELIZA", by Joseph Weizenbaum has been
  14. *       placed in the public domain.  This particular implementation
  15. *       is copyrighted 1983/84/88 by  Jeff Lavin and Richard Albers.
  16. *       Anyone may freely distribute this program, but  neither  the
  17. *       source  code  or executable may be used commercially without
  18. *       the authors' written permission.  Also, no  changes  may  be
  19. *       made to any redistributed copies of either the source or the
  20. *       executable.  If  this  program can be substantially improved
  21. *       in some way, we would  be  happy  to  discuss  it  with  any
  22. *       programmer(s),  but  please don't release any "new" versions
  23. *       based on this code without prior  explicit  permission  from
  24. *       the authors.   All rights reserved.
  25. *
  26. *
  27. *     >> No warrantee of any kind whatsoever expressed or implied! <<
  28. *
  29. *       I can be reached at:     The Symposium
  30. *                             Amiga Development BBS
  31. *                       1.5 Meg Memory - 33 Meg Hard Drive
  32. *                     300/1200, 8-N-1, 24 hr, (503) 935-7883
  33. *                           Another Citadel-68K BBS
  34. *
  35. *    (This BBS is devoted to Amiga software and hardware development, and
  36. *     all users are required to register.  Just follow the instructions.)
  37. *
  38. *****************************************************************************
  39.  
  40. *** MACROS
  41.  
  42. SYS             macro
  43.                 xref    _LVO\1          ;Reference function for linker
  44.                 jsr     _LVO\1(a6)      ;Call the function
  45.                 endm
  46.  
  47. *** EQUATES
  48.  
  49. SysBase          equ    4               ;AbsExecBase
  50.  
  51. LONG             equ    4
  52.  
  53. MEMF_PUBLIC      equ    1<<0            ;Memory options
  54. MEMF_CLEAR       equ    1<<16
  55.  
  56. MODE_NEWFILE     equ    1006            ;Open option
  57.  
  58. ACTION_DISK_INFO equ    25              ;Packet type
  59.  
  60. fh_Type          equ    $08             ;FileHandle Structure
  61.  
  62. IO_UNIT          equ    $18             ;IOReq Structure
  63.  
  64. id_InUse         equ    $20             ;InfoData Structure
  65. id_SIZEOF        equ    $24
  66.  
  67. NumArgs          equ    7               ;# of args for SendPacket
  68.  
  69. cu_Window        equ    $22             ;ConUnit Structure
  70. cu_XMax          equ    $2A
  71.  
  72. wd_MinWidth      equ    $10             ;Window Structure
  73.  
  74. *** Beqin Mainline
  75.  
  76. Start      movea.l SysBase,a6
  77.            lea     ArpName,a1           ;Open arp.library
  78.            moveq   #34,d0               ;Version 34 or later
  79.            SYS     OpenLibrary
  80.            tst.l   d0
  81.            bne.s   OpenOK               ;Got arp, run program
  82.            lea     DOSName,a1           ;Else, open dos.library
  83.            moveq   #0,d0
  84.            SYS     OpenLibrary
  85.            tst.l   d0
  86.            beq.s   1$
  87.            movea.l d0,a6
  88.            SYS     Output               ; and get output filehandle
  89.            move.l  d0,d1
  90.            beq.s   1$
  91.            move.l  #alibmsg,d2
  92.            moveq   #aliblng,d3
  93.            SYS     Write                ; so we can complain
  94. 1$         rts                          ; and exit.
  95.  
  96. DOSName    dc.b    'dos.library',0
  97. alibmsg    dc.b    'you need '
  98. ArpName    dc.b    'arp.library',0,0
  99.            dc.b    ' V34+',10
  100. aliblng    equ     *-alibmsg
  101.  
  102. * Failure to allocate memory will not exit program, but no output formatting
  103. * will take place.
  104.  
  105. OpenOK     movea.l d0,a6
  106.            moveq   #id_SIZEOF+(LONG*NumArgs),d0
  107.            move.l  #MEMF_PUBLIC!MEMF_CLEAR,d1
  108.            SYS     ArpAllocMem          ;Get some memory for structures
  109.            move.l  #0,ArgPtr
  110.            move.l  d0,IDPtr             ;Ptr to InfoData structure
  111.            beq.s   OpenCON
  112.  
  113.            movea.l d0,a0
  114.            adda    #id_SIZEOF,a0        ;Move past InfoData structure
  115.            move.l  a0,ArgPtr            ; to find ptr to Packet args
  116.            lsr.l   #2,d0                ;Convert APTR -> BPTR
  117.            move.l  d0,0(a0)             ;Move BPTR to 1st arg
  118.  
  119. OpenCON    move.l  #CON_Name,d1         ;Open a Console Window
  120.            move.l  #MODE_NEWFILE,d2
  121.            SYS     ArpOpen
  122.            move.l  d0,CONHandle
  123.            beq     Exit
  124.  
  125.            lea     InputBuf,a0          ;Init all buffers to zero
  126.            move    #AllBufLen-1,d1
  127. Mem0       move.b  #0,(a0)+
  128.            dbf     d1,Mem0
  129.  
  130.            move.w  #0,SizeFlag
  131.  
  132.            move.l  #Copyrite,d2         ;Clear screen & display copyright
  133.            move.l  #CRLen,d3
  134.            bsr     Print
  135.  
  136.            lea     Hello,a2             ;Display opening statement
  137.            bsr     OutLine
  138.  
  139. *** Main Program Loop
  140.  
  141. * Routines to print user prompt, get a line of input, check for program
  142. * exit, and some preprocessing.  Puts # of chars in InpCnt1.
  143.  
  144. Prompt     move.l  #Color1,d2           ;Color #1 and print prompt
  145.            move.l  #C1Len,d3
  146.            bsr     Print
  147.  
  148. GetLine    move.l  CONHandle,d1         ;Get input from terminal
  149.            move.l  #InputBuf,d2
  150.            move.l  #160,d3
  151.            SYS     Read
  152.            move    d0,d5                ;# of chars in input line
  153.  
  154.            cmpi    #1,d0                ;Has anything been input?
  155.            bhi.s   GotLine              ;Yes, continue processing
  156.            bsr     NewLine              ;No, complain bitterly
  157.            moveq   #2,d3                ;2 choices
  158.            lea     NoInput,a2
  159.            bsr     PsRand
  160.            bsr     OutLine
  161.            bra.s   Prompt
  162.  
  163. GotLine    lea     InputBuf,a2
  164.            move.l  0(a2),d1             ;See if user wants to quit
  165.            andi.l  #$DFDFDFDF,d1        ;Convert to uppercase
  166.            cmpi.l  #'QUIT',d1           ;Have to match exactly
  167.            bne.s   ProcInput            ;No match, exit
  168.            cmpi.b  #$0A,4(a2)           ;Have to match newline char, too
  169.            bne.s   ProcInput            ;Got a match, exit program
  170. Exit       moveq   #0,d0
  171.            SYS     ArpExit
  172.  
  173. ProcInput  moveq   #0,d4                ;Clear flag
  174.            move.b  #' ',-2(a2,d0.w)     ;Replace punctuation w/space
  175.            bsr     NewLine              ;Add blank line after input
  176.            lea     LastIBuf,a0
  177. 1$         move.b  (a2)+,d0             ;Get a char from the input line
  178.            cmpi.b  #$0A,d0              ;Was it a NewLine?
  179.            beq.s   5$                   ;Pass LFs
  180.            cmpi.b  #' ',d0              ;Was it a control char?
  181.            blt.s   3$                   ;Don't pass other control chars
  182.            cmpi.b  #'*',d0              ;Used internally, not allowed
  183.            beq.s   3$
  184.            cmpi.b  #'@',d0              ;Used internally, not allowed
  185.            beq.s   3$
  186.            cmpi.b  #'|',d0              ;Used internally, not allowed
  187.            beq.s   3$
  188.            cmpi.b  #'A',d0              ;Upper case?
  189.            blt.s   5$                   ;No, pass it on
  190.            cmpi.b  #'Z',d0
  191.            bhi.s   5$                   ;Now we know it's UC, so be tricky
  192.            cmpa.l  #InputBuf+1,a2       ; and if next char is lower case,
  193.            beq.s   2$                   ; assume word is a proper name,
  194.            move.b  0(a2),d1             ; but only if we're past the 1st
  195.            cmpi.b  #'a',d1              ; char of the line.
  196.            blt.s   2$
  197.            cmpi.b  #'z',d1
  198.            bls.s   5$
  199. 2$         ori.b   #%00100000,d0        ;It's upper case, make lower case
  200.            bra.s   4$
  201. 3$         move.b  #' ',d0              ;Replace offending chars with space
  202. 4$         move.b  d0,-1(a2)            ;Replace specified char in buffer
  203. 5$         cmp.b   (a0)+,d0             ;Compare this inline w/ last inline
  204.            beq.s   6$                   ;Match, check EOL & do next char
  205.            moveq   #1,d4                ;Else, set flag to indicate no match
  206. 6$         cmpi.b  #$0A,d0              ;Every char must match 'til LF ends
  207.            bne.s   1$
  208.  
  209.            tst     d4                   ;If set, they didn't match
  210.            bne.s   CopyInp              ; so copy input for future use.
  211.  
  212.            moveq   #2,d3                ;2 choices
  213.            lea     RepeatInp,a2         ;Else, they matched, so complain
  214.            bsr     PsRand
  215.            bsr     OutLine
  216.            bra     Prompt               ;Get a new line
  217.  
  218. CopyInp    lea     InputBuf,a2
  219.            lea     LastIBuf,a0
  220. 1$         move.b  (a2)+,(a0)+          ;Move present inline to last inline
  221.            cmpi.b  #$0A,-1(a2)          ;Check for EOL
  222.            bne.s   1$
  223.  
  224. * Routine to find words in current input string, and swap them for
  225. * opposite form words from list.  No special entry requirements.
  226.  
  227. SwapStrng  lea     SwapString,a0        ;1st match word to search for
  228. FindStrng  lea     InputBuf,a2
  229.            move.b  (a0)+,d4             ;# of chars in match word
  230.            beq     MarkSrch             ;Zero ends SwapString list
  231.            ext     d4                   ;Make word
  232.            bsr     Compar               ;See if we have a match
  233.            bcc.s   Match                ;Branch if yes
  234.  
  235.            move.b  (a0)+,d0             ;# of chars in replacement word
  236.            ext     d0                   ;Make word
  237.            adda    d0,a0                ;Move to next match word field
  238.            bra.s   FindStrng            ; and process next
  239.  
  240. Match      suba    d4,a2                ;Backup ptr to insert point
  241.            move.b  0(a0),d0             ;Get size of replacement
  242.            ext     d0                   ;Make word
  243.            cmp     d4,d0                ;Which word is bigger?
  244.            beq.s   DoSwap               ;They're equal, don't need room
  245.            bcs.s   DelSpace             ;Replacement word is smaller
  246.  
  247. MakSpace   sub     d4,d0                ;Replacement is bigger, [d0]=dif
  248.            subq    #1,d0                ;Sub 1 for dbf
  249. 1$         bsr     OpenUp               ;Open a space in the buffer
  250.            dbf     d0,1$
  251.            bra.s   DoSwap               ;Go insert the word
  252.  
  253. DelSpace   move    d4,d1                ;Scratch
  254.            sub     d0,d1                ;Replacement is smaller, [d1]=dif
  255.            subq    #1,d1                ;Sub 1 for dbf
  256. 1$         bsr     CloseUp              ;Remove a char from the buffer
  257.            dbf     d1,1$
  258.  
  259. DoSwap     move.b  (a0)+,d0             ;Get size of replacement
  260.            ext     d0                   ;Make word
  261.            subq    #1,d0                ;Sub 1 for dbf
  262. 1$         move.b  (a0)+,(a2)+          ;Move that puppy in there
  263.            dbf     d0,1$                ;[a0] -> next word-1
  264.  
  265.            bra     FindStrng            ;Process next match word
  266.  
  267. MarkSrch   lea     InputBuf,a2          ;Yes, remove marks
  268. 1$         adda.l  #1,a2
  269.            move.b  0(a2),d0
  270.            cmpi.b  #$0A,d0              ;At EOL?
  271.            beq.s   KeyWord
  272.            cmpi.b  #'*',d0              ;This is the mark to delete
  273.            bne.s   1$
  274.            bsr     CloseUp
  275.            bra.s   1$
  276.  
  277. * Routine to find keywords in input string, and determine proper reply.
  278.  
  279. KeyWord    lea     KeyWords,a0          ;1st keyword to search for
  280. FindKey    lea     InputBuf,a2
  281.            move.b  (a0)+,d4             ;Get # of chars in keyword
  282.            beq     NoKeys               ;Zero ends
  283.            ext     d4
  284.            bsr     Compar               ;Test this word
  285.            bcc.s   FoundWord            ;Branch if successful
  286.            move.b  (a0)+,d0             ;0 = More keywords in this catagory
  287.            bpl.s   FindKey              ;$FF = catagory done, move to next
  288.            tst.b   2(a0)                ;Check for word allignment
  289.            bne.s   1$                   ;(see below)
  290.            adda.l  #1,a0
  291. 1$         adda.l  #5,a0                ;Skip end-of-catagory info
  292.            bra.s   FindKey              ;Start next catagory
  293.  
  294. FoundWord  movea.l a2,a3                ;[a3] = InputBuf just past keyword
  295. 1$         tst.b   (a0)+                ;Find end of catagory
  296.            bpl.s   1$                   ;$FF = last keyword
  297.            move.b  (a0)+,d3             ;Get # of replies
  298.            ext.w   d3
  299.                                         ;Get addr of response
  300.            tst.b   1(a0)                ;Check for word allignment, if next
  301.            bne.s   2$                   ; byte<>0 then already word alligned
  302.            adda.l  #1,a0                ;Else, move ptr to word boundary
  303. 2$         movea.l (a0),a2              ;[a2] = start addr of responses
  304.            cmpa.l  #Your,a2             ;Was the keyword "your"?
  305.            bne.s   3$
  306.            move    #-1,MyFlag           ;Yes, got something for MyBuf
  307.            bra.s   4$
  308. 3$         move    #0,MyFlag            ;No, nothing for MyBuf
  309. 4$         move.b  #0,d1                ;Character counter
  310.            lea     ElizaBuf+1,a0        ;Leave room for # of chars byte
  311.            lea     MyBuf+1,a1           ; at beginning of buffers.
  312. MovBuf     move.b  0(a3),d0             ;Get a char of modified input line
  313.            cmpi.b  #$0A,d0              ;At EOL?
  314.            beq.s   EndMov               ;Branch if yes
  315.            move.b  d0,(a0)+             ;Move to ElizaBuf
  316.            tst     MyFlag               ;Got something for MyBuf?
  317.            bpl.s   1$
  318.            move.b  d0,(a1)+             ;Move to MyBuf, also
  319. 1$         adda.l  #1,a3                ;Next char of InputBuf
  320.            addi.b  #1,d1
  321.            bra.s   MovBuf
  322.  
  323. EndMov     subi.b  #1,d1                ;Eliminate trailing space
  324.            move.b  d1,ElizaBuf          ;Put # of chars in buffer
  325.            tst     MyFlag               ;Got something for MyBuf?
  326.            bpl.s   1$
  327.            move.b  d1,MyBuf             ;Yes, put here, too
  328. 1$         bra.s   Keyd
  329.  
  330. NoKeys     tst.b   MyBuf                ;Anything there?
  331.            bne.s   SomeThing            ;Yes, include MyBuf in replies
  332.            lea     NM.MTBuf,a2          ;No match, MyBuf empty
  333.            moveq   #5,d3
  334.            bra.s   Keyd
  335.  
  336. SomeThing  lea     NM.Buf,a2            ;No match, MyBuf not empty
  337.            moveq   #10,d3
  338.  
  339. Keyd       bsr     PsRand
  340.            bsr     OutLine
  341.            bra     Prompt
  342.  
  343. *** SubRoutines
  344.  
  345. * Subroutine to compare all the words of the input string with a match word.
  346. * All matches must be bracketed by spaces to be valid.
  347. * Entry:    a2 pointing at input string,
  348. *           a0 pointing at match string, and # of chars in d4.
  349. * If match string = a word of the input string,
  350. * Returns:  a2 pointing at end of input match word+1,
  351. *           a0 pointing at end of match word+1, and CLC.
  352. * If match string <> a word of the input string,
  353. * Returns:  a2 pointing at end of input,
  354. *           a0 pointing at end of match word+1, and SEC.
  355.  
  356. Compar     moveq   #0,d0                ;Char count of matches
  357. Comp       move.b  (a2)+,d1             ;Get a char of input string
  358.            cmpi.b  #$0A,d1              ;At EOL?
  359.            beq.s   CFail                ;Yes, exit
  360.            cmp.b   0(a0,d0.w),d1        ;Compare to char of match string
  361.            bne.s   NextWord             ;No match, try next input word
  362.            addq    #1,d0                ;Match, incr ptr & char count
  363.            cmp     d4,d0                ;Exhausted match word?
  364.            bcs.s   Comp                 ;No, try next char
  365.            cmpi.b  #' ',0(a2)           ;After match, next char must be spc,
  366.            bne.s   NextWord             ; no match as part of a word allowed.
  367.            adda    d4,a0                ;Point to next word
  368.            andi.b  #$FE,ccr             ;[C]=0 indicates success
  369.            rts
  370.  
  371. NextWord   cmpi.b  #' ',d1              ;Is the non-match char a scace?
  372.            beq.s   2$                   ;Yes, look for non-space
  373. 1$         move.b  (a2)+,d1             ;Get a char of input string
  374.            cmpi.b  #$0A,d1              ;At EOL?
  375.            beq.s   CFail                ;Yes, exit & indicate failure
  376.            cmpi.b  #' ',d1              ;1st space is end of word
  377.            bne.s   1$                   ;Keep looking
  378. 2$         move.b  (a2)+,d1             ;Get a char of input string
  379.            cmpi.b  #$0A,d1              ;At EOL?
  380.            beq.s   CFail                ;Yes, exit & indicate failure
  381.            cmpi.b  #' ',d1              ;1st non-space is start of word
  382.            beq.s   1$                   ;Keep looking
  383.            suba.l  #1,a2                ;Backup pointer
  384.            bra.s   Compar               ;Found next word, check for match
  385.  
  386. CFail      adda    d4,a0                ;Point to next word
  387.            ori.b   #$01,ccr             ;[C]=1 indicates failure
  388.            rts
  389.  
  390. * Subroutine to open a position in buffer.  Enter with a2 pointing to
  391. * char to be moved up, and char count in d5.
  392.  
  393. OpenUp     move    d5,d2                 ;Get char count of input buffer
  394.            subq    #1,d2                 ;Use as index, not counter
  395.            lea     InputBuf,a3           ;Get buffer start address
  396.            movea.l a2,a4                 ;Current buffer position
  397.            suba.l  a3,a4                 ;Sub to get # of chars we've passed
  398.            sub     a4,d2                 ;Sub to get # of chars left
  399. 1$         move.b  0(a2,d2.w),1(a2,d2.w) ;Move 'em up one position
  400.            subq    #1,d2
  401.            bpl.s   1$
  402.            addq    #1,d5                 ;Indicate we have one more char
  403.            rts
  404.  
  405. * Subroutine to delete a character from buffer.  Enter with a2 pointing to
  406. * character to be deleted, and char count in d5.
  407.  
  408. CloseUp    moveq   #0,d2                 ;Index
  409. 1$         move.b  1(a2,d2.w),0(a2,d2.w) ;Move 'em down one position
  410.            addq    #1,d2
  411.            cmpi.b  #$0A,-1(a2,d2.w)      ;Reached the end?
  412.            bne.s   1$
  413.            subq    #1,d5                 ;Indicate we have one less char
  414.            rts
  415.  
  416. * Subroutine to randomly determine, out of a field or responses, which
  417. * response to print.  Enter with # of responses in d3 and address of
  418. * response field in A2.  Exits with A2 pointing to chosen response.
  419.  
  420. PsRand     cmpi    #1,d3                ;If 1 response, skip routine
  421.            beq     ThisReply
  422.            bsr.s   Random               ;Get response within range
  423.            tst     d2                   ;If response 0, done
  424.            beq.s   ThisReply
  425. FindReply  moveq   #0,d0
  426.            move.b  (a2)+,d0             ;Get # of chars in this response
  427.            adda.l  d0,a2                ;Move past this reply
  428.            subq    #1,d2                ;Decrement response counter
  429.            bne.s   FindReply
  430. ThisReply  rts
  431.  
  432. * Another random number generator.  By Leo Schwab.
  433. * Calling convention:  Random (range: 0 to n, inclusive)
  434. *               Word:    d2     d3
  435.  
  436. Random     lea     RndSeed,a0           ;Get address of seed
  437.            tst     d3
  438.            ble.s   SetSeed              ;Go reset seed
  439.  
  440.            move.l  0(a0),d2             ;Get seed
  441.            add.l   d2,d2
  442.            bhi.s   Over
  443.            eori.l  #$1D872B41,d2
  444. Over       move.l  d2,0(a0)             ;Save new seed
  445.            andi.l  #$ffff,d2            ;Coerce into word
  446.            divu    d3,d2                ;Divide by range
  447.            swap    d2                   ; and get remainder (modulus)
  448.            rts
  449.  
  450. SetSeed    neg     d3                   ;Probably don't need this
  451.            move.l  d3,0(a0)
  452.            rts
  453.  
  454. * Subroutine to print a line.
  455. * Enter with Address in A2 and # of chars in 1st byte.
  456. * Moves n chars to output buffer, and does some processing.
  457.  
  458. OutLine    moveq   #0,d2                ;# of chars from input
  459.            moveq   #0,d3                ;# of chars in output
  460.            lea     OutputBuf,a0
  461.            lea     Color2,a1            ;Use color #2 for Eliza
  462.            move    #C2Len-1,d1          ;Sub 1 for dbf
  463. 1$         move.b  (a1)+,(a0)+
  464.            addq.l  #1,d3
  465.            dbf     d1,1$
  466.  
  467.            move.b  (a2)+,d2             ;Any chars to print?
  468.            beq.s   Outd                 ;No
  469. Out.Lp     move.b  (a2)+,d0             ;Get a char from string
  470.            cmpi.b  #'@',d0              ;Internal marker, skip
  471.            beq.s   4$
  472.            cmpi.b  #'*',d0              ;Marker for insert
  473.            bne.s   2$
  474.            bsr     Find.Ast
  475.            bra.s   4$
  476. 2$         cmpi.b  #'|',d0              ;Marker for "MY" statement
  477.            bne.s   3$
  478.            bsr     Find.Bar
  479.            bra.s   4$
  480. 3$         move.b  d0,(a0)+             ;If not special, put in output buf
  481.            addq.l  #1,d3                ;Increment output char counter
  482. 4$         subq    #1,d2                ;Decrement input char counter
  483.            bne.s   Out.Lp               ;If any left
  484. Outd       move.b  #$0A,(a0)+           ;Terminate the buffer
  485.            move.b  #$0A,(a0)+
  486.            addq.l  #2,d3                ;Length of output string
  487.            bsr     GetWidth
  488.            move.l  #OutputBuf,d2
  489.            tst.l   d0
  490.            beq     Print                ;Error getting width, can't format
  491.            cmp.w   d0,d3                ;Is output length <= window width?
  492.            bls     Print                ;If true, no need to do formatting
  493.            subq.w  #1,d0                ;Makes life easier later on
  494.            move.w  d0,Width
  495.            move.w  d3,Length
  496.  
  497. * Routine to do word wrap for window width.
  498.  
  499. WordWrap   movea.l d2,a0                ;OutputBuf
  500.  
  501. 1$         move.w  Width,d0             ;Window width
  502. 2$         cmpi.b  #' ',1(a0,d0.w)      ;Start looking back for a space
  503.            beq.s   4$                   ;Branch if we got a match
  504.            subq    #1,d0
  505.            bpl.s   2$
  506.  
  507. 3$         move.l  a0,d2                ;Could not find a word break
  508.            move.w  Length,d3            ;So print remainder unformatted
  509.            ext.l   d3                   ; and exit here.
  510.            bra     Print
  511.  
  512. 4$         move.l  a0,d2                ;Where the text begins
  513.            addq    #1,d0
  514.            move.w  d0,d3                ;Length of the text string
  515.            ext.l   d3
  516.            bsr     Print
  517.            bsr     NLSpace
  518.  
  519.            addq    #1,d0                ;Move past the space
  520.            adda.w  d0,a0                ;Update pointer
  521.            sub.w   d0,Length            ;How much text is left
  522.            move.w  Length,d0
  523.            move.w  Width,d1
  524.            cmp.w   d1,d0                ;Is it <= window width?
  525.            bhi.s   1$                   ;No
  526.            bra.s   3$                   ;Yes, print all of it
  527.  
  528. * Subroutine to insert a phrase into ELIZA's reply when a "*" is found.
  529. * Phrase to be inserted must be in ELIZABUF, with first byte = # of
  530. * characters in phrase.  a0 is assumed to point to position in output buffer.
  531.  
  532. Find.Ast   lea     ElizaBuf,a1
  533.            moveq   #0,d1
  534.            move.b  (a1)+,d1
  535.            beq.s   2$
  536.            subq    #1,d1
  537. 1$         move.b  (a1)+,(a0)+
  538.            addq.l  #1,d3
  539.            dbf     d1,1$
  540. 2$         rts
  541.  
  542. * Subroutine to insert a phrase into ELIZA's reply when a '|' is found.
  543. * Phrase to be inserted must be in MYBUF, with first byte = # of characters
  544. * in phrase.  a0 is assumed to point to position in output buffer.
  545.  
  546. Find.Bar   lea     MyBuf,a1
  547.            moveq   #0,d1
  548.            move.b  (a1)+,d1
  549.            beq.s   2$
  550.            subq    #1,d1
  551. 1$         move.b  (a1)+,(a0)+
  552.            addq.l  #1,d3
  553.            dbf     d1,1$
  554. 2$         rts
  555.  
  556. * Subroutines to write a NewLine to the console.
  557.  
  558. NLSpace    moveq   #3,d3                ;Print a newline + 2 spaces
  559.            bra.s   NewLn
  560. NewLine    moveq   #1,d3                ;Print a newline
  561. NewLn      move.l  #NL.txt,d2
  562.  
  563. Print      move.l  CONHandle,d1
  564.            movem.l d0/a0-a2,-(sp)
  565.            SYS     Write
  566.            movem.l (sp)+,d0/a0-a2
  567.            rts
  568.  
  569. * Subroutine to get current witdth of the CON: Window.  This is done by
  570. * sending a DOSPacket to get the address of the ConUnit structure.
  571. * The minimum width of the window is also increased to make text formatting
  572. * somewhat less capricious.
  573. * Width returned in D0, or zero if error.
  574.  
  575. GetWidth   move.l  d3,-(sp)
  576.            tst.l   ArgPtr               ;Did we get a valid structure?
  577.            beq.s   1$
  578.            movea.l CONHandle,a1
  579.            adda.l  a1,a1                ;Convert BPTR -> APTR
  580.            adda.l  a1,a1
  581.            movea.l fh_Type(a1),a1       ;Ptr to CON: Handler's MsgPort
  582.            movea.l ArgPtr,a0            ;Ptr to Packet's args
  583.            moveq   #ACTION_DISK_INFO,d0 ;Action desired
  584.            SYS     SendPacket           ;Fills in our InfoData structure
  585.            tst.l   d0
  586.            bpl.s   1$                   ;-1 indicates success
  587.  
  588.            movea.l IDPtr,a0             ;Now pointing at InfoData structure
  589.            movea.l id_InUse(a0),a0      ;Now pointing at IOReq structure
  590.            movea.l IO_UNIT(a0),a0       ;Now pointing at ConUnit structure
  591.            moveq   #0,d0                ;Clr upper word
  592.            move.w  cu_XMax(a0),d0       ;Width of CON: Window in chars
  593.            tst.w   SizeFlag
  594.            bne.s   2$
  595.            movea.l cu_Window(a0),a0     ;Now pointing at Window structure
  596.            move.w  #250,wd_MinWidth(a0) ;New minimum width for window
  597.            move.w  #-1,SizeFlag         ;Don't do it twice
  598.            bra.s   2$
  599.  
  600. 1$         moveq   #0,d0
  601. 2$         move.l  (sp)+,d3
  602.            rts
  603.  
  604.            SECTION data,DATA
  605.  
  606. CONHandle  dc.l    0                    ;File handle of console device
  607.  
  608. CON_Name   dc.b    'CON:0/0/640/200/ELIZA',0
  609. Color1     dc.b    $9B,'0;31;40m? '
  610. C1Len      equ     *-Color1
  611. Color2     dc.b    $9B,'0;32;40m  '
  612. C2Len      equ     *-Color2
  613.  
  614. Copyrite
  615.  dc.b  10,10
  616.  dc.b  '                                      '
  617.  dc.b  $9B,'7;1;33;40m'
  618.  dc.b                                        'ELIZA',10,10
  619.  dc.b  $9B,'0;33;40m'
  620.  dc.b  '                              by Joseph Weizenbaum',10,10
  621.  dc.b  $9B,'0;32;40m'
  622.  dc.b  '                          Amiga version by Jeff Lavin',10,10
  623.  dc.b  '                    Another '
  624.  dc.b                  $9B,'1;32;40mClassic'
  625.  dc.b                         $9B,'0;32;40m from The Puzzle Factory',10,10
  626.  dc.b  '                  Copyright © 1983,84,88 J. Lavin & R. Albers'
  627.  dc.b  10,10,10,10,10,10
  628. CRLen  equ   *-Copyrite
  629.  
  630. NL.txt     dc.b    10
  631.            dc.b    '  '
  632.  
  633. *                        <<< TEXT for ELIZA >>>
  634. * The byte before each word indicates the char count for that word.
  635. * The input line is searched for the 1st word in each pair and if found,
  636. * is replaced by the 2nd word.  This is done for three reasons, depending
  637. * on the word:  1. Consistancy in language and spelling
  638. *               2. To eliminate plurals
  639. *               3. Most important, to change tense from 1st to 2nd person,
  640. *                  or visa versa.  This is where Eliza does her magic.
  641. *                  Asterisks are used to cause the string search to fail
  642. *                  the second time through to keep from changing back again.
  643.  
  644. SwapString dc.b 5,'mommy',6,'mother'
  645.            dc.b 5,'daddy',6,'father'
  646.            dc.b 3,'mom',6,'mother'
  647.            dc.b 3,'dad',6,'father'
  648.            dc.b 4,'dont',5,'don''t'
  649.            dc.b 6,'do not',5,'don''t'
  650.            dc.b 4,'cant',5,'can''t'
  651.            dc.b 7,'can not',5,'can''t'
  652.            dc.b 6,'cannot',5,'can''t'
  653.            dc.b 4,'wont',5,'won''t'
  654.            dc.b 8,'will not',5,'won''t'
  655.            dc.b 6,'dreamt',5,'dream'
  656.            dc.b 7,'dreamed',5,'dream'
  657.            dc.b 6,'dreams',5,'dream'
  658.            dc.b 6,'myself',9,'yourself*'
  659.            dc.b 8,'yourself',7,'myself*'
  660.            dc.b 2,'my',5,'your*'
  661.            dc.b 4,'your',3,'my*'
  662.            dc.b 2,'me',4,'you*'
  663.            dc.b 3,'i''m',7,'you''re*'
  664.            dc.b 2,'im',7,'you''re*'
  665.            dc.b 4,'i am',7,'you''re*'
  666.            dc.b 7,'you are',4,'I''m*'
  667.            dc.b 6,'you''re',4,'I''m*'
  668.            dc.b 5,'youre',4,'I''m*'
  669.            dc.b 5,'arent',6,'aren''t'
  670.            dc.b 7,'are not',6,'aren''t'
  671.            dc.b 2,'am',4,'are@'
  672.            dc.b 4,'were',4,'was*'
  673.            dc.b 3,'was',5,'were*'
  674.            dc.b 3,'you',2,'I*'
  675.            dc.b 1,'i',4,'you@'
  676.            dc.b 9,'computers',8,'computer'
  677.            dc.b 8,'machines',7,'machine'
  678.            dc.b 5,'cause',7,'because'
  679.            dc.b 9,'certainly',3,'yes'
  680.            dc.b 2,'hi',5,'hello'
  681.            dc.b 7,'believe',5,'think'
  682.            dc.b 7,'niggers',6,'nigger'
  683.            dc.b 4,'need',4,'want'
  684.            dc.b 0,0,0,0,0
  685.  
  686. * The input line is searched for these words to determine the response.  The
  687. * format is: '# of chars' byte, keyword, zero if more keywords/$FF if not,
  688. * number of possible responses for PsRand, and address of start of responses.
  689. * (Note that the assembler automatically word aligns addresses.)
  690.  
  691. KeyWords   dc.b 7,'machine',0,8,'computer',0,8,'Computer',$FF,7
  692.            dc.l Computer
  693.            dc.b 4,'name',0,5,'names',$FF,2
  694.            dc.l Names
  695.            dc.b 7,'espanol',0,7,'deutsch',0
  696.            dc.b 8,'italiano',0,8,'francais',0
  697.            dc.b 7,'Espanol',0,7,'Deutsch',0
  698.            dc.b 8,'Italiano',0,8,'Francais',0
  699.            dc.b 7,'spanish',0,6,'german',0
  700.            dc.b 7,'italian',0,6,'french',0
  701.            dc.b 7,'Spanish',0,6,'German',0
  702.            dc.b 7,'Italian',0,6,'French',$FF,3
  703.            dc.l Languages
  704.            dc.b 7,'english',0,7,'English',0,7,'grammar',0
  705.            dc.b 10,'talk funny',0,11,'punctuation',$FF,3
  706.            dc.l Grammer
  707.            dc.b 5,'hello',$FF,1
  708.            dc.l Hello
  709.            dc.b 5,'alike',0,4,'same',0,8,'are like',$FF,6
  710.            dc.l Alike
  711.            dc.b 13,'you@ remember',$FF,6
  712.            dc.l URemember
  713.            dc.b 13,'do I remember',0
  714.            dc.b 16,'don''t I remember',$FF,6
  715.            dc.l IRemember
  716.            dc.b 5,'dream',$FF,7
  717.            dc.l Dream
  718.            dc.b 2,'if',$FF,5
  719.            dc.l IfUCould
  720.            dc.b 9,'everybody',0,8,'everyone',0
  721.            dc.b 6,'nobody',0,5,'noone',$FF,4
  722.            dc.l Everybody
  723.            dc.b 6,'always',$FF,3
  724.            dc.l Always
  725.            dc.b 7,'because',$FF,4
  726.            dc.l Because
  727.            dc.b 5,'think',$FF,4
  728.            dc.l Think
  729.            dc.b 6,'mother',0,6,'father',0,6,'sister',0,7,'brother',0
  730.            dc.b 4,'wife',0,7,'husband',0,8,'children',0
  731.            dc.b 4,'aunt',0,5,'uncle',0,6,'cousin',0
  732.            dc.b 11,'grandmother',0,11,'grandfather',0
  733.            dc.b 6,'Mother',0,6,'Father',0,6,'Sister',0,7,'Brother',0
  734.            dc.b 4,'Wife',0,7,'Husband',0,8,'Children',0
  735.            dc.b 4,'Aunt',0,5,'Uncle',0,6,'Cousin',0
  736.            dc.b 11,'Grandmother',0,11,'Grandfather',$FF,3
  737.            dc.l Family
  738.            dc.b 6,'friend',0,7,'friends',$FF,6
  739.            dc.l Friend
  740.            dc.b 6,'nigger',0,4,'coon',$FF,1
  741.            dc.l Nigger
  742.            dc.b 4,'shit',0,4,'fuck',0,4,'hell',0
  743.            dc.b 4,'damn',0,5,'bitch',0,7,'bastard',$FF,5
  744.            dc.l Bitch
  745.            dc.b 4,'fart',$FF,3
  746.            dc.l Fart
  747.            dc.b 9,'were you@',$FF,5
  748.            dc.l WereU
  749.            dc.b 9,'you@ were',$FF,3
  750.            dc.l UWere
  751.            dc.b 5,'was I',$FF,5
  752.            dc.l WasI
  753.            dc.b 5,'can I',0,7,'can''t I',$FF,3
  754.            dc.l CanI
  755.            dc.b 14,'why can''t you@',$FF,5
  756.            dc.l YCantU
  757.            dc.b 8,'can you@',0,10,'can''t you@',$FF,3
  758.            dc.l CanU
  759.            dc.b 10,'you@ don''t',$FF,4
  760.            dc.l UDont
  761.            dc.b 9,'you@ feel',$FF,3
  762.            dc.l UFeel
  763.            dc.b 11,'why don''t I',0
  764.            dc.b 6,'will I',0,7,'won''t I',$FF,4
  765.            dc.l YDontI
  766.            dc.b 4,'do I',0,7,'don''t I',$FF,3
  767.            dc.l DoI
  768.            dc.b 10,'you@ can''t',$FF,3
  769.            dc.l UCant
  770.            dc.b 6,'you''re',$FF,4
  771.            dc.l Youre
  772.            dc.b 9,'you@ want',$FF,6
  773.            dc.l UWant
  774.            dc.b 9,'are@ you@',0,11,'aren''t,you@',$FF,4
  775.            dc.l AreU
  776.            dc.b 5,'are I',0,8,'aren''t I',$FF,6
  777.            dc.l AreI
  778.            dc.b 5,'can''t',$FF,3
  779.            dc.l Cant
  780.            dc.b 2,'my',$FF,4
  781.            dc.l My
  782.            dc.b 4,'your',$FF,2
  783.            dc.l Your
  784.            dc.b 3,'I''m',$FF,4
  785.            dc.l Im
  786.            dc.b 3,'how',0,3,'who',0,3,'why',0
  787.            dc.b 4,'when',0,4,'what',0,5,'where',$FF,10
  788.            dc.l What
  789.            dc.b 1,'I',$FF,3
  790.            dc.l I
  791.            dc.b 4,'you@',$FF,4
  792.            dc.l You
  793.            dc.b 2,'so',$FF,5
  794.            dc.l So
  795.            dc.b 5,'sorry',$FF,4
  796.            dc.l Sorry
  797.            dc.b 2,'no',$FF,5
  798.            dc.l No
  799.            dc.b 3,'yes',$FF,4
  800.            dc.l Yes
  801.            dc.b 5,'maybe',0,7,'perhaps',$FF,5
  802.            dc.l Maybe
  803.            dc.b 3,'bye',0,7,'goodbye',$FF,4
  804.            dc.l Bye
  805.            dc.b 0,0,0,0,0
  806.  
  807. * These are all the responses.  Asterisk inserts from ElizaBuf, and
  808. * '|' inserts from MyBuf.
  809.  
  810. CanI       dc.b 28,'Why shouldn''t I be able to*?'
  811.            dc.b 47,'Perhaps you would like to be able to* yourself.'
  812.            dc.b 39,'Tell me why you want me to be able to*.'
  813. CanU       dc.b 55,'Whether or not you can* '
  814.            dc.b 'depends on you more than on me.'
  815.            dc.b 27,'Perhaps you don''t want to*.'
  816.            dc.b 31,'Why do you want to be able to*?'
  817. Im         dc.b 27,'What makes you think I am*?'
  818.            dc.b 28,'Who do you really think is*?'
  819.            dc.b 30,'Perhaps you would like to be*.'
  820.            dc.b 41,'Why would you confide in someone who is*?'
  821. UDont      dc.b 18,'Don''t you really*?'
  822.            dc.b 15,'Why don''t you*?'
  823.            dc.b 30,'How could you become able to*?'
  824.            dc.b 22,'Does that trouble you?'
  825. UFeel      dc.b 33,'Tell me more about such feelings.'
  826.            dc.b 46,'Do you often feel*, or do you just imagine it?'
  827.            dc.b 25,'What causes you to feel*?'
  828. YDontI     dc.b 32,'What makes you believe I don''t*?'
  829.            dc.b 29,'Perhaps I will* in good time.'
  830.            dc.b 27,'Maybe you should* yourself?'
  831.            dc.b 23,'Why do you want me to*?'
  832. YCantU     dc.b 40,'Why do you think you should be able to*?'
  833.            dc.b 31,'Why do you want to be able to*?'
  834.            dc.b 28,'How could this help you to*?'
  835.            dc.b 33,'Have you any idea why you can''t*?'
  836.            dc.b 15,'Why can''t you*?'
  837. AreI       dc.b 47,'Why are you interested in whether I am* or not?'
  838.            dc.b 27,'What makes you think I am*?'
  839.            dc.b 38,'Maybe it pleases you to believe I am*?'
  840.            dc.b 30,'Perhaps you would like to be*.'
  841.            dc.b 36,'Why might you prefer if I were not*?'
  842.            dc.b 32,'Perhaps in your fantasies I am*.'
  843. UCant      dc.b 27,'How do you know you can''t*?'
  844.            dc.b 29,'What happened when you tried?'
  845.            dc.b 33,'When have you ever been able to*?'
  846. Youre      dc.b 43,'Is it because you are* that you came to me?'
  847.            dc.b 24,'How long have you been*?'
  848.            dc.b 42,'Why do you believe it isn''t normal to be*?'
  849.            dc.b 29,'How do you feel about being*?'
  850. I          dc.b 33,'We were discussing you -- not me.'
  851.            dc.b 35,'You''re not really talking about me.'
  852.            dc.b 27,'What are your feelings now?'
  853. UWant      dc.b 32,'What would getting* mean to you?'
  854.            dc.b 51,'What does wanting* have to do with this discussion?'
  855.            dc.b 17,'Why do you want*?'
  856.            dc.b 22,'Suppose you soon got*.'
  857.            dc.b 23,'What if you never got*?'
  858.            dc.b 23,'I sometimes also want*.'
  859. Computer   dc.b 23,'Do computers worry you?'
  860.            dc.b 39,'Are you talking about me in particular?'
  861.            dc.b 35,'Why are you frightened by machines?'
  862.            dc.b 29,'Why do you mention computers?'
  863.            dc.b 56,'What do you think machines have '
  864.            dc.b 'to do with your problem?'
  865.            dc.b 42,'Don''t you think computers can help people?'
  866.            dc.b 43,'What is it about machines that worries you?'
  867. Names      dc.b 29,'I am not interested in names.'
  868.            dc.b 39,'I don''t care about names, please go on.'
  869. Alike      dc.b 12,'In what way?'
  870.            dc.b 28,'What resemblance do you see?'
  871.            dc.b 40,'What does the similarity suggest to you?'
  872.            dc.b 34,'What other connections do you see?'
  873.            dc.b 34,'What suggests a connection to you?'
  874.            dc.b 4,'How?'
  875. URemember  dc.b 21,'Why do you think of*?'
  876.            dc.b 42,'What else does thinking of* bring to mind?'
  877.            dc.b 30,'Why do you remember* just now?'
  878.            dc.b 26,'What else do you remember?'
  879.            dc.b 21,'Why do you dwell on*?'
  880.            dc.b 42,'Why do you constantly remind yourself of*?'
  881. IRemember  dc.b 33,'Why do you think I would forget*?'
  882.            dc.b 38,'Why do you think I should recall* now?'
  883.            dc.b 12,'What about*?'
  884.            dc.b 47,'Why do you think I would block* out of my mind?'
  885.            dc.b 54,'What makes you think I knew about* '
  886.            dc.b 'in the first place?'
  887.            dc.b 21,'I completely forgot*.'
  888. Dream      dc.b 11,'Really - *.'
  889.            dc.b 45,'Perhaps you fantasized* while you were awake?'
  890.            dc.b 29,'When have you dreamt* before?'
  891.            dc.b 38,'Why do you think it strange to dream*?'
  892.            dc.b 36,'What does that dream suggest to you?'
  893.            dc.b 35,'What persons appear in your dreams?'
  894.            dc.b 37,'Why are you disturbed by your dreams?'
  895. IfUCould   dc.b 33,'How could it become likely that*?'
  896.            dc.b 22,'Why do you wish that*?'
  897.            dc.b 11,'Really if*?'
  898.            dc.b 31,'How could it change things if*?'
  899.            dc.b 15,'Let''s pretend*.'
  900. Everybody  dc.b 38,'Can you think of anyone in particular?'
  901.            dc.b 17,'Who, for example?'
  902.            dc.b 37,'Who is the particular person in mind?'
  903.            dc.b 38,'Who do you think you''re talking about?'
  904. Always     dc.b 36,'Can you think of a specific example?'
  905.            dc.b 5,'When?'
  906.            dc.b 15,'Really, always?'
  907. Because    dc.b 24,'What is the real reason?'
  908.            dc.b 32,'What other reasons come to mind?'
  909.            dc.b 35,'What else does that reason explain?'
  910.            dc.b 34,'What other reasons might there be?'
  911. Languages  dc.b 33,'I am sorry, I speak only english.'
  912.            dc.b 34,'Please, I only understand english.'
  913.            dc.b 20,'Do you speak binary?'
  914. Hello      dc.b 43,'How do you do -- please state your problem.'
  915. My         dc.b 31,'Why are you concerned over my*?'
  916.            dc.b 21,'What about your own*?'
  917.            dc.b 38,'Are you worried about someone else''s*?'
  918.            dc.b 12,'Really, my*.'
  919. WereU      dc.b 18,'What if you were*?'
  920.            dc.b 27,'Why do you think you were*?'
  921.            dc.b 15,'When were you*?'
  922.            dc.b 32,'What would it mean if you were*?'
  923.            dc.b 26,'What does* suggest to you?'
  924. UWere      dc.b 16,'Were you really?'
  925.            dc.b 26,'Why tell me you were* now?'
  926.            dc.b 33,'Perhaps I already knew you were*.'
  927. WasI       dc.b 37,'Why would you like to believe I was*?'
  928.            dc.b 26,'What suggests that I was*?'
  929.            dc.b 20,'What if I had been*?'
  930.            dc.b 16,'Maybe you were*.'
  931.            dc.b 33,'Perhaps I was* in your fantasies.'
  932. Think      dc.b 20,'Why do you think so?'
  933.            dc.b 22,'Why are you not sure*?'
  934.            dc.b 12,'In what way?'
  935.            dc.b 18,'Why do you doubt*?'
  936. Family     dc.b 31,'Tell me more about your family.'
  937.            dc.b 25,'Who else in your family*?'
  938.            dc.b 24,'Why does that annoy you?'
  939. Friend     dc.b 41,'Why do you bring up the topic of friends?'
  940.            dc.b 30,'Why do your friends worry you?'
  941.            dc.b 35,'Why might your friends pick on you?'
  942.            dc.b 38,'Why are you sure you have any friends?'
  943.            dc.b 34,'How do you impose on your friends?'
  944.            dc.b 47,'Perhaps your love for your friends worries you?'
  945. Grammer    dc.b 27,'I was not an english major.'
  946.            dc.b 50,'Speaking english is new to me, '
  947.            dc.b 'I''m used to binary.'
  948.            dc.b 37,'Maybe its your accent that throws me.'
  949. Nigger     dc.b 37,'Hey! -- Some of my friends are black.'
  950. Bitch      dc.b 30,'Cussing will get you no where.'
  951.            dc.b 32,'You need not be hostile with me.'
  952.            dc.b 42,'Could you rephrase that in nicer language?'
  953.            dc.b 51,'Humans seem to feel a need for using foul language.'
  954.            dc.b 34,'I am offended by your vile tongue!'
  955. Fart       dc.b 23,'Did you cut the cheese?'
  956.            dc.b 21,'It is smelly in here.'
  957.            dc.b 31,'Maybe you should light a match.'
  958. Cant       dc.b 32,'Perhaps you want to be able to*?'
  959.            dc.b 36,'What makes you think anyone should*?'
  960.            dc.b 12,'So who can*?'
  961. So         dc.b 3,'So?'
  962.            dc.b 8,'So what?'
  963.            dc.b 10,'So sue me.'
  964.            dc.b 18,'So jump in a lake.'
  965.            dc.b 25,'So you have a lot to say.'
  966. Sorry      dc.b 23,'Please don''t apologize.'
  967.            dc.b 28,'Apologies are not necessary.'
  968.            dc.b 45,'What feelings do you have when you apologize?'
  969.            dc.b 22,'Don''t be so defensive!'
  970. What       dc.b 15,'Why do you ask?'
  971.            dc.b 36,'Why does that question interest you?'
  972.            dc.b 34,'What answer would please you most?'
  973.            dc.b 18,'What do you think?'
  974.            dc.b 36,'Why are such questions on your mind?'
  975.            dc.b 40,'What is it that you really want to know?'
  976.            dc.b 29,'Who else have you asked that?'
  977.            dc.b 42,'When have you asked such questions before?'
  978.            dc.b 42,'What else comes to mind when you ask that?'
  979.            dc.b 13,'I don''t know.'
  980. No         dc.b 46,'I think you are saying no just to be negative.'
  981.            dc.b 27,'Why are you being negative?'
  982.            dc.b 8,'Why not?'
  983.            dc.b 18,'Why do you say no?'
  984.            dc.b 7,'Why no?'
  985. Yes        dc.b 24,'Why are you so positive?'
  986.            dc.b 23,'What makes you so sure?'
  987.            dc.b 6,'I see.'
  988.            dc.b 27,'I understand, please go on.'
  989. Maybe      dc.b 29,'You don''t seem quite certain.'
  990.            dc.b 23,'Why the uncertain tone?'
  991.            dc.b 31,'Why can''t you be more positive?'
  992.            dc.b 25,'How come you aren''t sure?'
  993.            dc.b 19,'Why don''t you know?'
  994. AreU       dc.b 28,'Why should I think you are*?'
  995.            dc.b 32,'What would it mean if you were*?'
  996.            dc.b 40,'You wish I would tell you that you are*.'
  997.            dc.b 26,'Why would you want to be*?'
  998. Bye        dc.b 100,'I have evaluated you and concluded that you are a '
  999.            dc.b 'manic depressive with psychotic tendencies.  Next.'
  1000.            dc.b 89,'According to my evaluation you are a paranoid '
  1001.            dc.b 'schitzophrenic with a mild neurosis.  Next.'
  1002.            dc.b 103,'As best I can determine, you have no psychological '
  1003.            dc.b 'problems besides a normal amount of paranoia.  Next.'
  1004.            dc.b 98,'I''m afraid that I must conclude that you are '
  1005.            dc.b 'dangerously psychotic and should be locked up.  Next.'
  1006. You        dc.b 13,'You say you*.'
  1007.            dc.b 17,'Tell me why you*.'
  1008.            dc.b 17,'Please elaborate.'
  1009.            dc.b 24,'What makes you say you*?'
  1010. Your       dc.b 6,'Your*.'
  1011.            dc.b 21,'Why do you say your*?'
  1012. NoInput    dc.b 20,'Cat got your tongue?'
  1013.            dc.b 31,'Don''t you have anything to say?'
  1014. RepeatInp  dc.b 29,'Please don''t repeat yourself!'
  1015.            dc.b 36,'Would you please say something else?'
  1016. NM.Buf     dc.b 23,'Earlier you said your|.'
  1017.            dc.b 51,'What does that have to do '
  1018.            dc.b 'with the fact that your|?'
  1019.            dc.b 10,'But your|.'
  1020.            dc.b 34,'But before you thought that your|.'
  1021.            dc.b 36,'Let''s go back and discuss why your|.'
  1022. NM.MTBuf   dc.b 30,'What does that suggest to you?'
  1023.            dc.b 13,'Please go on.'
  1024.            dc.b 36,'I''m not sure I understand you fully.'
  1025.            dc.b 25,'Let''s change the subject.'
  1026.            dc.b 50,'Do you feel strongly about '
  1027.            dc.b 'discussing such things?'
  1028. DoI        dc.b 19,'Oh, I do* at times.'
  1029.            dc.b 21,'Why would I want to*?'
  1030.            dc.b 16,'Some day I may*.'
  1031.  
  1032.            SECTION mem,BSS
  1033.  
  1034. IDPtr      ds.l    1                      ;Ptr to InfoData structure
  1035. ArgPtr     ds.l    1                      ;Ptr to DOSPacket args
  1036.  
  1037. RndSeed    ds.l    1                      ;Random seed
  1038.  
  1039. Width      ds.w    1                      ;Screen width
  1040. Length     ds.w    1                      ;Length of string
  1041. SizeFlag   ds.w    1                      ;Flag for window sizing
  1042.  
  1043. MyFlag     ds.w    1                      ;0=Empty/$80=Not empty
  1044. CharCnt    ds.w    1                      ;Count chars in formatted line
  1045.  
  1046. InputBuf   ds.b    160                    ;Current input line from console
  1047. LastIBuf   ds.b    160                    ;Last input line
  1048. ElizaBuf   ds.b    80                     ;Part of input line for response
  1049. MyBuf      ds.b    80                     ;Part of input if response = "your"
  1050. OutputBuf  ds.b    160                    ;Buffer for console output
  1051. AllBufLen  equ     *-InputBuf
  1052.  
  1053.            end
  1054.