diff options
| author | KuroiIeWa5Da <tyuki@adu.me> | 2012-01-23 01:41:05 -0600 |
|---|---|---|
| committer | KuroiIeWa5Da <tyuki@adu.me> | 2012-01-23 01:41:05 -0600 |
| commit | 4d0797bc3a6ae0ea4b44e8b6463339d662f5d669 (patch) | |
| tree | 03b824a1bb511bbb8c57ea378c1d27ea04c27ef7 /music/pokeredmusicdisasm/Call.cpp | |
| parent | Finished PkmnHealed music data - all 3 channels (diff) | |
| download | pokeyellow-4d0797bc3a6ae0ea4b44e8b6463339d662f5d669.tar.gz pokeyellow-4d0797bc3a6ae0ea4b44e8b6463339d662f5d669.tar.xz pokeyellow-4d0797bc3a6ae0ea4b44e8b6463339d662f5d669.zip | |
made changes in repo
hg-commit-id: 1145e088ee27
Diffstat (limited to 'music/pokeredmusicdisasm/Call.cpp')
| -rw-r--r-- | music/pokeredmusicdisasm/Call.cpp | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/music/pokeredmusicdisasm/Call.cpp b/music/pokeredmusicdisasm/Call.cpp new file mode 100644 index 00000000..bbc2c21e --- /dev/null +++ b/music/pokeredmusicdisasm/Call.cpp @@ -0,0 +1,71 @@ +#include <sstream>
+#include "Call.h"
+using namespace std;
+
+Call::Call()
+{
+ error = false;
+ address = 0;
+}
+
+Call::Call(unsigned char* byte)
+{
+ Parse(byte);
+}
+
+Call::Call(unsigned short value, bool)
+{
+ SetAddress(value);
+}
+
+unsigned short Call::GetAddress()
+{
+ return address;
+}
+
+void Call::SetAddress(unsigned short value)
+{
+ address = value;
+}
+
+string Call::GenAsm()
+{
+ string tmpRet = AbstractData::GenAsm();
+ if(tmpRet != "") return tmpRet;
+
+ stringstream tmpAsmOut;
+ tmpAsmOut << "mus_call" << " $" << hex << uppercase << address;
+ return tmpAsmOut.str();
+}
+
+bool Call::IsValid(unsigned char* byte)
+{
+ if(byte[0] == 0xFD)
+ {
+ error = false;
+ return true;
+ }
+ else
+ {
+ error = true;
+ return false;
+ }
+}
+
+bool Call::Parse(unsigned char* byte)
+{
+ if(!AbstractData::Parse(byte)) return false;
+
+ // Get Address
+ address = byte[2];
+ address <<= 8;
+ address |= byte[1];
+
+ return true;
+}
+
+unsigned int Call::Arguments()
+{
+ // 1 2-byte argument = 2 bytes
+ return 2;
+}
\ No newline at end of file |
