Re: [cc65-devel] c64 - getting seemingly random chars on screen
cc65 - a freeware C compiler for 6502 based systems
Brought to you by:
gpz
|
From: <gr...@gm...> - 2021-03-03 18:53:16
|
Am Mittwoch, 3. März 2021, 17:59:35 CET schrieb Michael Parson: > OK, put together a stripped down version. No score keeping, no stdio.h > calls, no filesystem access, just the basic gameplay. All screen > manipulation should be going through conio. Since this is a C-64 > test, I even removed the asm bits and used a POKE to kick back into > uppercase/PETSCII mode. I'd still prefer a cross-platform 'safe' way to > do that. > > https://github.com/mparson/gridgame/blob/main/c64/minimal.c > > Still getting the same behavior. > > For grins, I compiled it for C-128, also got the errant chars. it happens in the inner loop gotoxy (mx,my); c = cpeekc (); textcolor (COLOR_RED); cputcxy (c,mx,my); // BUG, should be mx,my,c textcolor (COLOR_WHITE); :) here is what i did: first compile and generate a VICE label file: cl65 -Ln minimal.lbl -o minimal.prg minimal.c start in VICE: x64sc -autostartprgmode 1 -moncommands minimal.lbl minimal.prg break into the monitor (alt-h) use "sc" to find out where the screen under the playfield starts watch 06d0 07e7 x to go on now press fire, it will break when the bug happens chis to show the cpu history now you can see its in cputc, and scrolling up a bit reveals that it comes after a "textcolor(2)", which is that textcolor (COLOR_RED) in the main loop now i replaced the cputcxy call by gotoxy/cputc ... and that worked. obviously the cputcxy must be going wrong. Looked again, AHA! argument order :) so there :) (i almost hoped for another compiler bug being triggered, but no - its just an ordinary bug in this code :)) -- http://hitmen.eu http://ar.pokefinder.org http://vice-emu.sourceforge.net http://magicdisk.untergrund.net Easy to learn = hard to use, Easy to use = hard to learn, Easy to learn and use = won't do what you want it to, Powerful = hard to learn and use, Menu- driven = easy to learn. <Stephen Manes> |