aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/kmisc.cpp14
-rw-r--r--engines/sci/engine/kstring.cpp11
-rw-r--r--engines/sci/engine/seg_manager.cpp12
3 files changed, 27 insertions, 10 deletions
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index 90ddf4d7ea..2d611d32ef 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -289,9 +289,12 @@ reg_t kMemory(EngineState *s, int argc, reg_t *argv) {
error("Attempt to peek invalid memory at %04x:%04x", PRINT_REG(argv[1]));
return s->r_acc;
}
- if (ref.isRaw)
- return make_reg(0, (int16)READ_LE_UINT16(ref.raw));
- else {
+ if (ref.isRaw) {
+ if (g_sci->getPlatform() == Common::kPlatformAmiga)
+ return make_reg(0, (int16)READ_BE_UINT16(ref.raw)); // Amiga versions are BE
+ else
+ return make_reg(0, (int16)READ_LE_UINT16(ref.raw));
+ } else {
if (ref.skipByte)
error("Attempt to peek memory at odd offset %04X:%04X", PRINT_REG(argv[1]));
return *(ref.reg);
@@ -311,7 +314,10 @@ reg_t kMemory(EngineState *s, int argc, reg_t *argv) {
error("Attempt to poke memory reference %04x:%04x to %04x:%04x", PRINT_REG(argv[2]), PRINT_REG(argv[1]));
return s->r_acc;
}
- WRITE_LE_UINT16(ref.raw, argv[2].offset);
+ if (g_sci->getPlatform() == Common::kPlatformAmiga)
+ WRITE_BE_UINT16(ref.raw, argv[2].offset); // Amiga versions are BE
+ else
+ WRITE_LE_UINT16(ref.raw, argv[2].offset);
} else {
if (ref.skipByte)
error("Attempt to poke memory at odd offset %04X:%04X", PRINT_REG(argv[1]));
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index a66dc8d91f..4a8e0f716b 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -111,7 +111,12 @@ reg_t kStrAt(EngineState *s, int argc, reg_t *argv) {
offset++;
reg_t &tmp = dest_r.reg[offset / 2];
- if (!(offset & 1)) {
+
+ bool oddOffset = offset & 1;
+ if (g_sci->getPlatform() == Common::kPlatformAmiga)
+ oddOffset = !oddOffset;
+
+ if (!oddOffset) {
value = tmp.offset & 0x00ff;
if (argc > 2) { /* Request to modify this char */
tmp.offset &= 0xff00;
@@ -128,9 +133,7 @@ reg_t kStrAt(EngineState *s, int argc, reg_t *argv) {
}
}
- s->r_acc = make_reg(0, value);
-
- return s->r_acc;
+ return make_reg(0, value);
}
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index d509046a15..8e2a8865ff 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -600,7 +600,11 @@ static inline char getChar(const SegmentRef &ref, uint offset) {
if (!((val.segment == 0xFFFF) && (offset > 1)))
warning("Attempt to read character from non-raw data");
- return (offset & 1 ? val.offset >> 8 : val.offset & 0xff);
+ bool oddOffset = offset & 1;
+ if (g_sci->getPlatform() == Common::kPlatformAmiga)
+ oddOffset = !oddOffset; // Amiga versions are BE
+
+ return (oddOffset ? val.offset >> 8 : val.offset & 0xff);
}
static inline void setChar(const SegmentRef &ref, uint offset, char value) {
@@ -611,7 +615,11 @@ static inline void setChar(const SegmentRef &ref, uint offset, char value) {
val->segment = 0;
- if (offset & 1)
+ bool oddOffset = offset & 1;
+ if (g_sci->getPlatform() == Common::kPlatformAmiga)
+ oddOffset = !oddOffset; // Amiga versions are BE
+
+ if (oddOffset)
val->offset = (val->offset & 0x00ff) | (value << 8);
else
val->offset = (val->offset & 0xff00) | value;