start refactor

merging other dev code with mine, refactoring for specific 8051
architecture.