C nebo ASM?
Andrej Jancura
hw_aj@zoznam.sk
Neděle Květen 24 08:51:08 CEST 2009
----- Original Message -----
From: "Jan Waclawek" <konfera@efton.sk>
To: "HW-news" <hw-list@list.hw.cz>
Sent: Friday, May 22, 2009 11:32 AM
Subject: Re: C nebo ASM?
...
Zaver: toto zda sa ziadny jednocipovy kompilator neriesi ako
(auto)inkrementovany pointer.
wek
---
Jano, zda sa ze ano. Tu je zdrojak a asm. Dolezity je riadok 24 v listingu.
movf 4 je adresovy register RAM a movf 0,w su data. decf 76,f a addlw 44 je
prave ta autodekrementacia...
A.
unsigned char sum2()
{
Number_of_Bytes = 32; // 0...31
Sum = 0;
do {
Sum += Array[--Number_of_Bytes];
} while(Number_of_Bytes != 0);
return(Sum);
}
psect text23
file "test.c"
line 17
_sum2:
opt stack 7
line 18
; Regs used in _sum2: [wreg-fsr0h+status,2+status,0]
;test.c: 18: Number_of_Bytes = 32;
movlw 32
movwf 76
line 19
;test.c: 19: Sum = 0;
clrf 77
line 21
;test.c: 21: do {
l4:
line 24
;test.c: 24: Sum += Array[--Number_of_Bytes];
decf 76,f
movf 76,w
addlw 44
movwf 4
movf 0,w
addwf 77,f
line 26
;test.c: 26: } while(Number_of_Bytes != 0);
movf 76,f
btfss 3,2
goto l4
line 28
;test.c: 28: return(Sum);
movf 77,w
line 29
;test.c: 29: }
return
_______________________________________________
HW-list mailing list - sponsored by www.HW.cz
Hw-list@list.hw.cz
http://list.hw.cz/mailman/listinfo/hw-list
__________ Informacia od ESET NOD32 Antivirus, verzia databazy 4097
(20090522) __________
Tuto spravu preveril ESET NOD32 Antivirus.
http://www.eset.sk
Další informace o konferenci Hw-list