Login
Back to forumSee the full topicGo to last reply

Posted By

Harry Potter
on 2022-12-08
08:39:49
 Re: AdvSkel65/128k Plus4/cc65: Hannes memory not loaded properly

I got the strings to display properly. happy I was loading a pointer from Hannes memory instead of directly. Now, in the first room, I'm getting garbage for all items but the first. sad Following are the code for the vLook verb:
void vLook (void)//char Itm1)
{
static unsigned char i;
static void (*func)();
//If an item is specified:
if (Itm1!=0xFF) {
//If it is available in the player inventory,
#ifdef __USEFARMEM__
if (SearchInvPlayer () || SearchInvRoom ())
{
//get string address and print help text.
if ((s=hidereadw((void*)&ItemPtr->Info))==0) {
printscr ("No help available for that item.");
return;
}
printtok (s); printcr ();
#else
if (SearchInvPlayer () || SearchInvRoom ())
{
//get string address and print help text.
if ((s=ItemPtr->Info)==0) {
printscr ("No help available for that item.");
return;
}
printscr (s);
#endif
} else {
printnoitem ();
}
return;
}
//Otherwise,
//get room information
CurRoomInv=Player.RoomInv[CRoom];
CRm=&Room[CRoom];
//print it,
#ifdef __USEFARMEM__
printtok ((char*)hidereadw((void*)&CRm->Desc));
//printc ('a');
//call the room handler
func=hidereadw((void*)&CRm->RoomHandler);
//printc ('b');
#else
printtok (CRm->Desc);
//call the room handler
func=(CRm->RoomHandler);
#endif
(*func) ();
printcr();
//and list room items.
for (i=0; i<8 && (Itm1=CurRoomInv<i>)!=0xFF;++i) {
#ifdef __USEFARMEM__
prints ("There is a ");
printitmname ();
printscr (" here.");
#else
prints ("There is a ");
printitmname ();
printscr (" here.");
#endif
}
//if (i) printcr();
}
[/code]and to print the item name:
[code]static void __fastcall__ printitmname (void)
{
//printu (Itm1); printc (' ');
#ifdef __USEFARMEM__
#ifdef __C128__
//bank1_print (bank1_readword((void*)&Item[Itm1].Name));
printtok (Item[Itm1].Name);
#elif defined __C64__
printtok (hidereadw((void*)&Item[/*CurRoomInv*/Itm1].Name));
#elif defined __PLUS4__ || defined __C128__
printtok (bank1_readword((void*)&Item[Itm1].Name));
#elif defined __ATARI__ || defined __APPLE2ENH__
printtok (aux_readword((void*)&Item[Itm1].Name));
#endif
#else
prints (Item[Itm1].Name);
#endif
}




Back to top


Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon