Mercurial > lcfOS
comparison python/target.py @ 280:02385f62f250
Rework from str interface to Instruction interface
author | Windel Bouwman |
---|---|
date | Sat, 02 Nov 2013 10:03:26 +0100 |
parents | 046017431c6a |
children |
comparison
equal
deleted
inserted
replaced
279:2ccd57b1d78c | 280:02385f62f250 |
---|---|
55 return cls(vop.number) | 55 return cls(vop.number) |
56 | 56 |
57 | 57 |
58 class LabelRef: | 58 class LabelRef: |
59 def __init__(self, name): | 59 def __init__(self, name): |
60 assert type(name) is str | |
60 self.name = name | 61 self.name = name |
61 | 62 |
62 @classmethod | 63 @classmethod |
63 def Create(cls, vop): | 64 def Create(cls, vop): |
64 if type(vop) is ASymbol: | 65 if type(vop) is ASymbol: |
68 def encode(self): | 69 def encode(self): |
69 raise NotImplementedError('Instruction {0} has no encode yet, TODO'.format(type(self))) | 70 raise NotImplementedError('Instruction {0} has no encode yet, TODO'.format(type(self))) |
70 def resolve(self, f): | 71 def resolve(self, f): |
71 pass | 72 pass |
72 | 73 |
74 | |
75 class Nop(Instruction): | |
76 """ Instruction that does nothing and has zero size """ | |
77 def encode(self): | |
78 return bytes() | |
79 | |
80 | |
73 | 81 |
74 class PseudoInstruction(Instruction): | 82 class PseudoInstruction(Instruction): |
75 pass | 83 pass |
76 | 84 |
77 | 85 |