Users browsing this thread: 1 Guest(s)
Attempting to create a new event command

#11
Posts: 127
Threads: 8
Thanks Received: 21
Thanks Given: 12
Joined: Jan 2012
Reputation: 13
Status
None
Yeah, I think you got it with $E5-$E7. Why they are not in the RAM list you'll have to ask Madsiur, but the RAM map states that it is incomplete.

Jumping to itself is more like jumping back in the code that results in the same place aka. looping. So it's like a high level while(true) loop that lasts forever unless we break (in high level languages). The event processor is a very complicated example of this so I find it just good to know that each command ends in JMP $9A6D and all is well.

____________________________________

Regarding your code it looks fine, very good, I'm not sure why it doesn't work. Debugger might help as Catone suggested.

One idea is that the battle variables might be reset after battle and return zero. But I've never used them so I don't know how they are handled at all.

Another idea is the P register (processor flags) might be incorrectly set. Although it shouldn't be, I'll try to explain SEP and REP a bit better here:

I noticed you set A to be 16-bit and then load and store with X and then change A back to 8-bit. (A is also known as Accumulator)

So the P register or Process Register is a byte that helps the other registers function. Each bit of the byte represents a flag:

Code:
HEX  FLAG  WHEN SET
0x80 n     negative
0x40 v     overflow
0x20 m     8-bit A (accumulator)
0x10 x     8-bit X and Y
0x08 d     decimal
0x04 i     IRQ disable
0x02 z     zero
0x01 c     carry

SEP and REP are assembly commands used to set or reset flags in the p register.

Code:
MACHINE        ASSEMBLY           EFFECT                         FLAGS
e2 nn          sep #$nn           set processor flags            nvmxdizc
c2 nn          rep #$nn           reset processor flags          nvmxdizc

So you can use these commands to clear or set negative flag or zero flag aswell:

Code:
MACHINE        ASSEMBLY           EFFECT                         FLAGS
e2 20          SEP #$20           set 8-bit A                    --m-----
c2 20          REP #$20           set 16-bit A                   --m-----
e2 10          SEP #$10           set 8-bit X and Y              ---x----
c2 10          REP #$10           set 16-bit X and Y             ---x----
c2 83          REP #$82           clear negative and zero        n-----z-

http://wiki.superfamicom.org/snes/show/65816+Reference
  Find
Quote  



Messages In This Thread
RE: Attempting to create a new event command - by m06 - 04-06-2015, 09:42 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite