-
Notifications
You must be signed in to change notification settings - Fork 0
Implement ROL and ROR (rotate left/right) instructions #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: PaulTrampert <5550942+PaulTrampert@users.noreply.github.com>
…ments Co-authored-by: PaulTrampert <5550942+PaulTrampert@users.noreply.github.com>
|
|
||
| namespace GenieSys { | ||
| class ROL : public CpuOperation { | ||
| private: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have a constant here to represent the base opcode. Define the constant using binary representation rather than hex or base-10.
The value should be 0b1110001000011000 for ROL and 0b111000000011000 for ROR.
| #include "../BitMask.h" | ||
|
|
||
| namespace GenieSys { | ||
| class ROL : public CpuOperation { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:thought: Maybe merge this with ROR and extract the direction as a bitmask on bit 8.
| return countRegMask.getWidth() + sizeMask.getWidth() + irMask.getWidth() + regMask.getWidth(); | ||
| } | ||
|
|
||
| std::vector<uint16_t> GenieSys::ROL::getOpcodes() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getOpcodes should be a single call to getPossibleOpcodes. The first parameter should be the base opcode, and the second should be a vector of the addresses of all the operand bitmasks.
Implements M68000 ROL (Rotate Left) and ROR (Rotate Right) instructions per the specification.
Supported modes
ROL.b #3, D0— count 1-8 (0 encodes 8)ROL.w D1, D0— count mod 64ROL.w (A0)— word only, 1-bit rotationCondition codes
Files added
include/GenieSys/CpuOperations/ROL.h/ROR.hsrc/CpuOperations/ROL.cpp/ROR.cpptest/CpuOperations/ROLTest.cpp/RORTest.cppExample
36 new tests, all 805 tests passing.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.