aboutsummaryrefslogtreecommitdiffstats
path: root/music/pokeredmusicdisasm/Jump.cpp
diff options
context:
space:
mode:
authorKuroiIeWa5Da <tyuki@adu.me>2012-01-23 01:41:05 -0600
committerKuroiIeWa5Da <tyuki@adu.me>2012-01-23 01:41:05 -0600
commit4d0797bc3a6ae0ea4b44e8b6463339d662f5d669 (patch)
tree03b824a1bb511bbb8c57ea378c1d27ea04c27ef7 /music/pokeredmusicdisasm/Jump.cpp
parentFinished PkmnHealed music data - all 3 channels (diff)
downloadpokeyellow-4d0797bc3a6ae0ea4b44e8b6463339d662f5d669.tar.gz
pokeyellow-4d0797bc3a6ae0ea4b44e8b6463339d662f5d669.tar.xz
pokeyellow-4d0797bc3a6ae0ea4b44e8b6463339d662f5d669.zip
made changes in repo
hg-commit-id: 1145e088ee27
Diffstat (limited to 'music/pokeredmusicdisasm/Jump.cpp')
-rw-r--r--music/pokeredmusicdisasm/Jump.cpp83
1 files changed, 83 insertions, 0 deletions
diff --git a/music/pokeredmusicdisasm/Jump.cpp b/music/pokeredmusicdisasm/Jump.cpp
new file mode 100644
index 00000000..8b094996
--- /dev/null
+++ b/music/pokeredmusicdisasm/Jump.cpp
@@ -0,0 +1,83 @@
+#include <sstream>
+#include "Jump.h"
+using namespace std;
+
+Jump::Jump()
+{
+ address = 0x0000;
+ loop = 0;
+}
+
+Jump::Jump(unsigned char* byte) // Parse Immidiately
+{
+ Parse(byte);
+}
+
+Jump::Jump(unsigned short value, unsigned char loop, bool) // Set value
+{
+ SetAddress(value);
+ SetLoop(loop);
+}
+
+unsigned short Jump::GetAddress()
+{
+ return address;
+}
+
+void Jump::SetAddress(unsigned short value)
+{
+ address = value;
+}
+
+unsigned char Jump::GetLoop()
+{
+ return loop;
+}
+
+void Jump::SetLoop(unsigned char value)
+{
+ loop = value;
+}
+
+string Jump::GenAsm()
+{
+ string tmpRet = AbstractData::GenAsm();
+ if(tmpRet != "") return tmpRet;
+
+ stringstream tmpAsmOut;
+ tmpAsmOut << "mus_jump" << " " << (short)loop << ", $" << hex << uppercase << address;
+ return tmpAsmOut.str();
+}
+
+bool Jump::IsValid(unsigned char* byte)
+{
+ if(byte[0] == 0xFE)
+ {
+ error = false;
+ return true;
+ }
+ else
+ {
+ error = true;
+ return false;
+ }
+}
+
+bool Jump::Parse(unsigned char* byte)
+{
+ if(!AbstractData::Parse(byte)) return false;
+
+ loop = byte[1];
+
+ address = byte[3];
+ address <<= 8;
+ address |= byte[2];
+
+ return true;
+}
+
+unsigned int Jump::Arguments()
+{
+ // 1 1-byte command, 1 1-byte loop, 1 2-byte pointer = 4 bytes
+ return 3;
+} \ No newline at end of file