Print color bug (*solved*) - Printable Version +- Forum (https://www.boriel.com/forum) +-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11) +---- Forum: Bug Reports (https://www.boriel.com/forum/forumdisplay.php?fid=15) +---- Thread: Print color bug (*solved*) (/showthread.php?tid=2241) Pages:
1
2
|
RE: Print color bug - Darkstar - 10-09-2022 (10-09-2022, 06:30 PM)boriel Wrote: That's weird: the "system variable" core.SCREEN_ADDR is initialized with 16384, and core.SCREEN_ATTR_ADDR with 22528 respectively, and they are not modified anymore (in other words, all the instructions using these variables are read-only). The only other time that SCREEN_ATTR_ADDR is used is in this routine and that is read only: Code: Sub SetAttrs (ByVal Row as ubyte, ByVal Column as ubyte, ByVal NumberOfCells as uinteger) The output from this routine is always right regardless if the workaround is employed or not which means it is not dependent on the attr address and it does not modify it. However that output from the print routine is in the wrong color. The screen is set to black paper and white ink and then the screen is switched to another place in memory and then a print command in blue paper and yellow ink but the blue and yellow does not take. It is printed in the original colors of black and white. Then the screen is copied to another screen where it is printed on some more and then it is copied to screen 16384 or screen0. The only way to get the right colors is to employ the workaround. My routine above always works and the print routine does not and not other routines in my program mess with my screen other than the routine that sets the screen that I have posted before. So this is a bug in the compiler, read only or not. It is like it does not update the attr address when it is supposed to, that's the closest I can figure. RE: Print color bug - Darkstar - 10-10-2022 Here is some code that you can use to recreate the bug, the org address is 39936 when compiling. Code: Code deleted. RE: Print color bug - boriel - 10-11-2022 (10-05-2022, 07:59 AM)Darkstar Wrote:(10-05-2022, 07:01 AM)boriel Wrote: The print changes were introduced in 1.16.0! Okay, I've reviewed your code and it's ok. And so the compiler. SCREEN_ATTR_ADDR *must* be updated, along with SCREEN_ADDR from 15.x onwards. This is because this allows having the ATTR Region in another separate place. For example, suppose you want to buffer only the first 2 thirds of the screen (rows 0 to 15, both included), and leave the last third unbuffered (for scores and game data only). You can do it, by pointing the ATTR address to SCREEN_ADDR + 4096 and saving 2k. Your SetAttrs routine should be: Code: Sub SetAttrs (ByVal Row as ubyte, ByVal Column as ubyte, ByVal NumberOfCells as uinteger) RE: Print color bug - Darkstar - 10-11-2022 This clears it up then, thank you for your time and for the changes to the SetAttrs routine. Good to know this, I am not sure if it is mentioned in the Wiki but that's another matter. Thanks. RE: Print color bug - boriel - 01-19-2023 Note. I've fixed several bugs in the scr buffer routine. Now PRINT, PLOT, DRAW, CIRCLE, ScrollXXXX and WinscrollXXXX works perfectly and use the screen buffer! Beta here: http://www.boriel.com/files/zxb/zxbasic-v1.16.5-beta9.tar.gz http://www.boriel.com/files/zxb/zxbasic-v1.16.5-beta9.zip http://www.boriel.com/files/zxb/zxbasic-v1.16.5-beta9-win32.zip http://www.boriel.com/files/zxb/zxbasic-v1.16.5-beta9-linux64.tar.gz http://www.boriel.com/files/zxb/zxbasic-v1.16.5-beta9-macos.tar.gz |