mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-03 17:54:06 +00:00
changed encoding of segment 3 opcodes (increasing the number of opcodes, while reducing the width of the argument)
This commit is contained in:
parent
08d2b80434
commit
b3cc3073a3
@ -14,7 +14,7 @@ opcodes 0x200-0x3ff unused
|
||||
|
||||
Segment 3:
|
||||
(not implemented yet)
|
||||
opcodes 0x200-0x3ff unused
|
||||
opcodes 0x20000-0x3ffff unused
|
||||
|
||||
Segment 4:
|
||||
(not implemented yet)
|
||||
|
@ -505,6 +505,11 @@ namespace Compiler
|
||||
void message (CodeContainer& code, Literals& literals, const std::string& message,
|
||||
int buttons)
|
||||
{
|
||||
assert (buttons>=0);
|
||||
|
||||
if (buttons>=256)
|
||||
throw std::runtime_error ("A message box can't have more than 255 buttons");
|
||||
|
||||
int index = literals.addString (message);
|
||||
|
||||
opPushInt (code, index);
|
||||
|
@ -36,8 +36,8 @@ namespace Compiler
|
||||
|
||||
inline Interpreter::Type_Code segment3 (unsigned int c, unsigned int arg0)
|
||||
{
|
||||
assert (c<1024);
|
||||
return 0xc0000000 | (c<<20) | (arg0 & 0xffff);
|
||||
assert (c<262144);
|
||||
return 0xc0000000 | (c<<8) | (arg0 & 0xff);
|
||||
}
|
||||
|
||||
inline Interpreter::Type_Code segment4 (unsigned int c, unsigned int arg0,
|
||||
@ -120,4 +120,3 @@ namespace Compiler
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -19,7 +19,7 @@ Code bit-patterns:
|
||||
00ccccccAAAAAAAAAAAAAAAAAAAAAAAA segment 0: 64 opcodes, 1 24-bit argument
|
||||
01ccccccAAAAAAAAAAAABBBBBBBBBBBB segment 1: 64 opcodes, 2 12-bit arguments
|
||||
10ccccccccccAAAAAAAAAAAAAAAAAAAA segment 2: 1024 opcodes, 1 20-bit argument
|
||||
110000ccccccccccAAAAAAAAAAAAAAAA segment 3: 1024 opcodes, 1 16-bit argument
|
||||
110000ccccccccccccccccccAAAAAAAA segment 3: 262144 opcodes, 1 8-bit argument
|
||||
110001ccccccccccAAAAAAAABBBBBBBB segment 4: 1024 opcodes, 2 8-bit arguments
|
||||
110010cccccccccccccccccccccccccc segment 5: 67108864 opcodes, no arguments
|
||||
other bit-patterns reserved
|
||||
@ -50,8 +50,8 @@ op 0: show message box with message string literal index in stack[0];
|
||||
additional arguments (if any) in stack[arg0+n]..stack[arg0+1];
|
||||
n is determined according to the message string
|
||||
all arguments are removed from stack
|
||||
opcodes 1-511 unused
|
||||
opcodes 512-1023 reserved for extensions
|
||||
opcodes 1-131071 unused
|
||||
opcodes 131072-262143 reserved for extensions
|
||||
|
||||
Segment 4:
|
||||
opcodes 0-511 unused
|
||||
|
@ -69,8 +69,8 @@ namespace Interpreter
|
||||
{
|
||||
case 0x30:
|
||||
{
|
||||
int opcode = (code>>16) & 0x3ff;
|
||||
unsigned int arg0 = code & 0xffff;
|
||||
int opcode = (code>>8) & 0x3ffff;
|
||||
unsigned int arg0 = code & 0xff;
|
||||
|
||||
std::map<int, Opcode1 *>::iterator iter = mSegment3.find (opcode);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user