DG>Is there a program that will take an assemlber source file for input and
DG>output a file with suggested optimizations and/or possible detection of
DG>logic errors?
BM> Detect logic errors? In assembly language? That is doubtful...
BM> optimizations, however, could be done, especially if it was written for a
BM> different processor...
CC> You could detect some specifics, but you'd have to make a "smart"
CC> assembler. Example, give the 'bler (assembler) a knowledge base
CC> of DOS interupt services. It can check if you've assigned the
CC> right registers for the service.
All you'd need would be about 4 bytes for each function (possibly even get
more than just dos), with each bit representing a register, and if the bit is
set, that register has to have a value (for call), or gets a value (on
return).
CC> You could try a "define before use" clause for registers. If a register
CC> has not been assigned a value (by declaration or by INT call), you could
CC> produce a warning that it may not be defined yet.
CC> You could try to define pairs of instuctions. Maybe warn if a "push"
CC> has no accompanying "pop" in a function macro. Warn if a macro destroys
CC> registers that haven't been saved (or pushed).
Or if SP would end up different at the end of a function - I caught someone a
few weeks ago trying to push the remainders of division by 16, but didn't pop
them before he got to the RET instruction.
CC> If a well experienced asm writter could think of the common mistakes
CC> he makes, he could find some semantic warnings that would really fit
CC> the bill.
This is true... however, I'm not sure those would be logic errors exactly...
logic errors would be like dividing where you wanted to multiply... the
program would still run, it just wouldn't do quite what you wanted it to do.
If you're going to go this far, you could even provide directives to make
self-decrypting code automatically... then it could check the code before it
was encrypted...
((Cloud))
MauveCloud@juno.com
* OLX 2.2 * Bank error in your favor. Collect $200.
--- PCBoard (R) v15.3/M 10
---------------
* Origin: Next time, Dial The Wrong Number! (209) 943-1880 (1:208/205)
|