Mercurial > lcfOS
diff python/ppci/target/arm/instructions.py @ 353:b8ad45b3a573
Started with strings
author | Windel Bouwman |
---|---|
date | Sun, 09 Mar 2014 18:49:10 +0100 |
parents | 899ae3aea803 |
children | 5477e499b039 |
line wrap: on
line diff
--- a/python/ppci/target/arm/instructions.py Sun Mar 09 11:55:55 2014 +0100 +++ b/python/ppci/target/arm/instructions.py Sun Mar 09 18:49:10 2014 +0100 @@ -25,11 +25,17 @@ self.token = ArmToken() -class Dcd(ArmInstruction): +class ConstantData(ArmInstruction): def __init__(self, v): super().__init__() + assert isinstance(v, int) self.v = v + def __repr__(self): + return 'DCD {}'.format(hex(self.v)) + + +class Dcd(ConstantData): def encode(self): self.token[0:32] = self.v return self.token.encode() @@ -38,6 +44,15 @@ return 'DCD {}'.format(hex(self.v)) +class Db(ConstantData): + def encode(self): + assert self.v < 256 + return bytes([self.v]) + + def __repr__(self): + return 'DB {}'.format(hex(self.v)) + + def Mov(*args): if len(args) == 2: if isinstance(args[1], int):