I know this is available on many PIC enthusiast sites, and it is also in an app note on the Microchip site, but it is so simple that I'll state it here. Starting with the lookup value in W, call a lookup subroutine to get the converted value, also in W. convert: addwf PCL,1 retlw val 1 ; W = 0 retlw val 2 ; W = 1 retlw val 3 ; W = 2 retlw val 4 ; W = 3 retlw val 5 ; W = 4 ... retlw val n ; W = n-1 Note that the entire lookup table must not cross a page boundary. This all depends on the unusual fact (compared to other MCU's) that the PIC program counter can be manipulated like any other register by the addwf instruction. HTH - Martin R. Green elimar@bigfoot.com ---------- From: Steven J Tucker[SMTP:classics@NACS.NET] Sent: Friday, September 19, 1997 12:44 AM To: PICLIST@mitvma.mit.edu Subject: Re: PIC or SBC? On Thu, 18 Sep 1997, Martin R. Green wrote: > The current issue of Steve Ciarcia's Circuit Cellar Ink magazine has a > project almost identical to what you are doing, except it converts PC [snip] Thanks for the info, I will look for it. > PPS. If you use a PIC, you don't need to EEPROM for the conversion tables, > you should be able to use RETLW ROM lookup tables instead. Can you point me to any examples of this? I assume you mean a large block of RETLW statements, w/ an indirect CALL somehow? On a 6502 there is an indirect JSR addressing mode, but on the pic? I would really love to see how this is done, seems very inventive :) Steve * * * Author of Imagic and APE - The Atari Peripheral Emulator! * * * * * * Turn your 8-bit Atari into a powerhouse with APE! * * * * * * Ape Homepage: http://www.nacs.net/~classics * * * * * ********************************************************* * * !! Request my *FOR SALE* LISTING OF CLASSIC VIDEO GAME STUFF -- 2000+ Items !!