could be used to display a message, '0' terminating the string
or
dt 0x1,0x2,0x3,0x4,0x5
for a simple 5 byte lookup table.
The ability to store a message say for an lcd is much more tidyer and quicker than having to enter each ascii character on its own line with its own retlw and quotation marks.
The 'ugh' was to Nagkiller's code, not MPLAB which I think is a great program.
The example using the DT directive is quite correct and it actually codes each byte in the table as a 'retlw' instruction but without all the typing!
Warning: be careful if the table crosses a page boundary because the jump into it (adding W to PCL) will not update the PCLATH register. If it goes beyond an address ending in 0xFF it will pick up the instruction at address 0x00 in the same page, not the next one. There are fixes for this, a good discussion on it can be found on the Microchip Forum. Only the PIC 10F, 12F and 16F need to use this method of using look-up tables, the other families have dedicated instructions for table access.
I have writtena piece of code to setup the value within a ad9850 dds chip last night using the dt directive, and yes it saves time and looks neater.
Yes I'm well aware of the fact that adding to the program counter only affects the lower 8 bits and page boundarys come into effect, I think I have my own way of dealing with this, I assemble the code , then see what page the table is in by looking at the .lst file, then go back to the code and load pclath with the correct page no just before adding to the program counter.
I'm not sure what the code actually does (a frequency synth?) but as each entry has 4 values you *might* be able to adapt the code by multiplying the W value by 4 (shift left twice) to find the entry into the table then extract the following four entries into individual variables. The whole table can then be a single DT statement or if you prefer several lines of DT. It uses at least three extra ram locations but cuts the number of instructions needed.
Incidentally, if you post code on the forum, please do it inside code tags (the # in the menu bar at the top of the window). It tells the forum software not to reformat it so we can see it as you wrote it.
The code fetches a value to add or subtract to the synth's freq register, the register is 32 bit hence 4 bytes.
I need to call each one independantly, however yes I see what you say I could have just one table, I do have a load of space in the chip thoug so it'll be fine, but I'll remember that.