| |||
Views: 88,549,095 |
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search | 05-06-24 01:43 PM |
|
Guest: Register | Login |
0 users currently in SMW Hacking | 1 guest |
Main - SMW Hacking - HEX problems | New thread | Thread closed |
cory21391 |
| ||
Flurry Level: 37 Posts: 1/260 EXP: 332135 Next: 6118 Since: 03-01-07 From: NC, US Last post: 5138 days Last view: 5138 days |
Well, I'm learning hex (trying to) and asm, trying to make custom blocks. well, i had an idea, and here was my thought progression of code:
AD 0D BF 5A A8 C9 32 B0 AD 0D B4 1A 8D 0D B4 A8 0D BF 7A 60 AD: LDA 0DBF (mario's coin value) 5A: PHY (push whats currently in the y reg to the stack) A8: TAY (transfer Accumulator to y reg) C9 32: compare y reg to 32 (50 in deimal) (carry flag set if 32>y reg) B0: BCS branch if the carry flag is set (32>y reg, which is mario's coins) AD 0DB4 LDA abs 0DB4 (mario's lives) 1A increment marios lives by 1 8D 0DB4 Store accumulator to abs 0DB4 (marios lives) A8 trasfer y to accumulator 8D 0DBF STA abs 0DBF (marios coins) (y reg is coin value) 60 return from subroutine i thought this would compare marios coind to 32 (50) and if greater, it would give an extra life i set all offsets to -1 except above to 0; and it freezes the game. any thoughts? ____________________ |
Smallhacker |
| ||
Panser Swedish weirdo times eleven Level: 42 Posts: 86/339 EXP: 494874 Next: 26488 Since: 02-19-07 From: Stockholm, Sweden Last post: 5195 days Last view: 5194 days |
For RAM and ROM addresses, you have to switch the byte order.
2 byte addresses: AB CD becomes CD AB 3 byte addresses: AB CD EF becomes EF CD AB Also, you forgot to push Y from the stack. ____________________ |
Ninetales |
| ||
Panser Level: 42 Posts: 260/338 EXP: 492682 Next: 28680 Since: 02-19-07 Last post: 5521 days Last view: 4919 days |
Posted by SmallhackerI think you meant pull Y from the stack. He already used a PHY statement. |
Bio |
| ||
Red Paragoomba Level: 19 Posts: 32/58 EXP: 35021 Next: 756 Since: 02-19-07 Last post: 5844 days Last view: 5707 days |
Posted by cory21391 CPY is C0 in hex, not C9 It's nice to see more people are having interrest in Hex/ASM, we need more ASM hacker |
cory21391 |
| ||
Flurry Level: 37 Posts: 2/260 EXP: 332135 Next: 6118 Since: 03-01-07 From: NC, US Last post: 5138 days Last view: 5138 days |
thans, i didnt know if i had to reverse the byte order for the rom/ram addresses or not in opcodes. and whoops... "pull Y from the stack"
oh, and i wasnt sure if that was how you used branch statements and carry flags or not. and do i have to push to stack from y/pull from stack to y? i did that to clear the y register just in case, but idk... (working on it lol) im trying to get a general feel of how the accumulator works (which i pretty much get, tis kinda simple), as weel as the x and y registers, carry and zero flags, the 'stack,' and the increment/decrementing and opcodes etc. that im just learning by practicing/learning how different opcodes work. next is add w/ carry, subtract w/ carry. and damn does 65816ref help file really actually HELP well, to more practice and work on my hack (working on Super Mario Journey, which ive actually canned everything and started over from scratch) EDIT: it still doesnt work, heres my code: any thoughts as to why? ____________________ |
Bio |
| ||
Red Paragoomba Level: 19 Posts: 33/58 EXP: 35021 Next: 756 Since: 02-19-07 Last post: 5844 days Last view: 5707 days |
you're suppose to add the number of bytes to skip after the BCS instruction |
cory21391 |
| ||
Flurry Level: 37 Posts: 4/260 EXP: 332135 Next: 6118 Since: 03-01-07 From: NC, US Last post: 5138 days Last view: 5138 days |
OMFG now i feel like a dumbass thanks tho
now lets try this one more time... EDIT: well, now my code is the gfxfor the block dont show up at all (its invisible) and when i touch it (i go through it even though its set to act like 130) and then the game glitches up as though the framerate has dropped urg.... hex is pretty complicated, but im not giving up yet! although im out of ideas and could use a tiny bit more help EDIT2: i went here (http://www.smwcentral.net/?p=map&type=ram) and found that the marios coin counter was wrong (fixed it to 0DB6 [B60D byteswapped]) and still the same, but i'd like to add the fact that all the the offsets in blocktool are -1, except above, which is 0. and when i edit the map16 block data to act like 130, it reverts to 29 any ideas of wuts wrong? ____________________ |
Smallhacker |
| ||
Panser Swedish weirdo times eleven Level: 42 Posts: 87/339 EXP: 494874 Next: 26488 Since: 02-19-07 From: Stockholm, Sweden Last post: 5195 days Last view: 5194 days |
"when i edit the map16 block data to act like 130, it reverts to 29 "
After changing that setting, did you right click on the block to update it, and then press F9 to save it? Anyway. This is what your code does: LDA $0DBF ;\ In short: If Mario's Coins >= x32, increase Mario's lives and set Mario's coins to Mario's lives. One of the mistakes you've made is to use the Mario's Coins and Mario's Lives addresses. These are the correct ones: $0DBE for lives, $0DBF for coins. The Mario's Coins/Lives are only used to remember Mario's Coins/Lives while playing as Luigi. $0DBE and $0DBF are used by the current player. (I have renamed those two address to be less confusing.) ____________________ |
cory21391 |
| ||
Flurry Level: 37 Posts: 6/260 EXP: 332135 Next: 6118 Since: 03-01-07 From: NC, US Last post: 5138 days Last view: 5138 days |
well thank you for the explanation, ecspecially about the addresses
(SMW Central ROM/RAM map just said 'mario's lives' and 'mario's coins' so i assumed they were the ones to use) "STA $0DBF; If lives were increased, store lives to coins, otherwise, store coins to coins" thanks, i didnt know exactly how that opcode worked, i assumed it did nothing but increment the following address if the carry flag was set so if i just take out the part after the increment and fix the addresses, it should check to see if mario's coins>x32 and if so increment lives by 1, if not, just skip the increment opcode and return from subroutine, right? EDIT: and yea, i forgot to save w/ F9; i just got back into SMW hacking like 5 days ago (after like 8 months of not hacking anything) so I'm a little rusty EDIT AGAIN: well, i got it to work somewhat at least, it gave me like 53 lives (YEAH! ) when i stood on it from the top, but for some reason, the GFX for the block still dont show up. ____________________ |
Smallhacker |
| ||
Panser Swedish weirdo times eleven Level: 42 Posts: 88/339 EXP: 494874 Next: 26488 Since: 02-19-07 From: Stockholm, Sweden Last post: 5195 days Last view: 5194 days |
I would just like to clearify why "STA $0DBF ;If lives were increased, store lives to coins, otherwise, store coins to coins" does what it does
LDA $0DBF ;<--- Here, A is set to amount of coins ____________________ |
cory21391 |
| ||
Flurry Level: 37 Posts: 8/260 EXP: 332135 Next: 6118 Since: 03-01-07 From: NC, US Last post: 5138 days Last view: 5138 days |
I got the branch statement confused, it BRANCHES IF the carry flag is set (which is if coins>=x32) so i should change that to a branch if carry clear opcode, that way, if the carry flag is set, it reads the next 7 bytes, but if it isnt set, it skips them
but after the branch TAY STA $0DBF i meant to put 98 (TYA) instead of (TAY) heres my new code (hope its right now) AD BF 0D A8 C9 32 90 07 AD B4 0D 1A 8D B4 0D 98 8D BF 0D 60 AD BF0D (LDA BF 0D marios coins) A8 (TAY) C9 32(CPY to x32; set carry flag if >= x32; clear carry flag if 90 07 (BCC 07 skips 7 bytes if carry flag is clear, read the next code if carry is set) AD B40D (LDA B40D mario's lives) 1A (INC adds 1 to A (mario's lives)) 8D B40D (STA B40D; stores A (marios lives) to marios lives address) 98 (TYA transfers y (marios coins) to A) 8D BF0D (STA BF0D stores A (marios coins) to marios coins address) 60 (RTS Return from subroutine) ____________________ |
Smallhacker |
| ||
Panser Swedish weirdo times eleven Level: 42 Posts: 93/339 EXP: 494874 Next: 26488 Since: 02-19-07 From: Stockholm, Sweden Last post: 5195 days Last view: 5194 days |
Posted by cory21391 I told you to use 0DBE instead of 0DB4, remember? ____________________ |
cory21391 |
| ||
Flurry Level: 37 Posts: 10/260 EXP: 332135 Next: 6118 Since: 03-01-07 From: NC, US Last post: 5138 days Last view: 5138 days |
whoops
well, im getting better (i think, hope so anyways ) now how would i go about stopping it from giving an extra life every time you touch it with more than 50 coins? ____________________ |
cory21391 |
| ||
Flurry Level: 37 Posts: 11/260 EXP: 332135 Next: 6118 Since: 03-01-07 From: NC, US Last post: 5138 days Last view: 5138 days |
this thread can be closed now ____________________ |
Main - SMW Hacking - HEX problems | New thread | Thread closed |
© 2005-2023 Acmlm, blackhole89, Xkeeper et al. |
MySQL - queries: 102, rows: 135/136, time: 0.018 seconds. |