[Scummvm-git-logs] scummvm master -> 4384d75d8c101f3a050807ce3dacea753e03e454

mduggan mgithub at guarana.org
Sat May 15 13:15:11 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4384d75d8c ULTIMA8: Usecode push-byte-indirect should sign-extend


Commit: 4384d75d8c101f3a050807ce3dacea753e03e454
    https://github.com/scummvm/scummvm/commit/4384d75d8c101f3a050807ce3dacea753e03e454
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-05-15T22:13:59+09:00

Commit Message:
ULTIMA8: Usecode push-byte-indirect should sign-extend

Opcode 0x3E pushes a byte on to the stack as a 16-bit value. Previously we
assumed it should be treated as an unsigned value, but the code for conveyors
in Crusader clearly treats it as a signed value - they move at +3 or -3 per
tick.  Confirmed in the disasm that both U8 and Cru use CBW to sign-extend
value in AL, so this may fix some things in U8 too.

Changed paths:
    engines/ultima/ultima8/usecode/uc_machine.cpp


diff --git a/engines/ultima/ultima8/usecode/uc_machine.cpp b/engines/ultima/ultima8/usecode/uc_machine.cpp
index 04dffeb374..98df3879a5 100644
--- a/engines/ultima/ultima8/usecode/uc_machine.cpp
+++ b/engines/ultima/ultima8/usecode/uc_machine.cpp
@@ -1043,9 +1043,9 @@ void UCMachine::execProcess(UCProcess *p) {
 
 		case 0x3E:
 			// 3E xx
-			// push the value of the unsigned 8 bit local var xx as 16 bit int
+			// push the value of the sign-extended 8 bit local var xx as 16 bit int
 			si8a = static_cast<int8>(cs->readByte());
-			ui16a = p->_stack.access1(p->_bp + si8a);
+			ui16a = static_cast<uint16>(static_cast<int8>(p->_stack.access1(p->_bp + si8a)));
 			p->_stack.push2(ui16a);
 			LOGPF(("push byte\t%s = %02Xh\n", print_bp(si8a), ui16a));
 			break;




More information about the Scummvm-git-logs mailing list