??? 09/20/06 12:28 Read: times |
#124668 - it is still 'hidden' and BTW why hide it Responding to: ???'s previous message |
The reason to spend some number of machine cycles on the overhead of the function call is so that you can hide the implementation of GlobalSerialBuffer[] from the other modules.
You are using the old mantra "programming ease is more important than process efficiency". That may be a good approach where you make 5 thingies and programming cost far outweigh adding $5 to the cost of the chip to achieve needed speed and/or memory. If you make 1.000.000 thingies, that is pure unadulterated male cow manure. Of course, for a PC it was thought "that does not matter since no hardware is already there", but how often have you wondered why things run slower today on out multigigahertz machines than the did on our old 10MHz XP. I get furious when complaining about the sloveness of a PC app (NOHAU is a great example) and am told "just buy a faster PC". Assuming that the serial routine does the verification, checksumming etc (as it should do) whatever way you implement the serial routine, there will, somewhere be a "GlobalSerialBuffer[]" with the actual data. so what we are discussing is nothing but "how to get data from "GlobalSerialBuffer[]" so, if the method of stuffing, checking or whatever of is changed, the contents of "GlobalSerialBuffer[]" will not change so "then you have to find and fix every single place that references the buffer" is simply not true. Or suppose that you want to change GlobalSerialBuffer[] from a linear buffer to a circular buffer of some kind. That simply means that you did not do your homework before you implemented the "GlobalSerialBuffer[]". I can see that, if your approach is to haphazardly set out programming something, then the 'hiding' makes sense. Say that something changes and you suddenly have to accommodate a ten-byte message preamble that's sitting in the buffer no problem .asm Preamble buffer ds 1034 GlobalSerialBuffer equ Preamble buffer + 10 .h extern Preamble buffer[1034] extern GlobalSerialBuffer[1024] store in Preamble buffer read from GlobalSerialBuffer please do understand that I am not, actually, arguaing against what you say, I am arging agaist preaching it as gospel. Erik |