Qaddress.txt 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. Addressing mode quick reference
  2. By Qwertie (QwertMan@hotmail.com)
  3. I lifted this straight from my emulator code, which I tend to comment heavily :)
  4. Please correct me if any of this is wrong...
  5. // ADDRESSING MODES - several categories, one mode from each category can be combined
  6. // None of the instructions can use all combinations, and certain combinations are
  7. // never used with any instruction.
  8. // Used to calculate memory address:
  9. // Absolute: Argument is two bytes and specifies a memory location
  10. // + Long: Argument is three bytes instead opcode $addr
  11. // Direct: Argument is one byte; memory address formed by adding D.
  12. // Bank is always 0, unless indirect addressing is also used, in
  13. // which case the bank is the program bank. opcode <$addr
  14. // Stack Relative: Argument is one byte, which is added to the stack pointer
  15. // to find the final address. opcode $addr,S
  16. // Indexed addressing:
  17. // Indexed: Memory location argument is added to X or Y to get the final
  18. // memory location. opcode $addr,X or Y
  19. // Note that certain indexed addressing modes only work with the X register
  20. // or only with the Y register.
  21. //
  22. // Note! The above addressing mode specifiers are used only to specify the
  23. // size of the argument and how it is used. The specifiers DO NOT SPECIFY
  24. // anything about the actual memory location being referenced.
  25. // For example, suppose the Absolute Indexed mode is used. This means that
  26. // the argument to the opcode is 16 bits and will be added to an index
  27. // register. It does not, however, mean that the value at the calculated
  28. // memory location will be a 16-bit value. The size of the value at the memory
  29. // location is determined by either:
  30. // a. whether the processor is in 16-bit mode (and whether E=0), or
  31. // b. if indirect addressing is used, whether the Long Indirect mode is used.
  32. //
  33. // Indirect addressing:
  34. // Indirect: Uses indirection (pointers). In other words, after the memory
  35. // location is found and the contents are loaded, the contents are used as
  36. // a SECOND memory location and the value at the second memory location is
  37. // used in the operation. opcode ($addr)
  38. // + Direct Long: Normally, the pointer found at the specified location
  39. // will be two bytes. If Direct Indirect Long is used, the pointer
  40. // at the memory address found will be a three-byte long address.
  41. // opcode [$addr]
  42. // Indexed Indirect (preindexed; (arg,x)) vs. Indirect Indexed (postindexed;
  43. // (arg),x): remember, these two are different!
  44. //
  45. // Stack relative addressing: denoted by arg,s, the address is calculated by
  46. // adding the argument value to the stack pointer. Always accesses bank 0,
  47. // since the stack is always in bank 0.
  48. // There is also two more modes, which are never used with any other specifiers:
  49. // Implied: Opcode has no arguments
  50. // Immediate: The argument specifies an actual constant value to be used,
  51. // rather than a memory address. [opcode #$XX or #$XXXX]
  52. Vector Locations:
  53. In Emulation Mode: In Native Mode:
  54. 00.FFFE /IRQ or BRK 00.FFEE /IRQ
  55. 00.FFFC /RESET 00.FFEC (Unused)
  56. 00.FFFA /NMI 00.FFEA /NMI
  57. 00.FFF8 /ABORT 00.FFE8 /ABORT
  58. 00.FFF6 (Unused) 00.FFE6 BRK
  59. 00.FFF4 CSP 00.FFE4 CSP
  60. -The location after the one listed holds the high byte of the address
  61. -CSP (Call system procedure) is same as the COP mnemonic