(opcode: string | undefined)
| 1 | import type {AssemblyInstructionInfo} from '../../../types/assembly-docs.interfaces.js'; |
| 2 | |
| 3 | export function getAsmOpcode(opcode: string | undefined): AssemblyInstructionInfo | undefined { |
| 4 | if (!opcode) return; |
| 5 | switch (opcode.toUpperCase()) { |
| 6 | case "ADC": |
| 7 | return { |
| 8 | "html": "<p>This instruction adds the value of memory and carry from the previous operation to the value of the accumulator and stores the result in the accumulator.</p><p>This instruction affects the accumulator; sets the carry flag when the sum of a binary add exceeds 255 or when the sum of a decimal add exceeds 99, otherwise carry is reset. The overflow flag is set when the sign or bit 7 is changed due to the result exceeding +127 or -128, otherwise overflow is reset. The negative flag is set if the accumulator result contains bit 7 on, otherwise the negative flag is reset. The zero flag is set if the accumulator result is 0, otherwise the zero flag is reset.</p>", |
| 9 | "tooltip": "Add Memory to Accumulator with Carry", |
| 10 | "url": "https://www.pagetable.com/c64ref/6502/?cpu=6502&tab=2#ADC", |
| 11 | }; |
| 12 | |
| 13 | case "AND": |
| 14 | return { |
| 15 | "html": "<p>The AND instruction transfer the accumulator and memory to the adder which performs a bit-by-bit AND operation and stores the result back in the accumulator.</p><p>This instruction affects the accumulator; sets the zero flag if the result in the accumulator is 0, otherwise resets the zero flag; sets the negative flag if the result in the accumulator has bit 7 on, otherwise resets the negative flag.</p>", |
| 16 | "tooltip": "\"AND\" Memory with Accumulator", |
| 17 | "url": "https://www.pagetable.com/c64ref/6502/?cpu=6502&tab=2#AND", |
| 18 | }; |
| 19 | |
| 20 | case "ASL": |
| 21 | return { |
| 22 | "html": "<p>The shift left instruction shifts either the accumulator or the address memory location 1 bit to the left, with the bit 0 always being set to 0 and the input bit 7 being stored in the carry flag. ASL either shifts the accumulator left 1 bit or is a read/modify/write instruction that affects only memory.</p><p>The instruction does not affect the overflow bit, sets N equal to the result bit 7 (bit 6 in the input), sets Z flag if the result is equal to 0, otherwise resets Z and stores the input bit 7 in the carry flag.</p>", |
| 23 | "tooltip": "Arithmetic Shift Left", |
| 24 | "url": "https://www.pagetable.com/c64ref/6502/?cpu=6502&tab=2#ASL", |
| 25 | }; |
| 26 | |
| 27 | case "BCC": |
| 28 | return { |
| 29 | "html": "<p>This instruction tests the state of the carry bit and takes a conditional branch if the carry bit is reset.</p><p>It affects no flags or registers other than the program counter and then only if the C flag is not on.</p>", |
| 30 | "tooltip": "Branch on Carry Clear", |
| 31 | "url": "https://www.pagetable.com/c64ref/6502/?cpu=6502&tab=2#BCC", |
| 32 | }; |
| 33 | |
| 34 | case "BCS": |
| 35 | return { |
| 36 | "html": "<p>This instruction takes the conditional branch if the carry flag is on.</p><p>BCS does not affect any of the flags or registers except for the program counter and only then if the carry flag is on.</p>", |
| 37 | "tooltip": "Branch on Carry Set", |
| 38 | "url": "https://www.pagetable.com/c64ref/6502/?cpu=6502&tab=2#BCS", |
| 39 | }; |
| 40 | |
| 41 | case "BEQ": |
| 42 | return { |
| 43 | "html": "<p>This instruction could also be called \"Branch on Equal.\"</p><p>It takes a conditional branch whenever the Z flag is on or the previous result is equal to 0.</p><p>BEQ does not affect any of the flags or registers other than the program counter and only then when the Z flag is set.</p>", |
| 44 | "tooltip": "Branch on Result Zero", |
| 45 | "url": "https://www.pagetable.com/c64ref/6502/?cpu=6502&tab=2#BEQ", |
| 46 | }; |
| 47 | |
| 48 | case "BIT": |
| 49 | return { |
| 50 | "html": "<p>This instruction performs an AND between a memory location and the accumulator but does not store the result of the AND into the accumulator.</p><p>The bit instruction affects the N flag with N being set to the value of bit 7 of the memory being tested, the V flag with V being set equal to bit 6 of the memory being tested and Z being set by the result of the AND operation between the accumulator and the memory if the result is Zero, Z is reset otherwise. It does not affect the accumulator.</p>", |
| 51 | "tooltip": "Test Bits in Memory with Accumulator", |
| 52 | "url": "https://www.pagetable.com/c64ref/6502/?cpu=6502&tab=2#BIT", |
| 53 | }; |
| 54 | |
| 55 | case "BMI": |
| 56 | return { |
| 57 | "html": "<p>This instruction takes the conditional branch if the N bit is set.</p><p>BMI does not affect any of the flags or any other part of the machine other than the program counter and then only if the N bit is on.</p>", |
| 58 | "tooltip": "Branch on Result Minus", |
| 59 | "url": "https://www.pagetable.com/c64ref/6502/?cpu=6502&tab=2#BMI", |
| 60 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected