ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Четверг
28 марта
307250 Топик полностью
lentjaj1 (13.02.2012 17:30 - 14.02.2012 09:15, просмотров: 313) ответил Andreas на Полстраницы странного ассемблера.
А вот так в ARM-е получается, всего одна операция :) LPC17xx
prom.adc=(1<<23);
       0xddac: 0xf45f 0x0000  MOVS.W    R0, #8388608            ; 0x800000
       0xddb0: 0xf360 0x0417  BFI       R4, R0, #0, #24
prom.sw = prom.adc;
       0xddb4: 0xf344 0x0417  SBFX      R4, R4, #0, #24
printf("%X %X",prom.uw,prom.adc); 
       0xddb8: 0xf344 0x0217  SBFX      R2, R4, #0, #24
       0xddbc: 0x0021         MOVS      R1, R4
       0xddbe: 0xf8df 0x08ac  LDR.W     R0, ??DataTable8_4      ; ?<Constant "%X %X">
       0xddc2: 0xf000 0xfda3  BL        printf                  ; 0xe90c
нашёл комментарии http://www.arm.com …f/IntroToCortex-M3.pdf
The Thumb-2 instruction set includes instructions that make it easier to write compact code for
many different applications. The BFI and BFC instructions are bit-field instructions that are useful in
applications like network packet processing. The SBFX and UBFX instructions improve the ability to
insert or extract a number of bits to or from a register, a capability particularly useful in automotive
applications. The RBIT instruction reverses the bits in a word and is useful in DSP algorithms such
as DFT. The table branch instructions TBB and TBH enable a balance of code compaction and high
performance. Thumb-2 instructions also introduce a new If-Then construct that predicates the
conditional execution of up to four subsequent instructions.