#if defined __USEFARMEM__ && !defined __C128__ //Compares player noun to given word. //Returns 1 if match an 0 otherwise. static unsigned char __fastcall__ ScanWord (char* Dest) { __asm__ ( //"\tjsr\tpopax\n" "\tsta\tptr4\n" "\tstx\tptr4+1\n" "\tldy\t#0\n" "\tsty\ttmp3\n" "@a01:\n" "\tldy\ttmp3\n" "\tlda\t(%v),y\n" "\tsta\t_c\n" //"\tcmp\t(ptr1),y\n" "\tlda\tptr4\n" "\tldx\tptr4+1\n" "\tjsr\t%v\n" "\tinc\ttmp3\n" "\tinc\tptr4\n" "\tbne\t@a02\n" "\tinc\tptr4+1\n" //"\tbne\t@a01\n" "@a02:\n" "\tcmp\t_c\n" "\tbne\t@a09\n" "\tlda\t_c\n" "\tbne\t@a01\n" // "\tlda\t_c\n" // "\tbne\t@a01\n" "@a09:\n", inx, hidereadb ); return c==0; } //Searches for the verb given at the start of Input and returns the verb #. //Returns 0xFF if not found. unsigned char FindVerb (void) { static unsigned char c, d; j=0; for (; j < NumVerbs; ++j) { //printh (hidereadw((void*)&Verb[j].Name)); printcr(); for (CurPos=0; #ifdef __C128__ (d=Input[CurPos]) == (c=(Verb[j].Name[CurPos])) && #else (c=(hidereadb(hidereadw((void*)&Verb[j].Name)+CurPos))) && (d=Input[CurPos]) == c && #endif d/*Input[CurPos]*/ >= 33 && c ; ++CurPos); if (Input[CurPos]<33 && c==0) { //CurPos=CurPos; return j; } } __asm__ ( "\tldx\t_CurPos\n" "a00:\n" "\tlda\t_Input,x\n" "\tcmp\t#33\n" "\tbcc\ta01\n" "\tinx\n" "\tbne\ta00\n" "a01:\n" "\tstx\t_CurPos\n" "\tlda\t#0\n" "\tsta\t_Input,x\n" ); return -1; } //Scan items for user input. unsigned char __fastcall__ FindItem (void) { inx=&Input[CurPos]; /* Search for item in Input */ for (CurItem=0; CurItem < NumItems; ++CurItem) { if (ScanWord(hidereadw((void*)&Item[CurItem].Name))) { //printc ('0'); getkey(); return CurItem; } } /* Search item aliases */ for (CurItem=0; CurItem < NumItemAliases; ++CurItem) { if (ScanWord(hidereadw((void*)(ita=&ItemAlias[CurItem])->Name))) { return hidereadb((void*)&ita->Num); } } /* Search item categories */ for (CurItem=0; CurItem < NumItemCate; ++CurItem) { if (ScanWord(hidereadw((void*)&ItemCate[CurItem].Name))) { return CurItem|128; } } /* Search directions */ for (CurItem = 0; CurItem < 4; ++CurItem) { if (ScanWord((char*)&RoomDir[CurItem])) { return CurItem | 160; } } return -1; }