Harry Potter Posted January 14 Share Posted January 14 Hi! I'm currently working on updating AdvSkelVic65 and AdvSkel65 and am having problems with the former: the Atari8 cartridge version is moving the screen slightly then displaying a blank screen, and the PET version, when I type a noun, displays garbage on the top-left corner of the screen. I think the former is due to my AtaSimpleIO library and the latter when the ScanWord() routine is called. The following is the code that handles identifying the noun: [code] static unsigned char __fastcall__ ScanWord (char* Dest) { #ifdef __DOFE3__ unsigned char j, c; for (j=0; (c=bankgetbyte((unsigned) Dest+j)) && c == (s[j])/*Sour[j]*/; ++j); // return c==0; #else __asm__ ( "\tjsr\tpopax\n" "\tsta\tptr4\n" "\tstx\tptr4+1\n" "\tldy\t#0\n" "@a01:\n" "\tlda\t(ptr4),y\n" "\tsta\t%v\n" "\tcmp\t(%v),y\n" "\tbne\t@a03\n" "\tlda\t%v\n" "\tbeq\t@a03\n" "\tiny\n" "\tbne\t@a01\n" "@a03:\n", c, s, c ); #endif return c==0; } //Searches for user-inputted item #. //Returns 0xFF if not found. unsigned char __fastcall__ FindItem (void) { #ifdef __DOFE3__ //s=&Input[CurPos]; //char* s; #endif /* Search for item in Input */ for (CurItem=0; CurItem < NumItems; ++CurItem) { #ifdef __DOFE3__ //printh (bankgetword(&Item[CurItem].Name)); printcr (); //s=bankgetword(&Item[CurItem].Name); if (ScanWord(bankgetword(&Item[CurItem].Name))) { ItemPtr=&Item[CurItem]; return CurItem; #else if (ScanWord((ItemPtr=&Item[CurItem])->Name)) { return CurItem; #endif } } /* Search item aliases */ // for (CurItem=0; CurItem < NumItemAliases; ++CurItem) // { // //if (ScanWord((char*)&ItemAlias[CurItem].Name, Input)) { // if (find2(ItemAlias[CurItem].Name))) { // return ItemAlias[CurItem].Num; // } // } /* Search directions */ //++brdrcol; //printc ('a'); for (CurItem = 0; CurItem < 4; ++CurItem) { if (ScanWord((char*)&RoomDir[CurItem])) { return CurItem | 160; } } return -1; } [/code]BTW, __DOFE3__ is for large cartridges and not applicable here. Quote Link to comment Share on other sites More sharing options...
Harry Potter Posted January 14 Author Share Posted January 14 I solved the bug: in a __fastcall__ function, I popped the stack early and exited using a C return command, and, apparently, this caused stack corruption. Now it works. I believe there's a similar bug in AdvSkel65, though. The symptom is, on the 128k Plus4 version, when I type in certain instructions, I get the monitor. This doesn't happen in the 64k version or most other versions. The 128k Plus4 version uses MemBankP4. I attached the crt0.s file I'm using and some functions responsible for parsing user input. plus4a_crt0_bank1.s advskel65 verbs_nouns.txt Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.