It is currently Thu Oct 19, 2017 6:06 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 112 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8  Next
Author Message
 Post subject:
PostPosted: Sun Jul 31, 2005 6:26 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2129
Location: Minneapolis, Minnesota, United States
Okay, so if the hi bit is on, it would equal 8 in binary, which is why you have 85 for list something 5 times! yay. I figured something out. So when you define the bytes like you did in the compression thing above, you just have to decompress it? you don't have to write a compression code?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 31, 2005 8:14 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19100
Location: NE Indiana, USA (NTSC)
You have to compress the data within the map editor, or if your map editor doesn't compress, you have to compress the data with some external tool.

At least one popular RLE compression format uses signed numbers: 0 through 127 for a string of 1 to 128 literal bytes, or -1 through -127 for a run of 2 through 128 copies of the following byte. This format, introduced by Apple Computer with the MacPaint file format, is called PackBits. I've written a PackBits compressor (in C) and a decompressor (in 6502 assembly language) as part of Pin Eight NES Tools.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 01, 2005 11:54 am 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2129
Location: Minneapolis, Minnesota, United States
Okay, this is really dumb, but how do you pull a byte from a .db line?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 01, 2005 12:21 pm 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
Code:
MyData:
.db $54, $34

MyCode:
   LDA MyData    ;A will be $54
   LDX MyData+1  ;X will be $34


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 01, 2005 12:25 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2129
Location: Minneapolis, Minnesota, United States
Oh, I didn't know that when you loaded A with the data, it would equal the first byte of the data. If that didn't make any sense, I didn't know that what you just said was true. :) Well, I've decided upon which RLE decompression method I'm going to use, and that's the one Disch displayed, because it makes alot of sense. I need to think of a good code. Because I'm not sure how I would tell it to do this:

Code:
lda data
ldx data+1
ldy #Low(data)
(some other code here saying display data+1 as many times as the low byte of data says)


That last part would be a bit tricky. Anyone know how to do that?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 01, 2005 2:27 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2129
Location: Minneapolis, Minnesota, United States
I'm assuming that you'd have to have all of that information present, so that's why I used a,x, and y. :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 01, 2005 2:48 pm 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
You will probably need Y for indirection (odds are you will need to use Indirect.Y addressing mode). X will probably need to be used as a counter to count down the run length. A will probably need to be used for memory movement and other things. Which means you'll need areas in RAM for other information (like current source and dest positions, remaining bytes to be decompressed, etc)

But I'm kinda just blowing smoke at you.

I'm kind of in agreement with blargg on this one. It looks like you're trying to move too far too fast. Before you start doing things like compression you should really get more familiar with the basics.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 01, 2005 3:01 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2129
Location: Minneapolis, Minnesota, United States
Well, I just want to find a way to load a background with out an emulator going phsyco or displaying Name Table 1.5. If what you mean by basics is Sprite moving, Sprite DMA, joypad handling, vblank, etc., I pretty much have that all down. I'm thinking loading a background is pretty basic. Maybe I'll just start making one screen backgrounds with NSA. It's just that it always screws up on emulators, and shows name table 1.5. But no one else seems to have this problem, so maybe it's just my code. Any one know a decent way to load a .nam file?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 01, 2005 3:29 pm 
Offline
User avatar

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
I think a .nam file is in the native PPU format for loading; just copy it to the current nametable memory (along with the proper pattern table) and it's displayed.

I'll figure out how to do this this evening and e-mail you demo code in our ongoing tutorial.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 01, 2005 3:45 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2129
Location: Minneapolis, Minnesota, United States
Yeah, the only problem is it doesn't work on most emulators. It is displayed incorrectly, and looks like the camera scrolled down to Name table 1.5 and stopped.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 01, 2005 5:09 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1389
Celius wrote:
Yeah, the only problem is it doesn't work on most emulators. It is displayed incorrectly, and looks like the camera scrolled down to Name table 1.5 and stopped.


Actually, "loading a .NAM file" does work just fine on most emulators, AS LONG AS you do the other necessary stuff (i.e. turn off rendering while writing, set the VRAM address to the correct value, reset the origin/scroll parameters when you're done, and re-enable rendering at the end).

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 01, 2005 6:55 pm 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3470
Location: Indianapolis
And don't forget the all-important NMI routine, to be enabled once you've got your full nametable loaded. You'll want to at least write zeros to $2005 and $2006 in there, otherwise I think the screen would get stuck at whatever point you turned it on.

That could be why it looks like it scrolled (it didn't scroll, but rather started it's display at the wrong origin). I used to see that all the time in my programs, but it was temporary (since NMI would fix it on the next frame). Now I get around that by waiting for a vblank before enabling the screen.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 17, 2005 2:31 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2129
Location: Minneapolis, Minnesota, United States
Okay, are you not able to incbin more than 7 nam files, or what? Because I was putting together a quick demo, and I tried to take the high and low bytes of the adress that the 8th nam file was at, and it completely screwed up, and the name table was all messed up. But in my routine, I changed it from taking the high and low bytes of the 8th nam file, to taking the high and low bytes of the 7th nam file, and it worked just fine. If you switch the nam files around, it will always load the last one improperly. I'm thinking it has something to do with memory space. Any clue?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 5:57 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10057
Location: Rio de Janeiro - Brazil
I don't see a reason for that problem unless you are going over the limit the PRG bank can store. How big are your nam files? How big is your code?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 7:29 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2129
Location: Minneapolis, Minnesota, United States
Sorry for a late reply, my nam files are 1K each, and I think that is going way over the prg limit. And my PRG banks are 16K, actually, now that I think about it, I don't know how I could be going over the limit. But just a rough idea, not really an educated guess, it may have something to do with memory mirroring like in RAM, but I have my nam files in PRG. I hope that's not a problem. Oh, and if I put my nam files right by the .org $8000 part, it says "Bank overflow! <$1FFF!" And when I put them back on bottom, it doesn't say that. But, I don't have any segments where I org it at any different location, or change banks, so what's the deal? I don't get it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 112 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 9 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