Advertisement
Guest User

Untitled

a guest
Mar 6th, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.62 KB | None | 0 0
  1. // c
  2. void pre(void){
  3.     uint8_t volatile t;
  4.     for(uint8_t volatile i=0; i<10; ++i){
  5.         ++t;
  6.     };
  7. };
  8. // asm
  9. 00000092 <_Z3prev>:
  10.   92:   cf 93           push    r28
  11.   94:   df 93           push    r29
  12.   96:   00 d0           rcall   .+0         ; 0x98 <_Z3prev+0x6>
  13.   98:   cd b7           in  r28, 0x3d   ; 61
  14.   9a:   de b7           in  r29, 0x3e   ; 62
  15.   9c:   19 82           std Y+1, r1 ; 0x01
  16.   9e:   89 81           ldd r24, Y+1    ; 0x01
  17.   a0:   8a 30           cpi r24, 0x0A   ; 10
  18.   a2:   38 f4           brcc    .+14        ; 0xb2 <_Z3prev+0x20>
  19.   a4:   8a 81           ldd r24, Y+2    ; 0x02
  20.   a6:   8f 5f           subi    r24, 0xFF   ; 255
  21.   a8:   8a 83           std Y+2, r24    ; 0x02
  22.   aa:   89 81           ldd r24, Y+1    ; 0x01
  23.   ac:   8f 5f           subi    r24, 0xFF   ; 255
  24.   ae:   89 83           std Y+1, r24    ; 0x01
  25.   b0:   f6 cf           rjmp    .-20        ; 0x9e <_Z3prev+0xc>
  26.   b2:   0f 90           pop r0
  27.   b4:   0f 90           pop r0
  28.   b6:   df 91           pop r29
  29.   b8:   cf 91           pop r28
  30.   ba:   08 95           ret
  31.  
  32. // c
  33. void pos(void){
  34.     uint8_t volatile t;
  35.     for(uint8_t volatile i=0; i<10; i++){
  36.         t++;
  37.     };
  38. };
  39. // asm
  40. 000000bc <_Z3posv>:
  41.   bc:   cf 93           push    r28
  42.   be:   df 93           push    r29
  43.   c0:   00 d0           rcall   .+0         ; 0xc2 <_Z3posv+0x6>
  44.   c2:   cd b7           in  r28, 0x3d   ; 61
  45.   c4:   de b7           in  r29, 0x3e   ; 62
  46.   c6:   19 82           std Y+1, r1 ; 0x01
  47.   c8:   89 81           ldd r24, Y+1    ; 0x01
  48.   ca:   8a 30           cpi r24, 0x0A   ; 10
  49.   cc:   38 f4           brcc    .+14        ; 0xdc <_Z3posv+0x20>
  50.   ce:   8a 81           ldd r24, Y+2    ; 0x02
  51.   d0:   8f 5f           subi    r24, 0xFF   ; 255
  52.   d2:   8a 83           std Y+2, r24    ; 0x02
  53.   d4:   89 81           ldd r24, Y+1    ; 0x01
  54.   d6:   8f 5f           subi    r24, 0xFF   ; 255
  55.   d8:   89 83           std Y+1, r24    ; 0x01
  56.   da:   f6 cf           rjmp    .-20        ; 0xc8 <_Z3posv+0xc>
  57.   dc:   0f 90           pop r0
  58.   de:   0f 90           pop r0
  59.   e0:   df 91           pop r29
  60.   e2:   cf 91           pop r28
  61.   e4:   08 95           ret
  62.  
  63. // c
  64. void ontabpost(uint8_t* t){
  65.     uint8_t* tt = t;
  66.     while(*(tt++));
  67. };
  68. // asm
  69. 000000e6 <_Z9ontabpostPh>:
  70.   e6:   fc 01           movw    r30, r24
  71.   e8:   21 91           ld  r18, Z+
  72.   ea:   cf 01           movw    r24, r30
  73.   ec:   21 11           cpse    r18, r1
  74.   ee:   fb cf           rjmp    .-10        ; 0xe6 <_Z9ontabpostPh>
  75.   f0:   08 95           ret
  76.  
  77. // c
  78. void ontabpre(uint8_t* t){
  79.     uint8_t* tt = t;
  80.     while(*(++tt));
  81. };
  82. // asm
  83. 000000f2 <_Z8ontabprePh>:
  84.   f2:   fc 01           movw    r30, r24
  85.   f4:   31 96           adiw    r30, 0x01   ; 1
  86.   f6:   81 91           ld  r24, Z+
  87.   f8:   81 11           cpse    r24, r1
  88.   fa:   fd cf           rjmp    .-6         ; 0xf6 <_Z8ontabprePh+0x4>
  89.   fc:   08 95           ret
  90.  
  91. int main(void)
  92. {
  93.     uint8_t* tab = (uint8_t*)malloc(10);
  94.     while(1)
  95.     {
  96.         pos();
  97.         pre();
  98.         ontabpost(tab);
  99.         ontabpre(tab);
  100.     };
  101. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement