Intel 8035 microcontroller architecture
Data memory and stack memory occupy the same memory space. Program memory is separate from data and stack memory.
Program memory may have up to 4 KB of external program memory. Conditional branch and unconditional indirect jump instructions can be used to jump within current 256-byte program memory page. Unconditional jump and call instructions are used to address within current 2 KB program memory block. Due to the way how the program counter register is incremented (see "Registers" below), going from the first 2 KB program memory block to the second 2 KB block, or vice versa, should be programmed as SEL MB0 (or SEL MB1) followed by JMP or CALL instruction.
Data memory consists of 64 bytes of on-chip RAM and up to 256 bytes of external RAM:
Stack is stored in data memory locations 08h - 17h (8 - 23) and can be 8-levels deep. The stack starts at location 08h and grows upwards. When a CALL instruction is executed the return address (12 bits) and the upper 4 bits of the program status word (CY, AC, F0 and BS flags) are stored in the stack. If the user program does not use all stack levels then part of the stack memory (2 bytes per stack level) can be reused for data storage.
The processor has two maskable interrupts:
INT external interrupt. When the interrupt occurs the microcontroller disables further interrupts, saves the program counter and part of the program status word into stack, and jumps to address 0003h. This address usually contains a jump instruction to interrupt processing routine. To return from the interrupt the routine should use RETR instruction. If necessary, the interrupt can be enabled or disabled using EN I or DIS I instructions. When interrupt is disabled it is possible to check if there is a pending interrupt using JNI instruction.
Timer/counter interrupt. This interrupt occurs when the counter overflows, i.e. when it has the value FFh and it's incremented. When the interrupt occurs the microcontroller disables further interrupts, saves the program counter and part of the program status word into stack, and jumps to address 0007h. This address usually contains a jump instruction to interrupt processing routine. To return from the interrupt the routine should use RETR instruction. If necessary, the interrupt can be enabled or disabled using EN TCNTI or DIS TCNTI instructions. The timer/counter interrupt has lower priority than the external INT interrupt - when both of them occur at the same time the MCU calls the INT interrupt processing routine.
27 I/O lines:
Program counter (12-bit). The most significant bit of the program counter is not updated when the program counter is incremented. To tell the MCU to set/reset this bit the program should use SEL MB1 or SEL MB0 instructions. The bit value specified by the SEL MB instruction will be set when the next unconditional JMP or CALL instruction is executed.
Accumulator is used for data moving, arithmetic, logic and I/O operations.
Working registers are used for temporary data storage. These registers can be addressed directly by many instructions. There are two sets of working registers - bank 0 and bank 1, each bank has 8 working registers. First two registers in each bank are RAM pointer registers (see below). Working registers are located in RAM, their addresses are 00h - 07h for register bank 0, and 18h - 1Fh for register bank 1. To switch between different banks of working registers use SEL RB instruction.
RAM pointer registers are used by many instructions to address RAM indirectly. These registers are located in RAM. Their addresses are 00h and 01h for register bank 0, and 18h and 19h for register bank 1.
Program status word consists of the following bits:
8035 instruction set consists of the following instructions:
Instruction length can be one or two bytes.
Implied - the data value/data address is implicitly associated with the instruction.
Accumulator - the instruction implies that the accumulator contains the data.
Register - references data in one of 8 working registers in the currently selected data memory bank.
Immediate - 8-bit data is provided in the instruction.
Absolute - the instruction operand specifies the memory address where control is transferred. The instruction may have 8-bit or 11-bit operand:
Register indirect - instruction specifies RAM pointer register that contains RAM address, where data is located.
Accumulator indirect - the accumulator contains a program memory address within current 256-byte program memory page where the program control will be transferred.
Jump to CPU / Family