It is currently Sun Oct 22, 2017 3:57 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 36 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
PostPosted: Fri Nov 15, 2013 2:09 am 
Offline
User avatar

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1020
Code:
DrawScreen:

        LDA #<pic              ; load low byte of first picture
        STA $10
        LDA #>pic              ; load high byte of first picture
        STA $11

I think he's talking about that.

But that probably shouldn't be a problem, it's run only once before the music's own init routine. To be extra safe, one could zero them out after DrawScreen is run, though.

Code:
 JSR DrawScreen          ; draw initial nametable
  lda #$00;Add this
  sta $10;And this
  sta $11;And this

Hacky, but eh. That's what this'll always be.

Quote:
and how do you know that PPMCK uses them too? are they in one of the .h or asm files inside the MML Bundle?

A really quick, (but not really failsafe) way to see what RAM is being used by your NSF is to run it in FCEUX. Debug, hex editor. Scan through 0x0000-0x07FF. Anything that's non zero is definitely being used, but things that are zero aren't necessarily free.

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


Top
 Profile  
 
PostPosted: Fri Nov 15, 2013 2:56 am 
Offline

Joined: Fri Mar 08, 2013 12:19 am
Posts: 43
Ok so I'm sorta getting it now. Since I'm going to be filling my rom up with as much music as possible should I choose a location like $7900? I assume you are talking about locations in the .nes rom right? I looked at my .nes in hexedit and noticed the code for vegaplay looks like it starts way down at $7A10. So $7900 through $7A00 look free to me.

So if I understand you correctly I need to alter the asm to read
Code:
ClearSprites:
      STA $500, x
      INX
      BNE ClearSprites

      LDA #$00
      STA $2003                 ; set the low byte (00) of the RAM address
      LDA #$79
      STA $4014                 ; set the high byte (05) of the RAM address

LoadSprites:
      LDX #$00
LoadSpritesLoop:
      LDA sprites, x            ; load data from address
      STA $7900, x              ; store into RAM address
      INX
      CPX #4
      BNE LoadSpritesLoop
      RTS
instead of the way it was before with $500 in the LoadSprites SDA spot and in the ClearSprites LDA spot.

Where do I add the code for the $2004 register like you described? There is already a spot with those variables in the code that looks like
Code:
sprites:
           ;vert tile attr horiz
        .db $37, $2D, $00, $18  ; sprite


Just simply changing what I have above doesn't do the trick I know there is more to what you told me, but I'm too new at this to know how to proceed.


Top
 Profile  
 
PostPosted: Fri Nov 15, 2013 3:02 am 
Online

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6296
Location: Seattle
Septr wrote:
What I'm concerned with fixing in terms of 'getting the cursor working' is removing all the glitchyness from the screen. It seems to move in time with the music and scroll through every tile in bank 2 of the .chr.
You're absolutely right; this is because your NSF is overwriting the bytes at $0500-$05FF , where vegaplay is storing its sprite memory.

Septr wrote:
What line in the vegaplay.asm are referring for those addresses? and how do you know that PPMCK uses them too? are they in one of the .h or asm files inside the MML Bundle?
What Kasumi said. I know PPMCK is using them too because I used bisqwit's nescom's clever-disasm to automatically disassemble your .NES file, where I found two different places $10 was being used. I assume it's somewhere inside the MML bundle, but changing either is sufficient.

As far as what I was suggesting: I made the modifications and have attached them. To explain exactly what I did:
  • I added a NES-2.0 compliant header (because why not)
  • I removed the redundant clearing of memory at $0800 and $0900
  • I increased the startup time to wait 2-3 vblanks instead of 1-2
  • It no longer clears the picture on screen when it boots, because it uploads the actual picture immediately afterwards
  • I made the sound initialization comply with what the NSF page says on nesdevwiki
  • I moved the pointer that used $10 and $11 to something explicitly allocated at the top of the asm file
  • I threw away the old sprites code and replaced it with my minimized one that takes advantage of the NES's design and avoids its bugs. (In short: The NES guarantees that the sprites pointer is 0 at the end of normal rendering. Actively changing the sprites pointer causes corruption, so I avoid it by using the above. We don't actually need to clear the entirety of sprite memory every vertical refresh as I suggested doing in my previous post, so now I do it only once)
  • I shaved off 144 more bytes for your NSF.

I hope I haven't ruined your fun by doing it for you ... :|


Attachments:
vegaplay-modified.zip [2.21 KiB]
Downloaded 78 times
Top
 Profile  
 
PostPosted: Fri Nov 15, 2013 3:08 am 
Offline
User avatar

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1020
I made the thing. (And lidnariq beat me to it AGAIN!!!!)

I guess alternates are always good...

Here is Vegaplay completely free of sprites and (hopefully) most other stuff that would cause incompatibility. Barely tested, though. Should support up to 10 songs without customization. Cursor tile is customizable.

If you want to change where it appears, edit cursornametablehi and cursornametablelo.

"How do I know what to put there?" Open your rom in FCEUX. Debug, nametable viewer. Move your mouse where you want to put the cursor. At the bottom right, you'll see PPU address. The first two characters go in cursornametablehi, the second two go in cursornametablelo.

I could make this slightly better (animated cursor wouldn't be too hard to do at least), but who knows if I ever will. Enjoy.

Quote:
Since I'm going to be filling my rom up with as much music as possible should I choose a location like $7900?

That's not a valid place to start a ROM. Don't aim to use more than you have. $8000 through $FFF9 minus the bytes vegaplay uses.

Edit: Also, if you want more than say... 23 songs, this probably has to be modified to scroll. (I say 23, not 30 to make some room for title graphics/safe area).

Edit2: Silly me, uploaded a broken file. Tried to move something to make it easier to edit, not realizing of course it wouldn't assemble.

Edit3: Fixed wrong cursor offsets for later songs. Whoops. I wasn't kidding when I said barely tested.


Attachments:
vegaplay.asm [7.19 KiB]
Downloaded 82 times

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


Last edited by Kasumi on Fri Nov 15, 2013 3:48 am, edited 1 time in total.
Top
 Profile  
 
PostPosted: Fri Nov 15, 2013 3:48 am 
Offline

Joined: Fri Mar 08, 2013 12:19 am
Posts: 43
lidnariq wrote:
I hope I haven't ruined your fun by doing it for you ...

No fun ruined here. You've only allowed my fun to actually continue. I enjoy making music and modding hardware. I start cracking my head open when I have to start programming or debugging in a difficult and foreign language such as NES assembly. I can't thank you guys enough. You guys are all diamonds.

Do either of you foresee any conflicts that might arise from using most of the memory when I'm nearing completion of the album? I know I can only go so far with it, but will it stop me with the same issue somewhere like half way though my work or can I get pretty much most out of this configuration? And also if I do run into some issues down the line could I message either of you guys for more help?


Top
 Profile  
 
PostPosted: Fri Nov 15, 2013 3:56 am 
Offline
User avatar

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1020
No, I don't foresee any issues, but I really make no guarantees. (Like the broken files I uploaded the first two times. :oops: Fixed now!) If it's any consolation, I just tried mine with a 16 KB NSF, which was the largest I have around that's not also too large for NROM (greater than 32KB). Worked fine.

Sure, you can message me or just post here where lidnariq will beat me in the race! :beer:

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


Top
 Profile  
 
PostPosted: Fri Nov 15, 2013 4:03 am 
Offline

Joined: Fri Mar 08, 2013 12:19 am
Posts: 43
Kasumi wrote:
Sure, you can message me or just post here where lidnariq will beat me in the race! :beer:

I'm not going to lie. I had quite the chuckle witnessing how close both of you were to replying on two occasions. XD

And yeah, I'm only using an NROM-256 along with a 27C256 EPROM so I'm assuming things with go smoothly in regards to the hardware side of things.


Top
 Profile  
 
PostPosted: Fri Nov 15, 2013 12:55 pm 
Online

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6296
Location: Seattle
Yeah, I think both Kasumi's and my implementation should work.

If you ever do want the cursor to be animated, rather than snapping from tile to tile, you'll need to start with my version. Other than that, both should work fine.


Top
 Profile  
 
PostPosted: Fri Nov 15, 2013 3:24 pm 
Offline

Joined: Fri Mar 08, 2013 12:19 am
Posts: 43
Cool. maybe you can point me in the right direction so some material to read so I can try and figure it out. Now are we taking about only animating the screen location, or can I cycle through a tile or two for proper animation?

I had actually already been trying to modified your version to put the cursing is more custom locations.
Code:
UpdateSprites:
   ;; in NMI, assuming rendering is just finished
   ;; naturally-- can write 7 bytes to $2004

   LDX SongNumber
   LDA Virtical,x  ; Y
   STA $2004
   lda #$2B    ; tile #
   sta $2004
   lda #0      ; attrib (e.g. palette)
   sta $2004
   lda Horizontal,x    ; X
   sta $2004

   RTS

;;;       ----------------------------------------------------

Virtical:
   .db $77,$87,$97
   
Horizontal:
   .db $2F,17,2F

Though when I tried setting a jump location like that for the tile spot I got errors. I'm gessing is doesn't work the same. if it's possible for animations I would be cheating myself if I didn't try to get that implemented as well :)


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

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1020
Quote:
Now are we taking about only animating the screen location, or can I cycle through a tile or two for proper animation?

Animating screen location (by say... smoothly sliding the cursor between two songs when one ends, rather than have it warp down) is only possible with sprites.

Having the cursor animate by changing tiles is easy for either method, but really you kinda have to learn a lot about the NES and 6502 programming to do it. If you eventually want to make homebrew games, try reading some of this: http://nintendoage.com/pub/faq/NA/nerdy_nights_out.html If all you want is just this done, one of us may as well do it for you since it'll take like two seconds as opposed to like... the minimum couple weeks you'll have to spend learning to accomplish the one task.

I could make mine customizably animated later tonight, but I'm about to go out to dinner.

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


Top
 Profile  
 
PostPosted: Fri Nov 15, 2013 3:53 pm 
Online

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6296
Location: Seattle
You can use tile-cycling animations using either his or mine.

Moving around not on multiples of 8 pixels, you'll have to use mine.

Color changes are a fuzzy case; if you're only using a single color and just want it to change you can probably instead change the color in the palette and use his or mine. If you want the cursor to have more colors than the current one color, you'll probably need to use mine (the NES requires that every 16x16 pixel block in the background use the same set of three colors)

You failed to put $s before your hexadecimal numbers, there; otherwise it seems to work.

(Also, you'll want those tables to be as long as the number of songs you have, and for the two lines later in the file: CMP #10 ; equal to total # of songs +1, starting from 0 and LDA #9 ; equal to total # of songs, starting from 0 to match that number also)


Top
 Profile  
 
PostPosted: Fri Nov 15, 2013 4:16 pm 
Offline

Joined: Fri Mar 08, 2013 12:19 am
Posts: 43
Kasumi wrote:
If all you want is just this done, one of us may as well do it for you since it'll take like two seconds as opposed to like... the minimum couple weeks you'll have to spend learning to accomplish the one task.
I could make mine customizably animated later tonight, but I'm about to go out to dinner.



That would be wonderful. I just didn't know how far I could politely go in terms of asking for it to be done for me. Cause as I said before I'm a complete novice. If either of you could add animated sprites that allow me to designate which and how many tiles are used that would be awesome. And a smoother transition like what you are describing lidnariq would be very useful as well. lol Both would be freakin' ace! I don't need color changing. But I do need to have multi color curser. I'm using these that I mocked up for my current tests. And I'm also only currently using 4 colors total for the entirety of the graphics.

lidnariq wrote:
You failed to put $s before your hexadecimal numbers, there; otherwise it seems to work.

Oopsie. I had it correct during testing, but just quickly typed it back in when trying to show you guys. :P


Attachments:
Picture 31.png
Picture 31.png [ 3.16 KiB | Viewed 1654 times ]
Top
 Profile  
 
PostPosted: Fri Nov 15, 2013 6:03 pm 
Online

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6296
Location: Seattle
Septr wrote:
If either of you could add animated sprites that allow me to designate which and how many tiles are used that would be awesome.
Just a simple flipbook that goes continuously? Or do you want it to be part of the transition animation? Or something else?


Top
 Profile  
 
PostPosted: Fri Nov 15, 2013 8:00 pm 
Offline
User avatar

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1020
Here's one that allows you to customize the cursor animation. To change the animation, set the length with NumberOfFrames, then add/subtract bytes from cursoranimation as needed. All frames will show up for the same amount of time (CursorDelay). If you want variable delays, find the least common multiple of the delays you want and double up tiles as needed.

That's about as far as I go, unless I broke it again somehow. The more things you want, the harder it is to make customizable anyhow.


Attachments:
vegaplay.asm [7.42 KiB]
Downloaded 79 times

_________________
https://kasumi.itch.io/indivisible
Top
 Profile  
 
PostPosted: Sat Nov 16, 2013 12:25 am 
Offline

Joined: Fri Mar 08, 2013 12:19 am
Posts: 43
lidnariq wrote:
Septr wrote:
If either of you could add animated sprites that allow me to designate which and how many tiles are used that would be awesome.
Just a simple flipbook that goes continuously? Or do you want it to be part of the transition animation? Or something else?


Yeah just like a single loop. I will probably be building some frames to make the curser look like its rotating or bouncing (all within the 8x8 tile of course.) So I could make like three or four tiles of curser animation and it will loop continuously. and if it's is possible maybe like a smooth transition to the next location whenever changing songs (like tweening)

I'm downloading your new version now, Kasumi.

Edit: I tried out you code Kasumi and I noticed that you changed the chr page that the curser used to the same one the background uses. Was that on purpose? I used to put all my curser graphics in page 2 but now it's scrolling though tiles from my background. My preference would be to have the cursers on there own chr page, cause I want as many tiles as I can manage for my back ground graphics. I know it'll only be like 3-4 tiles lost but I could very easily be needing those tiles later on with the plans I have.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 36 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: BlackGuyRX and 2 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