Misplaced Pages

Hudson Soft HuC6280

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

The HuC6280 8-bit microprocessor is Japanese company Hudson Soft 's improved version of the WDC 65C02 CPU , an upgraded CMOS version of the popular NMOS-based MOS Technology 6502 8-bit CPU (the latter is essentially a simplified, less expensive and faster version of Motorola 's 6800 design), manufactured for Hudson by Seiko Epson and NEC . The most notable product using the HuC6280 is NEC 's TurboGrafx-16 video game console .

#887112

56-586: The HuC6280 contains a 65C02 core which has several additional instructions and a few internal peripheral functions such as an interrupt controller , a memory management unit , a timer , an 8-bit parallel I/O port, and a programmable sound generator (PSG). The processor operates at two speeds, 1.79 MHz and 7.16 MHz. A slightly revised HuC6280A was released and used in the PC Engine CoreGrafx and SuperGrafx . This revision reportedly fixed some minor audio issues in those systems. The HuC6280 has

112-431: A device driver might list the entry points for OPEN , CLOSE , READ , etc in a table at $ A000 . READ is the third entry, zero indexed, and each address requires 16-bits, so to call READ one would use something similar to JMP ($ A004) . If the driver is updated and the subroutine code moves in memory, any existing code will still work as long as the table of pointers remains at $ A000 . The 65C02 adds

168-419: A memory address e.g. DEC PDP-10 , ICT 1900 . Almost all computers, whether load/store architecture or not, load items of data from a larger memory into registers where they are used for arithmetic operations , bitwise operations , and other operations, and are manipulated or tested by machine instructions . Manipulated items are then often stored back to main memory, either by the same instruction or by

224-439: A 16-bit program counter (PC). In addition to the single accumulator, the first 256 bytes of RAM, the "zero page" ( $ 0000 to $ 00FF ), allow faster access through addressing modes that use an 8-bit memory address instead of a 16-bit address. The stack lies in the next 256 bytes, page one ($ 0100 to $ 01FF), and cannot be moved or extended. The stack grows backwards with the stack pointer (S) starting at $ 01FF and decrementing as

280-440: A 16-bit value from a given memory address and then jumps to the address in that 16-bit value. For instance, if memory location $ A000 holds $ 34 and $ A001 holds $ 12, JMP ($ A000) will read those two bytes, construct the value $ 1234 , and then jump to that location. One common use for indirect addressing is to build branch tables , a list of entry points for subroutines that can be accessed using an index. For instance,

336-410: A 64 KB logical address space, but a 2 MB physical address space. The HuC6280 uses a Memory Management Unit that splits the memory space into segments of 8 KB. Each logical 8 KB segment is associated with one of 256 physical 8 KB sized segments. This can be set up with an 8-bit register (MPR0-7) that contains the most significant eight bits of the address of the 8 KB segment in physical memory. Thus

392-656: A basic arrangement known as the von Neumann architecture , first proposed by the Hungarian-American mathematician John von Neumann . It is also noteworthy that the number of registers on GPUs is much higher than that on CPUs. (64 elements) (if FP present) 8 (if SSE/MMX present) (if AVX-512 available) (if FP present) + 2 × 32 Vector (dedicated vector co-processor located nearby its GPU) 16 in G5 and later S/390 models and z/Architecture (if FP present) (if FPP present) (up to 32) The number of registers available on

448-415: A bug because the description of the original MOS Technology MCS6500 Programming Manual does not include an increment of the upper byte of the indirect address when a carry is generated out of the lower byte, while the same manual does explicitly specify that such a carry is propagated when incrementing a 16-bit address in other addressing modes such as plain and indexed Absolute modes, and it is consistent with

504-430: A double read of addr , followed by a single write. When performing indexed addressing, if indexing crosses a page boundary all NMOS variants will read from an invalid address before accessing the correct address. As with a R-M-W instruction, this behavior can cause problems when accessing hardware registers via indexing. The 65C02 fixed this problem by performing a dummy read of the instruction opcode when indexing crosses

560-653: A graph indicates that typical devices are capable of operation at higher speeds than suggested by the AC characteristics table, and that reliable operation at 20 MHz should be readily attainable with V DD at 5 volts, assuming the supporting hardware will allow it. The W65C02S support for arbitrary clock rates allows it to use a clock that runs at a rate ideal for some other part of the system, such as 13.5 MHz (digital SDTV luma sampling rate), 14.31818 MHz (NTSC colour carrier frequency × 4), 14.75 MHz (PAL square pixels), 14.7456 (baud rate crystal), etc., as long as V DD

616-446: A later revision of the processor core that supports this instruction. A flaw that is present in all NMOS variants of the 6502 involves the jump instruction when using indirect addressing . In this addressing mode, the target address of the JMP instruction is fetched from memory, the jump vector, rather than being an operand to the JMP instruction. For example, JMP ($ 1234) would fetch

SECTION 10

#1733084610888

672-486: A page boundary. However, this fix introduced a new bug that occurs when the base address is on an even page boundary (which means indexing will never cross into the next page). With the new bug, a dummy read is performed on the base address prior to indexing, such that LDA $ 1200,X will do a dummy read on $ 1200 prior to the value of X being added to $ 1200 . Again, if indexing on hardware register addresses, this bug can result in undefined behavior. If an NMOS 6502

728-425: A pseudo-random square wave . Alternatively, each channel can be individually switched to "Direct D/A" mode in which the programmer can send data directly to the sound mixer, allowing more complex sound patterns to be generated, such as speech. Inevitably, this requires more programming effort and CPU time. WDC 65C02 The Western Design Center (WDC) 65C02 microprocessor is an enhanced CMOS version of

784-509: A set of new instructions. Both WDC and Rockwell contributed improvements to the bit testing and manipulation functions in the 65C02. WDC added new addressing modes to the BIT instruction that was present in the 6502, as well two new instructions for convenient manipulation of bit fields, a common activity in device drivers. BIT in the 65C02 adds immediate mode, zero page indexed by X and absolute indexed by X addressing. Immediate mode addressing

840-462: A software development system. The W65C02S–14 is the production version as of 2023 , and is available in PDIP , PLCC and QFP packages. The maximum officially supported Ø2 (primary) clock speed is 14  MHz when operated at 5 volts, indicated by the –14 part number suffix (hobbyists have developed 65C02 homebrew systems that run faster than the official rating). The "S" designation indicates that

896-682: A subsequent one. Modern processors use either static or dynamic RAM as main memory, with the latter usually accessed via one or more cache levels . Processor registers are normally at the top of the memory hierarchy , and provide the fastest way to access data. The term normally refers only to the group of registers that are directly encoded as part of an instruction, as defined by the instruction set . However, modern high-performance CPUs often have duplicates of these "architectural registers" in order to improve performance via register renaming , allowing parallel and speculative execution . Modern x86 design acquired these techniques around 1995 with

952-462: Is fetching a BRK (software interrupt) opcode at the same time a hardware interrupt occurs, the BRK will be ignored as the processor reacts to the hardware interrupt. The 65C02 correctly handles this situation by servicing the interrupt and then executing BRK. The 6502 has two indirect addressing modes which dereference through 16-bit addresses stored in page zero: A downside of this model is that if indexing

1008-474: Is intended to make the 65C02 well suited for low power system-on-chip (SoC) designs. A Verilog hardware description model is available for designing the W65C02S core into an application-specific integrated circuit (ASIC) or a field-programmable gate array (FPGA). As is common in the semiconductor industry, WDC offers a development system, which includes a developer board , an in-circuit emulator (ICE) and

1064-456: Is not needed but the address is in the zero page, one of the index registers must still be set to zero and used in one of these instructions. The 65C02 adds a non-indexed indirect addressing mode, e.g. LDA ($ 10) , to all instructions that can use indexed indirect and indirect indexed modes, freeing up the index registers. The 6502's JMP instruction has a unique (among 6502 instructions) addressing mode known as "absolute indirect" that reads

1120-421: Is particularly convenient in that it is completely non-destructive. For example: may be used in place of: The AND operation changes the value in the accumulator, so the original value loaded from $ 1234 is lost. Using BIT leaves the value in the accumulator unchanged, so subsequent code can make additional tests against the original value, avoiding having to re-load the value from memory. In addition to

1176-513: Is sufficient to support the frequency. Designer Bill Mensch has pointed out that F MAX is affected by off-chip factors, such as the capacitive load on the microprocessor's pins. Minimizing load by using short signal tracks and fewest devices helps raise F MAX . The PLCC and QFP packages have less pin-to-pin capacitance than the PDIP package, and are more economical in the use of printed circuit board space. WDC has reported that FPGA realizations of

SECTION 20

#1733084610888

1232-421: Is used for the new BBS instruction. Those which remain truly unused are equivalent to NOP s. 6502 programs using those opcodes will not work on the 65C02. The original 6502 had several errata when initially launched. Early 1975 versions of the processor had no ROR (rotate right) instruction, even though they did have ROL (rotate left). This was a deliberate design choice by MOS Technology, as it

1288-503: Is used in conjunction with an 8-bit offset. The same can be achieved in the NMOS version using indexed indirect mode, but only if the table is in the zero page, a limited resource. Allowing these tables to be constructed outside zero page not only lessens the demand for this resource but also allows the tables to be placed in ROM. In addition to the new addressing modes, the "base model" 65C02 also adds

1344-593: The WAI . The 65 SC 02 is a variant of the WDC 65C02 without bit instructions. Processor register A processor register is a quickly accessible location available to a computer's processor . Registers usually consist of a small amount of fast storage , although some registers have specific hardware functions, and may be read-only or write-only. In computer architecture , registers are typically addressed by mechanisms other than main memory , but may in some cases be assigned

1400-613: The W65C02 . Sanyo later licensed the design as well, and Seiko Epson produced a further modified version as the HuC6280 . Early versions used 40-pin DIP packaging, and were available in 1, 2 and 4 MHz versions, matching the speeds of the original nMOS versions. Later versions were produced in PLCC and QFP packages, as well as PDIP, and with much higher clock speed ratings. The current version from WDC,

1456-458: The W65C02S-14 has a fully static core and officially runs at speeds up to 14 MHz when powered at 5 volts. The 65C02 is a low cost, general-purpose 8-bit microprocessor (8-bit registers and data bus ) with a 16-bit program counter and address bus . The register set is small, with a single 8-bit accumulator (A), two 8-bit index registers (X and Y), an 8-bit status register (P), and

1512-465: The 65C02 and see a similar improvement in performance, largely through avoided memory accesses through the use of fewer instructions to accomplish a given task. The original 6502 has 56 instructions, which, when combined with different addressing modes, produce a total of 151 opcodes of the possible 256 8-bit opcode patterns. The remaining 105 unused opcodes are undefined, with the set of codes with low-order 4-bits with 3, 7, B or F left entirely unused,

1568-477: The NMOS 6502 will put the (N)egative, o(V)erflow and (Z)ero flags into officially undefined states. In reality, programmers have found empirically that the CPU updates these three flags to reflect the result of underlying binary arithmetic, that is, the flags reflect a result computed prior to the processor performing decimal correction. In contrast, the 65C02 sets these flags according to the result of decimal arithmetic, at

1624-457: The Processor, halts all processing until a hardware reset is issued. This can be used to put a system to "sleep" and then rapidly "wake" (reactivate) it with a reset. WAI t has a similar effect, halting all processing, but this instruction resumes normal execution on the reception of an interrupt. Without this instruction, waiting for a hardware interrupt generally involves running a loop suspend

1680-419: The W65C02S have been successfully operated at 200 MHz. Although the 65C02 can mostly be thought of as a low-power 6502, it also fixes several bugs found in the original and adds new instructions, addressing modes and features that can assist the programmer in writing smaller and faster-executing programs. It is estimated that the average 6502 assembly language program can be made 10 to 15 percent smaller on

1736-466: The WDC 65C02 began in 1981 with samples released in early 1983. The 65C02 was officially released sometime shortly after. WDC licensed the design to Synertek , NCR , GTE Microcircuits , and Rockwell Semiconductor . Rockwell's primary interest was in the embedded market and asked for several new commands to be added to aid in this role. These were later copied back into the baseline version, at which point WDC added two new commands of their own to create

Hudson Soft HuC6280 - Misplaced Pages Continue

1792-460: The above definition of a register. The following table shows the number of registers in several mainstream CPU architectures. Note that in x86 -compatible processors, the stack pointer ( ESP ) is counted as an integer register, even though there are a limited number of instructions that may be used to operate on its contents. Similar caveats apply to most architectures. Although all of the below-listed architectures are different, almost all are in

1848-558: The code with low-order 2 having only a single opcode. On the 6502, some of these leftover codes actually perform computation. Due to the way the 6502's instruction decoder works, simply setting certain bits in the opcode cause parts of the instruction processing to take place. Some of these opcodes immediately crash the processor, while other perform useful functions and were even given unofficial assembler mnemonics by some programmers. The 65C02 adds new opcodes that use some of these previously undocumented instruction slots. For example, $ FF

1904-399: The cost of an extra clock cycle per arithmetic instruction. (Some writers assert that the V flag on the 65C02 is still incorrect in decimal mode, but the flag may also be considered to be meaningless because decimal arithmetic is always unsigned.) When executing a read-modify-write (R-M-W) instruction, such as INC addr , all NMOS variants will do a double write on addr , first rewriting

1960-404: The current value found at addr and then writing the modified value. This behavior can result in difficult-to-resolve bugs if addr is a hardware register. This may occur if the hardware is watching for changes to the value in the register and then performs an action, in this case, it will perform two actions, one with the original value and then again with the new value. The 65C02 instead performs

2016-526: The enhancements of the BIT instruction, WDC added two instructions designed to conveniently manipulate bit fields: Rockwell's changes added more bit manipulation instructions for any bit in zero page, to directly set or reset a bit with a 2-byte instruction, or to test and branch on a bit with a single 3-byte instruction. The new instructions were available from the start in Rockwell's R65C00 family, but were not part of

2072-469: The first or last register in the integer register file is a pseudo-register in that it is hardwired to always return zero when read (mostly to simplify indexing modes), and it cannot be overwritten. In Alpha , this is also done for the floating-point register file. As a result of this, register files are commonly quoted as having one register more than how many of them are actually usable; for example, 32 registers are quoted when only 31 of them fit within

2128-411: The functionality they provide: Waveform playback is the most common and allows a 32-byte, 5-bit unsigned linear sample to be played back at selected frequencies. Frequency modulation takes this one step further, allowing the playback frequency to be dynamically adjusted according to a specified pattern. White noise is used to simulate percussion instruments and effects, such as explosions, by means of

2184-416: The general design philosophy set forth in the manual that the chip architects may have intended that programmers would simply avoid trying to use any indirect address that crosses a page boundary, in order to save one clock cycle when performing indirect addressing. Nonetheless, many NMOS 650X users perceived this complication to be a weakness, so it was eliminated in the 65C02. Another by-design weakness that

2240-458: The logical 64 KB address space can be overlapping, continuous or scattered in physical address space, depending on the eight MPR registers. Two special instructions are used to access these registers: TAMi - transfer the content of the accumulator (A) into an MPR register (0-7). TMAi - transfer an MPR register into the accumulator. PSG-styled wavetable synthesis provides six sound channels, which can be conveniently paired according to

2296-413: The most significant byte of the target address from $ 00 of the original page rather than $ 00 of the new page. Hence JMP ($ 12FF) would get the least significant byte of the target address at $ 12FF and the most significant byte of the target address from $ 1200 rather than $ 1300 . The 65C02 corrected this issue. The undesirable behavior of the NMOS 650X JMP Indirect instruction may not be

Hudson Soft HuC6280 - Misplaced Pages Continue

2352-452: The new "indexed absolute indirect" mode which eases the use of branch tables. This mode adds the value of the X register to the absolute address and takes the 16-bit address from the resulting location. For instance, to access the READ function from the table above, one stores 4 in X, then executyes JMP ($ A000,X) . This style of access makes accessing branch tables simpler as a single base address

2408-400: The number of bits they can hold, for example, an " 8-bit register", " 32-bit register", " 64-bit register", or even more. In some instruction sets , the registers can operate in various modes, breaking down their storage memory into smaller parts (32-bit into four 8-bit ones, for instance) to which multiple data (vector, or one-dimensional array of data) can be loaded and operated upon at

2464-506: The original 65C02 specification and not found in versions made by WDC or its other licensees. These were later copied back into the baseline design, and were available in later WDC versions. Rockwell-specific instructions are: Each of RMB , SMB , BBR , and BBS replaces a sequence of three instructions. In addition to the new commands above, WDC also added the STP and WAI instructions for supporting low-power modes. STP , STop

2520-794: The part has a fully static core , a feature that allows Ø2 to be slowed down or fully stopped in either the high or low state with no loss of data. Typical microprocessors not implemented in CMOS have dynamic cores and will lose their internal register contents (and thus crash) if they are not continuously clocked at a rate between some minimum and maximum specified values. The W65C02S may be operated at any convenient supply voltage (V DD ) between 1.8 and 5 volts (±5%). The data sheet AC characteristics table lists operational characteristics at 5 V at 14 MHz, 3.3 V or 3 V at 8 MHz, 2.5 V at 4 MHz, and 1.8 V at 2 MHz. This information may be an artifact of an earlier data sheet, as

2576-523: The popular nMOS -based 8-bit MOS Technology 6502 . It uses less power than the original 6502, fixes several problems, and adds new instructions. The power usage is on the order of 10 to 20 times less than the original 6502 running at the same speed; its reduced power consumption has made it useful in portable computer roles and industrial microcontroller systems. The 65C02 has also been used in some home computers , as well as in embedded applications, including implanted medical devices. Development of

2632-424: The processor enters the low-power state in a known location where all instructions are guaranteed to be complete, so when the interrupt arrives it cannot possibly interrupt an instruction and the interrupt response can be immediate. Plus, since the program expects the interrupt, the processor can safely continue without spending time saving state; the program is responsible to perform any necessary state-saving before

2688-480: The processor goes into low-power mode. When an interrupt is received, the processor immediately executes the JSR and handles the request. This has the added advantage of slightly improving performance. In the spinning case, the interrupt might arrive in the middle of one of the loop's instructions, and to allow it to restart after returning from the handler, the processor spends three cycles to save its location. With WAI ,

2744-427: The program until interrupt processing breaks out of the loop, sometimes known as " spinning ". This means the processor runs during the entire process, using power while doing (almost) nothing, even when no interrupts are occurring. In contrast, in the 65C02, interrupt code can be written by having a WAI followed immediately by a JSR or JMP to the handler. When the WAI is encountered, processing stops and

2800-436: The releases of Pentium Pro , Cyrix 6x86 , Nx586 , and AMD K5 . When a computer program accesses the same data repeatedly, this is called locality of reference . Holding frequently used values in registers can be critical to a program's performance. Register allocation is performed either by a compiler in the code generation phase, or manually by an assembly language programmer. Registers are normally measured by

2856-462: The reset code. The 65C02 automatically clears this flag after pushing the status register onto the stack in response any interrupt or in response to a hardware reset, thus placing the processor back into binary arithmetic mode. This usually saves a few bytes in the software and eliminates the possibility of a common programming mistake (although it increases the size of any software that runs constantly in decimal mode). During decimal mode arithmetic,

SECTION 50

#1733084610888

2912-514: The same time. Typically it is implemented by adding extra registers that map their memory into a larger register. Processors that have the ability to execute single instructions on multiple data are called vector processors . A processor often contains several kinds of registers, which can be classified according to the types of values they can store or the instructions that operate on them: Hardware registers are similar, but occur outside CPUs. In some architectures (such as SPARC and MIPS ),

2968-468: The stack grows. It has a variable-length instruction set , varying between one and three bytes per instruction. The basic architecture of the 65C02 is identical to the original 6502, and can be considered a low-power implementation of that design. At 1 MHz, the most popular speed for the original 6502, the 65C02 requires only 20 mW, while the original uses 450 mW, a reduction of over twenty times. The manually optimized core and low power use

3024-410: The value in memory locations $ 1234 (least significant byte) and $ 1235 (most significant byte) and load those values into the program counter , which would then cause the processor to continue execution at the address stored in the vector. The flaw, which some consider a bug, appears when the vector address ends in $ FF , which is the boundary of a memory page . In this case, JMP will fetch

3080-407: Was deemed that implementing ROR was too costly in chip area for the benefits it provided. However, clients complained about the missing ROR and it was implemented in parts manufactured since June 1976. The absence of ROR especially hurt the performance of mantissa normalization in floating-point math routines. The vast majority of machines using the original (NMOS) processor family contain

3136-468: Was revised by popular demand, the state of the (D)ecimal flag in the NMOS 6502's status register is undefined after a reset or interrupt . This means programmers have to set the flag to a known value in order to avoid random errors caused by arithmetic operations performed in the mode other than the one intended, constititing software bugs. As a result, one finds a CLD instruction (CLear Decimal) in almost all 6502 interrupt handlers , as well as early in

#887112