Re: Different hex file generated by gpasm and mpasm

Rob Hamerling <[email protected]> Tue, 20 Sep 2005 12:07:01 +0200
Newsgroups gmane.comp.hardware.microcontrollers.gnupic
Message-ID <[email protected]>

Martyn Welch wrote:

> ----- Original Message ----------
> On Tuesday 20 September 2005 01:11, Chen Xiao Fan wrote:
> 
> 
>>The file in question is a single relocatable assembly
>>file and I do not expect too much difference in the
>>generated assmebly. Since both are working in the final
>>application, both must be correct. Still I am just
>>a bit curious what is the difference between gpasm
>>and MPASM.
> 
> 
> One is open source,the other isn't.
> 
> As far as I understand, some consideration has been made to keep the syntax 
> for gputils the same or at least similar to mpasm. As a result the operation 
> of the application should be broadly the same, however gputils is not a 
> cloned implementation of mpasm (this assumes the logic used during 
> compilation doesn't change between revisions).

An assembler is not a compiler! With an assembler there is a one-to-one 
relationship between a source statement and a machine instruction. A 
compiler must translate the high level symbolic language to a machine 
instructions and it has much freedom how it wants to reach the goal.

> There is more than one way to get the approximately the same point. For 
> example, could you tell the difference between these two blocks of code once 
> compiled and running?:
> 
> 1)
> int main(){
> 	char i = 0;
> 	while(i<10){
> 		print("%d",i);
> 		i++;
> 	}
> 	return(0);
> }
> 
> 2)
> int main(){
> 	char i;
> 	for(i=0,i<10,i++){
> 		print("%d",i);
> 	}
> 	return(0);
> }

1. Not a fair comparison with assembler!
2. The second example will give compilation errors!   ;-)

Regards, Rob.


-- 
Rob Hamerling, Vianen, NL phone +31-347-322822
homepage: http://www.robh.nl/