Author
|
Topic: Help wanted with GBA vwf (Read 4088 times)
|
DaMarsMan
Guest
|
|
« Reply #30 on: January 19, 2007, 11:09:01 am » |
|
I think I know the name of that font for DQ8 or at least one similar to it. I'm using it for DQ5. It probably isn't going to look as good in a smaller size though. I'll post what it is when I get home. Also, you need to create a simple tool to copy your block of code into the gba rom in a single click. I think we have one in our database. That way when you compile, all you have to do is double click a batch file and start the rom.
|
|
|
|
KaioShin
Guest
|
|
« Reply #31 on: January 19, 2007, 11:29:34 am » |
|
I think I know the name of that font for DQ8 or at least one similar to it. I'm using it for DQ5. It probably isn't going to look as good in a smaller size though. I'll post what it is when I get home. Also, you need to create a simple tool to copy your block of code into the gba rom in a single click. I think we have one in our database. That way when you compile, all you have to do is double click a batch file and start the rom.
Thanks for the font, I'll just try it out and see if it looks ok at small size. Yeah, I should propably get a tool for insertion, well, I'm almost used to inserting with an hex editor now >_< So I'm currently debugging my routine. I already found and fixed 2 smaller bugs. They would have corrupted the tile, but they aren't responsible for the fact that nothing gets to VRAm at all. I think I have found the problem though, and it's damn strange. The command which stores the control word for the DMA transfer isn't storing what I think it should. str r1,[r3,0x8] r1 = 84000001 r3 = 040000D4 From GBAtek: 40000DCh - DMA3CNT_L - DMA 3 Word Count (W) (16 bit, 1..10000h) Specifies the number of data units to be transferred, each unit is 16bit or 32bit depending on the transfer type, a value of zero is treated as max length (ie. 4000h, or 10000h for DMA3).
40000DEh - DMA3CNT_H - DMA 3 Control (R/W)
Bit Expl. 0-4 Not used 5-6 Dest Addr Control (0=Increment,1=Decrement,2=Fixed,3=Increment/Reload) 7-8 Source Adr Control (0=Increment,1=Decrement,2=Fixed,3=Prohibited) 9 DMA Repeat (0=Off, 1=On) (Must be zero if Bit 11 set) 10 DMA Transfer Type (0=16bit, 1=32bit) 11 Game Pak DRQ - DMA3 only - (0=Normal, 1=DRQ <from> Game Pak, DMA3) 12-13 DMA Start Timing (0=Immediately, 1=VBlank, 2=HBlank, 3=Special) The 'Special' setting (Start Timing=3) depends on the DMA channel: DMA0=Prohibited, DMA1/DMA2=Sound FIFO, DMA3=Video Capture 14 IRQ upon end of Word Count (0=Disable, 1=Enable) 15 DMA Enable (0=Off, 1=On)
Can someone break up that control word and tell what it should do exactly (which of these values are set with what)? Sorry, I tried it myself but I don't quite get it. Anyway, the beforementioned str command saves the following to 040000DC -DF: 01 00 00 04. Huh???
|
|
|
|
DaMarsMan
Guest
|
|
« Reply #32 on: January 19, 2007, 12:11:09 pm » |
|
The font is called Palatino and now that i look at it it's a little wider than DQ8 but similar.
break up r1 into bits. 4 bits per nibble (digit).
1000 0100 0000 0000 0000 0000 0000 0001
Like it says it's storing a word. So we ignore the first 16 bits. Leaving us with.
0000 0000 0000 0001
So let's look at our table...I believe that bit 0 is the left most bit. Our table says 0-4 arean't used. So all we have is.
000 0000 0001
value of 5-6 is 0 so we are using regular increments for the starting adress to copy from. value of 7-8 is 0 so we are using regular increments for our destination address (vram in this case). value at 9 is 0 because we aren't repeating DMA. It's a one shot thing in this case. value at 10 is 0 which means we are transferring 16bit's at a time. value at 11 is 0 for normal gamepak (don't know what this is but i'm sure it's almost always 0) value at 12-13 is 0 to start DMA immediately and copy right away. value at 14 is 0 so IRQ interrupt disabled. value at 15 is 1 to enable our dma.
Some of this stuff is guessing but it looks pretty similar to what I have seen on SNES. So what happens is whenever a 1 is written to that 15th bit, the cpu starts a DMA transfer with the values. Now what you need to do is check that document and find out where the location for the DMA address to copy from and to are stored. It's probably a register that was already written to. So you are going to need to find where that is and change the starting address to copy from to you position of your VWF tiles in RAM.
|
|
|
|
RedComet
Guest
|
|
« Reply #33 on: January 19, 2007, 12:18:18 pm » |
|
Are you sure you shouldn't be storing only a halfword (strh)? The 4 bytes might be causing you to access adjacent registers and messing up your results.
|
|
|
|
KaioShin
Guest
|
|
« Reply #34 on: January 19, 2007, 12:33:13 pm » |
|
Some of this stuff is guessing but it looks pretty similar to what I have seen on SNES. So what happens is whenever a 1 is written to that 15th bit, the cpu starts a DMA transfer with the values. Now what you need to do is check that document and find out where the location for the DMA address to copy from and to are stored. It's probably a register that was already written to. So you are going to need to find where that is and change the starting address to copy from to you position of your VWF tiles in RAM.
Source and Destination are right before that. They are set correctly, that's why I don't understand why nothing gets send to VRAM. Ok, it turns out I used the wrong control word. It must be 84000010 not 01 at the end. Now I've got the tile in VRAM. I think I've got them reversed. I tried to combine i with n and half of n was at the beginning followed by a slightly messed up i. The mess up is propably because I didn't use a real width table yet but instead just used 5 for all widths. I think I'll try to chose a final font now, so I can make a real width table for further testing. Thanks for your continued help DaMarsMan and Red
|
|
|
|
DaMarsMan
Guest
|
|
« Reply #35 on: January 19, 2007, 12:43:35 pm » |
|
Gimme screenshot of 5 width ugly font. And you can use Bitmap Font Builder to choose a font and export your width table.
|
|
|
|
KaioShin
Guest
|
|
« Reply #36 on: January 19, 2007, 12:52:16 pm » |
|
Well, it's only 2 tiles^^ I didn't run a whole string through my routine. I haven't replaced the routine completely yet, so I have to jump to it with the debugger manually. With some fantasy that's the right half of a n with a i plus messed up dot, don't you think?^^
|
|
|
|
Nightcrawler
Guest
|
|
« Reply #37 on: January 19, 2007, 01:10:56 pm » |
|
You can used a fixed width value of 5 for testing purposes. In fact, I'd probably recommend it. Get that to work right before introducing a width table with potential additional buggy code. Maybe it's just me, but over the years I've found the best way to manage a programming task for myself is to only do one small piece at a time. Get that working first before moving on. Remember sometimes, you may fit MORE than 2 letters in a tile(say three i's in a small font). You want to set up your code to loop through as many characters that are necessary to fill the tile and THEN transfer to VRAM. You're only going to transfer completed finished tiles to VRAM. You're going to stay in your routine and keep looping and building in RAM until then. You're a lucky guy. I feel like I need to take a number to help you with all this help going on!
|
|
|
|
KaioShin
Guest
|
|
« Reply #38 on: January 19, 2007, 01:18:40 pm » |
|
What do you guys think, this looks very very close to the DQVIII font to me: But only with Font Smoothing enabled, without it's kind of blurry, but that may be for other reasons? I hope I can transfer this into the game without messing the font up, I hate all kind of image editing >_< You can used a fixed width value of 5 for testing purposes. In fact, I'd probably recommend it. Get that to work right before introducing a width table with potential additional buggy code. Maybe it's just me, but over the years I've found the best way to manage a programming task for myself is to only do one small piece at a time. Get that working first before moving on. Yeah, but I find it much easier to test with a real font since I immediately see if it's correct or wrong. In the end I'll have to insert a font anyway, so why not do it now? If there are problems related to the width stuff I'll know while debugging (hopefully^^). Remember sometimes, you may fit MORE than 2 letters in a tile(say three i's in a small font). You want to set up your code to loop through as many characters that are necessary to fill the tile and THEN transfer to VRAM. You're only going to transfer completed finished tiles to VRAM. You're going to stay in your routine and keep looping and building in RAM until then.
I have accounted for that in my code, but I haven't tested it yet, maybe it works already, maybe not. I'll see when I got that font in. You're a lucky guy. I feel like I need to take a number to help you with all this help going on! Thanks!
|
|
|
|
DaMarsMan
Guest
|
|
« Reply #39 on: January 19, 2007, 01:27:00 pm » |
|
It's going to be hard to get a font to look that good in gba. Smoothing looks good but the ps2 is using 8 colors for those characters. You don't have that option on GBA.
|
|
|
|
KaioShin
Guest
|
|
« Reply #40 on: January 19, 2007, 02:04:18 pm » |
|
It's going to be hard to get a font to look that good in gba. Smoothing looks good but the ps2 is using 8 colors for those characters. You don't have that option on GBA.
Yeah, I'm already noticing this >_<. Does anyone know a good 8x16 vwf which might come out good on the GBA?
|
|
|
|
DaMarsMan
Guest
|
|
« Reply #41 on: January 19, 2007, 02:54:40 pm » |
|
Same stuff that looks good on snes. If you only have 2bpp font to work with, then I suggest something like what's used in Dejap's DQ5. If you have shadow available for your font, then go with something like Star Ocean font or pick any game you like and rip it.
|
|
|
|
KaioShin
Guest
|
|
« Reply #42 on: January 19, 2007, 05:01:10 pm » |
|
Ok I inserted a proper font now and created a width table for it. Now I can do some real debugging. I immediately notice, more than 2 letters on one tile won't work (I haven't look into why yet). The more severe problem - combining two tiles doesn't work either. It seems as if the endianess kills it. If a row is 17 11 11 11 in RAM and I copy it into a register it will become 11 11 11 17. The first variant was the right one. What should I do now? Save the font in reverse byte order? Can I do that easily with a modified tile definition for FEIDIAN? Any other suggestions? The DMA routine copies the data stright into VRAM, the original font is stored in normal byte order and it will appear normal in VRAM as well there.
Edit: Just thought about something. Would it be enough to reverse my shifts? Turn all right shifts into left ones and vice versa? Because, when the registers are saved back the bytes are in right order again.
|
|
« Last Edit: January 19, 2007, 05:11:05 pm by KaioShin »
|
|
|
|
Ryusui
Guest
|
|
« Reply #43 on: January 19, 2007, 05:46:04 pm » |
|
I would guess so.
I've already half-assed part of a GBA VWF, and I've never encountered the problem you're talking about, to my recollection anyhow. >_>
|
|
|
|
KaioShin
Guest
|
|
« Reply #44 on: January 20, 2007, 09:00:59 am » |
|
Ok, seems as if exchanging shifts took care of that problem for now. I now know the problem why tiles which consist of more than 2 characters don't work yet and I expect another problem to arise.
Let's examine how a row of pixels is stored on the GBA. Every nibble presents one pixel, however, the ordering is not so straigth forward.
Second Pixel -> 17h <- First Pixel.
So, the Bytes are reversed, the first nibble is the second pixel and the second nibble is the first pixel. I think my code only works as long as the number of pixels to shift is even. For an uneven pixelcount it propably cuts out the column with the last pixel instead of the column after that. Does anyone know how I can adjust my shift logic to take this into account? I couldn't come up with anything yet. A workaround I thought of was to have every character an even pixel count, but that would be cheating a bit :p
I'll look into the problem with tiles with more than 2 characters for now, I hope in the meantime someone can give me advise on the shifting problem.
Thanks
|
|
|
|
|