Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1817 Albom 1
use32
2
org	0
3
db	'MENUET01'
4
dd	1
5
dd	_start
6
dd	_end
7
dd	_memory
8
dd	_stack
9
dd	_param
10
dd	0
11
 
12
_start:
13
 
14
	call lib_console_init
15
	push    caption
16
	push    -1
17
	push    -1
18
	push    -1
19
	push    -1
20
	call    [con_init]
21
 
22
 ;----------------------------------------------------;
23
 ; Program code starts here                           ;
24
 ;----------------------------------------------------;
25
        mov   dl,1                                    ; init dl to 1, reply paging
26
        call  [Clstext]                               ; Clear screen
27
        mov   esi,line1                               ; Load intro screen line adress
28
        call  [PrintString]                           ; Print it
29
        call  [WaitForKeyPress]                       ; Key press ends intro
30
        call  [Clstext]                               ; Clear screen
31
        mov   ax,0111h                                ; Write location in Dex title block
32
        mov   esi,Program_name                        ; What to write
33
        call  [SetCursorPos]                          ; Put cursor there
34
        call  [PrintString]                           ; Write title
35
        mov   ax,0400h                                ; Write location to start chat
36
        call  [SetCursorPos]                          ; Set it
37
        mov   al,2                                    ; Eliza text color
38
        call  [TextColor]                             ; Set it
39
        mov   esi,Message                             ; Intro Message
40
        call  [PrintString]                           ; Print it
41
userinput:
42
        call  prtblk                                  ; Add a blank line
43
        mov   al,3                                    ; User text color
44
        call  [TextColor]                             ; Set it
45
        call  [GetUserInput]                          ; Get sentance from user
46
        call  prtblk                                  ; Add line after input
47
        call  [UpperCase]                             ; Make user input caps
48
        mov   al,2                                    ; Eliza text color
49
        call  [TextColor]                             ; Set it
50
phr:
51
        push  edi                                     ; Save user input pointer
52
        mov   ebx,keywords                            ; Set keyword pointer
53
phr1:
54
        mov   al,[edi]                                ; Get char from user input
55
        inc   edi                                     ; Set pointer to next char
56
        inc   ebx                                     ; Set keyword pointer to next char
57
        mov   ah,[ebx]                                ; Get letter to test from keywords
58
        and   ah,127                                  ; Strip out bit 7 marker
59
        cmp   al,ah                                   ; Do the letters match?
60
        je    phr2                                    ; Jump if they do
61
phr1a:
62
        cmp   byte[ebx],128                           ; Was that the last letter of keyword?
63
        jnb   phr1b                                   ; Jump if it was
64
        inc   ebx                                     ; increment key word pointer to next letter
65
        jmp   phr1a                                   ; Jump back to see if this is the last letter
66
phr1b:
67
        add   ebx,5                                   ; Add 5 to get to next word past execution address
68
        cmp   byte[ebx],128                           ; No more keywords?
69
        je    phr3                                    ; Jump to maybe inc user input
70
        dec   ebx                                     ; Correct for pre-increment
71
        pop   edi                                     ; Restore user input pointer
72
        push  edi                                     ; Save user input pointer
73
        jmp   phr1                                    ; Check next keyword for a match
74
phr2:
75
        cmp   byte[ebx],128                           ; Last letter of a keyword?
76
        jb    phr1                                    ; No check some more
77
        inc   ebx                                     ; ebx -> is the execution address
78
        pop   eax                                     ; Clear stored pointer from stack
79
        jmp   dword[ebx]                              ; Goto line stored with keyword
80
phr3:   pop   edi                                     ; Restore input pointer
81
        inc   edi                                     ; Move to next letter of user input
82
        cmp   byte[edi],0                             ; Nothing left to check?
83
        je    rep29                                   ; Go to sorry message
84
        jmp   phr                                     ; Try some more
85
rep1:
86
        mov   esi,rep1a                               ; Load reply
87
        cmp   dl,2                                    ; are we repeating our self
88
        jna   printmore                               ; reply with user text
89
        mov   esi,rep1b                               ; Load reply
90
        cmp   dl,4                                    ; are we repeating our self
91
        jna   printmore                               ; reply with user text
92
        mov   esi,rep1c                               ; Load reply
93
        cmp   dl,6                                    ; are we repeating our self
94
        jna   printmore                               ; reply with user text
95
        mov   esi,rep1b                               ; Load reply
96
        cmp   dl,8                                    ; are we repeating our self
97
        jna   printmore                               ; reply with user text
98
        mov   esi,rep1c                               ; Load reply
99
        jmp   printmore                               ; reply with user text
100
rep2:
101
        mov   esi,rep2a                               ; Load reply
102
        cmp   dl,2                                    ; are we repeating our self
103
        jna   printmore                               ; reply with user text
104
        mov   esi,rep2b                               ; Load reply
105
        cmp   dl,4                                    ; are we repeating our self
106
        jna   printmore                               ; reply with user text
107
        mov   esi,rep2a                               ; Load reply
108
        cmp   dl,6                                    ; are we repeating our self
109
        jna   printmore                               ; reply with user text
110
        mov   esi,rep2b                               ; Load reply
111
        cmp   dl,8                                    ; are we repeating our self
112
        jna   printmore                               ; reply with user text
113
        mov   esi,rep2a                               ; Load reply
114
        cmp   dl,9                                    ; are we repeating our self
115
        jna   printmore                               ; reply with user text
116
        mov   esi,rep2b                               ; Load reply
117
        jmp   printmore                               ; reply with user text
118
rep3:
119
        mov   esi,rep3a                               ; Load reply
120
        cmp   dl,2                                    ; are we repeating our self
121
        jna   printmore                               ; reply with user text
122
        mov   esi,rep3b                               ; Load reply
123
        cmp   dl,4                                    ; are we repeating our self
124
        jna   printmore                               ; reply with user text
125
        mov   esi,rep3c                               ; Load reply
126
        cmp   dl,6                                    ; are we repeating our self
127
        jna   printmore                               ; reply with user text
128
        mov   esi,rep3d                               ; Load reply
129
        cmp   dl,8                                    ; are we repeating our self
130
        jna   printmore                               ; reply with user text
131
        mov   esi,rep3b                               ; Load reply
132
        cmp   dl,9                                    ; are we repeating our self
133
        jna   printmore                               ; reply with user text
134
        mov   esi,rep3c                               ; Load reply
135
        jmp   printmore                               ; reply with user text
136
rep4:
137
        mov   esi,rep4a                               ; Load reply
138
        cmp   dl,2                                    ; are we repeating our self
139
        jna   printmore                               ; reply with user text
140
        mov   esi,rep4b                               ; Load reply
141
        cmp   dl,4                                    ; are we repeating our self
142
        jna   printmore                               ; reply with user text
143
        mov   esi,rep4c                               ; Load reply
144
        cmp   dl,6                                    ; are we repeating our self
145
        jna   printmore                               ; reply with user text
146
        mov   esi,rep4d                               ; Load reply
147
        cmp   dl,8                                    ; are we repeating our self
148
        jna   printless                               ; reply with user text
149
        mov   esi,rep4b                               ; Load reply
150
        cmp   dl,9                                    ; are we repeating our self
151
        jna   printmore                               ; reply with user text
152
        mov   esi,rep4c                               ; Load reply
153
        jmp   printmore                               ; reply with user text
154
rep5:
155
        mov   esi,rep5a                               ; Load reply
156
        cmp   dl,2                                    ; are we repeating our self
157
        jna   printless                               ; reply with user text
158
        mov   esi,rep5b                               ; Load reply
159
        cmp   dl,4                                    ; are we repeating our self
160
        jna   printmore                               ; reply with user text
161
        mov   esi,rep5c                               ; Load reply
162
        cmp   dl,6                                    ; are we repeating our self
163
        jna   printmore                               ; reply with user text
164
        mov   esi,rep5b                               ; Load reply
165
        cmp   dl,8                                    ; are we repeating our self
166
        jna   printmore                               ; reply with user text
167
        mov   esi,rep5c                               ; Load reply
168
        jmp   printmore                               ; reply with user text
169
rep6:
170
        mov   esi,rep6a                               ; Load reply
171
        cmp   dl,2                                    ; are we repeating our self
172
        jna   printmore                               ; reply with user text
173
        mov   esi,rep6b                               ; Load reply
174
        cmp   dl,4                                    ; are we repeating our self
175
        jna   printmore                               ; reply with user text
176
        mov   esi,rep6c                               ; Load reply
177
        cmp   dl,6                                    ; are we repeating our self
178
        jna   printmore                               ; reply with user text
179
        mov   esi,rep6b                               ; Load reply
180
        cmp   dl,8                                    ; are we repeating our self
181
        jna   printmore                               ; reply with user text
182
        mov   esi,rep6c                               ; Load reply
183
        jmp   printmore                               ; reply with user text
184
rep7:
185
        mov   esi,rep7a                               ; Load reply
186
        cmp   dl,2                                    ; are we repeating our self
187
        jna   printmore                               ; reply with user text
188
        mov   esi,rep7b                               ; Load reply
189
        cmp   dl,4                                    ; are we repeating our self
190
        jna   printmore                               ; reply with user text
191
        mov   esi,rep7a                               ; Load reply
192
        cmp   dl,6                                    ; are we repeating our self
193
        jna   printmore                               ; reply with user text
194
        mov   esi,rep7b                               ; Load reply
195
        cmp   dl,8                                    ; are we repeating our self
196
        jna   printmore                               ; reply with user text
197
        mov   esi,rep7a                               ; Load reply
198
        cmp   dl,9                                    ; are we repeating our self
199
        jna   printmore                               ; reply with user text
200
        mov   esi,rep7b                               ; Load reply
201
        jmp   printmore                               ; reply with user text
202
rep8:
203
        mov   esi,rep8a                               ; Load reply
204
        cmp   dl,2                                    ; are we repeating our self
205
        jna   printmore                               ; reply with user text
206
        mov   esi,rep8b                               ; Load reply
207
        cmp   dl,4                                    ; are we repeating our self
208
        jna   printmore                               ; reply with user text
209
        mov   esi,rep8c                               ; Load reply
210
        cmp   dl,6                                    ; are we repeating our self
211
        jna   printmore                               ; reply with user text
212
        mov   esi,rep8b                               ; Load reply
213
        cmp   dl,8                                    ; are we repeating our self
214
        jna   printmore                               ; reply with user text
215
        mov   esi,rep8c                               ; Load reply
216
        jmp   printmore                               ; reply with user text
217
rep9:
218
        mov   esi,rep9a                               ; Load reply
219
        cmp   dl,2                                    ; are we repeating our self
220
        jna   printmore                               ; reply with user text
221
        mov   esi,rep9b                               ; Load reply
222
        cmp   dl,4                                    ; are we repeating our self
223
        jna   printmore                               ; reply with user text
224
        mov   esi,rep9c                               ; Load reply
225
        cmp   dl,6                                    ; are we repeating our self
226
        jna   printmore                               ; reply with user text
227
        mov   esi,rep9b                               ; Load reply
228
        cmp   dl,8                                    ; are we repeating our self
229
        jna   printmore                               ; reply with user text
230
        mov   esi,rep9c                               ; Load reply
231
        jmp   printmore                               ; reply with user text
232
rep10:
233
        mov   esi,rep10a                              ; Load reply
234
        cmp   dl,2                                    ; are we repeating our self
235
        jna   printmore                               ; reply with user text
236
        mov   esi,rep10b                              ; Load reply
237
        cmp   dl,4                                    ; are we repeating our self
238
        jna   printmore                               ; reply with user text
239
        mov   esi,rep10c                              ; Load reply
240
        cmp   dl,6                                    ; are we repeating our self
241
        jna   printmore                               ; reply with user text
242
        mov   esi,rep10d                              ; Load reply
243
        cmp   dl,8                                    ; are we repeating our self
244
        jna   printmore                               ; reply with user text
245
        mov   esi,rep10c                              ; Load reply
246
        jmp   printmore                               ; reply with user text
247
rep11:
248
        mov   esi,rep11a                              ; Load reply
249
        cmp   dl,2                                    ; are we repeating our self
250
        jna   printless                               ; reply with user text
251
        mov   esi,rep11b                              ; Load reply
252
        cmp   dl,4                                    ; are we repeating our self
253
        jna   printmore                               ; reply with user text
254
        mov   esi,rep11c                              ; Load reply
255
        cmp   dl,6                                    ; are we repeating our self
256
        jna   printless                               ; reply with user text
257
        mov   esi,rep11b                              ; Load reply
258
        cmp   dl,8                                    ; are we repeating our self
259
        jna   printmore                               ; reply with user text
260
        mov   esi,rep11c                              ; Load reply
261
        jmp   printless                               ; reply with user text
262
rep12:
263
        mov   esi,rep12a                              ; Load reply
264
        cmp   dl,2                                    ; are we repeating our self
265
        jna   printmore                               ; reply with user text
266
        mov   esi,rep12b                              ; Load reply
267
        cmp   dl,4                                    ; are we repeating our self
268
        jna   printmore                               ; reply with user text
269
        mov   esi,rep12c                              ; Load reply
270
        cmp   dl,6                                    ; are we repeating our self
271
        jna   printmore                               ; reply with user text
272
        mov   esi,rep12d                              ; Load reply
273
        cmp   dl,8                                    ; are we repeating our self
274
        jna   printmore                               ; reply with user text
275
        mov   esi,rep12e                              ; Load reply
276
        jmp   printmore                               ; reply with user text
277
rep13:
278
        mov   esi,rep13a                              ; Load reply
279
        cmp   dl,1                                    ; are we repeating our self
280
        jna   printless                               ; reply with user text
281
        mov   esi,rep13b                              ; Load reply
282
        cmp   dl,2                                    ; are we repeating our self
283
        jna   printless                               ; reply with user text
284
        mov   esi,rep13c                              ; Load reply
285
        cmp   dl,3                                    ; are we repeating our self
286
        jna   printless                               ; reply with user text
287
        mov   esi,rep13d                              ; Load reply
288
        cmp   dl,4                                    ; are we repeating our self
289
        jna   printless                               ; reply with user text
290
        mov   esi,rep13e                              ; Load reply
291
        cmp   dl,5                                    ; are we repeating our self
292
        jna   printless                               ; reply with user text
293
        mov   esi,rep13f                              ; Load reply
294
        cmp   dl,6                                    ; are we repeating our self
295
        jna   printless                               ; reply with user text
296
        mov   esi,rep13g                              ; Load reply
297
        cmp   dl,7                                    ; are we repeating our self
298
        jna   printless                               ; reply with user text
299
        mov   esi,rep13h                              ; Load reply
300
        cmp   dl,8                                    ; are we repeating our self
301
        jna   printless                               ; reply with user text
302
        mov   esi,rep13i                              ; Load reply
303
        jmp   printless                               ; reply with user text
304
rep14:
305
        mov   esi,rep14a                              ; Load reply
306
        cmp   dl,2                                    ; are we repeating our self
307
        jna   printless                               ; reply with user text
308
        mov   esi,rep14b                              ; Load reply
309
        cmp   dl,4                                    ; are we repeating our self
310
        jna   printless                               ; reply with user text
311
        mov   esi,rep14a                              ; Load reply
312
        cmp   dl,6                                    ; are we repeating our self
313
        jna   printless                               ; reply with user text
314
        mov   esi,rep14b                              ; Load reply
315
        cmp   dl,8                                    ; are we repeating our self
316
        jna   printless                               ; reply with user text
317
        mov   esi,rep14a                              ; Load reply
318
        cmp   dl,9                                    ; are we repeating our self
319
        jna   printless                               ; reply with user text
320
        mov   esi,rep14b                              ; Load reply
321
        jmp   printless                               ; reply with user text
322
rep15:
323
        mov   esi,rep15a                              ; Load reply
324
        cmp   dl,2                                    ; are we repeating our self
325
        jna   printless                               ; reply with user text
326
        mov   esi,rep15b                              ; Load reply
327
        cmp   dl,4                                    ; are we repeating our self
328
        jna   printless                               ; reply with user text
329
        mov   esi,rep15c                              ; Load reply
330
        cmp   dl,6                                    ; are we repeating our self
331
        jna   printless                               ; reply with user text
332
        mov   esi,rep15d                              ; Load reply
333
        cmp   dl,8                                    ; are we repeating our self
334
        jna   printless                               ; reply with user text
335
        mov   esi,rep15c                              ; Load reply
336
        jmp   printless                               ; reply with user text
337
rep16:
338
        mov   esi,rep16a                              ; Load reply
339
        cmp   dl,2                                    ; are we repeating our self
340
        jna   printless                               ; reply with user text
341
        mov   esi,rep16b                              ; Load reply
342
        cmp   dl,4                                    ; are we repeating our self
343
        jna   printless                               ; reply with user text
344
        mov   esi,rep16c                              ; Load reply
345
        cmp   dl,6                                    ; are we repeating our self
346
        jna   printless                               ; reply with user text
347
        mov   esi,rep16d                              ; Load reply
348
        cmp   dl,8                                    ; are we repeating our self
349
        jna   printless                               ; reply with user text
350
        mov   esi,rep16c                              ; Load reply
351
        jmp   printless                               ; reply with user text
352
rep17:
353
        mov   esi,rep17a                              ; Load reply
354
        cmp   dl,2                                    ; are we repeating our self
355
        jna   printless                               ; reply with user text
356
        mov   esi,rep17b                              ; Load reply
357
        cmp   dl,4                                    ; are we repeating our self
358
        jna   printless                               ; reply with user text
359
        mov   esi,rep17c                              ; Load reply
360
        cmp   dl,6                                    ; are we repeating our self
361
        jna   printless                               ; reply with user text
362
        mov   esi,rep17d                              ; Load reply
363
        cmp   dl,8                                    ; are we repeating our self
364
        jna   printless                               ; reply with user text
365
        mov   esi,rep17c                              ; Load reply
366
        jmp   printless                               ; reply with user text
367
rep18:
368
        mov   esi,rep18a                              ; Load reply
369
        jmp   printless                               ; print reply
370
rep19:
371
        mov   esi,rep19a                              ; Load reply
372
        cmp   dl,2                                    ; are we repeating our self
373
        jna   printless                               ; reply with user text
374
        mov   esi,rep19b                              ; Load reply
375
        cmp   dl,4                                    ; are we repeating our self
376
        jna   printless                               ; reply with user text
377
        mov   esi,rep19c                              ; Load reply
378
        cmp   dl,6                                    ; are we repeating our self
379
        jna   printless                               ; reply with user text
380
        mov   esi,rep19d                              ; Load reply
381
        cmp   dl,8                                    ; are we repeating our self
382
        jna   printless                               ; reply with user text
383
        mov   esi,rep19e                              ; Load reply
384
        jmp   printless                               ; reply with user text
385
rep20:
386
        mov   esi,rep20a                              ; Load reply
387
        cmp   dl,2                                    ; are we repeating our self
388
        jna   printless                               ; reply with user text
389
        mov   esi,rep20b                              ; Load reply
390
        cmp   dl,4                                    ; are we repeating our self
391
        jna   printless                               ; reply with user text
392
        mov   esi,rep20c                              ; Load reply
393
        cmp   dl,6                                    ; are we repeating our self
394
        jna   printless                               ; reply with user text
395
        mov   esi,rep20d                              ; Load reply
396
        cmp   dl,8                                    ; are we repeating our self
397
        jna   printless                               ; reply with user text
398
        mov   esi,rep20e                              ; Load reply
399
        jmp   printless                               ; reply with user text
400
rep21:
401
        mov   esi,rep21a                              ; Load reply
402
        cmp   dl,2                                    ; are we repeating our self
403
        jna   printmore                               ; reply with user text
404
        mov   esi,rep21b                              ; Load reply
405
        cmp   dl,4                                    ; are we repeating our self
406
        jna   printmore                               ; reply with user text
407
        mov   esi,rep21a                              ; Load reply
408
        cmp   dl,6                                    ; are we repeating our self
409
        jna   printmore                               ; reply with user text
410
        mov   esi,rep21b                              ; Load reply
411
        cmp   dl,8                                    ; are we repeating our self
412
        jna   printmore                               ; reply with user text
413
        mov   esi,rep21a                              ; Load reply
414
        cmp   dl,9                                    ; are we repeating our self
415
        jna   printmore                               ; reply with user text
416
        mov   esi,rep21b                              ; Load reply
417
        jmp   printmore                               ; reply with user text
418
rep22:
419
        mov   esi,rep22a                              ; Load reply
420
        cmp   dl,2                                    ; are we repeating our self
421
        jna   printless                               ; reply with user text
422
        mov   esi,rep22b                              ; Load reply
423
        cmp   dl,4                                    ; are we repeating our self
424
        jna   printless                               ; reply with user text
425
        mov   esi,rep22c                              ; Load reply
426
        cmp   dl,6                                    ; are we repeating our self
427
        jna   printless                               ; reply with user text
428
        mov   esi,rep22d                              ; Load reply
429
        cmp   dl,8                                    ; are we repeating our self
430
        jna   printless                               ; reply with user text
431
        mov   esi,rep22c                              ; Load reply
432
        jmp   printless                               ; reply with user text
433
rep23:
434
        mov   esi,rep23a                              ; Load reply
435
        cmp   dl,2                                    ; are we repeating our self
436
        jna   printless                               ; reply with user text
437
        mov   esi,rep23b                              ; Load reply
438
        cmp   dl,4                                    ; are we repeating our self
439
        jna   printless                               ; reply with user text
440
        mov   esi,rep23c                              ; Load reply
441
        cmp   dl,6                                    ; are we repeating our self
442
        jna   printless                               ; reply with user text
443
        mov   esi,rep23b                              ; Load reply
444
        cmp   dl,8                                    ; are we repeating our self
445
        jna   printless                               ; reply with user text
446
        mov   esi,rep23c                              ; Load reply
447
        jmp   printless                               ; reply with user text
448
rep24:
449
        mov   esi,rep24a                              ; Load reply
450
        cmp   dl,1                                    ; are we repeating our self
451
        jna   printless                               ; reply with user text
452
        mov   esi,rep24b                              ; Load reply
453
        cmp   dl,2                                    ; are we repeating our self
454
        jna   printless                               ; reply with user text
455
        mov   esi,rep24c                              ; Load reply
456
        cmp   dl,3                                    ; are we repeating our self
457
        jna   printless                               ; reply with user text
458
        mov   esi,rep24d                              ; Load reply
459
        cmp   dl,4                                    ; are we repeating our self
460
        jna   printless                               ; reply with user text
461
        mov   esi,rep24e                              ; Load reply
462
        cmp   dl,5                                    ; are we repeating our self
463
        jna   printless                               ; reply with user text
464
        mov   esi,rep24f                              ; Load reply
465
        cmp   dl,6                                    ; are we repeating our self
466
        jna   printless                               ; reply with user text
467
        mov   esi,rep24g                              ; Load reply
468
        cmp   dl,7                                    ; are we repeating our self
469
        jna   printless                               ; reply with user text
470
        mov   esi,rep24c                              ; Load reply
471
        cmp   dl,8                                    ; are we repeating our self
472
        jna   printless                               ; reply with user text
473
        mov   esi,rep24f                              ; Load reply
474
        jmp   printless                               ; reply with user text
475
rep25:
476
        mov   esi,rep25a                              ; Load reply
477
        cmp   dl,2                                    ; are we repeating our self
478
        jna   printless                               ; reply with user text
479
        mov   esi,rep25b                              ; Load reply
480
        cmp   dl,4                                    ; are we repeating our self
481
        jna   printless                               ; reply with user text
482
        mov   esi,rep25c                              ; Load reply
483
        cmp   dl,6                                    ; are we repeating our self
484
        jna   printless                               ; reply with user text
485
        mov   esi,rep25b                              ; Load reply
486
        cmp   dl,8                                    ; are we repeating our self
487
        jna   printless                               ; reply with user text
488
        mov   esi,rep25c                              ; Load reply
489
        jmp   printless                               ; reply with user text
490
rep26:
491
        mov   esi,rep26a                              ; Load reply
492
        cmp   dl,1                                    ; are we repeating our self
493
        jna   printless                               ; reply with user text
494
        mov   esi,rep26b                              ; Load reply
495
        cmp   dl,2                                    ; are we repeating our self
496
        jna   printless                               ; reply with user text
497
        mov   esi,rep26c                              ; Load reply
498
        cmp   dl,3                                    ; are we repeating our self
499
        jna   printless                               ; reply with user text
500
        mov   esi,rep26d                              ; Load reply
501
        cmp   dl,4                                    ; are we repeating our self
502
        jna   printless                               ; reply with user text
503
        mov   esi,rep26e                              ; Load reply
504
        cmp   dl,5                                    ; are we repeating our self
505
        jna   printless                               ; reply with user text
506
        mov   esi,rep26f                              ; Load reply
507
        cmp   dl,6                                    ; are we repeating our self
508
        jna   printless                               ; reply with user text
509
        mov   esi,rep26e                              ; Load reply
510
        cmp   dl,7                                    ; are we repeating our self
511
        jna   printless                               ; reply with user text
512
        mov   esi,rep26c                              ; Load reply
513
        cmp   dl,8                                    ; are we repeating our self
514
        jna   printless                               ; reply with user text
515
        mov   esi,rep26f                              ; Load reply
516
        jmp   printless                               ; reply with user text
517
rep27:
518
        mov   esi,rep27a                              ; Load reply
519
        cmp   dl,1                                    ; are we repeating our self
520
        jna   printless                               ; reply with user text
521
        mov   esi,rep27b                              ; Load reply
522
        cmp   dl,2                                    ; are we repeating our self
523
        jna   printless                               ; reply with user text
524
        mov   esi,rep27c                              ; Load reply
525
        cmp   dl,3                                    ; are we repeating our self
526
        jna   printless                               ; reply with user text
527
        mov   esi,rep27d                              ; Load reply
528
        cmp   dl,4                                    ; are we repeating our self
529
        jna   printless                               ; reply with user text
530
        mov   esi,rep27e                              ; Load reply
531
        cmp   dl,5                                    ; are we repeating our self
532
        jna   printless                               ; reply with user text
533
        mov   esi,rep27f                              ; Load reply
534
        cmp   dl,6                                    ; are we repeating our self
535
        jna   printless                               ; reply with user text
536
        mov   esi,rep27g                              ; Load reply
537
        cmp   dl,7                                    ; are we repeating our self
538
        jna   printless                               ; reply with user text
539
        mov   esi,rep27c                              ; Load reply
540
        cmp   dl,8                                    ; are we repeating our self
541
        jna   printless                               ; reply with user text
542
        mov   esi,rep27f                              ; Load reply
543
        jmp   printless                               ; reply with user text
544
rep28:
545
        mov   esi,rep28a                              ; Load reply
546
        cmp   dl,2                                    ; are we repeating our self
547
        jna   printless                               ; reply with user text
548
        mov   esi,rep28b                              ; Load reply
549
        cmp   dl,4                                    ; are we repeating our self
550
        jna   printless                               ; reply with user text
551
        mov   esi,rep28c                              ; Load reply
552
        cmp   dl,6                                    ; are we repeating our self
553
        jna   printless                               ; reply with user text
554
        mov   esi,rep28d                              ; Load reply
555
        cmp   dl,8                                    ; are we repeating our self
556
        jna   printless                               ; reply with user text
557
        mov   esi,rep28e                              ; Load reply
558
        jmp   printless                               ; reply with user tex
559
 
560
rep29:
561
        mov   esi,rep29a                              ; Load reply
562
        cmp   dl,1                                    ; are we repeating our self
563
        jna   printless                               ; reply with user text
564
        mov   esi,rep29b                              ; Load reply
565
        cmp   dl,2                                    ; are we repeating our self
566
        jna   printless                               ; reply with user text
567
        mov   esi,rep29c                              ; Load reply
568
        cmp   dl,3                                    ; are we repeating our self
569
        jna   printless                               ; reply with user text
570
        mov   esi,rep29d                              ; Load reply
571
        cmp   dl,4                                    ; are we repeating our self
572
        jna   printless                               ; reply with user text
573
        mov   esi,rep29e                              ; Load reply
574
        cmp   dl,5                                    ; are we repeating our self
575
        jna   printless                               ; reply with user text
576
        mov   esi,rep29f                              ; Load reply
577
        cmp   dl,6                                    ; are we repeating our self
578
        jna   printless                               ; reply with user text
579
        mov   esi,rep29g                              ; Load reply
580
        cmp   dl,7                                    ; are we repeating our self
581
        jna   printless                               ; reply with user text
582
        mov   esi,rep29c                              ; Load reply
583
        cmp   dl,8                                    ; are we repeating our self
584
        jna   printless                               ; reply with user text
585
        mov   esi,rep29f                              ; Load reply
586
        jmp   printless                               ; reply with user text
587
rep30:
588
        mov   al,"A"
589
        call  [PrintChar]
590
        mov   al,"M"
591
        call  [PrintChar]
592
        jmp   printmore2
593
rep31:
594
        mov   al,"W"
595
        call  [PrintChar]
596
        mov   al,"A"
597
        call  [PrintChar]
598
        mov   al,"S"
599
        call  [PrintChar]
600
        jmp   printmore2
601
rep32:
602
        mov   al,"I"
603
        call  [PrintChar]
604
        jmp   printmore2
605
rep33:
606
        mov   al,"M"
607
        call  [PrintChar]
608
        mov   al,"Y"
609
        call  [PrintChar]
610
        jmp   printmore2
611
rep34:
612
        mov   al,"Y"
613
        call  [PrintChar]
614
        mov   al,"O"
615
        call  [PrintChar]
616
        mov   al,"U"
617
        call  [PrintChar]
618
        mov   al,"'"
619
        call  [PrintChar]
620
        mov   al,"V"
621
        call  [PrintChar]
622
        mov   al,"E"
623
        call  [PrintChar]
624
        jmp   printmore2
625
rep35:
626
        mov   al,"Y"
627
        call  [PrintChar]
628
        mov   al,"O"
629
        call  [PrintChar]
630
        mov   al,"U"
631
        call  [PrintChar]
632
        mov   al,"'"
633
        call  [PrintChar]
634
        mov   al,"R"
635
        call  [PrintChar]
636
        mov   al,"E"
637
        call  [PrintChar]
638
        jmp   printmore2
639
rep36:
640
        mov   al,"M"
641
        call  [PrintChar]
642
        mov   al,"E"
643
        call  [PrintChar]
644
        jmp   printmore2
645
rep37:
646
        jmp   printmore2
647
progmend:
648
        mov   esi,message2                            ; Load good bye message
649
        call  [PrintString]                           ; Print it
650
        mov   al,7
651
        call  [TextColor]                             ; Restore text color
652
 
653
 
654
	push	0
655
	call	[con_exit]
656
 
657
	mov	eax, -1
658
	int	0x40
659
        ret                                           ; Exit.
660
printmore:
661
        call [PrintString]                            ; Print rep phrase with rephrased user input
662
printmore2:
663
        push  edi                                     ; Save user input pointer
664
        mov   ebx,keyword2                            ; Set keyword pointer
665
rphr1:
666
        mov   al,[edi]                                ; Get char from user input
667
        inc   edi                                     ; Set pointer to next char
668
        inc   ebx                                     ; Set keyword pointer to next char
669
        mov   ah,[ebx]                                ; Get letter to test from keywords
670
        and   ah,127                                  ; Strip out bit 7 marker
671
        cmp   al,ah                                   ; Do the letters match?
672
        je    rphr2                                   ; Jump if they do
673
rphr1a:
674
        cmp   byte[ebx],128                           ; Was that the last letter of keyword?
675
        jnb   rphr1b                                  ; Jump if it was
676
        inc   ebx                                     ; increment key word pointer to next letter
677
        jmp   rphr1a                                  ; Jump back to see if this is the last letter
678
rphr1b:
679
        add   ebx,5                                   ; Add 5 to get to next word past execution address
680
        cmp   byte[ebx],128                           ; No more keywords?
681
        je    rphr3                                   ; Jump to maybe inc user input
682
        dec   ebx                                     ; Correct for pre-increment
683
        pop   edi                                     ; Restore user input pointer
684
        push  edi                                     ; Save user input pointer
685
        jmp   rphr1                                   ; Check next keyword for a match
686
rphr2:
687
        cmp   byte[ebx],128                           ; Last letter of a keyword?
688
        jb    rphr1                                   ; No check some more
689
        inc   ebx                                     ; ebx -> is the execution address
690
        pop   eax                                     ; Clear stored pointer from stack
691
        jmp   dword[ebx]                              ; Goto line stored with keyword
692
rphr3:
693
        pop   edi                                     ; Restore input pointer
694
        mov   al,[edi]                                ; load non key word letter
695
        call  [PrintCharCursor]                       ; Print it
696
        inc   edi                                     ; Move to next letter of user input
697
        cmp   byte[edi],0                             ; Nothing left to check?
698
        je    userinput                               ; Go to get another user input
699
        jmp   printmore2                              ; Try some more
700
printless:
701
        call  [PrintString]                           ; Print it
702
        call  prtblk                                  ; Add a blank line
703
        inc   dl                                      ; inc reply
704
        cmp   dl,10                                   ; is it to large
705
        jna   printless2                              ; jump if it's ok
706
        mov   dl,1                                    ; if not reset it to 1
707
printless2:
708
        jmp   userinput                               ; go back and get more user input
709
keywords:
710
        db   " "
711
        db   "CAN YO",213
712
        dd   rep1
713
        db   "CAN ",201
714
        dd   rep2
715
        db   "YOU AR",197
716
        dd   rep3
717
        db   "YOU'R",197
718
        dd   rep3
719
        db   "I DON'",212
720
        dd   rep4
721
        db   "I FEE",204
722
        dd   rep5
723
        db   "WHY DON'T YO",213
724
        dd   rep6
725
        db   "WHY CAN'T ",201
726
        dd   rep7
727
        db   "ARE YO",213
728
        dd   rep8
729
        db   "I CAN'",212
730
        dd   rep9
731
        db   "I A",205
732
        dd   rep10
733
        db   "I'M",160
734
        dd   rep10
735
        db   "YOU",160
736
        dd   rep11
737
        db   "I WAN",212
738
        dd   rep12
739
        db   "WHA",212
740
        dd   rep13
741
        db   "HO",215
742
        dd   rep13
743
        db   "WH",207
744
        dd   rep13
745
        db   "WHER",197
746
        dd   rep13
747
        db   "WHE",206
748
        dd   rep13
749
        db   "WH",217
750
        dd   rep13
751
        db   "NAM",197
752
        dd   rep14
753
        db   "CAUS",197
754
        dd   rep15
755
        db   "SORR",217
756
        dd   rep16
757
        db   "DREA",205
758
        dd   rep17
759
        db   "HELL",207
760
        dd   rep18
761
        db   "HI",160
762
        dd   rep18
763
        db   "MAYB",197
764
        dd   rep19
765
        db   " N",207
766
        dd   rep20
767
        db   "YOU",210
768
        dd   rep21
769
        db   "ALWAY",211
770
        dd   rep22
771
        db   "THIN",203
772
        dd   rep23
773
        db   "ALIK",197
774
        dd   rep24
775
        db   "YE",211
776
        dd   rep25
777
        db   "FRIEN",196
778
        dd   rep26
779
        db   "COMPUTE",210
780
        dd   rep27
781
        db   "CA",210
782
        dd   rep28
783
        db   "BY",197
784
        dd   progmend
785
        db   128
786
        dd   rep29
787
keyword2:
788
        db   " "
789
        db   "AR",197
790
        dd   rep30
791
        db   "WER",197
792
        dd   rep31
793
        db   "YOU",210
794
        dd   rep33
795
        db   "YO",213
796
        dd   rep32
797
        db   "I'V",197
798
        dd   rep34
799
        db   "I'",205
800
        dd   rep35
801
        db   "YO",213
802
        dd   rep36
803
        db   128
804
        dd   rep37
805
prtblk:
806
        mov  esi,blkprt
807
        call [PrintString]
808
        ret
809
 ;----------------------------------------------------;
810
 ; calltable include goes here.                       ;
811
 ;----------------------------------------------------;
812
blkprt:
813
        db   13,13
814
userline:
815
        dw   0
816
line1:
817
	db   13,10
818
        db   "                           *** ELIZA ***",13,10, 13,10
819
        db   "                    First writen by: Joseph Weizenbaum ",13, 10, 13, 10
820
        db   "     MODIFIED FROM CYBER 175 AT UNIVERSITY OF ILLINOIS AT CHAMPAGNE",13, 10
821
        db   "                       BY JOHN SCHUGG JANUARY 1985",13, 10, 13, 10
822
        db   "                 Converted to asm for DexOS by Roboman 2007",13, 10
823
        db   "                Converted to asm for KolibriOS by Albom 2008",13, 10, 13, 10
824
        db   "                          HAVE ANY PROBLEMS ?",13, 10, 13, 10
825
        db   "                          LET ELIZA HELP YOU!",13, 10, 13, 10
826
        db   "                        TO STOP ELIZA TYPE 'bye'",13, 10, 13, 10
827
        db   "            (THIS VERSION WILL NOT RECORD YOUR CONVERSATIONS)",13, 10, 13, 10
828
        db   "                    < Press any key to continue...>",13, 10, 0
829
Program_name:
830
        db   "--** Dr. Eliza **--",0
831
Message:
832
        db   "HI!  I'M ELIZA.  WHAT'S YOUR PROBLEM?",0
833
message2:
834
        db  13,13,"Thanks for talking things over with Eliza, bye",13,13,0
835
rep1a:  db  "DON'T YOU BELIEVE THAT I CAN ",0
836
rep1b:  db  "PERHAPS YOU WOULD LIKE TO BE ABLE TO ",0
837
rep1c:  db  "YOU WANT ME TO BE ABLE TO ",0
838
rep2a:  db  "PERHAPS YOU DON'T WANT TO ",0
839
rep2b:  db  "DO YOU WANT TO BE ABLE TO ",0
840
rep3a:  db  "WHAT MAKES YOU THINK I AM ",0
841
rep3b:  db  "DOES IT PLEASE YOU TO BELIEVE I AM ",0
842
rep3c:  db  "PERHAPS YOU WOULD LIKE TO BE ",0
843
rep3d:  db  "DO YOU SOMETIMES WISH YOU WERE ",0
844
rep4a:  db  "DON'T YOU REALLY ",0
845
rep4b:  db  "WHY DON'T YOU ",0
846
rep4c:  db  "DO YOU WISH TO BE ABLE TO ",0
847
rep4d:  db  "DOES THAT TROUBLE YOU?",0
848
rep5a:  db  "TELL ME MORE ABOUT SUCH FEELINGS.",0
849
rep5b:  db  "DO YOU OFTEN FEEL ",0
850
rep5c:  db  "DO YOU ENJOY FEELING ",0
851
rep6a:  db  "DO YOU REALLY BELIEVE I DON'T ",0
852
rep6b:  db  "PERHAPS IN GOOD TIME I WILL ",0
853
rep6c:  db  "DO YOU WANT ME TO ",0
854
rep7a:  db  "DO YOU THINK YOU SHOULD BE ABLE TO ",0
855
rep7b:  db  "WHY CAN'T YOU ",0
856
rep8a:  db  "WHY ARE YOU INTERESTED IN WHETHER OR NOT I AM ",0
857
rep8b:  db  "WOULD YOU PREFER IF I WERE NOT ",0
858
rep8c:  db  "PERHAPS IN YOUR FANTASIES I AM ",0
859
rep9a:  db  "HOW DO YOU KNOW YOU CAN'T ",0
860
rep9b:  db  "HAVE YOU TRIED?",0
861
rep9c:  db  "PERHAPS YOU CAN NOW ",0
862
rep10a: db  "DID YOU COME TO ME BECAUSE YOU ARE ",0
863
rep10b: db  "HOW LONG HAVE YOU BEEN ",0
864
rep10c: db  "DO YOU BELIEVE IT IS NORMAL TO BE ",0
865
rep10d: db  "DO YOU ENJOY BEING ",0
866
rep11a: db  "WE WERE DISCUSSING YOU-- NOT ME.",0
867
rep11b: db  "OH, I ",0
868
rep11c: db  "YOU'RE NOT REALLY TALKING ABOUT ME, ARE YOU?",0
869
rep12a: db  "WHAT WOULD IT MEAN TO YOU IF YOU GOT ",0
870
rep12b: db  "WHY DO YOU WANT ",0
871
rep12c: db  "SUPPOSE YOU SOON GOT ",0
872
rep12d: db  "WHAT IF YOU NEVER GOT ",0
873
rep12e: db  "I SOMETIMES ALSO WANT ",0
874
rep13a: db  "WHY DO YOU ASK?",0
875
rep13b: db  "DOES THAT QUESTION INTEREST YOU?",0
876
rep13c: db  "WHAT ANSWER WOULD PLEASE YOU THE MOST?",0
877
rep13d: db  "WHAT DO YOU THINK?",0
878
rep13e: db  "ARE SUCH QUESTIONS ON YOUR MIND OFTEN?",0
879
rep13f: db  "WHAT IS IT THAT YOU REALLY WANT TO KNOW?",0
880
rep13g: db  "HAVE YOU ASKED ANYONE ELSE?",0
881
rep13h: db  "HAVE YOU ASKED SUCH QUESTIONS BEFORE?",0
882
rep13i: db  "WHAT ELSE COMES TO MIND WHEN YOU ASK THAT?",0
883
rep14a: db  "NAMES DON'T INTEREST ME.",0
884
rep14b: db  "I DON'T CARE ABOUT NAMES-- PLEASE GO ON.",0
885
rep15a: db  "IS THAT THE REAL REASON?",0
886
rep15b: db  "DON'T ANY OTHER REASONS COME TO MIND?",0
887
rep15c: db  "DOES THAT REASON EXPLAIN ANY THING ELSE?",0
888
rep15d: db  "WHAT OTHER REASONS MIGHT THERE BE?",0
889
rep16a: db  "PLEASE DON'T APOLOGIZE.",0
890
rep16b: db  "APOLOGIES ARE NOT NECESSARY.",0
891
rep16c: db  "WHAT FEELINGS DO YOU HAVE WHEN YOU APOLOGIZE?",0
892
rep16d: db  "DON'T BE SO DEFENSIVE!",0
893
rep17a: db  "WHAT DOES THAT DREAM SUGGEST TO YOU?",0
894
rep17b: db  "DO YOU DREAM OFTEN?",0
895
rep17c: db  "WHAT PERSONS APPEAR IN YOUR DREAMS?",0
896
rep17d: db  "ARE YOU DISTURBED BY YOUR DREAMS?",0
897
rep18a: db  "HOW DO YOU DO--PLEASE STATE YOUR PROBLEM.",0
898
rep19a: db  "YOU DON'T SEEM QUITE CERTAIN.",0
899
rep19b: db  "WHY THE UNCERTAIN TONE?",0
900
rep19c: db  "CAN'T YOU BE MORE POSITIVE?",0
901
rep19d: db  "YOU AREN'T SURE?",0
902
rep19e: db  "DON'T YOU KNOW?",0
903
rep20a: db  "ARE YOU SAYING NO JUST TO BE NEGATIVE?",0
904
rep20b: db  "YOU ARE BEING A BIT NEGATIVE.",0
905
rep20c: db  "WHY NOT?",0
906
rep20d: db  "ARE YOU SURE?",0
907
rep20e: db  "WHY NO?",0
908
rep21a: db  "WHY ARE YOU CONCERNED ABOUT MY ",0
909
rep21b: db  "WHAT ABOUT YOUR OWN ",0
910
rep22a: db  "CAN YOU THINK OF A SPECIFIC EXAMPLE?",0
911
rep22b: db  "WHEN?",0
912
rep22c: db  "WHAT ARE YOU THINKING OF?",0
913
rep22d: db  "REALLY, ALWAYS?",0
914
rep23a: db  "DO YOU REALLY THINK SO?",0
915
rep23b: db  "BUT YOU ARE NOT SURE YOU ",0
916
rep23c: db  "DO YOU DOUBT YOU ",0
917
rep24a: db  "IN WHAT WAY?",0
918
rep24b: db  "WHAT RESEMBLANCE DO YOU SEE?",0
919
rep24c: db  "WHAT DOES THE SIMILARITY SUGGEST TO YOU?",0
920
rep24d: db  "WHAT OTHER CONNECTIONS DO YOU SEE?",0
921
rep24e: db  "COULD THERE REALLY BE SOME CONNECTION?",0
922
rep24f: db  "HOW?",0
923
rep24g: db  "YOU SEEM QUITE POSITIVE.",0
924
rep25a: db  "ARE YOU SURE?",0
925
rep25b: db  "I SEE.",0
926
rep25c: db  "I UNDERSTAND.",0
927
rep26a: db  "WHY DO YOU BRING UP THE TOPIC OF FRIENDS?",0
928
rep26b: db  "DO YOUR FRIENDS WORRY YOU?",0
929
rep26c: db  "DO YOUR FRIENDS PICK ON YOU?",0
930
rep26d: db  "ARE YOU SURE YOU HAVE ANY FRIENDS?",0
931
rep26e: db  "DO YOU IMPOSE ON YOUR FRIENDS?",0
932
rep26f: db  "PERHAPS YOUR LOVE FOR FRIENDS WORRIES YOU?",0
933
rep27a: db  "DO COMPUTERS WORRY YOU?",0
934
rep27b: db  "ARE YOU TALKING ABOUT ME IN PARTICULAR?",0
935
rep27c: db  "ARE YOU FRIGHTENED BY MACHINES?",0
936
rep27d: db  "WHY DO YOU MENTION COMPUTERS?",0
937
rep27e: db  "WHAT DO YOU THINK MACHINES HAVE TO DO WITH YOUR PROBLEM?",0
938
rep27f: db  "DON'T YOU THINK COMPUTERS CAN HELP PEOPLE?",0
939
rep27g: db  "WHAT IS IT ABOUT MACHINES THAT WORRIES YOU?",0
940
rep28a: db  "OH, DO YOU LIKE CARS?",0
941
rep28b: db  "MY FAVORITE CAR IS A LAMBORGINI COUNTACH. WHAT IS YOUR FAVORITE CAR?",0
942
rep28c: db  "MY FAVORITE CAR COMPANY IS FERRARI.  WHAT IS YOURS?",0
943
rep28d: db  "DO YOU LIKE PORSCHES?",0
944
rep28e: db  "DO YOU LIKE PORSCHE TURBO CARRERAS?",0
945
rep29a: db  "SAY, DO YOU HAVE ANY PSYCHOLOGICAL PROBLEMS?",0
946
rep29b: db  "WHAT DOES THAT SUGGEST TO YOU?",0
947
rep29c: db  "I SEE.",0
948
rep29d: db  "I'M NOT SURE I UNDERSTAND YOU FULLY.",0
949
rep29e: db  "COME COME ELUCIDATE YOUR THOUGHTS.",0
950
rep29f: db  "CAN YOU ELABORATE ON THAT?",0
951
rep29g: db  "THAT IS QUITE INTERESTING.",0
952
 
953
include 'myConsole.inc'
954
include 'myDex.inc'
955
 
956
_param:
957
rb 256
958
 
959
_end:
960
 
961
align 32
962
rb 2048
963
_stack:
964
_memory: