Console15, eliza, ScrV src added.

git-svn-id: svn://kolibrios.org@1817 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Albom 2011-01-30 17:53:46 +00:00
parent 3d31c6abab
commit 5646ab62dc
17 changed files with 2566 additions and 0 deletions

View File

@ -0,0 +1,33 @@
format MS COFF
public Start
extrn Memory
extrn hEnd
extrn _kol_main
section ".text" code
db "MENUET01"
dd 1, Start, hEnd, Memory, hStack, 0, 0
Start:
; èíèöèàëèçàöèÿ êó÷è
mov eax, 68
mov ebx, 11
int 0x40
; âûçîâ ãëàâíîé ïðîöåäóðû
mov eax, _kol_main
call eax
; çàâåðøåíèå ðàáîòû ïðîãðàììû
mov eax, -1
int 0x40
section ".bss"
rb 4096
hStack:

View File

@ -0,0 +1,192 @@
#include "system/kolibri.h"
#include "system/stdlib.h"
#include "system/string.h"
char CONSOLE[] = "/sys/lib/console.obj";
#define MENTION _printf("Arrows to move left, up, right or down, or 'Esc' to exit: \n\n");
int** field;
int emptyCell_x, emptyCell_y;
char NOT_VALID_MOVE[] = {"Not valid move.\n\n"};
void (* _stdcall con_init)(unsigned w_w, unsigned w_h, unsigned s_w, unsigned s_h, const char* t);
void (* _cdecl _printf)(const char* format,...);
void (* _stdcall __exit)(char bCloseWindow);
int (* _stdcall _getch)(void);
//------------------
void init()
{
int x,y, i,j;
srand( kol_system_time_get() );
for(i=1; i<=15;)
{
x=rand()%4; y=rand()%4;
if(field[x][y] == 0) field[x][y] = i++;
}
for(i=0; i<4; i++) //to find the empty cell
for(j=0; j<4; j++)
if(field[j][i] == 0)
{
emptyCell_x=j; emptyCell_y = i; return;
}
}
//---------------------
void printField()
{
int i,j;
for(i=0; i<4; i++)
{
for(j=0; j<4; j++)
if(field[j][i]) _printf("%3d", field[j][i]);
else _printf(" _");
_printf("\n\n");
}
_printf("\n\n");
}
//-----------------------
int notEndYet()
{
int i,j;
for(i=0; i<3; i++)
for(j=0; j<4; j++)
if(field[j][i] != 4*i+j+1) return 0; //go on play
if(field[0][3] != 13) return 0;
return 1; //victory!
}
//--------------- allows move the emply cell
int move()
{
unsigned short c;
while(1)
{
c = _getch();
switch(c)
{
case 0x4d00:
if(emptyCell_x==0)
{
_printf(NOT_VALID_MOVE);
break;
}
else
{
field[emptyCell_x][emptyCell_y] = field[emptyCell_x-1][emptyCell_y];
field[emptyCell_x-1][emptyCell_y] = 0;
emptyCell_x--;
return 1;
}
case 0x5000:
if(emptyCell_y==0)
{
_printf(NOT_VALID_MOVE);
break;
}
else
{
field[emptyCell_x][emptyCell_y] = field[emptyCell_x][emptyCell_y-1];
field[emptyCell_x][emptyCell_y-1] = 0;
emptyCell_y--;
return 2;
}
case 0x4b00:
if(emptyCell_x==3)
{
_printf(NOT_VALID_MOVE);
break;
}
else
{
field[emptyCell_x][emptyCell_y] = field[emptyCell_x+1][emptyCell_y];
field[emptyCell_x+1][emptyCell_y] = 0;
emptyCell_x++;
return 3;
}
case 0x4800:
if(emptyCell_y==3)
{
_printf(NOT_VALID_MOVE);
break;
}
else
{
field[emptyCell_x][emptyCell_y] = field[emptyCell_x][emptyCell_y+1];
field[emptyCell_x][emptyCell_y+1] = 0;
emptyCell_y++;
return 4;
}
case 0x011b: __exit(1);
default: MENTION
}
}
}
//----------------- main function
void kol_main()
{
int i;
kol_struct_import *imp;
imp = kol_cofflib_load(CONSOLE);
if (imp == NULL)
kol_exit();
con_init = ( _stdcall void (*)(unsigned, unsigned, unsigned, unsigned, const char*))
kol_cofflib_procload (imp, "con_init");
if (con_init == NULL)
kol_exit();
_printf = ( _cdecl void (*)(const char*,...))
kol_cofflib_procload (imp, "con_printf");
if (_printf == NULL)
kol_exit();
__exit = ( _stdcall void (*)(char))
kol_cofflib_procload (imp, "con_exit");
if (__exit == NULL)
kol_exit();
_getch = ( _stdcall int (*)(void))
kol_cofflib_procload (imp, "con_getch2");
if (_getch == NULL)
kol_exit();
con_init(-1, -1, -1, -1, "Console15 by O.Bogomaz");
field = (int**)malloc(4 * sizeof(int*));
for( i=0; i<4; i++)
field[i] = (int*)malloc(4 * sizeof(int));
do
init();
while(notEndYet());
MENTION
printField();
while(!notEndYet())
{
move();
printField();
}
_printf("\nYou win!\n");
__exit(0);
}

View File

@ -0,0 +1,11 @@
del *.o
fasm asm_code.asm asm_code.o
gcc -c c_code.c
gcc -c system/kolibri.c
gcc -c system/stdlib.c
gcc -c system/string.c
ld -nostdlib -T kolibri.ld -o console15 asm_code.o kolibri.o stdlib.o string.o c_code.o
objcopy console15 -O binary
kpack console15
del *.o
pause

View File

@ -0,0 +1,20 @@
/*OUTPUT_FORMAT("binary")*/
ENTRY(Start)
SECTIONS
{
.text 0x000000:
{
*(.text)
}
.data : {
*(.data)
hEnd = . ;
}
.bss :
{
*(.bss)
}
Memory = . ;
}

View File

@ -0,0 +1,422 @@
#include "kolibri.h"
#include "string.h"
extern char KOL_PATH[256];
extern char KOL_PARAM[256];
extern char KOL_DIR[256];
void kol_exit()
{
asm ("int $0x40"::"a"(-1));
}
void kol_sleep(unsigned d)
{
asm ("int $0x40"::"a"(5), "b"(d));
}
void kol_wnd_define(unsigned x, unsigned y, unsigned w, unsigned h, unsigned c)
{
asm ("nop"::"a"(0), "b"(x*65536+w), "c"(y*65536+h), "d"(c));
asm ("movl $0xffffff, %esi \n int $0x40");
}
void kol_wnd_move(unsigned x, unsigned y)
{
asm ("nop"::"a"(67), "b"(x), "c"(y));
asm ("movl $-1, %edx \n movl $-1, %esi \n int $0x40");
}
void kol_event_mask(unsigned e)
{
asm ("int $0x40"::"a"(40), "b"(e));
}
unsigned kol_event_wait()
{
asm ("int $0x40"::"a"(10));
}
unsigned kol_event_wait_time(unsigned time)
{
asm ("int $0x40"::"a"(23), "b"(time));
}
unsigned kol_event_check()
{
asm ("int $0x40"::"a"(11));
}
void kol_paint_start()
{
asm ("int $0x40"::"a"(12), "b"(1));
}
void kol_paint_end()
{
asm ("int $0x40"::"a"(12), "b"(2));
}
void kol_paint_pixel(unsigned x, unsigned y, unsigned c)
{
asm ("int $0x40"::"a"(1), "b"(x), "c"(y), "d"(c));
}
void kol_paint_bar(unsigned x, unsigned y, unsigned w, unsigned h, unsigned c)
{
asm ("int $0x40"::"a"(13), "b"(x*65536+w), "c"(y*65536+h), "d"(c));
}
void kol_paint_line(unsigned x1, unsigned y1, unsigned x2, unsigned y2, unsigned c)
{
asm ("int $0x40"::"a"(38), "b"(x1*65536+x2), "c"(y1*65536+y2), "d"(c));
}
void kol_paint_string(unsigned x, unsigned y, char *s, unsigned c)
{
asm ("int $0x40"::"a"(4), "b"(x*65536+y), "c"(c), "d"(s));
}
void kol_paint_image(unsigned x, unsigned y, unsigned w, unsigned h, char *d)
{
asm ("int $0x40"::"a"(7), "c"(w*65536+h), "d"(x*65536+y), "b"(d));
}
void kol_paint_image_pal(unsigned x, unsigned y, unsigned w, unsigned h, char *d, unsigned *palette)
{
asm ("nop"::"c"(w*65536+h), "d"(x*65536+y), "b"(d));
asm ("nop"::"a"(palette));
asm ("movl %eax, %edi");
asm ("xor %eax, %eax");
asm ("movl %eax, %ebp");
asm ("pushl $8");
asm ("popl %esi");
asm ("int $0x40"::"a"(65));
}
unsigned kol_key_get()
{
asm ("int $0x40"::"a"(2));
}
unsigned kol_key_control()
{
asm ("int $0x40"::"a"(66), "b"(3));
}
void kol_key_lang_set(unsigned lang)
{
asm ("int $0x40"::"a"(21), "b"(2), "c"(9), "d"(lang));
}
unsigned kol_key_lang_get()
{
asm ("int $0x40"::"a"(26), "b"(2), "c"(9));
}
void kol_key_mode_set(unsigned mode)
{
asm ("int $0x40"::"a"(66), "b"(1), "c"(mode));
}
unsigned kol_key_mode_get()
{
asm ("int $0x40"::"a"(66), "b"(2));
}
unsigned kol_btn_get()
{
asm ("int $0x40"::"a"(17));
}
void kol_btn_define(unsigned x, unsigned y, unsigned w, unsigned h, unsigned d, unsigned c)
{
asm ("nop"::"b"(x*65536+w), "c"(y*65536+h), "d"(d));
asm ("nop"::"a"(c));
asm ("movl %eax, %esi");
asm ("int $0x40"::"a"(8));
}
void kol_btn_type(unsigned t)
{
asm ("int $0x40"::"a"(48), "b"(1), "c"(t));
}
void kol_wnd_caption(char *s)
{
asm ("int $0x40"::"a"(71), "b"(1), "c"(s));
}
unsigned kol_mouse_pos()
{
asm ("int $0x40"::"a"(37), "b"(0));
}
unsigned kol_mouse_posw()
{
asm ("int $0x40"::"a"(37), "b"(1));
}
unsigned kol_mouse_btn()
{
asm ("int $0x40"::"a"(37), "b"(2));
}
void kol_board_putc(char c)
{
asm ("int $0x40"::"a"(63), "b"(1), "c"(c));
}
void kol_board_puts(char *s)
{
unsigned i;
i = 0;
while (*(s+i))
{
asm ("int $0x40"::"a"(63), "b"(1), "c"(*(s+i)));
i++;
}
}
void kol_board_puti(int n)
{
char c;
int i = 0;
do
{
c = n % 10 + '0';
asm ("int $0x40"::"a"(63), "b"(1), "c"(c));
i++;
}
while ((n /= 10) > 0);
}
int kol_file_70(kol_struct70 *k)
{
asm ("int $0x40"::"a"(70), "b"(k));
}
kol_struct_import* kol_cofflib_load(char *name)
{
asm ("int $0x40"::"a"(68), "b"(19), "c"(name));
}
void* kol_cofflib_procload (kol_struct_import *imp, char *name)
{
int i;
for (i=0;;i++)
if ( NULL == ((imp+i) -> name))
break;
else
if ( 0 == strcmp(name, (imp+i)->name) )
return (imp+i)->data;
return NULL;
}
unsigned kol_cofflib_procnum (kol_struct_import *imp)
{
unsigned i, n;
for (i=n=0;;i++)
if ( NULL == ((imp+i) -> name))
break;
else
n++;
return n;
}
void kol_cofflib_procname (kol_struct_import *imp, char *name, unsigned n)
{
unsigned i;
*name = 0;
for (i=0;;i++)
if ( NULL == ((imp+i) -> name))
break;
else
if ( i == n )
{
strcpy(name, ((imp+i)->name));
break;
}
}
unsigned kol_system_cpufreq()
{
asm ("int $0x40"::"a"(18), "b"(5));
}
unsigned kol_system_mem()
{
asm ("int $0x40"::"a"(18), "b"(17));
}
unsigned kol_system_memfree()
{
asm ("int $0x40"::"a"(18), "b"(16));
}
unsigned kol_system_time_get()
{
asm ("int $0x40"::"a"(3));
}
unsigned kol_system_date_get()
{
asm ("int $0x40"::"a"(29));
}
unsigned kol_system_end(unsigned param)
{
asm ("int $0x40"::"a"(18), "b"(9), "c"(param));
}
void kol_path_file2dir(char *dir, char *fname)
{
unsigned i;
strcpy (dir, fname);
for ( i = strlen(dir);; --i)
if ( '/' == dir[i])
{
dir[i] = '\0';
return;
}
}
void kol_path_full(char *full, char *fname)
{
char temp[256];
switch (*fname)
{
case '/':
strncpy(temp, fname+1, 2);
temp[2]=0;
if ( (!strcmp("rd", temp)) || (!strcmp("hd", temp)) || (!strcmp("cd", temp)) )
strcpy (full, fname);
break;
case '.':
break;
default:
break;
};
}
void kol_screen_wait_rr()
{
asm ("int $0x40"::"a"(18), "b"(14));
}
void kol_screen_get_size(unsigned *w, unsigned *h)
{
unsigned size;
asm ("int $0x40":"=a"(size):"a"(14));
*w = size / 65536;
*h = size % 65536;
}
unsigned kol_skin_height()
{
asm ("int $0x40"::"a"(48), "b"(4));
}
unsigned kol_thread_start(unsigned start, unsigned stack)
{
asm ("int $0x40"::"a"(51), "b"(1), "c"(start), "d"(stack));
}
unsigned kol_time_tick()
{
asm ("int $0x40"::"a"(26), "b"(9));
}
unsigned kol_sound_speaker(char data[])
{
asm ("movl %0, %%esi"::"a"(data));
asm ("int $0x40"::"a"(55), "b"(55));
}
unsigned kol_process_info(unsigned slot, char buf1k[])
{
asm ("int $0x40"::"a"(9), "b"(buf1k), "c"(slot));
}
int kol_process_kill_pid(unsigned process)
{
asm ("int $0x40"::"a"(18), "b"(18), "c"(process));
}
int kol_kill_process(unsigned process)
{
asm ("int $0x40"::"a"(18), "b"(2), "c"(process));
}
void kol_get_kernel_ver(char buff16b[])
{
asm ("int $0x40"::"a"(18), "b"(13), "c"(buff16b));
}

View File

@ -0,0 +1,92 @@
#define NULL ((void*)0)
typedef struct
{
unsigned p00 __attribute__((packed));
unsigned p04 __attribute__((packed));
unsigned p08 __attribute__((packed));
unsigned p12 __attribute__((packed));
unsigned p16 __attribute__((packed));
char p20 __attribute__((packed));
char *p21 __attribute__((packed));
} kol_struct70 __attribute__((packed));
typedef struct
{
unsigned p00 __attribute__((packed));
char p04 __attribute__((packed));
char p05[3] __attribute__((packed));
unsigned p08 __attribute__((packed));
unsigned p12 __attribute__((packed));
unsigned p16 __attribute__((packed));
unsigned p20 __attribute__((packed));
unsigned p24 __attribute__((packed));
unsigned p28 __attribute__((packed));
unsigned p32[2] __attribute__((packed));
unsigned p40 __attribute__((packed));
} kol_struct_BDVK __attribute__((packed));
typedef struct
{
char *name __attribute__((packed));
void *data __attribute__((packed));
} kol_struct_import __attribute__((packed));
void kol_exit();
void kol_sleep(unsigned d);
void kol_wnd_define(unsigned x, unsigned y, unsigned w, unsigned h, unsigned c);
void kol_wnd_move(unsigned x, unsigned y);
void kol_wnd_caption(char *s);
void kol_event_mask(unsigned e);
unsigned kol_event_wait();
unsigned kol_event_wait_time(unsigned time);
unsigned kol_event_check();
void kol_paint_start();
void kol_paint_end();
void kol_paint_pixel(unsigned x, unsigned y, unsigned c);
void kol_paint_bar(unsigned x, unsigned y, unsigned w, unsigned h, unsigned c);
void kol_paint_line(unsigned x1, unsigned y1, unsigned x2, unsigned y2, unsigned c);
void kol_paint_string(unsigned x, unsigned y, char *s, unsigned c);
void kol_paint_image(unsigned x, unsigned y, unsigned w, unsigned h, char *d);
void kol_paint_image_pal(unsigned x, unsigned y, unsigned w, unsigned h, char *d, unsigned *palette);
unsigned kol_key_get();
unsigned kol_key_control();
void kol_key_lang_set(unsigned lang);
unsigned kol_key_lang_get();
void kol_key_mode_set(unsigned mode);
unsigned kol_key_mode_get();
void kol_btn_define(unsigned x, unsigned y, unsigned w, unsigned h, unsigned d, unsigned c);
unsigned kol_btn_get();
void kol_btn_type(unsigned t);
unsigned kol_mouse_pos();
unsigned kol_mouse_posw();
unsigned kol_mouse_btn();
void kol_board_putc(char c);
void kol_board_puts(char *s);
void kol_board_puti(int n);
int kol_file_70(kol_struct70 *k);
kol_struct_import* kol_cofflib_load(char *name);
void* kol_cofflib_procload (kol_struct_import *imp, char *name);
unsigned kol_cofflib_procnum (kol_struct_import *imp);
void kol_cofflib_procname (kol_struct_import *imp, char *name, unsigned n);
unsigned kol_system_end(unsigned param);
unsigned kol_system_cpufreq();
unsigned kol_system_mem();
unsigned kol_system_memfree();
unsigned kol_system_time_get();
unsigned kol_system_date_get();
void kol_path_file2dir(char *dir, char *fname);
void kol_path_full(char *full, char *fname);
void kol_screen_wait_rr();
void kol_screen_get_size(unsigned *w, unsigned *h);
unsigned kol_skin_height();
unsigned kol_thread_start(unsigned start, unsigned stack);
unsigned kol_time_tick();
unsigned kol_sound_speaker(char data[]);
unsigned kol_process_info(unsigned slot, char buf1k[]);
int kol_process_kill_pid(unsigned process);
void kol_get_kernel_ver(char buff16b[]);
int kol_kill_process(unsigned process);

View File

@ -0,0 +1,33 @@
unsigned int seed_o = 0x45168297;
void srand (unsigned seed)
{
seed_o = seed;
}
int rand (void)
{
seed_o = seed_o * 0x15a4e35 + 1;
return(seed_o >> 16);
}
void* malloc(unsigned s)
{
asm ("int $0x40"::"a"(68), "b"(12), "c"(s) );
}
void free(void *p)
{
asm ("int $0x40"::"a"(68), "b"(13), "c"(p) );
}
void* realloc(void *p, unsigned s)
{
asm ("int $0x40"::"a"(68), "b"(12), "c"(p), "d"(s) );
}

View File

@ -0,0 +1,14 @@
#define RAND_MAX 0x7FFFU
#define isspace(c) ((c)==' ')
#define abs(i) (((i)<0)?(-(i)):(i))
#define random(num) ((rand()*(num))/((RAND_MAX+1)))
void* malloc(unsigned size);
void free(void *pointer);
void* realloc(void* pointer, unsigned size);
void srand (unsigned seed);
int rand (void);

View File

@ -0,0 +1,124 @@
#include "string.h"
void* memset(void *mem, int c, unsigned size)
{
unsigned i;
for ( i = 0; i < size; i++ )
*((char *)mem+i) = (char) c;
return NULL;
}
void* memcpy(void *dst, const void *src, unsigned size)
{
unsigned i;
for ( i = 0; i < size; i++)
*(char *)(dst+i) = *(char *)(src+i);
return NULL;
}
int memcmp(const void* buf1, const void* buf2, int count)
{
int i;
for (i=0;i<count;i++)
{
if (*(unsigned char*)buf1<*(unsigned char*)buf2)
return -1;
if (*(unsigned char*)buf1>*(unsigned char*)buf2)
return 1;
}
return 0;
}
void strcat(char strDest[], char strSource[])
{
int i, j;
i = j = 0;
while (strDest[i] != '\0')
i++;
while ((strDest[i++] = strSource[j++]) != '\0')
;
}
int strcmp(const char* string1, const char* string2)
{
while (1)
{
if (*string1<*string2)
return -1;
if (*string1>*string2)
return 1;
if (*string1=='\0')
return 0;
string1++;
string2++;
}
}
void strcpy(char strDest[], const char strSource[])
{
unsigned i;
i = 0;
while ((strDest[i] = strSource[i]) != '\0')
i++;
}
char* strncpy(char *strDest, const char *strSource, unsigned n)
{
unsigned i;
if (! n )
return strDest;
i = 0;
while ((strDest[i] = strSource[i]) != '\0')
if ( (n-1) == i )
break;
else
i++;
return strDest;
}
int strlen(const char* string)
{
int i;
i=0;
while (*string++) i++;
return i;
}
char* strchr(const char* string, int c)
{
while (*string)
{
if (*string==c)
return (char*)string;
string++;
}
return (char*)0;
}

View File

@ -0,0 +1,15 @@
#ifndef NULL
#define NULL ((void*)0)
#endif
void* memset(void *mem, int c, unsigned size);
void* memcpy(void *dst, const void *src, unsigned size);
int memcmp(const void* buf1, const void* buf2, int count);
void strcat(char strDest[], char strSource[]);
int strcmp(const char* string1, const char* string2);
void strcpy(char strDest[], const char strSource[]);
char* strncpy(char *strDest, const char *strSource, unsigned n);
int strlen(const char* string);
char *strchr(const char* string, int c);

View File

@ -0,0 +1,3 @@
del eliza
fasm eliza.asm eliza
kpack eliza

View File

@ -0,0 +1,964 @@
use32
org 0
db 'MENUET01'
dd 1
dd _start
dd _end
dd _memory
dd _stack
dd _param
dd 0
_start:
call lib_console_init
push caption
push -1
push -1
push -1
push -1
call [con_init]
;----------------------------------------------------;
; Program code starts here ;
;----------------------------------------------------;
mov dl,1 ; init dl to 1, reply paging
call [Clstext] ; Clear screen
mov esi,line1 ; Load intro screen line adress
call [PrintString] ; Print it
call [WaitForKeyPress] ; Key press ends intro
call [Clstext] ; Clear screen
mov ax,0111h ; Write location in Dex title block
mov esi,Program_name ; What to write
call [SetCursorPos] ; Put cursor there
call [PrintString] ; Write title
mov ax,0400h ; Write location to start chat
call [SetCursorPos] ; Set it
mov al,2 ; Eliza text color
call [TextColor] ; Set it
mov esi,Message ; Intro Message
call [PrintString] ; Print it
userinput:
call prtblk ; Add a blank line
mov al,3 ; User text color
call [TextColor] ; Set it
call [GetUserInput] ; Get sentance from user
call prtblk ; Add line after input
call [UpperCase] ; Make user input caps
mov al,2 ; Eliza text color
call [TextColor] ; Set it
phr:
push edi ; Save user input pointer
mov ebx,keywords ; Set keyword pointer
phr1:
mov al,[edi] ; Get char from user input
inc edi ; Set pointer to next char
inc ebx ; Set keyword pointer to next char
mov ah,[ebx] ; Get letter to test from keywords
and ah,127 ; Strip out bit 7 marker
cmp al,ah ; Do the letters match?
je phr2 ; Jump if they do
phr1a:
cmp byte[ebx],128 ; Was that the last letter of keyword?
jnb phr1b ; Jump if it was
inc ebx ; increment key word pointer to next letter
jmp phr1a ; Jump back to see if this is the last letter
phr1b:
add ebx,5 ; Add 5 to get to next word past execution address
cmp byte[ebx],128 ; No more keywords?
je phr3 ; Jump to maybe inc user input
dec ebx ; Correct for pre-increment
pop edi ; Restore user input pointer
push edi ; Save user input pointer
jmp phr1 ; Check next keyword for a match
phr2:
cmp byte[ebx],128 ; Last letter of a keyword?
jb phr1 ; No check some more
inc ebx ; ebx -> is the execution address
pop eax ; Clear stored pointer from stack
jmp dword[ebx] ; Goto line stored with keyword
phr3: pop edi ; Restore input pointer
inc edi ; Move to next letter of user input
cmp byte[edi],0 ; Nothing left to check?
je rep29 ; Go to sorry message
jmp phr ; Try some more
rep1:
mov esi,rep1a ; Load reply
cmp dl,2 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep1b ; Load reply
cmp dl,4 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep1c ; Load reply
cmp dl,6 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep1b ; Load reply
cmp dl,8 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep1c ; Load reply
jmp printmore ; reply with user text
rep2:
mov esi,rep2a ; Load reply
cmp dl,2 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep2b ; Load reply
cmp dl,4 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep2a ; Load reply
cmp dl,6 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep2b ; Load reply
cmp dl,8 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep2a ; Load reply
cmp dl,9 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep2b ; Load reply
jmp printmore ; reply with user text
rep3:
mov esi,rep3a ; Load reply
cmp dl,2 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep3b ; Load reply
cmp dl,4 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep3c ; Load reply
cmp dl,6 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep3d ; Load reply
cmp dl,8 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep3b ; Load reply
cmp dl,9 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep3c ; Load reply
jmp printmore ; reply with user text
rep4:
mov esi,rep4a ; Load reply
cmp dl,2 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep4b ; Load reply
cmp dl,4 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep4c ; Load reply
cmp dl,6 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep4d ; Load reply
cmp dl,8 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep4b ; Load reply
cmp dl,9 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep4c ; Load reply
jmp printmore ; reply with user text
rep5:
mov esi,rep5a ; Load reply
cmp dl,2 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep5b ; Load reply
cmp dl,4 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep5c ; Load reply
cmp dl,6 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep5b ; Load reply
cmp dl,8 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep5c ; Load reply
jmp printmore ; reply with user text
rep6:
mov esi,rep6a ; Load reply
cmp dl,2 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep6b ; Load reply
cmp dl,4 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep6c ; Load reply
cmp dl,6 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep6b ; Load reply
cmp dl,8 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep6c ; Load reply
jmp printmore ; reply with user text
rep7:
mov esi,rep7a ; Load reply
cmp dl,2 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep7b ; Load reply
cmp dl,4 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep7a ; Load reply
cmp dl,6 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep7b ; Load reply
cmp dl,8 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep7a ; Load reply
cmp dl,9 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep7b ; Load reply
jmp printmore ; reply with user text
rep8:
mov esi,rep8a ; Load reply
cmp dl,2 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep8b ; Load reply
cmp dl,4 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep8c ; Load reply
cmp dl,6 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep8b ; Load reply
cmp dl,8 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep8c ; Load reply
jmp printmore ; reply with user text
rep9:
mov esi,rep9a ; Load reply
cmp dl,2 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep9b ; Load reply
cmp dl,4 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep9c ; Load reply
cmp dl,6 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep9b ; Load reply
cmp dl,8 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep9c ; Load reply
jmp printmore ; reply with user text
rep10:
mov esi,rep10a ; Load reply
cmp dl,2 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep10b ; Load reply
cmp dl,4 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep10c ; Load reply
cmp dl,6 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep10d ; Load reply
cmp dl,8 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep10c ; Load reply
jmp printmore ; reply with user text
rep11:
mov esi,rep11a ; Load reply
cmp dl,2 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep11b ; Load reply
cmp dl,4 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep11c ; Load reply
cmp dl,6 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep11b ; Load reply
cmp dl,8 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep11c ; Load reply
jmp printless ; reply with user text
rep12:
mov esi,rep12a ; Load reply
cmp dl,2 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep12b ; Load reply
cmp dl,4 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep12c ; Load reply
cmp dl,6 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep12d ; Load reply
cmp dl,8 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep12e ; Load reply
jmp printmore ; reply with user text
rep13:
mov esi,rep13a ; Load reply
cmp dl,1 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep13b ; Load reply
cmp dl,2 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep13c ; Load reply
cmp dl,3 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep13d ; Load reply
cmp dl,4 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep13e ; Load reply
cmp dl,5 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep13f ; Load reply
cmp dl,6 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep13g ; Load reply
cmp dl,7 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep13h ; Load reply
cmp dl,8 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep13i ; Load reply
jmp printless ; reply with user text
rep14:
mov esi,rep14a ; Load reply
cmp dl,2 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep14b ; Load reply
cmp dl,4 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep14a ; Load reply
cmp dl,6 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep14b ; Load reply
cmp dl,8 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep14a ; Load reply
cmp dl,9 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep14b ; Load reply
jmp printless ; reply with user text
rep15:
mov esi,rep15a ; Load reply
cmp dl,2 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep15b ; Load reply
cmp dl,4 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep15c ; Load reply
cmp dl,6 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep15d ; Load reply
cmp dl,8 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep15c ; Load reply
jmp printless ; reply with user text
rep16:
mov esi,rep16a ; Load reply
cmp dl,2 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep16b ; Load reply
cmp dl,4 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep16c ; Load reply
cmp dl,6 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep16d ; Load reply
cmp dl,8 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep16c ; Load reply
jmp printless ; reply with user text
rep17:
mov esi,rep17a ; Load reply
cmp dl,2 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep17b ; Load reply
cmp dl,4 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep17c ; Load reply
cmp dl,6 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep17d ; Load reply
cmp dl,8 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep17c ; Load reply
jmp printless ; reply with user text
rep18:
mov esi,rep18a ; Load reply
jmp printless ; print reply
rep19:
mov esi,rep19a ; Load reply
cmp dl,2 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep19b ; Load reply
cmp dl,4 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep19c ; Load reply
cmp dl,6 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep19d ; Load reply
cmp dl,8 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep19e ; Load reply
jmp printless ; reply with user text
rep20:
mov esi,rep20a ; Load reply
cmp dl,2 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep20b ; Load reply
cmp dl,4 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep20c ; Load reply
cmp dl,6 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep20d ; Load reply
cmp dl,8 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep20e ; Load reply
jmp printless ; reply with user text
rep21:
mov esi,rep21a ; Load reply
cmp dl,2 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep21b ; Load reply
cmp dl,4 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep21a ; Load reply
cmp dl,6 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep21b ; Load reply
cmp dl,8 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep21a ; Load reply
cmp dl,9 ; are we repeating our self
jna printmore ; reply with user text
mov esi,rep21b ; Load reply
jmp printmore ; reply with user text
rep22:
mov esi,rep22a ; Load reply
cmp dl,2 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep22b ; Load reply
cmp dl,4 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep22c ; Load reply
cmp dl,6 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep22d ; Load reply
cmp dl,8 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep22c ; Load reply
jmp printless ; reply with user text
rep23:
mov esi,rep23a ; Load reply
cmp dl,2 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep23b ; Load reply
cmp dl,4 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep23c ; Load reply
cmp dl,6 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep23b ; Load reply
cmp dl,8 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep23c ; Load reply
jmp printless ; reply with user text
rep24:
mov esi,rep24a ; Load reply
cmp dl,1 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep24b ; Load reply
cmp dl,2 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep24c ; Load reply
cmp dl,3 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep24d ; Load reply
cmp dl,4 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep24e ; Load reply
cmp dl,5 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep24f ; Load reply
cmp dl,6 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep24g ; Load reply
cmp dl,7 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep24c ; Load reply
cmp dl,8 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep24f ; Load reply
jmp printless ; reply with user text
rep25:
mov esi,rep25a ; Load reply
cmp dl,2 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep25b ; Load reply
cmp dl,4 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep25c ; Load reply
cmp dl,6 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep25b ; Load reply
cmp dl,8 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep25c ; Load reply
jmp printless ; reply with user text
rep26:
mov esi,rep26a ; Load reply
cmp dl,1 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep26b ; Load reply
cmp dl,2 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep26c ; Load reply
cmp dl,3 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep26d ; Load reply
cmp dl,4 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep26e ; Load reply
cmp dl,5 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep26f ; Load reply
cmp dl,6 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep26e ; Load reply
cmp dl,7 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep26c ; Load reply
cmp dl,8 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep26f ; Load reply
jmp printless ; reply with user text
rep27:
mov esi,rep27a ; Load reply
cmp dl,1 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep27b ; Load reply
cmp dl,2 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep27c ; Load reply
cmp dl,3 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep27d ; Load reply
cmp dl,4 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep27e ; Load reply
cmp dl,5 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep27f ; Load reply
cmp dl,6 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep27g ; Load reply
cmp dl,7 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep27c ; Load reply
cmp dl,8 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep27f ; Load reply
jmp printless ; reply with user text
rep28:
mov esi,rep28a ; Load reply
cmp dl,2 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep28b ; Load reply
cmp dl,4 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep28c ; Load reply
cmp dl,6 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep28d ; Load reply
cmp dl,8 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep28e ; Load reply
jmp printless ; reply with user tex
rep29:
mov esi,rep29a ; Load reply
cmp dl,1 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep29b ; Load reply
cmp dl,2 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep29c ; Load reply
cmp dl,3 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep29d ; Load reply
cmp dl,4 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep29e ; Load reply
cmp dl,5 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep29f ; Load reply
cmp dl,6 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep29g ; Load reply
cmp dl,7 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep29c ; Load reply
cmp dl,8 ; are we repeating our self
jna printless ; reply with user text
mov esi,rep29f ; Load reply
jmp printless ; reply with user text
rep30:
mov al,"A"
call [PrintChar]
mov al,"M"
call [PrintChar]
jmp printmore2
rep31:
mov al,"W"
call [PrintChar]
mov al,"A"
call [PrintChar]
mov al,"S"
call [PrintChar]
jmp printmore2
rep32:
mov al,"I"
call [PrintChar]
jmp printmore2
rep33:
mov al,"M"
call [PrintChar]
mov al,"Y"
call [PrintChar]
jmp printmore2
rep34:
mov al,"Y"
call [PrintChar]
mov al,"O"
call [PrintChar]
mov al,"U"
call [PrintChar]
mov al,"'"
call [PrintChar]
mov al,"V"
call [PrintChar]
mov al,"E"
call [PrintChar]
jmp printmore2
rep35:
mov al,"Y"
call [PrintChar]
mov al,"O"
call [PrintChar]
mov al,"U"
call [PrintChar]
mov al,"'"
call [PrintChar]
mov al,"R"
call [PrintChar]
mov al,"E"
call [PrintChar]
jmp printmore2
rep36:
mov al,"M"
call [PrintChar]
mov al,"E"
call [PrintChar]
jmp printmore2
rep37:
jmp printmore2
progmend:
mov esi,message2 ; Load good bye message
call [PrintString] ; Print it
mov al,7
call [TextColor] ; Restore text color
push 0
call [con_exit]
mov eax, -1
int 0x40
ret ; Exit.
printmore:
call [PrintString] ; Print rep phrase with rephrased user input
printmore2:
push edi ; Save user input pointer
mov ebx,keyword2 ; Set keyword pointer
rphr1:
mov al,[edi] ; Get char from user input
inc edi ; Set pointer to next char
inc ebx ; Set keyword pointer to next char
mov ah,[ebx] ; Get letter to test from keywords
and ah,127 ; Strip out bit 7 marker
cmp al,ah ; Do the letters match?
je rphr2 ; Jump if they do
rphr1a:
cmp byte[ebx],128 ; Was that the last letter of keyword?
jnb rphr1b ; Jump if it was
inc ebx ; increment key word pointer to next letter
jmp rphr1a ; Jump back to see if this is the last letter
rphr1b:
add ebx,5 ; Add 5 to get to next word past execution address
cmp byte[ebx],128 ; No more keywords?
je rphr3 ; Jump to maybe inc user input
dec ebx ; Correct for pre-increment
pop edi ; Restore user input pointer
push edi ; Save user input pointer
jmp rphr1 ; Check next keyword for a match
rphr2:
cmp byte[ebx],128 ; Last letter of a keyword?
jb rphr1 ; No check some more
inc ebx ; ebx -> is the execution address
pop eax ; Clear stored pointer from stack
jmp dword[ebx] ; Goto line stored with keyword
rphr3:
pop edi ; Restore input pointer
mov al,[edi] ; load non key word letter
call [PrintCharCursor] ; Print it
inc edi ; Move to next letter of user input
cmp byte[edi],0 ; Nothing left to check?
je userinput ; Go to get another user input
jmp printmore2 ; Try some more
printless:
call [PrintString] ; Print it
call prtblk ; Add a blank line
inc dl ; inc reply
cmp dl,10 ; is it to large
jna printless2 ; jump if it's ok
mov dl,1 ; if not reset it to 1
printless2:
jmp userinput ; go back and get more user input
keywords:
db " "
db "CAN YO",213
dd rep1
db "CAN ",201
dd rep2
db "YOU AR",197
dd rep3
db "YOU'R",197
dd rep3
db "I DON'",212
dd rep4
db "I FEE",204
dd rep5
db "WHY DON'T YO",213
dd rep6
db "WHY CAN'T ",201
dd rep7
db "ARE YO",213
dd rep8
db "I CAN'",212
dd rep9
db "I A",205
dd rep10
db "I'M",160
dd rep10
db "YOU",160
dd rep11
db "I WAN",212
dd rep12
db "WHA",212
dd rep13
db "HO",215
dd rep13
db "WH",207
dd rep13
db "WHER",197
dd rep13
db "WHE",206
dd rep13
db "WH",217
dd rep13
db "NAM",197
dd rep14
db "CAUS",197
dd rep15
db "SORR",217
dd rep16
db "DREA",205
dd rep17
db "HELL",207
dd rep18
db "HI",160
dd rep18
db "MAYB",197
dd rep19
db " N",207
dd rep20
db "YOU",210
dd rep21
db "ALWAY",211
dd rep22
db "THIN",203
dd rep23
db "ALIK",197
dd rep24
db "YE",211
dd rep25
db "FRIEN",196
dd rep26
db "COMPUTE",210
dd rep27
db "CA",210
dd rep28
db "BY",197
dd progmend
db 128
dd rep29
keyword2:
db " "
db "AR",197
dd rep30
db "WER",197
dd rep31
db "YOU",210
dd rep33
db "YO",213
dd rep32
db "I'V",197
dd rep34
db "I'",205
dd rep35
db "YO",213
dd rep36
db 128
dd rep37
prtblk:
mov esi,blkprt
call [PrintString]
ret
;----------------------------------------------------;
; calltable include goes here. ;
;----------------------------------------------------;
blkprt:
db 13,13
userline:
dw 0
line1:
db 13,10
db " *** ELIZA ***",13,10, 13,10
db " First writen by: Joseph Weizenbaum ",13, 10, 13, 10
db " MODIFIED FROM CYBER 175 AT UNIVERSITY OF ILLINOIS AT CHAMPAGNE",13, 10
db " BY JOHN SCHUGG JANUARY 1985",13, 10, 13, 10
db " Converted to asm for DexOS by Roboman 2007",13, 10
db " Converted to asm for KolibriOS by Albom 2008",13, 10, 13, 10
db " HAVE ANY PROBLEMS ?",13, 10, 13, 10
db " LET ELIZA HELP YOU!",13, 10, 13, 10
db " TO STOP ELIZA TYPE 'bye'",13, 10, 13, 10
db " (THIS VERSION WILL NOT RECORD YOUR CONVERSATIONS)",13, 10, 13, 10
db " < Press any key to continue...>",13, 10, 0
Program_name:
db "--** Dr. Eliza **--",0
Message:
db "HI! I'M ELIZA. WHAT'S YOUR PROBLEM?",0
message2:
db 13,13,"Thanks for talking things over with Eliza, bye",13,13,0
rep1a: db "DON'T YOU BELIEVE THAT I CAN ",0
rep1b: db "PERHAPS YOU WOULD LIKE TO BE ABLE TO ",0
rep1c: db "YOU WANT ME TO BE ABLE TO ",0
rep2a: db "PERHAPS YOU DON'T WANT TO ",0
rep2b: db "DO YOU WANT TO BE ABLE TO ",0
rep3a: db "WHAT MAKES YOU THINK I AM ",0
rep3b: db "DOES IT PLEASE YOU TO BELIEVE I AM ",0
rep3c: db "PERHAPS YOU WOULD LIKE TO BE ",0
rep3d: db "DO YOU SOMETIMES WISH YOU WERE ",0
rep4a: db "DON'T YOU REALLY ",0
rep4b: db "WHY DON'T YOU ",0
rep4c: db "DO YOU WISH TO BE ABLE TO ",0
rep4d: db "DOES THAT TROUBLE YOU?",0
rep5a: db "TELL ME MORE ABOUT SUCH FEELINGS.",0
rep5b: db "DO YOU OFTEN FEEL ",0
rep5c: db "DO YOU ENJOY FEELING ",0
rep6a: db "DO YOU REALLY BELIEVE I DON'T ",0
rep6b: db "PERHAPS IN GOOD TIME I WILL ",0
rep6c: db "DO YOU WANT ME TO ",0
rep7a: db "DO YOU THINK YOU SHOULD BE ABLE TO ",0
rep7b: db "WHY CAN'T YOU ",0
rep8a: db "WHY ARE YOU INTERESTED IN WHETHER OR NOT I AM ",0
rep8b: db "WOULD YOU PREFER IF I WERE NOT ",0
rep8c: db "PERHAPS IN YOUR FANTASIES I AM ",0
rep9a: db "HOW DO YOU KNOW YOU CAN'T ",0
rep9b: db "HAVE YOU TRIED?",0
rep9c: db "PERHAPS YOU CAN NOW ",0
rep10a: db "DID YOU COME TO ME BECAUSE YOU ARE ",0
rep10b: db "HOW LONG HAVE YOU BEEN ",0
rep10c: db "DO YOU BELIEVE IT IS NORMAL TO BE ",0
rep10d: db "DO YOU ENJOY BEING ",0
rep11a: db "WE WERE DISCUSSING YOU-- NOT ME.",0
rep11b: db "OH, I ",0
rep11c: db "YOU'RE NOT REALLY TALKING ABOUT ME, ARE YOU?",0
rep12a: db "WHAT WOULD IT MEAN TO YOU IF YOU GOT ",0
rep12b: db "WHY DO YOU WANT ",0
rep12c: db "SUPPOSE YOU SOON GOT ",0
rep12d: db "WHAT IF YOU NEVER GOT ",0
rep12e: db "I SOMETIMES ALSO WANT ",0
rep13a: db "WHY DO YOU ASK?",0
rep13b: db "DOES THAT QUESTION INTEREST YOU?",0
rep13c: db "WHAT ANSWER WOULD PLEASE YOU THE MOST?",0
rep13d: db "WHAT DO YOU THINK?",0
rep13e: db "ARE SUCH QUESTIONS ON YOUR MIND OFTEN?",0
rep13f: db "WHAT IS IT THAT YOU REALLY WANT TO KNOW?",0
rep13g: db "HAVE YOU ASKED ANYONE ELSE?",0
rep13h: db "HAVE YOU ASKED SUCH QUESTIONS BEFORE?",0
rep13i: db "WHAT ELSE COMES TO MIND WHEN YOU ASK THAT?",0
rep14a: db "NAMES DON'T INTEREST ME.",0
rep14b: db "I DON'T CARE ABOUT NAMES-- PLEASE GO ON.",0
rep15a: db "IS THAT THE REAL REASON?",0
rep15b: db "DON'T ANY OTHER REASONS COME TO MIND?",0
rep15c: db "DOES THAT REASON EXPLAIN ANY THING ELSE?",0
rep15d: db "WHAT OTHER REASONS MIGHT THERE BE?",0
rep16a: db "PLEASE DON'T APOLOGIZE.",0
rep16b: db "APOLOGIES ARE NOT NECESSARY.",0
rep16c: db "WHAT FEELINGS DO YOU HAVE WHEN YOU APOLOGIZE?",0
rep16d: db "DON'T BE SO DEFENSIVE!",0
rep17a: db "WHAT DOES THAT DREAM SUGGEST TO YOU?",0
rep17b: db "DO YOU DREAM OFTEN?",0
rep17c: db "WHAT PERSONS APPEAR IN YOUR DREAMS?",0
rep17d: db "ARE YOU DISTURBED BY YOUR DREAMS?",0
rep18a: db "HOW DO YOU DO--PLEASE STATE YOUR PROBLEM.",0
rep19a: db "YOU DON'T SEEM QUITE CERTAIN.",0
rep19b: db "WHY THE UNCERTAIN TONE?",0
rep19c: db "CAN'T YOU BE MORE POSITIVE?",0
rep19d: db "YOU AREN'T SURE?",0
rep19e: db "DON'T YOU KNOW?",0
rep20a: db "ARE YOU SAYING NO JUST TO BE NEGATIVE?",0
rep20b: db "YOU ARE BEING A BIT NEGATIVE.",0
rep20c: db "WHY NOT?",0
rep20d: db "ARE YOU SURE?",0
rep20e: db "WHY NO?",0
rep21a: db "WHY ARE YOU CONCERNED ABOUT MY ",0
rep21b: db "WHAT ABOUT YOUR OWN ",0
rep22a: db "CAN YOU THINK OF A SPECIFIC EXAMPLE?",0
rep22b: db "WHEN?",0
rep22c: db "WHAT ARE YOU THINKING OF?",0
rep22d: db "REALLY, ALWAYS?",0
rep23a: db "DO YOU REALLY THINK SO?",0
rep23b: db "BUT YOU ARE NOT SURE YOU ",0
rep23c: db "DO YOU DOUBT YOU ",0
rep24a: db "IN WHAT WAY?",0
rep24b: db "WHAT RESEMBLANCE DO YOU SEE?",0
rep24c: db "WHAT DOES THE SIMILARITY SUGGEST TO YOU?",0
rep24d: db "WHAT OTHER CONNECTIONS DO YOU SEE?",0
rep24e: db "COULD THERE REALLY BE SOME CONNECTION?",0
rep24f: db "HOW?",0
rep24g: db "YOU SEEM QUITE POSITIVE.",0
rep25a: db "ARE YOU SURE?",0
rep25b: db "I SEE.",0
rep25c: db "I UNDERSTAND.",0
rep26a: db "WHY DO YOU BRING UP THE TOPIC OF FRIENDS?",0
rep26b: db "DO YOUR FRIENDS WORRY YOU?",0
rep26c: db "DO YOUR FRIENDS PICK ON YOU?",0
rep26d: db "ARE YOU SURE YOU HAVE ANY FRIENDS?",0
rep26e: db "DO YOU IMPOSE ON YOUR FRIENDS?",0
rep26f: db "PERHAPS YOUR LOVE FOR FRIENDS WORRIES YOU?",0
rep27a: db "DO COMPUTERS WORRY YOU?",0
rep27b: db "ARE YOU TALKING ABOUT ME IN PARTICULAR?",0
rep27c: db "ARE YOU FRIGHTENED BY MACHINES?",0
rep27d: db "WHY DO YOU MENTION COMPUTERS?",0
rep27e: db "WHAT DO YOU THINK MACHINES HAVE TO DO WITH YOUR PROBLEM?",0
rep27f: db "DON'T YOU THINK COMPUTERS CAN HELP PEOPLE?",0
rep27g: db "WHAT IS IT ABOUT MACHINES THAT WORRIES YOU?",0
rep28a: db "OH, DO YOU LIKE CARS?",0
rep28b: db "MY FAVORITE CAR IS A LAMBORGINI COUNTACH. WHAT IS YOUR FAVORITE CAR?",0
rep28c: db "MY FAVORITE CAR COMPANY IS FERRARI. WHAT IS YOURS?",0
rep28d: db "DO YOU LIKE PORSCHES?",0
rep28e: db "DO YOU LIKE PORSCHE TURBO CARRERAS?",0
rep29a: db "SAY, DO YOU HAVE ANY PSYCHOLOGICAL PROBLEMS?",0
rep29b: db "WHAT DOES THAT SUGGEST TO YOU?",0
rep29c: db "I SEE.",0
rep29d: db "I'M NOT SURE I UNDERSTAND YOU FULLY.",0
rep29e: db "COME COME ELUCIDATE YOUR THOUGHTS.",0
rep29f: db "CAN YOU ELABORATE ON THAT?",0
rep29g: db "THAT IS QUITE INTERESTING.",0
include 'myConsole.inc'
include 'myDex.inc'
_param:
rb 256
_end:
align 32
rb 2048
_stack:
_memory:

View File

@ -0,0 +1,85 @@
lib_console_init:
; load DLL
mov eax, 68
mov ebx, 19
mov ecx, dll_name
int 0x40
test eax, eax
jz exit
; initialize import
mov edx, eax
mov esi, myimport
import_loop:
lodsd
test eax, eax
jz import_done
push edx
import_find:
mov ebx, [edx]
test ebx, ebx
jz exit;import_not_found
push eax
@@:
mov cl, [eax]
cmp cl, [ebx]
jnz import_find_next
test cl, cl
jz import_found
inc eax
inc ebx
jmp @b
import_find_next:
pop eax
add edx, 8
jmp import_find
import_found:
pop eax
mov eax, [edx+4]
mov [esi-4], eax
pop edx
jmp import_loop
import_done:
ret
exit:
or eax, -1
int 0x40
new_line db 13, 10, 0
dll_name db '/sys/lib/console.obj',0
caption db 'Eliza for KolibriOS', 0
align 4
myimport:
dll_start dd aStart
dll_ver dd aVersion
con_init dd aConInit
con_write_asciiz dd aConWriteAsciiz
con_exit dd aConExit
con_getch dd aCon_getch
con_cls dd aCon_cls
con_set_cursor_pos dd aCon_set_cursor_pos
con_gets dd aCon_gets
con_printf dd aCon_printf
dd 0
aStart db 'START',0
aVersion db 'version',0
aConInit db 'con_init',0
aConWriteAsciiz db 'con_write_asciiz',0
aConExit db 'con_exit',0
aCon_getch db 'con_getch',0
aCon_cls db 'con_cls',0
aCon_set_cursor_pos db 'con_set_cursor_pos',0
aCon_gets db 'con_gets',0
aCon_printf db 'con_printf',0
buffer rb 1024

View File

@ -0,0 +1,119 @@
; äëèíà ñòðîêè
macro strlen string
{
local .bcl,.ebcl
mov esi,string
mov ecx,0
.bcl:
cmp byte [esi+ecx],0
je .ebcl
inc ecx
jmp .bcl
.ebcl:
}
Clstext dd _Clstext
PrintString dd _PrintString
WaitForKeyPress dd _WaitForKeyPress
SetCursorPos dd _SetCursorPos
TextColor dd _TextColor
GetUserInput dd _GetUserInput
UpperCase dd _UpperCase
PrintChar dd _PrintChar
PrintCharCursor dd _PrintCharCursor
_Clstext:
call [con_cls]
ret
_PrintString:
pusha
push esi
call [con_write_asciiz]
popa
ret
_WaitForKeyPress:
pusha
call [con_getch]
popa
ret
_SetCursorPos:
pusha
mov ebx, eax
and ebx, 0xff
mov ecx, eax
and ecx, 0xff00
shr ecx, 8
push ecx
push ebx
call [con_set_cursor_pos]
popa
ret
_TextColor:
ret
_GetUserInput:
pusha
push new_line
call [con_write_asciiz]
push 256
push buffer
call [con_gets]
popa
mov edi, buffer
strlen edi
ret
_UpperCase: ; ñêîïèðîâàíî èç èñõîäíèêà DexOS
pushad
push es
; mov ax,sys_data ; <- ëèøíÿÿ äåòàëü :)
; mov es,ax
UcaseNextChar:
mov al,byte[es:edi]
cmp al,0
je UcaseDone
cmp al,0x61
jb DontUcaseChar
cmp al,0x7a
ja DontUcaseChar
sub al,0x20
mov byte[es:edi],al
DontUcaseChar:
inc edi
jmp UcaseNextChar
UcaseDone:
pop es
popad
ret
_PrintChar:
pusha
and eax, 0xff
push eax
push char_spec
call [con_printf]
add esp, 8
popa
ret
_PrintCharCursor:
pusha
and eax, 0xff
push eax
push char_spec
call [con_printf]
add esp, 8
popa
ret
char_spec db '%c',0

View File

@ -0,0 +1,3 @@
del scrv
fasm scrv.asm scrv
kpack scrv

View File

@ -0,0 +1,27 @@
=========================================
ScrV 0.2
=========================================
Simple program to view ZX Spectrum
screen files.
6912 bytes (*.scr, *.s)
and
6929 bytes (*.$c) files are supported now.
Ïðîñòàÿ ïðîãðàììà äëÿ ïðîñìîòðà
ôàéëîâ ýêðàíîâ ZX Spectrum.
Ïîääåðæèâàþòñÿ ôàéëû ðàçìåðîì
6912 áàéò (*.scr, *.s)
è
6929 áàéò (*.$c).
=========================================
author: Oleksandr Bogomaz
e-mail: albom85@yandex.ru
site: http://albom06.boom.ru/
=========================================

View File

@ -0,0 +1,409 @@
;=========================================
;
; Simple program to view ZX Spectrum
; screen files.
; 6912 bytes (*.scr, *.s)
; and
; 6929 bytes (*.$c) files are supported now.
; Ïðîñòàÿ ïðîãðàììà äëÿ ïðîñìîòðà
; ôàéëîâ ýêðàíîâ ZX Spectrum.
; Ïîääåðæèâàþòñÿ ôàéëû ðàçìåðîì
; 6912 áàéò (*.scr, *.s)
; è
; 6929 áàéò (*.$c).
;
; author: Oleksandr Bogomaz
; e-mail: albom85@yandex.ru
; site: http://albom06.boom.ru/
;
;=========================================
use32
org 0
db 'MENUET01'
dd 1
dd _start
dd _end
dd _memory
dd _stack
dd _param
dd 0
;=========================================
_start:
call mem_init
call file_getsize
call file_read
call file_convert
call window_draw
_event_wait:
mov eax, 10
int 0x40
cmp eax, 1
je __repaint_wnd
cmp eax, 2
je __key
cmp eax, 3
je __button
jmp _event_wait
__repaint_wnd:
call window_draw
jmp _event_wait
__key:
mov eax, 2
int 0x40
cmp ah, 27
jne _event_wait
jmp __end
jmp _event_wait
__button:
mov eax, 17
int 0x40
cmp ah, 1
jne _event_wait
__end:
call mem_free
mov eax, -1
int 0x40
;=========================================
window_draw:
mov eax, 12
mov ebx, 1
int 0x40
xor eax, eax
mov ebx, 10*65536+290
mov ecx, 10*65536+230
mov edx, 0x34ffffff
mov edi, _app_title
int 0x40
mov eax, 65
mov ebx, [dst]
mov ecx, 256*65536 + 192
mov edx, 5*65536 + 5
mov edi, _palette
mov esi, 8
mov ebp, 0
int 0x40
mov eax, 12
mov ebx, 2
int 0x40
ret
;=========================================
mem_init:
mov eax, 68
mov ebx, 11
int 0x40
mov eax, 68
mov ebx, 12
mov ecx, 6144
int 0x40
mov dword [src], eax
mov eax, 68
mov ebx, 12
mov ecx, 768
int 0x40
mov dword [atr], eax
mov eax, 68
mov ebx, 12
mov ecx, 256*192
int 0x40
mov dword [dst], eax
ret
;=========================================
mem_free:
mov eax, 68
mov ebx, 13
mov ecx, [src]
int 0x40
mov eax, 68
mov ebx, 13
mov ecx, [atr]
int 0x40
mov eax, 68
mov ebx, 13
mov ecx, [dst]
int 0x40
ret
;=========================================
file_read:
mov eax, 70
mov ebx, _in_f1
mov ecx, [src]
mov [_in_f1+16], ecx
int 0x40
mov eax, 70
mov ebx, _in_f2
mov ecx, [atr]
mov [_in_f2+16], ecx
int 0x40
ret
;=========================================
file_getsize:
mov eax, 68
mov ebx, 12
mov ecx, 0x5000
int 0x40
mov dword [tmp], eax
mov eax, 70
mov ebx, _in_f0
mov ecx, [tmp]
mov [_in_f0+16], ecx
int 0x40
mov [fsize], ebx
mov eax, 68
mov ebx, 13
mov ecx, [tmp]
int 0x40
cmp [fsize], 6929
jne _ok_size
mov dword [_in_f1+4], 17
mov dword [_in_f2+4], 6144+17
_ok_size:
ret
;=========================================
file_convert:
xor eax, eax
mov [I], eax
mov [J], eax
mov [K], eax
mov [L], eax
mov [M], eax
mov [N], eax
__J:
__I:
__K:
__L:
xor ebx, ebx
mov eax, [J]
shl eax, 0x0b ; eax * 2048
add ebx, eax
mov eax, [K]
shl eax, 0x08 ; eax * 256
add ebx, eax
mov eax, [I]
shl eax, 0x05 ; eax * 32
add ebx, eax
add ebx, [L]
add ebx, [src]
xor eax, eax
mov ah, [ebx]
mov [C], ah
__M:
mov ah, [C]
and ah, 128
shr ah, 7
mov [S], ah
xor ebx, ebx
mov eax, [J]
shl eax, 0x08 ; eax * 256
add ebx, eax
mov eax, [I]
shl eax, 0x05 ; eax * 32
add ebx, eax
add ebx, [L]
add ebx, [atr]
xor eax, eax
mov ah, [ebx]
mov [A], ah
and ah, 64
cmp ah, 64
jne __b0
mov [B], 8
jmp __OK_b
__b0:
mov [B], 0
__OK_b:
mov ah, [S]
cmp ah, 0
jne __1
mov ah, [A]
shr ah, 3
and ah, 7
add ah, [B]
jmp __OK_col
__1:
mov ah, [A]
and ah, 7
add ah, [B]
__OK_col:
mov ebx, [dst]
add ebx, [N]
mov [ebx], ah
inc [N]
shl [C], 1
inc [M]
cmp [M], 8
jne __M
mov [M], 0
inc [L]
cmp [L], 32
jne __L
mov [L], 0
inc [K]
cmp [K], 8
jne __K
mov [K], 0
inc [I]
cmp [I], 8
jne __I
mov [I], 0
inc [J]
cmp [J], 3
jne __J
ret
;=========================================
_app_title:
db 'ScrV 0.2 by O.Bogomaz', 0
_in_f0:
dd 0
dq 0
dd 0x5000
dd 0
db 0
dd _param
_in_f1:
dd 0
dq 0
dd 6144
dd 0
db 0
dd _param
_in_f2:
dd 0
dq 6144
dd 768
dd 0
db 0
dd _param
_palette:
dd 0 ; black
dd 0x000000b0 ; blue
dd 0x00b00000 ; red
dd 0x00b000b0 ; magenta
dd 0x0000b000 ; green
dd 0x0000b0b0 ; cyan
dd 0x00b0b000 ; yellow
dd 0x00b0b0b0 ; gray
dd 0 ; black
dd 0x000000ff ; light blue
dd 0x00ff0000 ; light red
dd 0x00ff00ff ; light magenta
dd 0x0000ff00 ; light green
dd 0x0000ffff ; light cyan
dd 0x00ffff00 ; light yellow
dd 0x00ffffff ; white
src dd 0
dst dd 0
atr dd 0
tmp dd 0
fsize dd 0
I dd 0
J dd 0
K dd 0
L dd 0
M dd 0
N dd 0
C db 0
A db 0
B db 0
S db 0
_param:
rb 256
_end:
align 32
rb 2048
_stack:
_memory:
;=========================================