| |||
Views: 88,491,279 |
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search | 04-27-24 05:36 AM |
|
Guest: Register | Login |
0 users currently in ROM Hacking | 7 guests |
Main - ROM Hacking - I don't believe in giving up... | New thread | New reply |
NetSplit |
| ||
Level: 32 Posts: 55/178 EXP: 188043 Next: 18399 Since: 02-26-07 Last post: 2218 days Last view: 2143 days |
I can't figure it out. Please paste all the code you're using, exactly as you're using it. Thanks. |
RetroRain |
| ||
Fuzz Ball Level: 66 Posts: 16/994 EXP: 2438345 Next: 23506 Since: 09-30-07 Last post: 1936 days Last view: 958 days |
.inesprg 1
.ineschr 1 .inesmir 1 .inesmap 0 .org $8000 .bank 0 Start: ;this sets up the PPU lda #%00001000 sta $2000 lda #%00011110 sta $2001 ;set to start of palette lda #$3F sta $2006 lda #$00 sta $2006 ;these are the writes that setup the palette lda #$0F sta $2007 lda #$05 sta $2007 lda #$06 sta $2007 lda #$07 sta $2007 lda #$0F sta $2007 lda #$05 sta $2007 lda #$06 sta $2007 lda #$07 sta $2007 lda #$0F ;stop here sta $2007 lda #$05 sta $2007 lda #$06 sta $2007 lda #$07 sta $2007 lda #$0F sta $2007 lda #$05 sta $2007 lda #$06 sta $2007 lda #$07 sta $2007 lda #$0F ;Start sprite colors sta $2007 lda #$05 sta $2007 lda #$06 sta $2007 lda #$07 sta $2007 lda #$0F sta $2007 lda #$05 sta $2007 lda #$06 sta $2007 lda #$07 sta $2007 lda #$0F sta $2007 lda #$05 sta $2007 lda #$06 sta $2007 lda #$07 sta $2007 lda #$0F sta $2007 lda #$05 sta $2007 lda #$06 sta $2007 lda #$07 sta $2007 vwait: lda $2002 bpl vwait lda #$21 sta $2006 lda #$48 sta $2006 LDX #$00 TXA LDY #$10 L_Write1: ;Write logo's tiles STX $2007 INX DEY BNE L_Write1 CPX #$B0 BEQ L_End LDY #$10 L_Write2: ;Write blank tiles STA $2007 DEY BNE L_Write2 LDY #$10 BNE L_Write1 L_End: lda #$20 sta $2006 sta $2006 Loop: jmp Loop .bank 2 .org $0000 .incbin "graphics.chr" ;gotta be 8192 bytes long .bank 1 .org $FFFA .dw 0 ;(NMI_Routine) .dw Start ;(Reset_Routine) .dw 0 ;(IRQ_Routine) Compiling this code will get you this: I know what you said about the palette code being too long. I haven't made that my concern, for obvious reasons. ____________________ My YouTube Channel |
NetSplit |
| ||
Level: 32 Posts: 56/178 EXP: 188043 Next: 18399 Since: 02-26-07 Last post: 2218 days Last view: 2143 days |
I think the problem is that the code is taking too long for VBlank, so it's not able to finish writing everything. My code was actually good, it seems, but it's trying to do too much during the VBlank period (using too many cycles. Loops are less efficient, cycle-wise, than long strips of code, and my loop writes 16 blank tiles instead of using a new VRAM address. If you want to use a new VRAM address, try loading it from a table using X as the index. ANDing it can get you the useful bits).
I've been speaking with Fx3 about this and here's what he has to say: >usually, he must do the following: >A. Wait for a VBlank (twice) >B. Do the necessary stuff >C. Once it's done, wait for a NMI to trigger >D. The game starts >The B part means a lot of important things >such as "turn off sprites and background" >and setup 2006/2007 registers properly AFTER that >WHY? >because even if the Vblank period is over, the screen is DISABLED, and thus it won't scramble the thing Edit: Additionally, what assembler are you using? |
RetroRain |
| ||
Fuzz Ball Level: 66 Posts: 17/994 EXP: 2438345 Next: 23506 Since: 09-30-07 Last post: 1936 days Last view: 958 days |
Your code was pretty good. I read it line by line. Wanna see something interesting?
I changed the BIOHAZARD 2 logo to characters, and look what it does. This is using the code I just posted. Is it supposed to be using As all over the background like that? Look how messed up this whole thing gets. EDIT - I'm using NESASM. ____________________ My YouTube Channel |
NetSplit |
| ||
Level: 32 Posts: 57/178 EXP: 188043 Next: 18399 Since: 02-26-07 Last post: 2218 days Last view: 2143 days |
Again, I think it's because VBlank isn't long enough. Listen to Fx3's advice and give that a shot. The A's are there because the screen is probably initialized to 00's. |
RetroRain |
| ||
Fuzz Ball Level: 66 Posts: 18/994 EXP: 2438345 Next: 23506 Since: 09-30-07 Last post: 1936 days Last view: 958 days |
Like this?
vwait1: lda $2002 bpl vwait1 vwait2: lda $2002 bpl vwait2 lda #%00010110 ;Turn off display sta $2001 lda #$21 ; Continue code as normal sta $2006 lda #$48 sta $2006 LDX #$00 TXA LDY #$10 L_Write1: ;Write logo's tiles STX $2007 INX DEY BNE L_Write1 CPX #$B0 BEQ L_End LDY #$10 L_Write2: ;Write blank tiles STA $2007 DEY BNE L_Write2 LDY #$10 BNE L_Write1 L_End: lda #$20 sta $2006 sta $2006 lda #%00011110 ; Turn display back on sta $2001 Loop: jmp Loop I did this, and I still get the same results. However, if I take away the second vwait code, the name tables on the right side of the screen are all As. No gibberish there. I don't know. ---------------------------------------------------EDIT----------------------------------------------------- I'm gonna be taking a break from this for a little while. It's getting to be too much for me. This is where I got the graphics from by the way. This image right here, is 255x170. Its a nice quality image, and all I want to do is load the whole thing into the Name Table, so it displays nicely on the screen. I know it can be done, and I feel like as if there has to be a simpler way to do this. I'm gonna be checking out more documents later on http://nesdev.parodius.com, and see if anyone has done something like this, hopefully. Thats kinda what I been doing all along though. But, I really need a break from this. This is crazy. Resident Evil 2 test demo running on the GameBoy Advance. I'm sure they were able to put that title screen there right from the background image. ____________________ My YouTube Channel |
jargon |
| ||
Ninji Banned until 2010-10-15 for an utterly psychedelic posting style Level: 36 Posts: 7/247 EXP: 300260 Next: 7850 Since: 12-10-07 From: 480/85260 Last post: 4949 days Last view: 4607 days |
you are using too much ram jackass
now actually think about how limited the NES is, you have only a handful of kb of ram to work with. you think you can actually use a damn full screen photo for a splash? this isn't the damn SNES. now, stop working on your damn NES game, and model it in something easier first so you stop bitching and actually have something more than just zomg look at my fantabulous splash screen. too many NES 'games' end up being nothing more than a splash screen because the people involved in these homebrews are total newbs that are used to systems using hundreds of megabytes of ram. NES only has a handful of kilobytes available at any given moment. now stop working on your apparently damned project you have been running in circles with for the past 3 days and actually model it in something higher language first such as blitz basic. if you aren't a god at 6502 style assembler your project isn't damn well going to go anywhere unless you man up and learn how to develop a game on the small scale. No offense, but you seem to fail to realize the NES was made in the damn 80s. ____________________ NIHYFDTTMWTMR |
RetroRain |
| ||
Fuzz Ball Level: 66 Posts: 19/994 EXP: 2438345 Next: 23506 Since: 09-30-07 Last post: 1936 days Last view: 958 days |
Wow, what a moron you are. ____________________ My YouTube Channel |
never-obsolete |
| ||
Rat Level: 24 Posts: 12/96 EXP: 74500 Next: 3625 Since: 02-22-07 From: Phoenix, AZ Last post: 2597 days Last view: 2597 days |
Chris Covell made this demo that has a full screen splash. |
DarkPhoenix |
| ||
Micro-Goomba Level: 12 Posts: 13/19 EXP: 6512 Next: 1409 Since: 05-24-07 Last post: 5300 days Last view: 5288 days |
Since no one else seemed to want to fight with the algebra (condensing into loops), I figured I would, since the other solutions aren't working for you.
My apologies in advance for throwing pseudo-code in with the assembly. Pardon my laziness, as well as my wordiness. Also, ignore any dashes, etc. They're there strictly because the board kills whitespace. Stuff I added starts with capital letters so it sticks out. Your condensed code should look something like this, if I don't fail at algebra: vwait: lda $2002 bpl vwait VALUEA = 48 VALUEB = 00 VALUEC = 0F For VAL = 0, increment by 1 for 12 iterations { lda #$21 ;For loops 1 through 6, load #$21 If (Val>7) lda #$22 ;For our other loops, load #$22 ;----------------Alternatively, and the proper way to do the above, is to keep track ;----------------of the overflow in the following, and add it (it should be 0 or 1) ;----------------to #$21, or simply use a 2-byte number if you can ;----------------you might need to reorganize a bit to do this, though. sta $2006 lda VALUEA ;((VAL*20) +48) in high level language ;-----------------I'm counting on this to overflow, to go back to #$08 before Title7 sta $2006 ldx VALUEB ;((VAL*10) +00) TitleX: stx $2007 inx cpx VALUEC ;((VAL*10) +0F) bne TitleX Add VALUEA,20 ;Here's where we're actually doing the multiplication in that (VAL*20) Add VALUEB,10 Add VALUEC,10 } lda #$20 sta $2006 sta $2006 Strip it of the comments, see if it looks familiar. In short, Value A, Value B, and Value C are just the numbers that were changing in each part of your code. I just took your working code, found the pattern, and plugged the math in. In a high level language, you could just use VAL (your loop index) and some math to do everything. I don't think the 6502 does multiplication, though, and if it did, it'd be slow, so we accomplish the same thing with some extra memory, by adding at the end of each loop iteration. As mentioned before, the proper way to do this is really to just use a 2-byte number, starting at #$2148, and keep incrementing by 20, write the high byte to $2006, low byte to $2007. (or two 1-byte numbers, 21 and 48, and add your overflow to the 21...same thing) Something you might be wondering - I load #$21, do a compare, and if the result is true, I load #$22, rather than adding 1 to the #$21. The reason is that loading a constant is faster than an add. This is still probably ultimately slower than using a two byte number, as mentioned before, as you replace your compare (load from memory and accumulate, then possibly branch - at best, depending on processor design) with just a load from memory (and maybe a manual add, if it doesn't support 2-byte numbers out of the box). |
RetroRain |
| ||
Fuzz Ball Level: 66 Posts: 20/994 EXP: 2438345 Next: 23506 Since: 09-30-07 Last post: 1936 days Last view: 958 days |
Problem is finally solved......
Here is what happened....... After I couldn't get NetSplit's code to work, I wondered why. The code seemed like it should work perfectly. So, I decided to make my own code, similar to NetSplit's, but different. I couldn't get that to work either. Then, I tried a million other different approaches. Couldn't get them to work either. Took a break from it for a few days, then tried at it again. This time, I wrote a different routine, using a bunch of BEQs, again, no success. Going through all of this crap, needless to say I was frustrated, and puzzled. How could no logical code be working? So, I went back to NetSplit's code he gave me, and ran it. I noticed, just as before, that most of the picture is showing up. But not all of it. So I thought to myself, maybe too much is being written to the screen at once. So, I narrowed down the row (#$B0), to something smaller, such as #$60. Now I'm noticing that the top row is being shown perfectly, and it stops fine at #$60. I try a lower value. #$50. Top row shows fine, bottom gets cut off where it should get cut off. So, I came to the conclusion that there is nothing wrong with NetSplit's code, nor any of the other logical code that I used (I wrote a ton of perfect routines, that I had to delete), which should have worked, and that perhaps maybe it was something else that was causing this to happen. I finally got my answer this morning...... lda #%00010110 ;Turn off display sta $2001 This little bitch right here. I copied this code from that same document that originally didn't run my code due to where I had my bank code located. Remember when I switched those two around, and finally it worked? Well, I thought to myself. If I am turning off the display completely, to write to the screen, then why are there 1s in there? lda #%00000000 sta $2001 Changed it to this, and problem is fixed. NetSplit's code runs the whole logo, with no problem. So.........in summary, what most likely was happening, was: Half of the problem was not turning the screen off, the other half was turning the screen off improperly. Yeah, that really sucks. I learned a lot from this experience, and I couldn't have done it without the help from you guys, but also, to any newbies or people looking to code a homebrew or something, you might want to stay away from this document: http://nesdev.parodius.com/NESprgmn.txt This guy apparently does not know how to use proper code. And I have a suggestion. If anyone wants to sticky this topic, so others don't have to go through what I went through, and this topic was a great learning experience. Maybe people can learn from it. Its got a lot of info. ____________________ My YouTube Channel |
blackhole89 |
| ||
The Guardian Moloch whose eyes are a thousand blind windows! Level: 124 Posts: 1226/4196 EXP: 21534278 Next: 302323 Since: 02-19-07 From: Ithaca, NY, US Last post: 472 days Last view: 85 days |
|
RetroRain |
| ||
Fuzz Ball Level: 66 Posts: 21/994 EXP: 2438345 Next: 23506 Since: 09-30-07 Last post: 1936 days Last view: 958 days |
Could you tell me how do I use table files? I wanted to use NetSplit's palette code, to narrow it down, but whenever I go to compile, it tells me that the table is an invalid instruction, and it doesn't even display the whole table line.
------------------------------------------------------------------------------------------------ ; NetSplit's Palette Loader Code LDX #$20 L_PalInit: LDA table-1,X STA $2007 DEX BNE L_PalInit table dc.b $0D,$0C,$0B,$01,$0A,$09,$08,$01,$07,$06,$05,$01,$2B,$08,$0D,$01,$0D,$0C,$0B,$01,$0A,$09,$08,$01,$08,$07,$06,$05,$04,$03,$02,$01 ------------------------------------------------------------------------------------------------ Does the table itself have to be in a certain spot in your code, like at the bottom? Or can it be used anywhere? ____________________ My YouTube Channel |
NetSplit |
| ||
Level: 32 Posts: 58/178 EXP: 188043 Next: 18399 Since: 02-26-07 Last post: 2218 days Last view: 2143 days |
It's not a table file. 'table' is an arbitrary label that I used to identify the table of palette data. I used syntax that works in Sephiroth3's FSNASM assembler. In his assembler, dc.b is syntax for byte data, so if you want straight data in the ROM, you would use dc.b. 'table' is the label that identifies that data, and I referenced it in the code as 'table-1' (to tell it to load from 1 before the address that 'table' is located at).
Your assembler is seeing 'table' and assume it's an instruction, but it's not. FSNASM treats anything that's not an instruction or special command code as a label. Your assembler apparently does not, so there is likely some special command code for labeling something. Additionally, there is likely a special command code for defining something as pure data rather than as an opcode. Read the assembler's documentation to find out what the commands are for this. Also, it shouldn't matter too much where the data table is defined. Regardless of whether you define it at the beginning of the file, right before or after the code, or at some random place, it will put the appropriate address into the place where the label referenced. I should just caution you to ensure that it's not in a different bank unless you know that bank will always be loaded at the same time that the table is needed. |
RetroRain |
| ||
Fuzz Ball Level: 66 Posts: 22/994 EXP: 2438345 Next: 23506 Since: 09-30-07 Last post: 1936 days Last view: 958 days |
Okay, if I can't get it to work, I might try Sephiroth3's assembler. Um, another thing, out of the 8 palettes that are there, how do you specify a different palette?
I want the text that I have to be in the color White (#$20). ____________________ My YouTube Channel |
Ailure |
| ||
Hats Steam Board2 group Level: 121 Posts: 2091/3965 EXP: 19780341 Next: 276355 Since: 02-19-07 From: Sweden, Skåne Last post: 3302 days Last view: 2053 days |
Posted by blackhole89And it might not seem much, but a such good would actually be useful. Kinda would made my NES programming experiments much quicker. I wasn't really programming much to make a game though, just getting to know the console hardware. ____________________ AIM: gamefreak1337, MSN: Emil_sim@spray.se, XMPP: ailure@xmpp.kafuka.org
|
NetSplit |
| ||
Level: 32 Posts: 59/178 EXP: 188043 Next: 18399 Since: 02-26-07 Last post: 2218 days Last view: 2143 days |
Background palettes are determined by the attributes table, a set of #$40 bytes that is located after the tile data per screen in the name tables. Each byte affects 4 2x2 tile sections. The first byte will change the colors of the 4x4 tile section at the top left of the screen. Each pair of bits corresponds to one 2x2 tile section, and the 4 possible values for those bits determine which of the 4 background palettes to use. You write to the attributes table by writing to $2007. More information about this can be found in this document. The attributes tables are located at $23C0, $27C0, $2BC0, and $2FC0. I highly suggest reading the attributes section in that document. |
RetroRain |
| ||
Fuzz Ball Level: 66 Posts: 23/994 EXP: 2438345 Next: 23506 Since: 09-30-07 Last post: 1936 days Last view: 958 days |
I'm still not quite getting the attribute tables at all. It's a bit confusing to me.
So, the attribute tables are responsible for all the palette assignments? Its very weird. In the second screenshot, this is being shown like this, bearing in mind that no attribute table has been set. I just want to make the text white. If you could explain the attribute table more, or perhaps give me sample code for the text, that would be great. I could study and learn from it. Thank you. By the way, when you press start at the title screen, it takes you to the second screen. So I'm kinda happy that I'm being able to get the NES to do what I want to do. Also, I was looking for Sephiroth3's assembler, but I couldn't find it. Did he ever release it? ____________________ My YouTube Channel |
NetSplit |
| ||
Level: 32 Posts: 60/178 EXP: 188043 Next: 18399 Since: 02-26-07 Last post: 2218 days Last view: 2143 days |
A search on Google uncovered a copy of FSNASM linked to in this thread.
The attributes table is a table of #$40 bytes, and each one corresponds to one 4x4 tile section on the screen (starting at the top left). Each pair of bits determines the palette assignment for one 2x2 block of that 4x4 section. 4 blocks per byte and #$40 bytes covers 256 onscreen blocks (ie the entire screen plus the row of blocks that would exist if the screen were 256x256 instead of 256x240). To define the attributes of a specific block, you need to write the proper byte to the proper address in the attributes section of the nametables, and I reiterate that each block tile has a specific entry in that table, just like the tiles that make up the screen have specific ID definitions in the nametables. So to make that text white, you can write bytes to the attributes table that will set the blocks the text is on to the white palette. Note that your screenshot indicates that those letters span 6 blocks, like so: [ L][EO][N ] [ R][OO][F ] Depending on the 4x4 tile sections that those fall into (I'm too lazy to open the image in Paint and figure it out), you'll have to modify a minimum of 2 bytes or a maximum of 4. Note that it'd be easiest if you positioned the text so that it were like this: [LE][ON] [RO][OF] This would put all the text into 4 2x2 blocks and, depending on its positioning on the screen, might cause it all to be within a single 4x4 area, which would mean only modifying one byte and not having to worry about preserving the attributes for any graphics near the text when doing the attributes update. Please try experimenting with this before your next post. I gave you the addresses of the attributes tables in my last post. If you can't get it working right on the second screen that you showed, try making a screen out of a non-transparent solid color (ie covering the screen with a tile that is colored some solid color), making all the palettes use different colors for the color you chose for that tile, and then fiddling with the attributes table. Then any change you make to the table will show up clearly and you'll get a better grasp of how exactly it works. |
RetroRain |
| ||
Fuzz Ball Level: 66 Posts: 24/994 EXP: 2438345 Next: 23506 Since: 09-30-07 Last post: 1936 days Last view: 958 days |
Thank you NetSplit. I still haven't fully figured out the attribute table, but I'm getting there. I been playing around with it, experimenting, practicing. I even saw how it was set up, with the 4x4 block sections, when I messing around with the name table. It's definitely a little bit confusing, but I came this far, so I should be able to pick it up. I just wanted to show you this pic:
It's not the colors it should be, but its better than all red. The color brings it to life. I'll probably practice more tomorrow. Thanks for the info. ____________________ My YouTube Channel |
Main - ROM Hacking - I don't believe in giving up... | New thread | New reply |
© 2005-2023 Acmlm, blackhole89, Xkeeper et al. |
MySQL - queries: 92, rows: 131/132, time: 0.018 seconds. |