OSCALL byte, what is this?
Your related question says that you are using a 12F629, so I will refer to this datasheet throughout.

Many modern microcontrollers have inbuilt oscillators.  These are fairly accurate but the exact frequency will vary due to the manufacturing process.  Because of this most of these microcontrollers have some way of "tuning" or calibrating the oscillator whilst it is running.

With the PIC 12F (and other similar PIC families) there is a register called OSCCAL.  You can read about it in section 9.2.5.1 "Calibrating the Internal Oscillator" on page 56 of the datasheet I linked above.

The datasheet says:


  A calibration instruction is programmed into the last location of program memory. This instruction is a RETLW XX, where the literal is the calibration value. The literal is placed in the OSCCAL register to set the calibration of the internal oscillator.


This value can be calculated and set by Microchip's PICKit2 and PICKit3 programmers and probably by some of the better compatible tools.

Example 9-1 on page 56 shows how this is loaded into the OSCCAL register, which is volatile and therefore needs to be set at each powerup.

BSF STATUS, RP0 ; Bank 1
CALL 3FFh       ; Get the cal value
MOVWF OSCCAL    ; Calibrate
BCF STATUS, RP0 ; Bank 0


This is a simple piece of code that selects the correct bank, calls the last memory location (0x3FF) and then moves the result into the OSCCAL register.  This explains why the last byte in a hex file disassembles to RETLW XX, it simply returns the calibration value.

If you want to use this value which is stored in program flash you need to include a small stub like the above code that runs each time your device undergoes a power-on reset.  Some PIC C compilers will automatically include this for you on relevant devices.

You can read some more about OSCCAL at the following links:


http://picprojects.org.uk/projects/piccal.htm
http://www.electronics-lab.com/projects/mcu/017/index.html
http://melabs.com/resources/articles/osccal.htm