AdvSkel65 bug in score board: room in wrong place?

4 posts / 0 new
Last post
Offline
Last seen: 3 months 3 weeks ago
Joined: Nov 12 2022 - 16:50
Posts: 202
AdvSkel65 bug in score board: room in wrong place?

Hi!  I am pretty close to getting my AdvSkel65 program ready for the next release.  I cleaned up the source code, removed a lot of unnecessary or redundant code and performed other optimizations,  Right now, I am in the middle of debugging it.  The current bug is that, while printing the score board, the room is displayed in the wrong place: it starts st the right-most character of the screen instead of the far left.  In my A2SimpleIO library, the tabx variable points to the current X cursor pos. on the screen.  Setting it to 0 and using gotox() don't work, but setting tabx to 1 does what it's supposed to do: set the cursor at the second column of the screen.  I don't know what's causing this.  Following is the code for the routine that prints the score board:

--------------------

//Displays current room name and score at top of screen.void DispScoreBoard (){/* Display status *///CBM version.#ifdef __CBM__//Get the current screen line; column is assumed to be 0.//wherey() shouldn't be needed; I need to optimize later.#if defined __PLUS4__ || defined __C128__    c=taby;#else    c=taby;#endif    //Home and set reverse mode.    //home2();    printc (0x13);    reverson();    //For the C128 (80 column version)#ifdef __C128__    //clear to row.    for (i=79; i; --i) printc (32);    //If using far memory, special memory access functions are needed.#ifdef __USEFARMEM__    //Display room name.    prints ("\x13Room: "); printh (hidereadw((void*)&CRm->Name));    //Display score at right edge of screen.    tabx=69; prints ("Score "); printu (Player.Score); printcr ();    //Using only Bank 0, access is more direct.#else    //Display room name.    prints ("\x13Room: "); prints (Room[CRoom].Name);    //Display score at right edge of screen.    tabx=69; prints ("Score "); printu (Player.Score); printcr ();#endif//40-column CBM computers:#else    //reverson();    //Clear status bar.    for (i=39; i; --i) printc (32);//If using far or hiddem memory#ifdef __USEFARMEM__    //Display room name.    prints ("\x13Room: "); printh (hidereadw((void*)&CRm->Name));    //Display score at right edge of screen.    tabx=29; prints ("Score "); printu (Player.Score); printcr ();//Otherwise:#else    //Display room name.    prints ("\x13Room: "); prints (CRm->Name);    //Display score at right edge of screen.    tabx=29; prints ("Score "); printu (Player.Score); printcr ();#endif#endif    //Return to row before the call to DispScoreBoard().    goline (c);//Atari8 version:#elif defined __ATARIXL__    //Preserve current cursor row; column is assumed to be 0.    c=wherey();    //Home the cursor.    gotoxy (0, 0);    //Clear the score board with reversed spaces.    for (i=39; i; --i) printc (32|128);    //Reset the X pos. to print score board.    tabx=0;    //Write the score board.  Note that, due to an unsupported feature of    //AtaSimpleIO, some information will not be printed in reverse.#ifdef __USEFARMEM__    printrs ("Room: "); printh (hidereadw((void*)&CRm->Name));    tabx=29; printrs ("Score "); printu (Player.Score); printcr ();#else    printrs ("Room: "); printrs (CRm->Name);    tabx=29; printrs ("Score "); printu (Player.Score); printcr ();#endif    //Return to orig. row.    goline (c);    //Apple2enh version.#elif defined __APPLE2ENH__    //Get row #.    c=wherey();    //Home the cursor and turn reverse mode on.    //home2();    gotoxy (0, 0);    reverson ();    //Clear score board.    for (i=79; i; --i) printc (32);    //Return to left of score board.    tabx=0;    //Print score board.#ifdef __USEFARMEM__    prints ("Room: "); printh (hidereadw((void*)&CRm->Name));    tabx=69; prints ("Score "); printu (Player.Score); //printcr ();#else    prints ("Room: "); prints (CRm->Name);    tabx=69; prints ("Score "); printu (Player.Score); //printcr ();#endif    //Clear reverse mode and return to orig. row.    reversoff(); printcr (); gotoy (c);#else    //For other computers.  I don't remember the purpose of this code.#ifdef __USEFARMEM__    prints ("\x13Room: "); printh (hidereadw((void*)&CRm->Name));    tabx=29; prints ("Score "); printu (Player.Score); printcr ();#else    prints ("\x13Room: "); prints (CRm->Name);    tabx=29; prints ("Score "); printu (Player.Score); printcr ();#endif    goline (c);#endif} 

Offline
Last seen: 3 months 3 weeks ago
Joined: Nov 12 2022 - 16:50
Posts: 202
I'm sorry about the mess.  I

I'm sorry about the mess.  I will try to attach the fil now.Plain text iconAdvSkel65_Debug PLAYER.C.txt

Offline
Last seen: 3 months 3 weeks ago
Joined: Nov 12 2022 - 16:50
Posts: 202
Trying "tabx=1; --tabx;" also

Trying "tabx=1; --tabx;" also doesn't work.  :(

Offline
Last seen: 3 months 3 weeks ago
Joined: Nov 12 2022 - 16:50
Posts: 202
I didn't actually fix the bug

I didn't actually fix the bug, but I got around it.  I issued a "printcr();" then a "gotoy (0);," and it worked.

Log in or register to post comments