Points of Required Attention™
Please chime in on a proposed restructuring of the ROM hacking sections.
Views: 88,473,426
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search 04-24-24 01:50 AM
Guest: Register | Login

0 users currently in ROM Hacking | 1 guest

Main - ROM Hacking - damn damn damn New thread | New reply


cory21391
Posted on 08-13-07 05:52 PM Link | Quote | ID: 62168


Flurry
Level: 37

Posts: 83/260
EXP: 331804
Next: 6449

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

Last post: 5126 days
Last view: 5126 days
Well, I kinda sorta have the character sprite created... but only the top left 16x16 tile displays (sprite is 32x32) I don't know why since I have the sp sizes to 16x16 and 32x32 and the sp size toggle bit to 1 (large.) Ugh... Oh, and my movement loop doesn't work right and idk why. I mean, I clc before all math and I rep and sep to prevent any flag settings messing up my cmp's and stuff...

Anyways, here's the SP gfx problem screen, the sp settings and the GFX file:




the smc...
http://www.mediafire.com/?allg9dyxjgs

And here's the input loop:
playercontrol:
wai
rep #$FF
sep #%100000
lda $4219
cmp #$80 ;B-button
beq b1
rep #$FF
sep #%100000
lda $4219
cmp #$81 ;B-button and right
beq b1
rep #$FF
sep #%100000
lda $4219
cmp #$82 ;B-button and left
bne continue
b1:
jsl jump
continue:
jsl screencheck
jmp playercontrol


;===============
;SCREENCHECK
;===============
screencheck:
rep #$FF
sep #%100000
lda $0001
cmp #224
beq noright
bcs noright
rep #$FF
sep #%100000
cmp #16
beq noleft
bmi noleft
jmp either

noright:
rep #$FF
sep #%100000
lda $4219
cmp #2
beq continue0
rtl
continue0:
jmp moveleft

noleft:
rep #$FF
sep #%100000
lda $4219
cmp #1
beq continue1
rtl
continue1:
jmp moveright

either:
rep #$FF
sep #%100000
lda $4219
cmp #1
bne checkleft
jmp moveright
checkleft:
rep #$FF
sep #%100000
cmp #2
beq continue2
rtl
continue2:
jmp moveleft

moveright:
lda #$00
jsl wailoop3
lda #%100000
sta $0004 ;flips sprite
lda $0001
clc
adc #8
sta $0001
SetupSpriteOAM
rtl

moveleft:
lda #$00
jsl wailoop3
lda #%1100000
sta $0004 ;flips sprite
lda $0001
clc
sbc #8
sta $0001
SetupSpriteOAM
rtl

;===============
;JUMP
;===============
jump:
lda #$00
jsl wailoop4
lda $0002
clc
sbc #16
sta $0002
SetupSpriteOAM
lda #$00
jsl wailoop4
lda $0002
clc
sbc #16
sta $0002
SetupSpriteOAM

lda #$00
jsl wailoop4
lda $0002
clc
adc #16
sta $0002
SetupSpriteOAM
lda #$00
jsl wailoop4
lda $0002
clc
adc #16
sta $0002
SetupSpriteOAM

rtl

;===============
;WAILOOP3
;===============
wailoop3:
rep #$FF
sep #%100000
wai
inc a
cmp #7
bne wailoop3
rtl

;===============
;WAILOOP4
;===============
wailoop4:
wai
rep #$FF
sep #%100000
inc a
cmp #5
bne wailoop4
wai
jsl screencheck2
rtl

;===============
;WAILOOP5
;===============
wailoop5:
rep #$FF
sep #%100000
wai
inc a
cmp #2
bne wailoop3
rtl

;===============
;SCREENCHECK 2
;===============
screencheck2:
rep #$FF
sep #%100000
lda $0001
cmp #224
beq noright2
bcs noright2
rep #$FF
sep #%100000
cmp #16
beq noleft2
bmi noleft2
jmp either2

noright2:
rep #$FF
sep #%100000
lda $4219
cmp #$82
beq continue3
rep #$FF
sep #%100000
cmp #2
beq continue3
rtl
continue3:
jmp moveleft2

noleft2:
rep #$FF
sep #%100000
lda $4219
cmp #$81
beq continue4
rep #$FF
sep #%100000
cmp #1
beq continue4
rtl
continue4:
jmp moveright2

either2:
rep #$FF
sep #%100000
lda $4219
cmp #$81
bne checkright3
jmp moveright2
checkright3:
rep #$FF
sep #%100000
cmp #1
bne checkleft2
jmp moveright2
checkleft2:
rep #$FF
sep #%100000
cmp #$82
beq continue5
rep #$FF
sep #%100000
cmp #2
beq continue5
rtl
continue5:
jmp moveleft2

moveright2:
lda #$00
jsl wailoop5
lda #%100000
sta $0004 ;flips sprite
lda $0001
clc
adc #8
sta $0001
SetupSpriteOAM
rtl

moveleft2:
lda #$00
jsl wailoop5
lda #%1100000
sta $0004 ;flips sprite
lda $0001
clc
sbc #8
sta $0001
SetupSpriteOAM
rtl


____________________




MathOnNapkins
Posted on 08-13-07 06:18 PM (rev. 2 of 08-13-07 06:19 PM) Link | Quote | ID: 62174


Super Koopa
Level: 62

Posts: 216/842
EXP: 1935142
Next: 49544

Since: 02-19-07
From: durff

Last post: 4486 days
Last view: 4009 days
Can you keep all your questions in one thread? And this time (and the last thread) you haven't really given us much to go on. I'm more than happy to help out once in a while, like when your HDMA settings were off, but I don't think you should expect people to jump up every time you have a problem with your code.

There's plenty of creative ways to solve your own problems when it comes to assembly language, you just have to think of them. E.g. if you're using Geiger's Debugger or the BSNES debugger, you can manipulate a lot of things, including changing code while the ROM is loaded. Memory, VRAM, ARAM. You can change all those things to perform various tests. (Though you can't edit OAM or CGRAM directly).

THAT SAID

I figured out your problem in seconds using GSD. Your OAM table in WRAM is at $7E0001 to $7E0220 (inclusive)

The problem is you were writing the large toggle bit (32x32) to $7E0221 which is outside of your table! I simply edited the memory at $7E0201 to 0x02 and it worked just fine.

edit: though I will say that this is the first time I downloaded the rom and it is pretty good progress for just by yourself.

____________________
Zelda Hacking Forum
hobbies: delectatio morosa

cory21391
Posted on 08-13-07 06:30 PM (rev. 2 of 08-13-07 06:30 PM) Link | Quote | ID: 62175


Flurry
Level: 37

Posts: 85/260
EXP: 331804
Next: 6449

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

Last post: 5126 days
Last view: 5126 days
ohh... uh, yeah... I knew it was probably something stupid! sorry for such a waste of time... That's just my typo error and not realizing it even after looking over the code like 10 times! But as for as the movements, I don't understand why when you get to the edge of the screen moving right, it won't let you go left. It only branches to the no left if you're position is <= 16. An way over there is like >200. And when you jump a lot, the 'base' y-position increases even though the jump loop decreases y by 32 then increases y by 32. So it shouldn't ever increase the standing y-position! Oh well, thanks for all the help thus far.

____________________




GreyMaria
Posted on 08-14-07 03:07 AM Link | Quote | ID: 62267

>implying even the Japanese understand the Japanese
Level: 105

Posts: 161/2851
EXP: 11918497
Next: 343763

Since: 07-13-07

Last post: 4495 days
Last view: 4464 days
Why is the sprite 32x32 anyways? Wouldn't it be better for it to be only as large as the graphics?

Just my two half-cents

____________________
we're currently experiencing some technical difficulties

blackhole89
Posted on 08-14-07 03:10 AM Link | Quote | ID: 62270


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

Posts: 443/4196
EXP: 21528862
Next: 307739

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

Last post: 469 days
Last view: 81 days



The SNES OAM only supports quadratic sprite sizes, i.e. with the X and Y size in tiles being identical.

____________________



smkdan
Posted on 08-14-07 08:16 AM Link | Quote | ID: 62340


Ninji
Level: 36

Posts: 73/238
EXP: 288593
Next: 19517

Since: 05-26-07

Last post: 4060 days
Last view: 4009 days
I'd put an AND #$XX before your CMP #$XX's in the joypad loop. Otherwise it'll only take a set key combination and refuse to branch when any other keys are set (from that byte).

cory21391
Posted on 08-14-07 05:30 PM Link | Quote | ID: 62387


Flurry
Level: 37

Posts: 86/260
EXP: 331804
Next: 6449

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

Last post: 5126 days
Last view: 5126 days

The SNES OAM only supports quadratic sprite sizes, i.e. with the X and Y size in tiles being identical.


I know that, but from the looks of Mario's GFX, small mario is 16x16 and big mario is 16x32, since there are no space in the graphics, I'm assuming big mario is actually 2 16x16 sprites. I just used a 32x32 and placed the char GFX in the middle of the alotted 32x32 (blank 8x32, 16x16 sprite, blank 8x32) so flipping would work correctly. And I guess I'll add the AND instruction before cmp-ing.

____________________




Main - ROM Hacking - damn damn damn New thread | New reply

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

Page rendered in 0.021 seconds. (349KB of memory used)
MySQL - queries: 57, rows: 83/84, time: 0.015 seconds.