From 50e90be14b7517ace1ac7ec65635e81640556aed Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Sat, 31 Aug 2013 21:23:31 +0000 Subject: [PATCH] [SOFT386] Implement the short unconditional jump instruction (JMP imm8). svn path=/branches/ntvdm/; revision=59932 --- lib/soft386/opcodes.c | 24 +++++++++++++++++++++++- lib/soft386/opcodes.h | 8 ++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/lib/soft386/opcodes.c b/lib/soft386/opcodes.c index 51ed74e4d4d..0aa22fd6efd 100644 --- a/lib/soft386/opcodes.c +++ b/lib/soft386/opcodes.c @@ -259,7 +259,7 @@ Soft386OpcodeHandlers[SOFT386_NUM_OPCODE_HANDLERS] = NULL, // TODO: OPCODE 0xE8 NOT SUPPORTED NULL, // TODO: OPCODE 0xE9 NOT SUPPORTED NULL, // TODO: OPCODE 0xEA NOT SUPPORTED - NULL, // TODO: OPCODE 0xEB NOT SUPPORTED + Soft386OpcodeShortJump, Soft386OpcodeInByte, Soft386OpcodeIn, Soft386OpcodeOutByte, @@ -1146,3 +1146,25 @@ Soft386OpcodeOut(PSOFT386_STATE State, UCHAR Opcode) return TRUE; } + +BOOLEAN +FASTCALL +Soft386OpcodeShortJump(PSOFT386_STATE State, UCHAR Opcode) +{ + CHAR Offset = 0; + + /* Make sure this is the right instruction */ + ASSERT(Opcode == 0xEB); + + /* Fetch the offset */ + if (!Soft386FetchByte(State, (PUCHAR)&Offset)) + { + /* An exception occurred */ + return FALSE; + } + + /* Move the instruction pointer */ + State->InstPtr.Long += Offset; + + return TRUE; +} diff --git a/lib/soft386/opcodes.h b/lib/soft386/opcodes.h index 801c05b6d08..8a560e97bab 100644 --- a/lib/soft386/opcodes.h +++ b/lib/soft386/opcodes.h @@ -183,4 +183,12 @@ Soft386OpcodeOut UCHAR Opcode ); +BOOLEAN +FASTCALL +Soft386OpcodeShortJump +( + PSOFT386_STATE State, + UCHAR Opcode +); + #endif // _OPCODES_H_