Differences
This shows you the differences between two versions of the page.
histcomp:6502 [2024-08-27 03:33] – created asdf | histcomp:6502 [2024-08-28 06:22] (current) – asdf | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== 6502 ====== | + | ====== |
===== Architecture ===== | ===== Architecture ===== | ||
The 6502 has only three general-purpose registers: A, X, and Y, all of which are 8 bits wide. It also has an eight-bit stack pointer (S) and an eight-bit status register (P). The stack is hardwired to page 1 (\$0100--\$01FF) and grows down. Addresses are always stored in little-endian format. | The 6502 has only three general-purpose registers: A, X, and Y, all of which are 8 bits wide. It also has an eight-bit stack pointer (S) and an eight-bit status register (P). The stack is hardwired to page 1 (\$0100--\$01FF) and grows down. Addresses are always stored in little-endian format. | ||
===== Instruction set ===== | ===== Instruction set ===== | ||
+ | 6502 instructions can often use multiple addressing modes. Examples include: | ||
+ | |||
+ | * implied: TAX | ||
+ | * immediate: ADC #\$01 | ||
+ | * zero page: STX \$A3 | ||
+ | * zero page indexed: LDX \$3A,Y | ||
+ | * absolute: LDA \$2000 | ||
+ | * indirect: JMP (\$C1FF) | ||
+ | * relative: BEQ -5 | ||
+ | * absolute indexed: EOR \$2000,X / AND \$2000,Y | ||
+ | * indexed indirect: CMP (\$65,X) | ||
+ | * indirect indexed: ORA (\$55),Y | ||
+ | |||
+ | Out of a possible 256, the NMOS 6502 had only 151 legal opcodes. Because the chip used a PLA instruction decoder, the illegal opcodes could have effects from combining existing valid instructions to completely locking up the processor [(pagetableIllegalOpcodes)]. | ||
<table |tab_nmosops> | <table |tab_nmosops> | ||
- | < | + | < |
^ ^ x0 ^ x1 ^ x2 ^ x3 ^ x4 ^ x5 ^ x6 ^ x7 ^ x8 ^ x9 ^ xA ^ xB ^ xC ^ xD ^ xE ^ xF ^ | ^ ^ x0 ^ x1 ^ x2 ^ x3 ^ x4 ^ x5 ^ x6 ^ x7 ^ x8 ^ x9 ^ xA ^ xB ^ xC ^ xD ^ xE ^ xF ^ | ||
^ 0x | BRK | ORA (a8,X) | | | | ORA a8 | ASL a8 | | PHP | ORA #d8 | ASL A | | | ORA a16 | ASL a16 | | | ^ 0x | BRK | ORA (a8,X) | | | | ORA a8 | ASL a8 | | PHP | ORA #d8 | ASL A | | | ORA a16 | ASL a16 | | | ||
Line 32: | Line 46: | ||
===== References ===== | ===== References ===== | ||
[(Zaks1983>// | [(Zaks1983>// | ||
+ | [(pastraiser6502> | ||
+ | [(pagetableIllegalOpcodes> | ||
~~REFNOTES~~ | ~~REFNOTES~~ |