News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

A question regarding ASM...

Started by PKstarship, August 27, 2015, 02:12:31 AM

Previous topic - Next topic

Smiley

You don't need necessarily need a new hijack point, you just need to add the original code you overwrote (JSR $DB69) to your routine.

PKstarship

I just found out that when I get full energy and try to shoot the Hyper Beam on the exact same frame, the game goes into a weird state of super-slow motion, where junk graphics randomly appeared on the screen. Only by fast-fowarding my emulator while holding left and pressing fire a bunch of times was I able to return the game to normal. Is there something wrong with my routine that causes this, or is this just how the Hyper Beam is?

Smiley

The same thing happens if you do the stand-up glitch when fighting Mother Brain and fire your beam right when you get Hyper, so it's a thing with Hyper Beam. One thing you can do is delete each beam before activating Hyper, but I'm not sure how to delete projectiles and can't be bothered to figure out right now.

PKstarship

I've been having trouble finding a value on the RAM map that resets the beam palettes, whenever the Hyper Beam is aquired, it stays the same color as the beam last used, until a room transition is triggered, and if the Hyper Beam is lost, the beam will still have the rainbow palette until you enter another room. How does the game make the Hyper Beam properly load the beam palette at the end of the game? If I find that out, maybe I can fix it.

Quote58

Quote from: SMILEuser96 on August 28, 2015, 05:32:31 PM
The same thing happens if you do the stand-up glitch when fighting Mother Brain and fire your beam right when you get Hyper, so it's a thing with Hyper Beam. One thing you can do is delete each beam before activating Hyper, but I'm not sure how to delete projectiles and can't be bothered to figure out right now.

It's pretty easy actually (in fact it only took me like 30 minutes to make long beam). I'm on my phone right now though so I can't write it out here.

PKstarship

I was wondering can you load a number into the accumulator and then store it into two addresses at the the same time? here's my code:
LDA #$0001
STA $0A76
LDA #$0001
STA $0A4A

Do I need to have the second LDA, or can I omit it to save space and have the value loaded into both addresses at the same time? I ask this because $0A4A needs a specific number to do what I want it to do, but $0A76 activates when any number is loaded into it.

Scyzer

Yeah you can just LDA #$0001 once, then STA to as many addresses as you like. The value in A won't change until something else is loaded into it from another LDA, T_A or PLA.
To fix the beam graphics after changing them, use a JSL to $90AC8D. That routine updates the current beam GFX and palettes.

Quote58

Since it might not be apparent, when she says T_A, she means one of the Transfer *register* into *different register*.
Obvious examples being TAX TXA TYA TAY.
Another useful thing to remember is that STZ stores 0 to any address without requiring you to load 0 into A first

PKstarship

I tried adding JSL $90AC8D to my routine, but the Hyper Beam graphics remained messed up, and it doesn't return to using the rainbow palette at all anymore. I tried placing the JSL before the branch in my routine, and after the branch, but it still doesn't work for me. Is there something I'm doing wrong? Should I put the JSL in a new routine? I feel like a major newb right now...

Quietus

Quote from: PKstarship on August 31, 2015, 01:52:30 AMI feel like a major newb right now...
But you are... I don't mean that in any negative way, but you should remember that you've been at this for a very short time. Some of the members here have been tinkering with ASM for years. It'll take time to understand it, longer to grasp minimising code, and longer still to write your own stuff from scratch. It'll take time, but the fact that you've got as far as you have in such a short time puts you in good stead. Keep at it, and you'll soon master it. It may also be helpful to get on IRC, as some of our members are often on there, and it can be easier to discuss these things in a short conversation, rather than taking days on here. :^_^:

PKstarship

I guess I'm being a bit too hard on myself, I'll try to go on IRC and maybe ask my question there. Thanks Quietus, I sometimes tend to get a bit depressed when I mess thing up, but I feel better now  :^_^:

Mon732

99 little bugs in the code, 99 little bugs in the code.
Fix them up, patch it around, 999 bugs in the code!

Don't worry if your code doesn't work at first, I've got around 2-3 years programming experience and I still make mistakes! :P

PKstarship

#37
In all reality, I actually have a bit of experience in stuff like this. A few years ago, I had a WarioWare game for the DS called WarioWare DIY. It was kinda like Mario Paint, where you make sprites and music, but you could "code" the sprites to make a small game, and the coding aspect behaved quite a bit like ASM, albeit way simpler. I was able to use logic in order to make some very complex, well put-together games. I think that if I could master that WarioWare game, I can probably master ASM.

I actually think ASM is pretty fun, to be honest. I first thought it would be really boring, but I like making code and seeing it have an effect on the game. I'm hoping that I get really REALLY good at ASM so that when I finally get a computer, I can make the best, most innovative Super Metroid hack ever :^_^:

JAM

Quote from: Mon732 on August 31, 2015, 03:09:11 PM
99 little bugs in the code, 99 little bugs in the code.
Fix them up, patch it around, 999 bugs in the code!

Don't worry if your code doesn't work at first, I've got around 2-3 years programming experience and I still make mistakes! :P
Top for me was writing an entire patch from scratch in IPS format in hex editor without single error. =)

PKstarship

I think I am going to postpone my Hyper Beam patch for a little bit, at least until I learn a good deal more about ASM. I want to ask, how do you alter controls? I want to make a control hack where the fire button always fires the beam, and the item select button fires missiles and such, in a way similar to Metroid Prime. I'm not sure where to start though...

PKstarship

I was wondering, is writing ASM different for each game system? I ask because I want to learn to write ASM for NES Metroid and Sonic The Hedgehog, but I'm not  sure if writing SNES ASM is different from writing Genesis and NES ASM.

biospark

Quote from: PKstarship on September 03, 2015, 12:10:16 PM
I was wondering, is writing ASM different for each game system? I ask because I want to learn to write ASM for NES Metroid and Sonic The Hedgehog, but I'm not  sure if writing SNES ASM is different from writing Genesis and NES ASM.
I don't have much experience with other consoles, but I'm pretty sure most consoles have their own assembly language. I know for a fact that snes, gameboy, and gameboy advance are all different. I'm pretty sure the nes is different as well. There's definitely some learning involved for each languages, but a lot of concepts are the same.

Quietus

That's pretty much as I understand it too. :^_^:

Quote58

Quote from: biospark on September 03, 2015, 03:59:29 PM
Quote from: PKstarship on September 03, 2015, 12:10:16 PM
I was wondering, is writing ASM different for each game system? I ask because I want to learn to write ASM for NES Metroid and Sonic The Hedgehog, but I'm not  sure if writing SNES ASM is different from writing Genesis and NES ASM.
I don't have much experience with other consoles, but I'm pretty sure most consoles have their own assembly language. I know for a fact that snes, gameboy, and gameboy advance are all different. I'm pretty sure the nes is different as well. There's definitely some learning involved for each languages, but a lot of concepts are the same.

The NES is the ARM 65C02, while the SNES is the 65C816, which are very similar in syntax and structure from what I've seen. Basically it's just a difference of writing in 8bit vs 16bit, not like the massive difference from say SNES to GBA.
Fun Fact, the SNES processor isn't even properly 16 bit, it's two 8bit processors working together to form the A and B registers which make up the 16 bit integers. Ie. (SNES) LDA #$AABB (NES) LDA #$AA.

Anyway Biospark is exactly right, with old systems like these they tend to have very different architecture, which means although the concepts of assembly obviously translate, you can't count on the syntax doing the same.

Crashtour99

Quote from: Quote58 on September 04, 2015, 12:41:04 AM
Fun Fact, the SNES processor isn't even properly 16 bit, it's two 8bit processors working together to form the A and B registers which make up the 16 bit integers. Ie. (SNES) LDA #$AABB (NES) LDA #$AA.

If memory serves, that's also why it has processor flags that can switch it over to 8-bit native mode (that iirc uses 6502 opcodes).  I believe it also starts out operations in 8-bit native, but I could be wrong, it's been a while since I did any reading on SNES hardware initialization.

JAM

Quote from: PKstarship on September 03, 2015, 12:10:16 PM
I was wondering, is writing ASM different for each game system? I ask because I want to learn to write ASM for NES Metroid and Sonic The Hedgehog, but I'm not  sure if writing SNES ASM is different from writing Genesis and NES ASM.
SNES and NES are a bit common to each other. Some opcodes are even the same. Genesis' is different. Too different. Motorolla M68000. Every opcode there is using 2 bytes (even RTS) and it's based on Big Endian format. This means pointers are not inverted. Syntax is close to PC's x86 opcodes. Like mov,x etc.