PIC to SX conversion

Program Memory, the 12bit wide instructions (opcode+operand) mean that jumps and calls can only operate within limited page boundaries unless you manually set the page bits in the status register or use the PAGE command. This is like the original PIC16C54 series of devices.  Fortunately the stack is 11bits wide so the RETURN commands operate correctly, but you must remember to restore the PAGE bits before you make any further calls. You should also make sure the page bits are set correctly after reset. See section 2.6 of the user manual.

Data Memory, a further consequence of the small instruction width is that only one SRAM file bank can be directly addressed at a time (eg: 10-1F).  To access different file banks you must change bits 5-7 in the file select register – FSR. See section 2.3

Port Configuration, Setting up PORTS is completely different as you must first use the MODE command to select the port function you want to change and then use the Wreg and TRIS command to configure the function.  For PORTA/C there are three functions, 0D-TTL/CMOS inputs, 0E-Pin pull up enable,  0F-Pin direction.  For PORTB there is also four additional registers. See section 2.4.7

Example: to set port B pins to all inputs,

    MODE        0x0F
    MOVLW     0xFF
    TRIS           PORTB

Option Register,  when OPTIONX in the FUSEX word is cleared Bits 7/6 of the option register are enabled.  Bit 6 enables RTCC interrupts, while Bit 7 determines what register is seen at address 01 (W or RTCC).  Note that PORTB week pull-ups are set through the MODE and TRIS commands not OPTION Bit7.  See section 4.3

Crystal/Ceramic Oscillator, a parallel resistor is required across the oscillator pins to make the oscillator work unless the /IFBD=1 in the FUSE, also the capacitor values are different.

FUSE settings,  the FUSE and FUSEX words are set up in the assembler and then programmed in to configure the general device operation.  FUSE is like the Configuration word but has additional bits such as RC divider/OPTIONX/TURBO, see section 5.1.  The FUSEX is completely new as it configures RAM/EEPROM size, ADD/SUB carry result and a brownout feature. See section 5.2

Data EPROM, there is no data EEPROM available for storing values during power down.

RESET, the reset address is to the top of memory eg: 0x07FF.

Assembler labels, the fluffy assembler gets confused if it finds a label ending in 0, so always start from 1.

Turbo mode, be careful when using Turbo mode to also set /SYNC=0 in FUSE as this causes port access to be synchronous. Otherwise port read/writes can give unpredictable results.