johnnystarr Posted August 20, 2013 Share Posted August 20, 2013 (edited) Here's a quick look at something else I don't quite get: ScanLoop: sta WSYNC ; graphics updates go here lda SpriteLine cmp #5 beq .skip lda #%01010101 sta GRP0 inc SpriteLine .skip dey bne ScanLoop lda #%00000010 sta WSYNC sta VBLANK ldx #30 ; setup 30 scan lines for overscan So, what I'm trying to do, is load 5 lines of sprite data so that I can make a block. SpriteLine is my variable and is initalized as 0. Every iteration I am comparing this to 5, if the zero flag is set, then I know it has reached 5 so i skip that drawing. For some reason, the state of ScanLoop doesn't seem to matter because this is the output: I can see that it is "working" when it comes to drawing to the screen, but it isn't working as it should. Edited August 20, 2013 by johnnystarr Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted August 20, 2013 Share Posted August 20, 2013 TIA is a scanline based video chip. If you set a register, such as GRP0, on one line and don't change it then that value will continue to be displayed on all following scanlines. You're setting GRP0 to %01010101, but never setting it to any other value, so the strips are drawn down the screen. You need to load GRP0 with 0 to make it stop displaying. lda SpriteLine cmp #5 beq .skip lda #%01010101 .byte $2c .skip lda #0 sta GRP0 inc SpriteLine $2c is the opcode for BIT $ABSOLUTE, so it "hides" the lda #0 by treating it as the $ABSOLUTE address. It doesn't affect the registers, but it does change the N, V and Z flags. There's undocumented opcodes that can also be used. NOP $ABSOLUTE can be done using .byte $0c. Like the $2c, it'll "hide" the lda #0, but it won't change any registers OR flags. 1 Quote Link to comment Share on other sites More sharing options...
johnnystarr Posted August 20, 2013 Author Share Posted August 20, 2013 Hmm, I applied this code and I'm just getting a scan up and down. I must be doing something wrong here: Maybe you could look at my source? processor 6502 include "macro.h" include "vcs.h" ORG $F000 ; constants ; variables SpriteLine = $80 Start: sei cld ldx #$FF txs lda #0 .clearmem sta 0,x dex bne .clearmem lda #$23 sta COLUBK ;setup sprite lda #$20 sta COLUP0 ; Main gameloop Main: lda #%00000010 sta VSYNC sta WSYNC sta WSYNC sta WSYNC ; set timer to handle the rest of VBLANK draw lda #41 sta TIM64T lda #0 sta VSYNC ; main logic goes here ; this is where you put all your controller logic and score, etc. ; ----- WaitForVBlank: lda INTIM bne WaitForVBlank ldy #191 sta WSYNC sta VBLANK sta WSYNC ScanLoop: sta WSYNC ; graphics updates go here lda SpriteLine cmp #5 beq .skip lda #%01010101 .byte $2c .skip lda #0 sta GRP0 inc SpriteLine dey bne ScanLoop lda #%00000010 sta WSYNC sta VBLANK ldx #30 ; setup 30 scan lines for overscan Overscan: sta WSYNC dex bne Overscan jmp Main Sprite: .byte #%00011000 .byte #%00111100 .byte #%00011000 .org $FFFC .word Start .word Start Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted August 20, 2013 Share Posted August 20, 2013 Go to the table of contents and read chapters 21, 22 and 23. Quote Link to comment Share on other sites More sharing options...
johnnystarr Posted August 20, 2013 Author Share Posted August 20, 2013 (edited) Will do. I have scanned over those chapters, but I was hoping to try to figure this out so I can get what I'm doing wrong. I've tried a second attempt to no avail. ; in above code lda #5 sta SpriteLine ; initialize to 5 ScanLoop: sta WSYNC ; --- begin graphics lda SpriteLine ; load current state beq .skip ; if is 0, branch to skip lda #%01010101 ; line pattern sta GRP0 ; store dec SpriteLine ; decrement the counter jmp .done ; jump past the skip portion .skip lda #0 ; load 0 sta GRP0 ; store in sprite register .done The output is just my background. When i change "beq .skip" to "bne .skip" I get the strip down the screen again. Edited August 20, 2013 by johnnystarr Quote Link to comment Share on other sites More sharing options...
Joe Musashi Posted August 20, 2013 Share Posted August 20, 2013 It might help to have a look a this example, which shows how to move a sprite vertically, i.e., how to turn it on and off on the respective lines. It's made for the ball, but it would be easy to adapt it for the players. Quote Link to comment Share on other sites More sharing options...
shazz Posted August 21, 2013 Share Posted August 21, 2013 why not changing to this ? ScanLoop: sta WSYNC ; graphics updates go here lda SpriteLine cmp #5 bne .cont lda #0 .cont: sta GRP0 inc SpriteLine dey bne ScanLoop it displays the funny pattern Quote Link to comment Share on other sites More sharing options...
johnnystarr Posted August 21, 2013 Author Share Posted August 21, 2013 Yeah, that fractal-ish pattern is neat, but not the desired outcome either. I will have to read up on the 2600 for newbies guide and try to fully understand this before I try to come up with my own routine. I guess I have to "crawl" before I can "run" 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.