Points of Required Attention™
Please chime in on a proposed restructuring of the ROM hacking sections.
Views: 88,490,108
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search 04-26-24 11:17 PM
Guest: Register | Login

0 users currently in ROM Hacking | 3 guests | 1 bot

Main - ROM Hacking - HDMA? New thread | New reply


cory21391
Posted on 08-07-07 06:57 PM Link | Quote | ID: 60700


Flurry
Level: 37

Posts: 67/260
EXP: 331881
Next: 6372

Since: 03-01-07
From: NC, US

Last post: 5129 days
Last view: 5129 days
Well, I read 2 or 3 different HDMA tutorials and it seemed simple enough and I thought I unserstood it. But, I guess not... I wanted to test a gradient hdma that changed color 0 per scanline (like it seems DKC does for jungle levels.) Anyways, I jsl-ed from before the title screen fades in to an hdma sub-routine and it just makes color 0 pink. I don't know what I'm doing wrong and could use some help.

compiled smc:
http://www.mediafire.com/?6po4me1du12

hdma sub-routine:
http://www.mediafire.com/?2flufzjjtxs


____________________




blackhole89
Posted on 08-07-07 06:59 PM Link | Quote | ID: 60702


The Guardian
Moloch whose eyes are a thousand blind windows!
Level: 124

Posts: 371/4196
EXP: 21533827
Next: 302774

Since: 02-19-07
From: Ithaca, NY, US

Last post: 472 days
Last view: 84 days



Could you dump the code here in a [code] tag? The uploader page produces JavaScript errors on my end for some reason (on top of doing nothing)...

____________________



cory21391
Posted on 08-07-07 07:05 PM (rev. 2 of 08-07-07 07:06 PM) Link | Quote | ID: 60704


Flurry
Level: 37

Posts: 68/260
EXP: 331881
Next: 6372

Since: 03-01-07
From: NC, US

Last post: 5129 days
Last view: 5129 days
weird, mediafire's never caused me problems before... how about I just post a screen of the 'hdma' in game and the code.

screen with all layers on:


screen where I turned all layers off:


CODE:
;===============
;HDMA
;===============
hdma:

stz $4300 ;HDMA transfer settings
lda #$21
sta $4301 ;sets destination to $2121, CGRAM selection
ldx #hdmatable0
stx $4302 ;sets source offset
lda #:hdmatable0
sta $4304 ;sets source bank

stz $4310 ;HDMA transfer settings
lda #$22
sta $4311 ;sets destination to $2122, CGRAM write
ldx #hdmatable1
stx $4312 ;sets source offset
lda #:hdmatable1
sta $4314 ;sets source bank

lda #$03
sta $420C ;enables HDMA transfer through channels 0 and 1

rts

;===============
;HDMA TABLE
;===============
hdmatable0:
.db 2
.db $00
.db 3
.db $00
.db 3
.db $00
.db 4
.db $00
.db 4
.db $00
.db 0

hdmatable1:
.db 2
.dw $0017
.db 3
.dw $001A
.db 3
.dw $001C
.db 4
.dw $001F
.db 4
.dw $085F
.db 0


____________________




MathOnNapkins
Posted on 08-07-07 07:37 PM (rev. 2 of 08-07-07 07:43 PM) Link | Quote | ID: 60719


Super Koopa
Level: 62

Posts: 189/842
EXP: 1935588
Next: 49098

Since: 02-19-07
From: durff

Last post: 4489 days
Last view: 4012 days

register 43x0 from Anomie's register doc

ttt = Transfer Mode.
000 => 1 register write once (1 byte: p )
001 => 2 registers write once (2 bytes: p, p+1 )
010 => 1 register write twice (2 bytes: p, p )
011 => 2 registers write twice each (4 bytes: p, p, p+1, p+1)
100 => 4 registers write once (4 bytes: p, p+1, p+2, p+3)
101 => 2 registers write twice alternate (4 bytes: p, p+1, p, p+1)
110 => 1 register write twice (2 bytes: p, p )
111 => 2 registers write twice each (4 bytes: p, p, p+1, p+1)


The problem here is that you are trying to write a byte for each step of the first transfer on channel 0 and trying to write two bytes every step of the second transfer

You need to do

LDA #$02
STA $4310

That *should* fix it. Let me know how it goes

edit: by the way, I do a transfer similar to this and i only use one HDMA channel. I use transfer mode 011 (3) which writes to $2121 twice then $2122 twice. So it effectively writes the color address twice then writes the whole color using only one table. Yes it's wasteful to write that address twice, but on the other hand, it is also wasteful to have the master cycle overhead of using 2 hdma transfers rather than 1, ne?

____________________
Zelda Hacking Forum
hobbies: delectatio morosa

cory21391
Posted on 08-07-07 08:43 PM Link | Quote | ID: 60750


Flurry
Level: 37

Posts: 69/260
EXP: 331881
Next: 6372

Since: 03-01-07
From: NC, US

Last post: 5129 days
Last view: 5129 days
ah, i get it... I knew it was something simple i overlooked because when reading the 2 or 3 tutorials, the basic premise for hdma seemed so simple compared to the general complexity i previously associated it with. well, since I have to use the public library for internet (for now, getting the internet back!!) Anyways, the computers here deny access to the command prompt so I can't check it until I go back home. But thanks

____________________




Main - ROM Hacking - HDMA? New thread | New reply

Acmlmboard 2.1+4δ (2023-01-15)
© 2005-2023 Acmlm, blackhole89, Xkeeper et al.

Page rendered in 0.021 seconds. (341KB of memory used)
MySQL - queries: 52, rows: 77/77, time: 0.015 seconds.