The ST6 and ST7 are 8-bit microcontroller product lines from STMicroelectronics . They are commonly used in small embedded applications like washing machines .
26-627: ST6 may refer to: ST6 and ST7 , 8-bit microcontroller product lines from STMicroelectronics ST6, a postcode district in the Stoke-on-Trent postcode area ST6, a variant of the Pratt & Whitney Canada PT6 turboprop aircraft engine ST6, the Finance and Investment Specialist Technical B examination of the Institute of Actuaries ST6,
52-410: A +not( b )+ C , while subtract without carry acts as if the carry bit were set. The result is that the carry bit is set if a ≥ b , and clear if a < b . The System/360 , 6502 , MSP430 , COP8 , ARM and PowerPC processors use this convention. The 6502 is a particularly well-known example because it does not have a subtract without carry operation, so programmers must ensure that the carry flag
78-414: A mechanism for comparing the values as signed integer values. While the carry flag is well-defined for addition, there are two ways in common use to use the carry flag for subtraction operations. The first uses the bit as a borrow flag, setting it if a < b when computing a − b , and a borrow must be performed. If a ≥ b , the bit is cleared. A subtract with borrow ( SBB ) instruction will compute
104-484: A single ALU width to be added/subtracted by carrying (adding) a binary digit from a partial addition/subtraction to the least significant bit position of a more significant word. This is typically programmed by the user of the processor on the assembly or machine code level, but can also happen internally in certain processors, via digital logic or microcode , where some processors have wider registers and arithmetic instructions than (combinatorial, or "physical") ALU. It
130-441: A − b − C = a −( b + C ), while a subtract without borrow ( SUB ) acts as if the borrow bit were clear. The 8080 , 6800 , Z80 , 8051 , x86 and 68k families (among others) use a borrow bit. The second uses the identity that − x = ( not x )+1 directly (i.e. without storing the carry bit inverted) and computes a − b as a +(not b )+1. The carry flag is set according to this addition, and subtract with carry computes
156-527: Is a Harvard architecture with an 8-bit (256 byte) data address space and a separate 12-bit (4096 byte) program space. Operands are always 1 byte long, and some instructions support two operands, such as "move 8-bit immediate to 8-bit memory address". Subroutine calls are done using a separate hardware stack. Data registers (but not the program counter or flags) are memory-mapped. The ST6's addressing modes are limited to immediate, 8-bit absolute memory address, and register indirect modes (X) and (Y). The ST7
182-554: Is a von Neumann architecture with a single 16-bit (64 kiB) address space. The first 256 bytes of RAM (the zero page ) have extra flexibility. There are no two-operand instructions except for "test bit and branch". Its registers are not memory-mapped, and it uses general-purpose RAM (plus a stack pointer register) for subroutine calls. The ST7 supports a wide variety of addressing modes, including base+index and double-indirect. The ST6 has 64 bytes of RAM and 4096 bytes of program ROM . Larger amounts are accessed by bank-switching
208-486: Is also used as an input to many of them. Several of these instructions have two forms which either read or ignore the carry. In assembly languages these instructions are represented by mnemonics such as ADD/SUB , ADC/SBC ( ADD/SUB including carry), SHL/SHR ( bit shifts ), ROL/ROR (bit rotates), RCR/RCL (rotate through carry), and so on. The use of the carry flag in this manner enables multi- word add, subtract, shift, and rotate operations. An example
234-510: Is also used to extend bit shifts and rotates in a similar manner on many processors (sometimes done via a dedicated flag). For subtractive operations, two (opposite) conventions are employed as most machines set the carry flag on borrow while some machines (such as the 6502 and the PIC ) instead reset the carry flag on borrow (and vice versa). The carry flag is affected by the result of most arithmetic (and typically several bitwise) instructions and
260-520: Is clear, and Carry_Flag is ignored. The sign of the result is negative, because Sign_Flag is set. 11111110 is the two's complement form of signed integer −2. If 11111111 represents unsigned integer binary number 255 ( ADD al,255 ), then the interpretation of the result would be 254, which is not correct, because the most significant bit of the result went into the Carry_Flag , which therefore cannot be ignored. The Overflow_Flag and
286-528: Is set before every subtract operation where a borrow is not required. Most commonly, the first alternative is referred to as a "subtract with borrow", while the second is called a "subtract with carry". However, there are exceptions in both directions; the VAX , NS320xx , and Atmel AVR architectures use the borrow bit convention, but call their a − b − C operation "subtract with carry" ( SBWC , SUBC and SBC ). The PA-RISC and PICmicro architectures use
SECTION 10
#1732780125000312-409: Is what happens if one were to add 255 and 255 using 8-bit registers. The result should be 510 which is the 9-bit value 111111110 in binary. The 8 least significant bits always stored in the register would be 11111110 binary (254 decimal) but since there is carry out of bit 7 (the eight bit), the carry is set, indicating that the result needs 9 bits. The valid 9-bit result is the concatenation of
338-549: The Sign_Flag are ignored. Another example may be an 8-bit register with the bit pattern 01010101 and the carry flag set; if we execute a rotate left through carry instruction, the result would be 10101011 with the carry flag cleared because the most significant bit (bit 7) was rotated into the carry while the carry was rotated into the least significant bit (bit 0). The early microprocessors Intel 4004 and Intel 8008 had specific instructions to set as well as reset
364-560: The ST6 family use different conventions for the value of the carry bit after a subtraction. ST60 processors use the "carry" convention, which clears the bit if the subtract underflows, while the ST62 and ST63 processors use the "borrow" convention, which sets the bit in that case. The ST7 has six registers: the accumulator, X and Y index registers, stack pointer, program counter, and condition code register. Also, double-indirect addressing allows
390-401: The X, Y, V and W registers, and some instructions can access them using special short addressing modes. The X and Y registers serve as index registers, and can use indirect addressing modes (X) and (Y) . The instruction set consists of one byte of opcode, followed by up to two one-byte operands. The instruction set can be summarized as follows: †: ^ Confusingly, different models of
416-466: The above, there are three prefix bytes which may be prepended to any instruction for which they make sense: Carry flag In computer processors , the carry flag (usually indicated as the C flag ) is a single bit in a system status register /flag register used to indicate when an arithmetic carry or borrow has been generated out of the most significant arithmetic logic unit (ALU) bit position. The carry flag enables numbers larger than
442-404: The carry bit convention, but call their a +not( b )+ C operation "subtract with borrow" ( SUBB and SUBWFB ). The ST6 8-bit microcontrollers are perhaps the most confusing of all. Although they do not have any sort of "subtract with carry" instruction, they do have a carry bit which is set by a subtract instruction, and the convention depends on the processor model. The ST60 processor uses
468-414: The carry flag explicitly. However, the later Intel 8080 (and Z80 ) did not include an explicit reset carry opcode as this could be done equally fast via one of the bitwise AND, OR or XOR instructions (which do not use the carry flag). The carry flag is also often used following comparison instructions, which are typically implemented by subtractive operations, to allow a decision to be made about which of
494-398: The carry flag with the result. For x86 ALU size of 8 bits, an 8-bit two's complement interpretation, the addition operation 11111111 + 11111111 results in 111111110 , Carry_Flag set, Sign_Flag set, and Overflow_Flag clear. If 11111111 represents two's complement signed integer −1 ( ADD al,-1 ), then the interpretation of the result is -2 because Overflow_Flag
520-529: The last of the KX series of telephone boxes in the United Kingdom See also [ edit ] Star Trek VI: The Undiscovered Country , a 1991 American science fiction film [REDACTED] Topics referred to by the same term This disambiguation page lists articles associated with the same title formed as a letter–number combination. If an internal link led you here, you may wish to change
546-448: The link to point directly to the intended article. Retrieved from " https://en.wikipedia.org/w/index.php?title=ST6&oldid=1054105352 " Category : Letter–number combination disambiguation pages Hidden categories: Short description is different from Wikidata All article disambiguation pages All disambiguation pages ST6 and ST7 Although they use similar peripherals and are marketed as part of
SECTION 20
#1732780125000572-542: The low 2K section of the ROM. The RAM address space is actually 256 bytes, divided as follows: Not mapped into the address space is a 12-bit program counter and an associated hardware stack (four or six levels deep, depending on model). There are only two status bits ( carry and zero ), and they are banked based on processor mode, with separate status bits for normal, interrupt and non-maskable interrupt operation. The first four general-purpose RAM locations are also known as
598-404: The same product line, the two architectures are actually quite different. Both have an 8-bit accumulator used for most operations, plus two 8-bit index registers (X and Y) used for memory addressing. Also both have 8-bit instructions followed by up to 2 bytes of operands, and both have support for manipulating and branching on individual bits of memory. There, the similarities end. The ST6
624-410: The second source, which may be: The destination is usually the accumulator, but a few instructions modify the second source. (Immediate operands are forbidden in such cases.) One-operand instructions use the specified operand for both source and destination. The operand may be: Register plus offset computes a full-width sum, so the 8-bit form may address memory up to 255+255 = 510. In addition to
650-427: The two compared values is lower than (or greater or equal to) the other. Branch instructions which examine the carry flag are often represented by mnemonics such as BCC and BCS to branch if the carry is clear, or branch if the carry is set respectively. When used in this way the carry flag provides a mechanism for comparing the values as unsigned integers. This is in contrast to the overflow flag which provides
676-401: The zero page of RAM to serve as additional registers. An unusual but useful feature is that an interrupt pushes four of these registers on the stack (A and X as well as the usual PC and CC), and interrupt return restores them. ALU instructions fall into two categories, two-operand and one-operand. Two-operand instructions use the accumulator as the first source. The addressing mode specifies
#0