It is currently Thu Apr 19, 2018 10:46 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 1443 posts ]  Go to page Previous  1 ... 71, 72, 73, 74, 75, 76, 77 ... 97  Next
Author Message
PostPosted: Tue Oct 29, 2013 7:29 pm 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 859
Location: cypress, texas
tepples wrote:
unregistered wrote:
so when drawing two columns at once... you have to wait on the columns to enter the rightmost attribute table spot before coloring them? That would be kind of odd. While playing Super Mario Bros. there wasn't any flickering of the last two columns that I could see.

Momentary miscoloring occurs at the seam. Super Mario Bros. arranges its nametables horizontally ("vertical mirroring"), letting it keep the seam offscreen. Go play Super Mario Bros. 3 once if you want to see color artifacts. SMB3 uses two vertically arranged nametables ("horizontal mirroring") for a 27-metatile-tall playfield plus status bar at the cost of miscoloring the tiles at the far right.
When scrolling the screen along to the right using vertical mirroring how does the correct coloring happen when there arent any attribute tables offscreen to color?


Top
 Profile  
 
PostPosted: Tue Oct 29, 2013 8:08 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19919
Location: NE Indiana, USA (NTSC)
Because when the nametable arrangement matches the scrolling direction, as in SMB1 and Contra (both of which use vertical mirroring), there are attribute tables offscreen. Each nametable has its own attribute table. The attribute table for $2000 is at $23C0-$2FFF, the attribute table for $2400 is at $27C0-$27FF, the attribute table for $2800 is at $2BC0-$2BFF, and the attribute table for $2C00 is at $2FC0-$2FFF.


Top
 Profile  
 
PostPosted: Tue Oct 29, 2013 9:42 pm 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 859
Location: cypress, texas
Ah! Ok I think I get it now... you draw 2 16bit columns to 2400's nametable... and then color it's first 32 bit attribute table column... and then scroll to the right? Thank you tepples! :D

forgetfulness.


Top
 Profile  
 
PostPosted: Wed Oct 30, 2013 3:32 pm 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 859
Location: cypress, texas
I'm trying to create a variable that will have the most rescent column drawn incase my method trys to redraw the same column again. It shouldn't take over 3 hours to do that. :?

No it shouldn't take 3 hours... but it did today. Now each column is drawn only once. :D

edit.


Top
 Profile  
 
PostPosted: Fri Nov 01, 2013 4:07 pm 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 859
Location: cypress, texas
I was going to make a complaint about how it is unfair that I can't press right on my controller and scroll into back into nametable 0 and see why, why do 7 RAMbufferw1 columns appear after it draws my RAMbufferw0 column. Why?! And then suddenly I realized that yes it's possible to make my computer think I pressed right on my controller... ANYTHING IS POSSIBLE!! :D At least that is what I've just realized and I wanted to share this with anyone who is just starting game creation like me. Tomorrow is going to be incredible cause I will... I still think... I'll know why 7 RAMbufferw1 collumns are drawn after it draws my RAMbuffer0 column! I'm gonna change some of the status flags and the values in some of my registers... so it will appear that I've scrolled into nametable 0 again! ...it is 6:00pm here in Texas time to eat. :)

edit: It's a bit hard to know the time right now... we gain an hour at 2:00am.. it's Sunday morning at 1:25am now. Want to say that anything is not possible. Yawn... goodnight.

edit2: Worked for 5 hours and 31 mins today. I've made progress! :mrgreen: Anything may be possible... that's correct. :) Now it's 10:39pm Sunday night.


Top
 Profile  
 
PostPosted: Mon Nov 04, 2013 6:56 pm 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 859
Location: cypress, texas
Now, here is my problem. The screen looks like this:
Code:
121212121234
121212121234
121212121234


and now I want it to look like this
Code:
123412341234
123412341234
123412341234

edit: like this
Code:
123456789ABC
123456789ABC
123456789ABC


*sigh... :( this is the same problem I had on page 73. Well almost the same. I bet I'll do better with this tomorrow. : )

edit2: Guess what happened to me. There must be an idea you could find for me... I increased the divide by 8 to be a divide by 16. And suddenly my screen turned into what I have been searching for:
Code:
123456789ABC
123456789ABC
123456789ABC
Every column appeared at the correct column spot! But each column was shifted up a metatile... so the top line of metatiles appear at the bottom of the screen with everything shifted up to be on top of them. (Our metatiles are 16x16pixels.) From all of my experiences with my level shifting up... that tells me that something is not correct. As time has continued on... the game being run and I'm traveling right. After looping the tiles are shifted a metatile higher... then another loop shifts them a metatile even higher. You must have experienced this at one point in your game creating career. So, anyways, then I increased the divide by 16 to be a divide by 32. And every column is perfectly drawn now... now nothing is shifted up but each column is not correct. It looks like somone has smeared my sister's level... it's all too wide looking.

edit3: I'm looking forward to solving this. Yesterday, I wasn't detailed with the looping part. By looping I mean that I'm running along and columns are being drawn... it's when they are redrawn... that's the loop; each time it loops the columns are raised a metatile. Noone else has experienced this? :shock:


Top
 Profile  
 
PostPosted: Thu Nov 14, 2013 10:50 pm 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 859
Location: cypress, texas
unregistered wrote:
...I wasn't detailed with the looping part. By looping I mean that I'm running along and columns are being drawn... it's when they are redrawn... that's the loop; each time it loops the columns are raised a metatile. Noone else has experienced this? :shock:
:shock:

Ok, so you know, today, I successfully rewrote my draw_me_a_column method. The main code loop appears only once now. It is run twice... one time for the even column... and then one more time for the odd column.
Code:
0C6E2                           ;************************************************************************
0C6E2                           ;you must dynamically modify p0ointer before jsring draw_me_a_column.
0C6E2                           ;   lda #<RAMbufferw1
0C6E2                           ;   sta p0ointer
0C6E2                           ;   lda #>RAMbufferw1
0C6E2                           ;   sta p0ointer+1
0C6E2                           ; destroys a x and y   ooooooooooohhhhh  nooooooooooooooooo
0C6E2                           ;************************************************************************
0C6E2                           draw_me_a_column: ;(please)
0C6E2                             
0C6E2                             
0C6E2                             ;increase valid_left by 1
0C6E2                           ;  inc valid_left
0C6E2                             ;and draw column valid_left+31
0C6E2                              ;set the address
0C6E2                             
0C6E2 20 AC C6                     jsr next
0C6E5 A5 3B                        lda columnLo
0C6E7 C5 45                        cmp playdough
0C6E9 F0 39                        beq +end
0C6EB E6 47                           inc t10 ;sets temporary zeropage variable to 1
0C6ED A5 3A                        lda columnHi
0C6EF 8D 06 20                     sta $2006
0C6F2 A6 3B                        ldx columnLo
0C6F4 8E 06 20                     stx $2006
0C6F7                             
0C6F7                             
0C6F7                              ;start with even column part
0C6F7 4C 0C C7                     jmp +even
0C6FA                             
0C6FA A0 3B                      -odd: ldy #59
0C6FC E8                           inx
0C6FD A5 3A                        lda columnHi
0C6FF 8D 06 20                     sta $2006
0C702 8E 06 20                     stx $2006
0C705 A9 00                           lda #$00
0C707 85 47                           sta t10
0C709 4C 0E C7                     jmp +draw
0C70C A0 3A                      +even: ldy #58
0C70E                           +draw: ;draw 16bit column, even and odd parts
0C70E B1 43                      - lda (p0ointer),y  ;RAMbufferw1, x
0C710 8D 07 20                     sta $2007
0C713 88                           dey
0C714 88                           dey ;subtract 2 to stay in even or odd column
0C715 10 F7                        bpl -
0C717                             
0C717 A5 47                           lda t10
0C719 F0 03                           beq +complete
0C71B                                 ;now go back to odd column part
0C71B 4C FA C6                        jmp -odd
0C71E                           
0C71E                           +complete   
0C71E A5 3B                        lda columnLo
0C720 85 45                        sta playdough   
0C722                               
0C722 E6 30                        inc valid_left
0C724                             
0C724                           
0C724 60                        +end: rts ;end of draw_me_a_column scrolllandiii and vblank code
YEAY!! :mrgreen:
So by the end a 16bit column is drawn. But I don't understand why my columns are one-metatile-too-high... one of yall must have experienced your columns being one-metatile-too-high. What did you do to fix this problem? :) :?


Top
 Profile  
 
PostPosted: Thu Nov 14, 2013 11:19 pm 
Offline
User avatar

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1122
Quote:
; destroys a x and y ooooooooooohhhhh nooooooooooooooooo

As a solo developer, I approve of this type of comment. :D

Is the only problem that the columns are drawn too high? (One column or both?) Then check if what you're writing to $2006 is correct. Or check if what's written to $2005 is correct.

How do you calculate columnLo and columnHi?

What's "next" that you jsr to immediately?

_________________
https://kasumi.itch.io/indivisible


Top
 Profile  
 
PostPosted: Fri Nov 15, 2013 1:49 pm 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 859
Location: cypress, texas
Kasumi wrote:
Quote:
; destroys a x and y ooooooooooohhhhh nooooooooooooooooo

As a solo developer, I approve of this type of comment. :D
haha, I'm glad you approve. Thanks. :D

Kasumi wrote:
Is the only problem that the columns are drawn too high? (One column or both?)
Well there is a small extra grafiti that happens at the end after all the columns are drawn from that nametable. Also currently I'm trying to think of my columns being drawn - each column is 16 pixels wide... according to tepples. :)
Kasumi wrote:
Then check if what you're writing to $2006 is correct. Or check if what's written to $2005 is correct.
Ok, how could I check that? I am going to guess that I could run the debugger and see what value is written to the accumulator.

Kasumi wrote:
How do you calculate columnLo and columnHi?

What's "next" that you jsr to immediately?
columnLo and columnHi are determined inside my next... that's what next does.


Top
 Profile  
 
PostPosted: Fri Nov 15, 2013 2:22 pm 
Offline
User avatar

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1122
Quote:
Ok, how could I check that? I am going to guess that I could run the debugger and see what value is written to the accumulator.

Or check the code that sets the values that eventually end up getting written there. Like next!

Is rendering disabled while this is happening? It may be taking too long if not. I dunno, I'm guessing at this point. I'm either missing something obvious or there's not enough info.

When all else fails, just rewrite it. There's lots of tiny things you could do, like just have even first instead of jumping over odd to get to even only to branch back to odd. You may not need t10. CPY #$FF could work if I'm understanding it correctly. The last value of y before that loop ends for even is 0. DEY twice, get #$FE. For odd, it's one. DEY twice, get #$FF, so you may be able to detect it that way instead. A total rewrite can be freeing. No worries about noodling around code you don't want to break when adding new features.

The first thing I'd do is make a loop that draws any one tile (say... #$FF. Any one that's different from the usual background) to the even column. This lets you be sure of two things. One: That you're getting the address correct for the update, and also that you're getting the number of loops correct. If it's too many updates, it will bleed into the next column, if you started in the wrong place it will be offset wrong.

Then add the loop that draws any different tile (#$80 or anything you didn't use for even that's also different from the usual background) to the odd column. Again, it lets you be sure you're starting in the right place etc.

After that, make it read from your buffer. If it was updating in the right places and right number of times before, but looks wrong after loading from the buffer instead of using a fixed tile then something is wrong with whatever code fills the buffer (or sets up the pointer TO the buffer)

I don't know what your process was for the current routine (haven't been following too closely recently), but never ever try to do too many things before verifying previous parts work. Lots of things could be wrong, and it makes things easier for both me and you to look at when you know "Column position worked, then I added the buffer code and it looks wrong." Then we at least know what to look at.

Edit: You know what? You can use the same steps to just work backwards, instead of rewriting. After even, add lda #$FF. After odd, add lda #$80. (or whatever tiles you're using.) Comment out "- lda (p0ointer),y ;RAMbufferw1, x". That will draw just columns of one tile so you can make sure your offsets/number of loops is correct. You can tell by the tile which is wrong (even or odd), if either one is. (Also, check in FCEUX's nametable viewer, on the off chance your emulator was clipping the top 8 pixels and you compensated for it or something.)

If that looks right, the issue is either your buffer or using too much time (assuming rendering is enabled). To check if using too much time, just disable rendering before, and enable it after. If the nametables look right in the nametable viewer, it ain't that. (It also ain't that if rendering is already disabled. :wink:) Which leaves just whatever fills your buffer, or whatever sets up the pointer TO your buffer.

If it looks wrong after removing the buffer code, the issue is your number of loops, or what sets ColumnHi/ColumnLo. (Or maybe your vertical scroll value, you can check if it's that by looking at your nametables in the nametable viewer.)

_________________
https://kasumi.itch.io/indivisible


Top
 Profile  
 
PostPosted: Fri Nov 15, 2013 3:30 pm 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 859
Location: cypress, texas
Sigh, well I feel that rewriting that wont help me. :( I strongly feel that the problem is with the code that fills the buffer. My coding life all just hasn't been any good. It seems frustrating but you are right, there needs to be some check that will guarentee my code is correct. I'm going to start with what you've suggested here... thank you very much Kasumi! :)

edit: Ok very good I see your edit now! This is going to work. :) Thank you for being so helpful Kasumi! :D

edit2: I have to go fix supper now... I don't understand why
Kasumi wrote:
There's lots of tiny things you could do, like just have even first instead of jumping over odd to get to even only to branch back to odd. You may not need t10. CPY #$FF could work if I'm understanding it correctly. The last value of y before that loop ends for even is 0. DEY twice, get #$FE. For odd, it's one. DEY twice, get #$FF, so you may be able to detect it that way instead.
Detect what instead? Um... I've got a good tile #7E that hasnt been used for the background. Ooohh wait. Ok you are talking about me not needing t10. t10 is the way I've set it to know when to ignore my jump to -odd. You are correct.. $FE is reached at the end of even and #FF is reached at the end of odd... so you are telling me that I might be able to use that check of Y with CPY #FF. I do understand! :shock: :) Ok, i have to go cook... give me some time to do that.

edit3: INCREDIBLY SWEET THANK YOU SO MUCH Kasumi!! :D
Code:
0C6E2                           ;************************************************************************
0C6E2                           ;you must dynamically modify p0ointer before jsring draw_me_a_column.
0C6E2                           ;   lda #<RAMbufferw1
0C6E2                           ;   sta p0ointer
0C6E2                           ;   lda #>RAMbufferw1
0C6E2                           ;   sta p0ointer+1
0C6E2                           ; destroys a x and y   ooooooooooohhhhh  nooooooooooooooooo
0C6E2                           ;************************************************************************
0C6E2                           draw_me_a_column: ;(please)
0C6E2                             
0C6E2                             
0C6E2                             ;increase valid_left by 1
0C6E2                           ;  inc valid_left
0C6E2                             ;and draw column valid_left+31
0C6E2                              ;set the address
0C6E2                             
0C6E2 20 AC C6                     jsr next
0C6E5 A5 3B                        lda columnLo
0C6E7 C5 45                        cmp playdough
0C6E9 F0 33                        beq +end
0C6EB A5 3A                        lda columnHi
0C6ED 8D 06 20                     sta $2006
0C6F0 A6 3B                        ldx columnLo
0C6F2 8E 06 20                     stx $2006
0C6F5                             
0C6F5                             
0C6F5                              ;start with even column part
0C6F5 4C 06 C7                     jmp +even
0C6F8                             
0C6F8 A0 3B                      -odd: ldy #59
0C6FA E8                           inx
0C6FB A5 3A                        lda columnHi
0C6FD 8D 06 20                     sta $2006
0C700 8E 06 20                     stx $2006
0C703 4C 08 C7                     jmp +draw
0C706 A0 3A                      +even: ldy #58
0C708                           +draw: ;draw 16bit column, even and odd parts
0C708 B1 43                      - lda (p0ointer),y  ;RAMbufferw1, x
0C70A 8D 07 20                     sta $2007
0C70D 88                           dey
0C70E 88                           dey ;subtract 2 to stay in even or odd column
0C70F 10 F7                        bpl -
0C711                             
0C711 C0 FF                           cpy #$ff ;lda t10
0C713 F0 03                           beq +complete
0C715                                 ;now go back to odd column part
0C715 4C F8 C6                        jmp -odd
0C718                           
0C718                           +complete   
0C718 A5 3B                        lda columnLo
0C71A 85 45                        sta playdough   
0C71C                               
0C71C E6 30                        inc valid_left
0C71E                             
0C71E                           
0C71E 60                        +end: rts ;end of draw_me_a_column scrolllandiii and vblank code


edit4: Yes thank you so much Kasumi!! :D I got to delete that slow 5 cycle inc t10... and it is so good to learn this way of smart programming. I really appreciate the cmp and cpy now!! :D Ok sleep is going to start soon goodnight.

edit5:It's around 11:34am on Monday. I want to say THANK YOU SO MUCH KASUMI!! I found the part that you started with saying that even should come first... instead of jumping over odd to run even... :D Now everytime it runs odd my code doesn't have to jmp anymore!

edit6: Wow, I'm in the middle of this now! Want to write out here what's going on now so I could read it in the future. So far I've moved the code back to how it was before it was combined with one draw section. Then I made it so that the even column was drawn with the tile #$44... and the odd column was drawn with the tile #$45. It became interesting... the even column was correct... the odd column was kindof correct and there were many grafiti #$45 tiles. So that must have been a hint that the odd buffer creation code was problemed. Next I read the bottom part of your response another time and I was blown away!!! There actually was a solution that could work with the single draw section... I quickly moved the code back to use the single draw section... and loaded the acumulator with #$44 for the even section and loaded the accumulator with #$45 for the odd section. And I commented the lda (ptr),y line like you suggested. And then I ran the code and it ran perfectly!!!!!!! :D :shock: Nothing was raised up when it restarted the nametable! Just kept going. So now the buffer code must be problem filled... that's my guess from all of your wise teaching Kasumi. Now I'll go look at my buffer code.

edit7: Column position worked, then I added the buffer code and it looks wrong. Here is my buffer code
Code:
  0C4C5                             ;*******************************************************
0C4C5                             ; uses x for load_screen input... send value of screen to load in x
0C4C5                             ; uses y to pick a column (1 16x16 metatile wide).
0C4C5                             ;*******************************************************
0C4C5                             draw_RAMbuffers: ;testing... goodsofar!!
0C4C5                             ;"Prepare the (new nametable) writes in a RAM buffer during draw time..." tepples pg 59
0C4C5                                 
0C4C5 85 FF                          sta $ff
0C4C7                                ;ldx #$02
0C4C7 20 44 C1                       jsr load_screen  ;< X goes into to load_screen
0C4CA                               
0C4CA A9 3B                          lda #59    ;note: each RAMbufferw is 60 bytes long... 0 through 59
0C4CC 85 31                          sta t2
0C4CE 85 41                          sta goodLocation
0C4D0                           
0C4D0 84 34                          sty CurrentColumn+0     ;ldy #$03
0C4D2                                ;---
0C4D2                                ;
0C4D2                           
0C4D2                           
0C4D2 B1 10                      --   lda ($10), y
0C4D4 AA                             tax
0C4D5                                 
0C4D5 BD DE C9                       lda MetatileTile3, x
0C4D8 8D 31 05                       sta RAMbufferw0+1
0C4DB BD FF C8                       lda MetatileTile2, x
0C4DE 8D 30 05                       sta RAMbufferw0+0
0C4E1 BD 20 C8                       lda MetatileTile1, x
0C4E4 8D 33 05                       sta RAMbufferw0+3
0C4E7 BD 41 C7                       lda MetatileTile0, x
0C4EA 8D 32 05                       sta RAMbufferw0+2
0C4ED                               
0C4ED A6 41                          ldx goodLocation
0C4EF AD 33 05                       lda RAMbufferw0+3
0C4F2 9D 30 05                       sta RAMbufferw0, x
0C4F5 CA                             dex
0C4F6 AD 32 05                       lda RAMbufferw0+2
0C4F9 9D 30 05                       sta RAMbufferw0, x
0C4FC CA                             dex
0C4FD AD 31 05                       lda RAMbufferw0+1
0C500 9D 30 05                       sta RAMbufferw0, x
0C503 CA                             dex
0C504 AD 30 05                       lda RAMbufferw0+0
0C507 9D 30 05                       sta RAMbufferw0, x
0C50A 98                               tya
0C50B 18                               clc
0C50C 69 10                            adc #$10 ;increment y by 16!!!!
0C50E A8                               tay
0C50F CA                             dex
0C510 86 41                          stx goodLocation
0C512 10 BE                          bpl -- ;if not we are ready to do the next metatile
0C514                           
0C514                                 
0C514 A4 34                          ldy CurrentColumn
0C516 C8                             iny
0C517 84 35                          sty CurrentColumn+1
0C519 A9 3B                          lda #59
0C51B 85 41                          sta goodLocation ;our buffers are both 59 long
0C51D                           
0C51D B1 10                      --   lda ($10), y
0C51F AA                             tax
0C520                                 
0C520 BD DE C9                       lda MetatileTile3, x
0C523 8D 6D 05                       sta RAMbufferw1+1
0C526 BD FF C8                       lda MetatileTile2, x
0C529 8D 6C 05                       sta RAMbufferw1+0
0C52C BD 20 C8                       lda MetatileTile1, x
0C52F 8D 6F 05                       sta RAMbufferw1+3
0C532 BD 41 C7                       lda MetatileTile0, x
0C535 8D 6E 05                       sta RAMbufferw1+2
0C538                               
0C538 A6 41                          ldx goodLocation
0C53A AD 6F 05                       lda RAMbufferw1+3
0C53D 9D 6C 05                       sta RAMbufferw1, x
0C540 CA                             dex
0C541 AD 6E 05                       lda RAMbufferw1+2
0C544 9D 6C 05                       sta RAMbufferw1, x
0C547 CA                             dex
0C548 AD 6D 05                       lda RAMbufferw1+1
0C54B 9D 6C 05                       sta RAMbufferw1, x
0C54E CA                             dex
0C54F AD 6C 05                       lda RAMbufferw1+0
0C552 9D 6C 05                       sta RAMbufferw1, x
0C555 98                               tya
0C556 18                               clc
0C557 69 10                            adc #$10 ;increment y by 16!!!!
0C559 A8                               tay
0C55A CA                             dex
0C55B 86 41                          stx goodLocation
0C55D 10 BE                          bpl -- ;if not we are ready to do the next metatile
0C55F                           
0C55F 20 63 C5                        jsr colors
0C562                                ;lda #11111111b ;true   ;draw_RAMbufferColors ends with #10100101b in the accumulator
0C562                                 ;sta DrawnRAMbuffers
0C562 60                             rts ;end of draw_RAMbuffers
All of that looks correct to me. The jsr colors at the end doesnt do much of anything right now.


Top
 Profile  
 
PostPosted: Tue Nov 19, 2013 4:31 pm 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 859
Location: cypress, texas
Kasumi wrote:
If that looks right, the issue is either your buffer or using too much time (assuming rendering is enabled). To check if using too much time, just disable rendering before, and enable it after.
When doing that my screen just slides down over and over again. :( :?
Code:
  ldx #$02 ;load screen number with x
  ldy visible_left;phase;#$00
  lda #$00
  sta PPUMASK1
  jsr draw_RAMbuffers ;32 bits wide (2 columns)
  lda #$1e
  sta PPUMASK1   


Top
 Profile  
 
PostPosted: Tue Nov 19, 2013 5:27 pm 
Offline
User avatar

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1122
Ignore what the actual rom displays while running and check the nametable viewer in FCEUX to verify instead. If they don't differ, you're fine.

But I think you're fine anyway, based on this:
Quote:
And I commented the lda (ptr),y line like you suggested. And then I ran the code and it ran perfectly!!!!!!! :D :shock: Nothing was raised up when it restarted the nametable! Just kept going.

edit to your post above. Then again, the difference between the two routines (that line commented out vs. not) is at least 360 cycles which isn't that small. draw_me_a_column is run at the beginning of the NMI, I'd assume?

Edit: You could actually benchmark it, but I don't know the best way to recommend doing that. I guess grab this build of virtuaNES: viewtopic.php?p=47911#p47911
Then, whereever jsr draw_me_a_column is, do this:
Code:
sta $401E
jsr  draw_me_a_column
sta $401F

It will display on screen how long the routine took each frame. If virtuaNES doesn't work (language plugin complaint and you don't want to dig one up), NintendulatorDX: viewtopic.php?t=6773 can do the same sort of thing.

I see the buffer routine, but yo... it's long, I'd just debug. Totally ignore if the code looks right, see if the result is right. Check the RAM this routine writes to.

Put a breakpoint at
Quote:
0C562 60 rts ;end of draw_RAMbuffers

And look at RAMbufferw1 (or whatever RAM this is supposed to update) using FCEUX's hex editor. Are all 60 values correct?

If all 60 are correct, is there a possibility something else writes to this RAM before draw_me_a_column tries to read it? Find out! Break at the start of draw_me_a_column and find out if they're STILL right. If they aren't, break on write to whatever's the first one that's wrong. Use the trace logger to find out what wrote the wrong thing to it. If they are still right at the start of draw_me_a_column, is whatever sets the pointer to RAMbufferw1 doing it properly?

Does doing this:
lda RAMbufferw1, y;
instead of this:
lda (p0ointer),y ;RAMbufferw1, x
Make it work?
(I'm saying just replace the line that uses a pointer with the absolute location the pointer is supposed point to. For all I know, that's really not still RAMbufferw1, hence this explanation ;) )
If so, the problem is definitely your pointer.

If all 60 values aren't correct at the rts from draw_RAMbuffers, put a breakpoint on write for whatever RAM location is the first to have an error. Run FCEUX's trace logger. When the breakpoint hits, find the beginning of draw_RAMbuffers and go down to see what caused the wrong value to be written.

That's what I'd do to debug this. I'll read draw_RAMbuffers and see if I find anything off, and edit this post if I find a thing.

Edit2: Okay, I read it and I got nothing. So yeah, try 'dem debug steps.

_________________
https://kasumi.itch.io/indivisible


Top
 Profile  
 
PostPosted: Tue Nov 19, 2013 9:59 pm 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 859
Location: cypress, texas
Kasumi wrote:
And look at RAMbufferw1 (or whatever RAM this is supposed to update) using FCEUX's hex editor. Are all 60 values correct?
WOAH (There's even more hex values to look at)... all 60 values... my sister said she would help me with getting those tomorrow morning.
Goodnight.
Kasumi, thank you for all of this help... your whole post!! :D

edit: Ok all 60 values are correct inside RAMbufferw1... they are correctly incorrect...
Code:
0A 0A
0A 0A
 ...
27 27
27 27
Code:
27 27
27 27
 ...
0A 0A
0A 0A
That's how it is but it is incorrect because the 0A 0A 0A 0A metatile is susposed to be at the bottom (top) ... it's at the beginning (end)... everything else is shifted down (up)... That's how it is but it is incorrect because the 0A 0A 0A 0A metatile is susposed to be at the top (not at the bottom) ... it's at the end... everything else is shifted up... so my code is running correctly with incorrect data. I've gone through our level 1 DAC file twice... everything is correct... so now I'm lost. But im going to read your post again. :) ...afterlunch

edit2: I got lost in your nintendulator dx link... I read the entire 7 pages... and I was wondering does Nintendulator DX work with asm6 too? qbradq mentioned learning about ca65 and that he would not like to return to non-ca65 life... but I'm only using asm6 right now. :)

edit3. edit4.

edit5:
Kasumi wrote:
Then again, the difference between the two routines (that line commented out vs. not) is at least 360 cycles which isn't that small.
How do you know this? :? : )
Kasumi wrote:
draw_me_a_column is run at the beginning of the NMI, I'd assume?
Draw_me_a_column is called twice in my update_vram method.
Code:
0C601                           update_vram: ;testing... good sofar!
0C601 85 FF                             sta $ff
0C603                                 
0C603                                 
0C603 A5 33                           lda my_copy_of_last_write_to_PPUCTRL
0C605 09 04                           ora #00000100b  ;change $2007 increment to +32
0C607 8D 00 20                        sta $2000
0C60A 85 33                           sta my_copy_of_last_write_to_PPUCTRL
0C60C                                 
0C60C                                 
0C60C A5 42                           lda iBeginAtOne  ;ahahahahahhahahahahahahahahaha!  it works!!!  :)
0C60E D0 1C                           bne +end
0C610                                   ; jsr next ;determines columnHi and columnLo
0C610                              ;         phases                0 4 8 12 16 20 24 28
0C610                              ;                              
0C610                                 
0C610                                 
0C610                                 ;if columnsDrawn == columnLo
0C610                           ;       ldx phase
0C610                           ;      txa
0C610                           ;      pha ;---------->
0C610                           ;      lda phases, x
0C610                           ;      sec
0C610                           ;      sbc columnLo
0C610                           ;      bne +end  ;only runs with 0
0C610                           ;      
0C610                           
0C610                           
0C610 A9 30                         lda #<RAMbufferw0
0C612 85 43                         sta p0ointer
0C614 A9 05                         lda #>RAMbufferw0
0C616 85 44                         sta p0ointer+1
0C618 20 E2 C6                      jsr draw_me_a_column  ;yes, <this draws one 16bit-wide column.
0C61B                              
0C61B 20 40 C6                     jsr prepare4new_column
0C61E                              
0C61E A9 6C                        lda #<RAMbufferw1
0C620 85 43                        sta p0ointer
0C622 A9 05                        lda #>RAMbufferw1
0C624 85 44                        sta p0ointer+1
0C626 20 E2 C6                     jsr draw_me_a_column
0C629                                    
0C629 20 2D C6                        jsr update_colors      
0C62C 60                         +end:   rts ;end of update_vram.
         
And update_vram is called near the middle of my vblank procedure.
Code:
0C5DC 48                        vblank: pha
0C5DD 98                                tya
0C5DE 48                              pha
0C5DF 8A                              txa
0C5E0 48                              pha
0C5E1                                 
0C5E1 E6 1E                             inc FRAME_CNT
0C5E3                                 .incsrc "daprg-vblank.asm"
0C5E3                           +   ;skip the video updates if the frame calculations aren't over yet
0C5E3 24 21                        bit FrameReady
0C5E5 10 08                        bpl SkipUpdates
0C5E7                           
0C5E7                              ;PERFORM VIDEO UPDATES HERE
0C5E7 20 FB C5                    jsr update_sprite
0C5EA                             
0C5EA                             
0C5EA 20 01 C6                    jsr update_vram    ;sets increment to +32
0C5ED                             
0C5ED                             
0C5ED                           
0C5ED                           
0C5ED                               ;modify the flag
0C5ED E6 21                        inc FrameReady
0C5EF                             
0C5EF                             
0C5EF                           
0C5EF                           SkipUpdates:
0C5EF                           
0C5EF                              ;PERFORM TASKS THAT MUST BE PERFORMED EVEN
0C5EF                              ;WHEN THE FRAME IS NOT READY, SUCH AS UPDATING
0C5EF                              ;THE MUSIC OR DRAWING A STATUS BAR
0C5EF 20 BE DE                      jsr FamiToneUpdate
0C5F2                           ;"Setting the scroll should ALWAYS be the very last thing in your VBlank handler." -tokumaru pg 43
0C5F2 20 48 C6                    jsr scroll_screen
0C5F5                           
0C5F5                              ;return from the NMI (vblank)
0C5F5 68                           pla
0C5F6 AA                           tax
0C5F7 68                           pla
0C5F8 A8                           tay
0C5F9 68                           pla
0C5FA 40                           rti


Top
 Profile  
 
PostPosted: Thu Nov 21, 2013 5:21 pm 
Offline
User avatar

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1122
Quote:
I got lost in your nintendulator dx link... I read the entire 7 pages... and I was wondering does Nintendulator DX work with asm6 too? qbradq mentioned learning about ca65 and that he would not like to return to non-ca65 life... but I'm only using asm6 right now. :)

Err... for the source level debugging? I have no idea, I've never used it for that. I was just talking about its cycle timing stuff. What you use to assemble the rom doesn't matter for this.

Download it, open it. Run your rom. Open the Debug, Disassembly window, and you'll see a place called timers. If you store to $401E/$401F as I described in my previous post (or before and after the thing you want to benchmark), the number of cycles that routine took will be next to timer 1. (Read the readme to learn how to use more/other timers.)

Quote:
How do you know this? :? : )

Hah, 360 is wrong because I looked at the wrong value. It'd really be 300. But... I know because lda (indirect),y (used by lda (p0ointer),y ) takes 5 cycles, and it's used in a loop that runs 60 times (well... it runs 30 times twice, anyway...). If you comment it out, it's no longer doing it so that time is saved.

Anyway, none of that matters until you find out how the wrong values get to that RAM in the first place. Garbage in, garbage out so there's not much point to checking if this taking too long is part of the cause of bad output until you fix the bad input its getting.

And, I can't really help beyond steps outlined on my last post. Break on writes to the first wrong value. Which... actually seems to be the first value. If everything moved up as I'm understanding, the data is 100% wrong (because there is no value that is in the right place.). Run trace logger, break on writes to find out how the first thing ends up wrong. Fix it.

I'd bet it's the pointer, since you said you're VERY sure your actual level data is correct. So similar to what I asked before, does it work if you replace
Code:
0C4D2 B1 10                      --   lda ($10), y


With lda leveldata,y where leveldata is wherever that pointer is supposed to point? If so, neat! If not, oh well, you gotta debug. Was just a guess.

Edit: Heck, other things it could be. I'm gonna guess that the metatile that should be on top is the same for both the column you're trying to read and the column next to it? Then it could be y just has the wrong value (one greater than it should be) when reading from the pointer for the first, and you're offset by 1. (Skipping the first tile in column A, getting the first tile of Column B at the bottom) So check load_screen.

_________________
https://kasumi.itch.io/indivisible


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1443 posts ]  Go to page Previous  1 ... 71, 72, 73, 74, 75, 76, 77 ... 97  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group