Romhacking.net

Romhacking => ROM Hacking Discussion => Topic started by: mopoz on December 08, 2010, 05:47:23 am

Title: DMA problem
Post by: mopoz on December 08, 2010, 05:47:23 am
I do VWF in the game illusion fo gaia.
Since the font in the game to boot, like a map tile, it had to be corrected.
The problem lies in the fact that sending a new font via DMA into VRAM.
In the emulator snes9x v1.51 displayed incorrectly.
And in 1.52, and Geiger's debugger, Tracer, bsnes and the PSP everything works fine.
What's the problem? Not the correct code or a bug emulator?
Title: Re: DMA problem
Post by: Nightcrawler on December 08, 2010, 08:28:54 am
It's probably best if you can find someone with a copier or flash cart to confirm it works on the real hardware. That would be a definitive answer. Aside from that, BSNES is the most accurate emulator we have and pretty trustworthy in most cases. So, it's likely your code is OK and there is just a problem with SNES9x 1.51.

9 times out of 10 DMA VWF problems are attributed to not properly waiting for vblank. You cannot transfer to VRAM (or most video registers) outside of vblank. Did you wait for vblank? If you're using the game's own DMA code, this is probably not an issue unless the code executes late in the vblank period. An increase in data transferred then may not make it before vblank expires.
Title: Re: DMA problem
Post by: andrewclunn on December 08, 2010, 02:30:02 pm
Crap, how far along are you?  I've been working on an Illusion of Gaia update.  I've been correcting text typos, making the voice consistent (Will sometimes thinks in the first person, sometimes his thoughts are narrated in the third, and even sometimes in the second person!), healing items and charge timing, and the goal was to add a variable width font as the final stroke.  I haven't started on the VW font part yet, but if you're working on that then I'd like to make sure that my work is compatible with yours.  Are you modifying the script coding at all?  Is anything being moved to a new location in ROM?
Title: Re: DMA problem
Post by: Auryn on December 08, 2010, 04:33:45 pm
If u need to test it on the real hardware, i can do that, i have a super wildcard 32MB and a profighter (i don't remember which one because longtime not used).
Title: Re: DMA problem
Post by: mopoz on December 16, 2010, 06:05:50 am
Code: [Select]
jmp $e00000

org $e00000
 REP #$20
 AND #$00FF
 INY
 STA $00
 rep #$30
 stx regx ; old X
 sty regy ; old Y
 pha
 tax
 lda $e05000,x ; wight
 and #$0007
 sta vwf
 pla
 ;and #$007F
 asl
 asl
 asl
 asl
 
 adc #$4000
 sta $f0
 lda #$00e0
 sta $f2  ; e04000 = font
 ldy #$0000
 ldx $0938; x reg for save font in ram
copy:
 lda #$0000
 sep #$20
 clc
 lda [$f0],y ; copy 1 byte font 1bpp
 sta char ;
 lda #$ff
 ;lsr char
 sbc char ; 00010010 => 11101101
 
 rep #$30
 ;xba
 adc #$ff00
 sta $7eF000,x
 iny
 inx
 inx
 cpy #$0010
 bne copy
 ...
 jsl $e00800

;----------------
; DMA font      |
;----------------
org $e00800
 rep #$30
 lda $0938 ;  address in VRAM
 sbc #$0020
 clc
 lsr
 clc
 adc #$6800 ; $D000 address in Vram
 sta $2116
 lda #$0020  ;The number of bytes to send in video RAM.
 sta $4305
 lda $0938
 sbc #$0020
 adc #$f000 ;offsetes address in RAM
 sta $4302
 sep #$20
 lda #$7e
 sta $4304
 lda #$80
 sta $2115
 lda #$01
 sta $4300
 lda #$18
 sta $4301
 lda #$01
 sta $420b

vb: 
 lda $4212 ; check Vblank
 bpl vb
 
 rtl

Text output, but with a delay of ~ 1 second.
Title: Re: DMA problem
Post by: mopoz on January 20, 2011, 10:03:04 am
(http://gegmopo3.magicteam.net/File/bof/bof000.png)
(http://gegmopo3.magicteam.net/File/bof/bof003.png)
(http://gegmopo3.magicteam.net/File/bof/bof008.png)
(http://gegmopo3.magicteam.net/File/bof/bof014.png)

I did it!
My first VFW!!!
I will finish for Illusion fo Gaia. ;D
Title: Re: DMA problem
Post by: RedComet on January 20, 2011, 10:53:57 am
Congratulations! Everyone remembers their first forever. ;)
Title: Re: DMA problem
Post by: justin3009 on January 20, 2011, 11:58:32 am
Woah.  Adding a VWF to a game is something I want to learn very soon.  Seeing you guys pulling this off with success is truly inspiring :D
Title: Re: DMA problem
Post by: Nightcrawler on January 20, 2011, 01:51:22 pm
Looks nice! Congrats!  :)

I know you want Illusion of Gaia, but you may want to make a small project out of this game too. If you reformat the text to use the extra window space you now have, you can release a nice Bof improvement patch that I'm sure a number of people would appreciate.

Two questions:

Where did you get the font you used?

How come you got rid of the text window background color?
Title: Re: DMA problem
Post by: mopoz on January 20, 2011, 02:08:34 pm
Font I took from DQ3. Thank you, DaMarsMan, I think he is not offended. =)
I replaced the background, changing the register # $ 2003 (blue), while filling the window.
I have yet to be fully not finish, still need to post the menu and battles. There used 4bpp, for a place 2bpp.
What about the window. I want to add more h-dma, to look beautiful.
What about the patch. I rewrote for hacking the ROM hirom, so it was convenient. Changed the system S-ram. Because in Hirom address $ 30:6000.
But as completed yet, will put a patch, it will be a good occasion to re-translation.
Title: Re: DMA problem
Post by: Nightcrawler on January 20, 2011, 03:16:02 pm
Sounds great! You're well on you way to becoming a superstar (http://i260.photobucket.com/albums/ii2/Jordzz12/Star.jpg)!  :woot!:
Title: Re: DMA problem
Post by: mopoz on January 21, 2011, 08:23:33 am
Damn!
Only appears in one frame and disappears.
In geiger's debug log do H-DMA, sends data only once per dialog.
Although the cycle is repeated not once. But does not send data ..
Put rti, but after the run, the results from the vector to any address. Who knows, tell me.
Title: Re: DMA problem
Post by: Nightcrawler on January 21, 2011, 11:05:31 am
I'm not sure I totally understand due to the language barrier. But:

I assume you put your HDMA code inside the NMI routine and that's where the RTI statement is? It needs to execute (or at least initiate the HDMA) there to work every frame.

Try using VSNES (http://www.romhacking.net/utils/274/). Take a savestate during the frame where things are working properly and then take another when they are not. You can then load them up in VSNES and compare your HDMA/DMA channels and setups there. That would point you in the right direction of what changed. When you know what changed, you can use that information to look for code or breakpoints in the debugger to find the offending code.

Being that you say it worked for a frame, I imagine either your HDMA is only actually being executed one time, or some other code overwrote the registers for some other DMA/HDMA use.

I'm a little rusty with my HDMA. Anybody else have any other insight to add?
Title: Re: DMA problem
Post by: mopoz on January 21, 2011, 01:08:08 pm
Uh ...
When put to the procedure in the NMI, it makes my terms in the h-dma, but not the data themselves do not go into the process of implementation. Does not even show that my channels are used.
When I put the procedure in the code output window, it shows one frame. =)
What about the free channels. I'm using 6 and 7 in the game all goes only 0 channel. Well, the first channel my VWF. I analyzed the game with other H-dma, but did not understand the essence of the situation.

P.S. I have a session, I did not prepare for the exams, I sit here and hack. ;D

January 22, 2011, 01:18:53 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Oh, damn!
I do it's!!! :crazy: :crazy: :crazy:
So far, only transparency.
Another line Colors Experiment.
(http://gegmopo3.magicteam.net/File/bof/bof019.png)
Title: Re: DMA problem
Post by: justin3009 on January 22, 2011, 02:36:31 pm
Very nice job :D
Title: Re: DMA problem
Post by: Nightcrawler on January 23, 2011, 11:17:10 am
What ended up being the problem?
Title: Re: DMA problem
Post by: mopoz on January 24, 2011, 06:12:06 am
I have a DMA transmit to the VRAM too much data # $ 0a00, all the space vacated by the new font. And the H-DMA did not have time. Made to DMA sent one letter in front of each output to the screen. And after that was okay.


(http://gegmopo3.magicteam.net/File/bof/bof021.png)
Title: Re: DMA problem
Post by: Griever on January 24, 2011, 12:24:46 pm
Они говорят 'wise men learn by other's faults, fools by their own'.
Здорово получилось, поздравляю.
Title: Re: DMA problem
Post by: mopoz on January 24, 2011, 12:32:44 pm
In Russia, learn from their fails ;D ;D ;D

January 26, 2011, 07:10:43 am - (Auto Merged - Double Posts are not allowed before 7 days.)
Menu / Shop

(http://gegmopo3.magicteam.net/File/bof/bof022.png)
(http://gegmopo3.magicteam.net/File/bof/bof023.png)
(http://gegmopo3.magicteam.net/File/bof/bof026.png)
(http://gegmopo3.magicteam.net/File/bof/bof025.png)
Title: Re: DMA problem
Post by: DavidMG on January 26, 2011, 01:50:27 pm
Sweet! :thumbsup:
Maybe in the future you'll be able to issue the BOF is not worse than the retranslation of the BOF2  :woot!:


Молодец! Прогресс на лицо Мороз!  :laugh:
Title: Re: DMA problem
Post by: JurasskPark on February 04, 2011, 06:17:32 am
DavidMG, а ты что здесь делаешь? Ты же больше не занимаешь ромхакингом. :)
Title: Re: DMA problem
Post by: Gemini on February 04, 2011, 06:23:08 am
Please guys, no Russian or any other foreign languages.