PicardHS Posted May 24, 2017 Share Posted May 24, 2017 (edited) This is probably a stupid mistake, but I can't figure out what I'm doing wrong. I'm just trying to draw the Atari logo on the playfield. The bitmap is 31 lines long, but I'm using LSR twice before loading it so it is the same for four scanlines. Here is my code for looping through the scanlines: ldy #191 tya lsr lsr tax ScanLoop lda PFData2,X sta PF2 lda PFData1,X sta PF1 sta WSYNC tya lsr lsr tax dey bne ScanLoop And I get something that looks like this: Thanks in advance, I don't know where I messed up here. Edit: Woops, that whole four lines of "tya lsr lsr tax" was meant to go after the DEY. I don't think that was causing it lol. Edited May 25, 2017 by PicardHS Quote Link to comment Share on other sites More sharing options...
GroovyBee Posted May 24, 2017 Share Posted May 24, 2017 Shouldn't the Y register be loaded with 31*4 and not 191? Quote Link to comment Share on other sites More sharing options...
PicardHS Posted May 25, 2017 Author Share Posted May 25, 2017 Shouldn't the Y register be loaded with 31*4 and not 191? Sorry for confusion, but that is actually the amount of scanlines in the TV frame, I have it decrementing down as I loop through the scanlines. Also, I am very very sorry for this late response. :\ Quote Link to comment Share on other sites More sharing options...
tokumaru Posted May 25, 2017 Share Posted May 25, 2017 (edited) Yeah, 191 divided by 4 is 47, but you only have 31 lines of actual picture data, so indices 47 down to 31 will fetch garbage (whatever lies past the bitmap in the ROM), and then indices 30 through 0 will read the actual picture. So you either have to extend the picture to fill the entire screen, or add some padding before and/or after the picture and have the loop go from 124 down. Also, why write the tya, lsr, lsr, tax block twice? You could move the ScanLoop label up and completely remove the second instance of these instructions. Edited May 25, 2017 by tokumaru Quote Link to comment Share on other sites More sharing options...
PicardHS Posted May 25, 2017 Author Share Posted May 25, 2017 (edited) add some padding before and/or after the picture and have the loop go from 124 down. That seems like a good solution. I'll try it out. Also, why write the tya, lsr, lsr, tax block twice? One of them is before the frame starts, one is during the actual picture drawing before the next scanline, to prepare for drawing the next scanline. Having it during the hblank on that scanline itself I think takes up too many cycles. Edited May 25, 2017 by PicardHS Quote Link to comment Share on other sites More sharing options...
PicardHS Posted May 25, 2017 Author Share Posted May 25, 2017 I tried your solution, and it worked! Thank you, tokumaru! I'll see if there is a better solution than having the same four lines twice. I could make it only update the TIA every four scanlines, but I don't really feel like doing that. I want to make a static effect for this, that was the original idea, but I got hung up on the playfield 'cause I'm a noob and haven't done this in a while. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.