Document fait avec Nvu Document made with Nvu


Specific instructions

Here is the description of the instructions linked to the architecture of the MICROCHIP 16 bits processors which are the base of the FORTH micro system.

These processors have 2 memory maps:
- the ramdom access memory including the SFR registers,
- the FLASH memory containing the software.

The random access memory is addressed by a 16 bits pointer with a maximum capacity of 65536 bytes or 32768 words of 16 bits. This justifies the choice of a 16 bits data stack making it possible to manage directly the random access memory addresses. The pointer HERE, dedicated to the declaration of various FORTH variables, is thus with the 16 bits format.

The FLASH memory is addressed by a 24 bits program counter pointing the 24 bits instructions supplemented by a byte to 0 for a 32 bit format. The program counter is incremented by 2 to point the following instruction. The maximum size of the program area is thus of 8388608 instructions or 25165824 bytes. It is thus necessary to add specific FORTH instructions to handle the FLASH memory: ++, --, MEM_PRGHERE, PRGHERE, >PRGHERE, PRG@, PRG!, and PRG,.

Additional instructions allow the management of interfaces TIMER1 and UART1 used by the FORTH kernel.

You can also open the page dedicated to the detailed description of all the instructions of the FORTH kernel. For those that are create in various software packages application software, files contain this description in their comments.

n1h,n1l,n2h,n2l ++ (n1+n2)h,(n1+n2)l

32 bits addition

n1h,n1l,n2h,n2l -- (n1-n2)h,(n1-n2)l

32 bits soustraction

- IDLE -

Processor clock halted


All clocks halted

- ITRX1 adresse

Address of a replacement program for the UART1 reception interrupt (2 words of 16 bits)

- TELEC adresse

Address of the duration in millisecond before the end of a downloading

- CNTITP adresse

Address of a parasitic interuptions counter cleared at the RESET

- MEM_PRGHERE adresse

Address of the "PRGHERE" value (2 words of 16 bits)

- PNT_PRG adresse

Address of a 32 bits variable containing the pointer to the FLASH memory block which is modified

- PRGHERE adrh,adrl

Deposit on the data stack the compilation address

adrh,adrl >PRGHERE -

Initialize the compilation address

adrh,adrl PRG@ nh,nl

24 bits word reading from the FLASH memory

nh,nl,adrh,adrl PRG! -

24 bits word writting in the FLASH memory

nh,nl PRG, -

Compilation of a word of 24 bits
compilation address (PRGHERE) is incremented by 2


Initialization of TIMER1 and UART1