C nebo ASM?
Petr Zahradnik
clexpert@clexpert.cz
Pátek Květen 22 10:58:58 CEST 2009
Puvodni zprava ze dne 22.5.2009 od Michal HW:
> volatile unsigned char Pole[32] = {
> 0,1,2,3,4,5,6,7,8,9,
> 0,1,2,3,4,5,6,7,8,9,
> 0,1,2,3,4,5,6,7,8,9,
> 0,1
> };
> unsigned char Soucet;
>
> void main(void) {
>
> auto unsigned char Ukazatel;
>
> for ( Ukazatel = 0; Ukazatel < 32; ++Ukazatel) {
>
> Soucet += Pole[Ukazatel];
> }
>
> }
CCS C:
.................... for ( Ukazatel = 0; Ukazatel < 32; ++Ukazatel) {
00A2: CLRF 26
00A4: MOVF 26,W
00A6: SUBLW 1F
00A8: BNC 00C0
....................
.................... Soucet += Pole[Ukazatel];
00AA: CLRF 03
00AC: MOVF 26,W
00AE: ADDLW 05
00B0: MOVWF FE9
00B2: MOVLW 00
00B4: ADDWFC 03,W
00B6: MOVWF FEA
00B8: MOVF FEF,W
00BA: ADDWF 25,F
.................... }
00BC: INCF 26,F
00BE: BRA 00A4
....................
Petr Zahradnik, pocitacovy expert
==========================================================
Petr Zahradnik, Computer Laboratory
Obvodova 740/14, 400 07 Usti nad Labem
telefon: 475 501 627, mobil: 602 409 601, fax: 475 511 338
web: http://www.clexpert.cz, e-mail: clexpert@clexpert.cz
ICQ: 21215917, MSN: clexpert@clexpert.cz
==========================================================
Další informace o konferenci Hw-list