On 11/16/06, Peter P. wrote: > William Couture gmail.com> writes: > > > > > On 11/15/06, Peter P. yahoo.com> wrote: > > > > > > There was a discussion in the past where the idea of porting assembly to C > > > > for > > > portability came up. Now there is a commercial solution for this. I did not > > > try > > > it but someone may need it: > > > > > > http://www.microapl.co.uk/asm2c/ > > > > > > It does not support the PIC (yet - and probably never will), only M68k and > > i386+. > > > > And, unfortunately, there is no "freebie" sample program. > > > > I'd love to see what it does with some of my old .ASM programs, > > but I'm not going to pay $Hundreds to find out... > > You do not say in what language. In theory 'porting to c' can be done by > 'simply' (famous last words) #definig C macros based on each assembly > instruction. When a mnemonic does not unambiguously describe the operation then > some more work is needed (f.ex. by expanding menmonics to other mnemonics that > correspond to unique functions). For better translation groups of instructions > must be matched to constructs. Exactly like a loophole optimizer does. A > reasonable translator can be built in Perl or Awk probably. Er... I'm not sure what you mean by "in what language". The original poster talked about an Assembly to C translator, and I talked about my .ASM (Assembly) programs. As for using #define macros, that isn't even close. For a trivial .ASM program: org 100h assume cs:code,ds:code,ss:code,es:code entry: mov ah,9 mov dx,offset message int 21h mov ax,4c00h int 21h message: db "Hello, World!",0dh,0ah,24h end would become the C program: #include main() { puts("Hello, World!"); exit(0); /* optional */ } > On a more interesting CPU (like the Z80 which has about 10 addressing modes) > decoding the menmonics could become interesting (LD can stand for a variety of > operations). The x86 equivalent is MOV, and it has enough variations to keep you busy for quite a while... Bill -- Psst... Hey, you... Buddy... Want a kitten? straycatblues.petfinder.org -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist