johnon Posted April 1, 2010 Share Posted April 1, 2010 (edited) Okay, so right now, I'm trying to create a scene. Just a basic scene, and then work from there. My problem right now is that no matter what I do, I can't seem to get them both to change when I want them to. The playfield always ends up screwing something up. I've tried all sorts of syncing up in the middle of the background changes, etc, and nothing. I'm just completely lost. Once, it changed my playfield color to purple, screwed up the playfield and then continued on to cause one of the noises to activate continuously. I couldn't tell you how. I removed the code after that and tried again. In any case, here's the code without the playfield included. processor 6502 include "vcs.h" include "macro.h" org $F000 Start sei cld ldx #$FF txs lda #0 ClearMem sta 0,x dex bne ClearMem StartOfFrame lda #000000 sta CTRLPF lda #0 sta VBLANK lda #2 sta VSYNC sta WSYNC sta WSYNC sta WSYNC lda #0 sta VSYNC ldx #0 VerticalBlank sta WSYNC inx cpx #37 bne VerticalBlank ldx #0 BackgroundTop sta WSYNC lda #$96 sta COLUBK inx cpx #64 bne BackgroundTop BackgroundMid sta WSYNC lda #$9A sta COLUBK inx cpx #128 bne BackgroundMid BackgroundBot sta WSYNC lda #$9E sta COLUBK inx cpx #192 bne BackgroundBot ; insertion point lda #%01000010 sta VBLANK ldx #0 Overscan sta WSYNC inx cpx #30 bne Overscan jmp StartOfFrame org $FFFC .word Start .word Start And it works fine...for the background only. At the place labelled insertion point, what I tried doing was: CloudTop sta WSYNC lda #$0E sta COLUPF cpx #2 bne CloudTop lda #%01100000 sta PF0 And adding that, as is, completely wipes my background and playfield and causes the entire screen to be the color of the bottom segment of the background. It's a newbie question, I know, and I may be missing something huge with the syntax here, so I'm asking for help. EDIT: Would it be possible to get the playfield working in a separate .asm file, and then have it included somewhere? Idk...I'm so lost. Edited April 1, 2010 by johnon Quote Link to comment Share on other sites More sharing options...
Omegamatrix Posted April 1, 2010 Share Posted April 1, 2010 You are drawing the entire "visible" portion of the screen before the playfield. The playfield you will see therefore will be right at the very bottom of the screen. The real problem is the X register. It increases all the way to 192 before the insertion piece, but once there you don't change it all. At that point the code gets stuck in an infinite loop as X=192, and that never changes, so X can never equal 2. Also you can make seperate files if you wish. You just have to add an "include filexxx.x" at the top of your code where include vcs.h and such are. "filexxx.x" needs to be changed to the actual filename and extension of course. Quote Link to comment Share on other sites More sharing options...
johnon Posted April 1, 2010 Author Share Posted April 1, 2010 You are drawing the entire "visible" portion of the screen before the playfield. The playfield you will see therefore will be right at the very bottom of the screen. Ah, so what needs to go where in terms of order? The real problem is the X register. It increases all the way to 192 before the insertion piece, but once there you don't change it all. At that point the code gets stuck in an infinite loop as X=192, and that never changes, so X can never equal 2. There was a "ldx #0" in there after BackgroundBot, but it must have gotten cut out. *shrugs* Didn't change anything, as far as the code was concerned. =\ Also you can make seperate files if you wish. You just have to add an "include filexxx.x" at the top of your code where include vcs.h and such are. "filexxx.x" needs to be changed to the actual filename and extension of course. Yeah, I just figured if I could get the playfield to work in one file and the background to work in another, then somehow I could mesh them together once I get order correct. *shrugs* I did quite a bit in C# before attempting this. This is a major change and I'm used to separated files with specific purposes and all sorts of other syntax, etc. Quote Link to comment Share on other sites More sharing options...
Omegamatrix Posted April 1, 2010 Share Posted April 1, 2010 Ah, so what needs to go where in terms of order? I'm just saying you're putting your playfield kinda low. It's reaching the point where it is almost off of the screen. There was a "ldx #0" in there after BackgroundBot, but it must have gotten cut out. *shrugs* Didn't change anything, as far as the code was concerned. =\ You're on the right track now! Look at the loop again for "CloudTop". You still need to change X inside of that loop with an INX, or else it will always remain at 0. I did quite a bit in C# before attempting this. This is a major change and I'm used to separated files with specific purposes and all sorts of other syntax, etc. You're doing fine. Quote Link to comment Share on other sites More sharing options...
johnon Posted April 1, 2010 Author Share Posted April 1, 2010 You're on the right track now! Look at the loop again for "CloudTop". You still need to change X inside of that loop with an INX, or else it will always remain at 0. *facepalm* Is that really what I missed? *double-checks* Thanks man. I thought there was some intricate thing I missed. Apparently I really just need to learn to proofread better. >.> Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted April 1, 2010 Share Posted April 1, 2010 Are you using Stella to test with? If so hit ~ to go into the debugger. I suspect you would have realized the INX was missing after stepping thru the loop a couple times. Quote Link to comment Share on other sites More sharing options...
johnon Posted April 1, 2010 Author Share Posted April 1, 2010 Are you using Stella to test with? If so hit ~ to go into the debugger. I suspect you would have realized the INX was missing after stepping thru the loop a couple times. Yes, I am, actually. Thanks for the advice! ^^ 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.