Page 1 of 1

CONIO wherey() issue

Posted: Sun Feb 17, 2019 12:08 pm
by thweasel
Hi,

I found this issue a while ago, only just found the time to form the bug into something easily readable!

It seems that conio wherey() is returning the value of x, not y! wherex() is correct. I might have found the issue in the wherey.asm file, but my attempts to rebuild z88dk with the change didn't work. I changed the file in a new copy of the release build (nightly download isn't working?) then ran the ./build.sh (Linux). Re-compiled the test code below and got the same result. Could be my failing to build correctly or there is another bug somewhere!

z88dk/libsrc/stdio/conio/wherey.asm

Code: Select all

; void wherey()
; 09.2017 stefano

SECTION code_clib
PUBLIC wherey
PUBLIC _wherey

EXTERN __console_x   ;  <<  Should this be __console_y

.wherey
._wherey

        ld        a,(__console_x)     ;  <<  Should this be __console_y
        ld        l,a
        ld        h,0
        ret
Test code

Code: Select all

#where.c
#zcc +zx -clib=ansi -pragma-define:ansicolumns=80 -lndos -lm -lrs232plus -create-app -o where.o where.c


#include <conio.h>
#include <stdio.h>
#include <spectrum.h>
#include <rs232.h>
#include <input.h>
#include <string.h>

void main(void)
{
    static int cX;
    static int cY;

    zx_border(INK_MAGENTA);

    zx_colour(PAPER_WHITE|INK_BLACK);
    clrscr();

    cprintf("X test\n");
    for(int z=0; z<10;z++)
    {
        cprintf("%d ",wherex());
    }
    
    cprintf("\nY test\n");
    for(int z=0; z<10;z++)
    {
        printf("\n");
        cY=wherey();
        printf("Y %d",cY);       
    }

    cY=wherey();
    cX=wherex();
    cprintf("\n");
    printf("cY = %d  :  cX = %d",cY,cX);

}
Screen output
X test
0 2 4 6 8 10 13 16 19 22
Ytest

Y 0
Y 0
Y 0
Y 0
Y 0
Y 0
Y 0
Y 0
Y 0
Y 0
cY = 3 : cX = 3

Posted: Sun Feb 17, 2019 2:53 pm
by stefano
wrong comment on Facebook :( .. now fixed for real, so the comment is now right ;)

Posted: Sun Feb 17, 2019 3:42 pm
by thweasel
Cheer Stefano, that was quick!

Was it the wherey.asm file? If so how should I be rebuilding the library in future to test fixes?

Posted: Sun Feb 17, 2019 4:11 pm
by stefano
you need a Unix like shell, make, etc..
move under {z88dk}/libsrc then 'make zxlibs' or 'make zx_clib.lib'.
once built, move *.lib /z88dk/lib/clibs