Author
|
Topic: Help wanted with GBA vwf (Read 4087 times)
|
DaMarsMan
Guest
|
|
« Reply #15 on: January 18, 2007, 10:39:21 am » |
|
If I'm correct, just cause the game DMA's characters to VRAM shouldn't make a difference. For a VWF, you should only need about 3 tiles worth of space in the RAM. You do the tile merging in there and when it's time ti store a character you code it so that it DMA's, the necessary tiles and shifts those 3 tiles creating a new one on the right.
|
|
|
|
KaioShin
Guest
|
|
« Reply #16 on: January 18, 2007, 10:56:47 am » |
|
Thanks for the help Nightcrawler.
When I thought about using a hwf I had the same idea - if it was possible by modifying the original routine instead of writing a completely new one.
Your post helped me a lot somehow. So that I don't say anything wrong I revisited the text routine and examined it more. I don't know why it didn't make click sooner, but I have a vastly better understanding of it now.
Yes, the current routine sends tiles directly from ROM to VRAM. It sends usually 16 words (32bit), which is exactly one 8x16 tile I think, the size of the current font. I tried to change that value to 8 words, but it will only cut the height in half, not the width.
I admit that the graphics, how they are encoded exactly is my weakpoint in understanding the GBA. I'll investigate it more, I hope with the information I could dig up for you, you can also tell me more about this stuff.
|
|
|
|
Nightcrawler
Guest
|
|
« Reply #17 on: January 18, 2007, 01:02:37 pm » |
|
Your welcome. I'm glad I could help. I'm surprised by the amount of people I've helped simply by explaining a concept at a higher level than CPU instruction by instruction.
Ok. The next step should be fairly simple then in our path toward 8x16. You know how many bytes it sends. So do this, open up a tile editor. Go to the address of where a DMA transfer starts. You need to visually see what it is transferring. See how your font is stored and what is being transferred. Sometimes it helps to switch and look at in in reduced bitplane mode such as one bitplane so you can really see every byte to help things make sense.
After you look at it, you should have good idea why reducing the bytes transferring in the DMA transfer cuts the height. It should also give you a clue with what you need to do to instead alter the width. Maye the answer is to store the font differently. Maybe you need to change the start offsets for the DMA transfer. Remember that you can alter the tilemap. You may need to. I can't tell you without looking at it. I don't have access to the ROM here.
I'd also figure out if the entire 16x16 space is transferred in one single DMA transfer or it is divided into more than one. You seemed uncertain. You said one 8x16 tile space. However, the full font letter is 16x16, so how the does the other half get there?
If I had to make a best guess, it sounds to me like your font is stored 16x16 visually in the ROM. I'd speculate you'll need to store an 8x16 letter with the first tile with the top half and second tile with the bottom half. That will occupy what used to be the two top tiles of the 16x16 letter. Then if you cut the DMA transfer to that. Then, the last step would be to adjust the tilemap so they appear top and bottom rather than side by side. The answer is going to be some variation of that most likely. I'll wait for you to learn more.
|
|
|
|
KaioShin
Guest
|
|
« Reply #18 on: January 18, 2007, 03:13:54 pm » |
|
The font already is 8x16. Half width would make it 4x16.
Anyway, I decided to give a vwf a try after all. So far, I got the routine to send a tile into RAM instead of VRAM. So, how I go on from here? I guess you can't help me much since you don't know yourself how GBA tiles are built. I have two tiles in RAM now, somehow I've got to combine them now. The thing I'm uncertain with is how to process the tile data. One row is 4 bytes long. A GBA register is also 4Bytes, so I assume I have to load row by row. For example I load reg1 with the first row of tile A and reg2 with the first row of tile B. All i have to do now is to shift the content of reg by the width of tile A to the right and OR them against each other, right? Is it really this easy? I'm sorry that I ask instead of trying it, but testing code is a royal pain. I have to copy the assembled code with an hex editor in between files -_-.
|
|
|
|
RedComet
Guest
|
|
« Reply #19 on: January 18, 2007, 03:28:52 pm » |
|
That sounds about right. You still need to take into account overflow that'll occur when you have one letter straddling the two tiles. Here's some code. It's for the SNES, but you should be able to follow it and get an idea of one way to do it. It's a lot better if you have watch the routine in a debugger and dump the buffer in ram as needed to make sure you understand how it's doing what it's doing. I used a 1BPP font and converted it to 2BPP on the fly, so I'm not real sure how a 4BPP font would work. You'll probably need to read up on the graphics format so you OR everything properly.
|
|
|
|
Claudius
Guest
|
|
« Reply #20 on: January 18, 2007, 06:12:55 pm » |
|
I'm into GBA homebrew, somewhat, but I'm not at all a Romhacker. I'd really like to see this game get translated, though, so I'll give whatever little help I can. First of all, you may already know of it, but in my opinion the overall best reference for GBA stuff around is TONC: http://user.chem.tue.nl/jakvijn/tonc/toc.htmDescribing the GBA graphics convention isn't too hard but is a bit beyond the scope of one post. Look under "Regular tiled backgrounds" on that link though, and pay special attention to 4bpp graphics mode (which if you say your rows are 4 bytes, you must be working with.) Now, you said that GBA registers are 32 bits so you'll have to write one row at a time. While you could do 16 bit writes, technically, the GBA is a real 32 bit machine and it likes 32 bit read/writes speedwise, so, I'd suggest it. In any case, don't try to write a single char at a time - GBA's VRAM isn't friendly to writing anything less than 16 bits at a time, despite what early homebrew demos tried. Oh, and one last thing, 4bpp mode means the graphic tile will have data for two pixels per byte. But, if the byte looks like 0xAB, pixel "A" will be on the RIGHT and pixel "B" will be on the LEFT. That tripped me up, on occasion. Well, best of luck, again, I'm looking forward to this one. ^^
|
|
|
|
KingMike
Guest
|
|
« Reply #21 on: January 18, 2007, 06:28:30 pm » |
|
The font already is 8x16. Half width would make it 4x16.
If GBA in tile mode (doesn't it have both tile and bitmap modes?) is anything SNES, DMA routine hacking alone won't help you make it 4x16. Since tiles are 8 pixels horizontally, you'd have to read two characters. So, you draw a 4x16 font in ROM, then you'd copy character #1 to RAM (making up an 8x16 character in VRAM, with the right half empty), then you'd have to shift character #2 4 pixels right and blend it in to the right half of the tile.
|
|
|
|
KaioShin
Guest
|
|
« Reply #22 on: January 18, 2007, 07:03:01 pm » |
|
Edit: Ok, I did a stupid mistake, apparently it's too late right now, I need to get some sleep. I'll try it out more profoundly tomorrow. I can already tell that it's not working yet though, so I'll leave the link to the code here in case someone wants to take a look at it. http://download.yousendit.com/7B779BD653C9F696Claudius: Thanks a lot for your help. I especially appreciate it that you registered just to help out. I'll take a look at that reference tomorrow, currently I use no$GBA's gbatek reference.
|
|
« Last Edit: January 18, 2007, 07:22:59 pm by KaioShin »
|
|
|
|
Nightcrawler
Guest
|
|
« Reply #23 on: January 18, 2007, 08:07:49 pm » |
|
http://transcorp.parodius.com/forum/?num=1124688575/1#1Try that explanation out. Many people have found it helpful. The concept is the same regardless of what system you're working on. All you're doing is shifting and OR'ing. After you get that part down, you can worry about catching the spillover for the start of a new tile. If a tile is 32-bits long, you do the same thing. You're going to shift that to the correct pixel position and OR it with the tile already in memory. When you have completed a tile, you can then send it to VRAM. Read the post first. Then ask some more questions. VWF on the GBA is done the exact same way it's done on any other tile based system.
|
|
|
|
RedComet
Guest
|
|
« Reply #24 on: January 18, 2007, 08:10:16 pm » |
|
I can vouch for NC's explanation. It and some source code Gid was kind enough to let me see were the best resources available for learning to code a VWF.
|
|
|
|
KaioShin
Guest
|
|
« Reply #25 on: January 19, 2007, 07:58:46 am » |
|
Right now Transcorp seems to be down for me. But I think I know that post, you explained it to Gideon, right? Well, the code I posted yesterday should be complete, I already do what you told me, shifting the pixels around, or them and send them to VRAM then. I'll now go to bug hunt and look where it messes up. If I can't figure out where the problem lies I'll ask more specific questions. In the meantime, I'm also thinking about what font to chose. As I said earlier, it should be around x16 in size. I like the font DQ8 uses... Does anyone know the name or if it's available in 8x16? If not, might someone be able to recreate it? Maybe I could just dump it from the PS2 game, but that might be a hassle so I thought I ask beforehand.
|
|
|
|
Normmatt
Guest
|
|
« Reply #26 on: January 19, 2007, 08:06:30 am » |
|
Kaioshin i do hope you using goldroad 1.7 not 1.6 as the 1.6 had a few buggy opcodes which could potentially mess up your code
|
|
|
|
KaioShin
Guest
|
|
« Reply #27 on: January 19, 2007, 08:25:17 am » |
|
Kaioshin i do hope you using goldroad 1.7 not 1.6 as the 1.6 had a few buggy opcodes which could potentially mess up your code
Yeah I upgraded. I still don't trust it entirely, especially some immediate 32 Bit loads appear very strange since goldroad throws some NOPs in between there, but aside from that the problem seems to be with my code and not with the assembly. If you read my post from last night before I edited it, that was my own stupidness, goldroad did assemble all my code.
|
|
|
|
Nightcrawler
Guest
|
|
« Reply #28 on: January 19, 2007, 09:51:55 am » |
|
Yeah, it appears Parodius is down. Figures.
So what is the problem you are having now? What is your screen output?
|
|
|
|
KaioShin
Guest
|
|
« Reply #29 on: January 19, 2007, 10:01:14 am » |
|
What is your screen output?
None, the VRAM transfer must be broken. I only ran it once yesterday, I didn't get to debug it properly yet. So I only know it doesn't work, not why yet.
|
|
|
|
|