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: Bill K. <nb...@so...> - 2021-03-02 20:29:59
|
Y'know, I had a similar problem with my cc65 port of my game "Gem Drop" (originally written in Action! back in 1997, so it was relatively easy to port to C). I never figured out what was up with it. :-/ http://www.newbreedsoftware.com/gemdrop_deluxe/ And similarly, since the screen data basically _defines_ the game board, any corruption there breaks the game. :-( -bill! On Tue, Mar 02, 2021 at 02:06:32PM -0600, Michael Parson wrote: > I'm pretty new to C programming in general, but cc65 and being able to > target the C-64 and Commander X-16 piqued my interest and gave me the > motivation to actually jump into it. > > First few small projects went fine, but then I decided to write a > C-64/X-16 version of an old Flash game I wasted a lot of time playing, > "Grid Game". > > https://github.com/mparson/gridgame > > The X-16 version has been fine, the problems come in when I try to build > it for the C-64. A few #ifdefs for system specific things, but most of > the code is the same. > > On the C-64, when you hit the joystick button to start a move, I get > a random (red) character printed to the screen. My first thought was > that maybe I was bumping into screen ram somehow, so I #ifdef'ed out > a bunch of stuff to make the C-64 version have fewer features, wrote > a joystick interface instead of the mouse like the X-16 version uses > (haven't actually verified that this generates smaller code yet, maybe I > should), etc, but I'm still getting the random letters. > > Using Vice, I set up a few break points, tracked it down to just a > few lines after the button is clicked: > > #1 (Stop on exec 094c) 296 034 > .C:094c 20 2A 15 JSR ._processQ - A:86 X:2D Y:00 SP:f4 N.-..... 219124114 > ^^^ no garbage chars yet > > (C:$094c) n > .C:094f 4C 5F 09 JMP $095F - A:00 X:11 Y:02 SP:f4 N.-..... 219185007 > ^^^ garbage appears, in this case, a red 'P' at col 26, row 16 > (C:$094f) .C:095f AD 09 2C LDA ._global_editmode - A:00 X:11 > Y:02 SP:f4 N.-..... 219185010 > > Digging around in memory with the Vice monitor, it looks like I should > have plenty and don't see any reason for some random byte of screen RAM > to be changed. > > The game seems to otherwise run fine, as long as the random char doesn't > wind up on the playboard, messing up the matching. A board reset fixes > it, until the next time one appears... > > I'm at a loss here, would appreciate any pointers. > > Thanks. > > -- > Michael Parson > Pflugerville, TX > > > _______________________________________________________ > cc6...@li... > https://lists.sourceforge.net/lists/listinfo/cc65-devel > -- -bill! Sent from my computer |