comparison python/testasm.py @ 262:ed14e077124c

Added conditional branch instructions
author Windel Bouwman
date Fri, 09 Aug 2013 11:30:11 +0200
parents 6ed3d3a82a63
children 6f2423df0675
comparison
equal deleted inserted replaced
261:444b9df2ed99 262:ed14e077124c
226 self.feed('bne henkie') 226 self.feed('bne henkie')
227 self.feed('henkie: b start') 227 self.feed('henkie: b start')
228 self.feed('eof: b eof') 228 self.feed('eof: b eof')
229 self.check('01e000d0 ffd1fbe7 fee7') 229 self.check('01e000d0 ffd1fbe7 fee7')
230 230
231 def testConditions(self):
232 self.feed('blt x')
233 self.feed('bgt x')
234 self.feed('x:')
235 self.check('00dbffdc')
236
231 def testBoff(self): 237 def testBoff(self):
232 self.feed('b henkie') 238 self.feed('b henkie')
233 self.feed('b henkie') 239 self.feed('b henkie')
234 self.feed('b henkie') 240 self.feed('b henkie')
235 self.feed('b henkie') 241 self.feed('b henkie')
263 self.feed('mov r5, 3') 269 self.feed('mov r5, 3')
264 self.feed('add r4, r5, 0') 270 self.feed('add r4, r5, 0')
265 self.feed('loop: add r6, r4, 7') 271 self.feed('loop: add r6, r4, 7')
266 self.feed('cmp r6, 5') 272 self.feed('cmp r6, 5')
267 self.check('0325 2c1c e61d 052e') 273 self.check('0325 2c1c e61d 052e')
274
268 def testSequence2(self): 275 def testSequence2(self):
269 self.feed('henkie:') 276 self.feed('henkie:')
270 self.feed('push {r1,r4,r5}') 277 self.feed('push {r1,r4,r5}')
271 self.feed('add r5, r2, r4') 278 self.feed('add r5, r2, r4')
272 self.feed('cmp r4, r2') 279 self.feed('cmp r4, r2')