Skip to content
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

Added eor, lsl, lrs #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
30 changes: 30 additions & 0 deletions pyssemble/pyInstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,33 @@ def __init__(self, *args):
def execute(self):
self.regs[self.rd] = self.val
self.pc.step()

class eor(RegInstruction):
func = lambda _, arg1, arg2: 0 if arg1 == arg2 else 1

class lsl(RegInstruction):
func = lambda _, __, arg, amt: arg << amt

class rsl(RegInstruction):
func = lambda _, __, arg, amt: arg >> amt

class asr(RegInstruction):
def func(_, arg, amt):
if arg >= 0:
return arg >> amt
else:

class mul(RegInstruction):
func = lambda _, arg1, arg2: arg1 * arg2 #CHECK

# class smull(RegInstruction) #INCOMPLETE

# class umull(RegInstruction)

# class B.cond(RegInstruction)