箭10.15
(1) C囂冱殻會
int wages [5]={42,38,44,52,40};
extern unsigned short weekpay(int wages[]);
main()
{
printf("Weekly pay = %u",weekpay(wages));
}
(2) 祉園囂冱徨狛殻
.model small
.code
public _weekpay
;this procedure add five bytes together
;At the end AX has the total sum
_weekpay proc near
push bp ;save BP
mov bp,sp
push si ;save SI
sub ax,ax
mov cx,5
mov si,[bp+4]
again: add al,[si] ;add a day's wages
adc ah,0
inc si ;increment pointer
inc si ; to next wage
loop again
pop si
pop bp
ret
_weekpay endp
end