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