290
|
1 #!/usr/bin/python
|
|
2
|
|
3 import unittest
|
334
|
4 from ppci.assembler import tokenize, Assembler
|
335
|
5 from ppci.objectfile import ObjectFile
|
342
|
6 from ppci.outstream import BinaryOutputStream
|
|
7 from ppci.target.target_list import msp430target
|
290
|
8 from testasm import AsmTestCaseBase
|
|
9
|
346
|
10 a = Assembler(msp430target)
|
290
|
11
|
342
|
12 class Msp430AssemblerTestCase(AsmTestCaseBase):
|
290
|
13 def setUp(self):
|
292
|
14 self.t = msp430target
|
335
|
15 self.obj = ObjectFile()
|
346
|
16 self.ostream = BinaryOutputStream(self.obj)
|
|
17 self.ostream.selectSection('.text')
|
|
18 self.a = a
|
290
|
19
|
|
20 def testMov(self):
|
|
21 self.feed("mov r14, r15")
|
|
22 self.check('0F4E')
|
|
23
|
|
24 def testMov1337(self):
|
|
25 self.feed("mov 0x1337, r12")
|
|
26 self.check('3C403713')
|
|
27
|
|
28 def testAdd(self):
|
|
29 self.feed("add r15, r13")
|
|
30 self.check('0D5F')
|
|
31
|
|
32 def testReti(self):
|
|
33 self.feed("reti")
|
|
34 self.check('0013')
|
|
35
|
|
36
|
|
37 if __name__ == '__main__':
|
|
38 unittest.main()
|