Incorrect colors

Bug reports (if you don't/won't have a Github account)
Post Reply
einar
Member
Posts: 47
Joined: Fri Sep 06, 2013 4:23 pm

Incorrect colors

Post by einar »

Take this test program:

Code: Select all

#include <stdio.h>
#include <arch/zx.h>

#define printInk(k)          printf("\x10%c", (k))
#define printPaper(k)        printf("\x11%c", (k))
#define printAt(row, col)    printf("\x16%c%c", (col), (row))

main() {
    zx_border(0);
    zx_cls(0);

    printInk(0);        /* black */
    printPaper(5);      /* cyan */
    printAt(2,8);
    printf("LINE #1");

    printInk(6);        /* yellow */
    printPaper(0);      /* black */
    printAt(6,8);
    printf("LINE #2");
}
Compile it as follows:

Code: Select all

zcc +zx -vn -startup=1 -clib=new test.c -o test
appmake +zx -b test_CODE.bin -o test.tap --org 32768
Now try to guess what's going to be the color of LINE #2 that will appear on screen. If you said "red", you guessed it right! :)
einar
Member
Posts: 47
Joined: Fri Sep 06, 2013 4:23 pm

Post by einar »

Further testing indicates the mask to set PAPER (while preserving INK) is probably wrong. It's supposed to reset attribute bits 3,4,5 only, but it's apparently resetting bit 2 too.
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

Yes that was exactly right. A mask of $c3 was being used instead of $c7 to clear the paper bits.

This is fixed in the March 5 build or if you don't want to wait you can make the changes yourself to the paper.asm files in these directories:

z88dk/libsrc/_DEVELOPMENT/target/zx/driver/terminal/zx_01_output_char_32_tty_z88dk
z88dk/libsrc/_DEVELOPMENT/target/zx/driver/terminal/zx_01_output_fzx_tty_z88dk

and then rebuild the zx library by running "Winmake zx" (windows) or "make TARGET=zx" (non-windows) from directory z88dk/libsrc/_DEVELOPMENT
einar
Member
Posts: 47
Joined: Fri Sep 06, 2013 4:23 pm

Post by einar »

Thanks!
Post Reply