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
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);
}
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