Code written for the Commodore 64 sometimes uses the PHX opcode, which should push X onto the stack. There also are plx, phy, ply. These were apparently added on the CMOS versions of the 6502; very old processors do not have these codes.

64tass assembles a phx as $da, but that opcode does not seem to be emulated by x64, which is the Commodore 64 emulator that comes with VICE. It even gets disassembled as a NOOP in the VICE debugger, and correspondingly, the emulated CPU leaves registers unchanged when it encounters this opcode:

.C:4048  68          PLA            - A:06 X:02 Y:06 SP:f5 .V-.....   22053498
.C:4049  DA          NOOP           - A:84 X:02 Y:06 SP:f6 NV-.....   22053502
.C:404a  6A          ROR A          - A:84 X:02 Y:06 SP:f6 NV-.....   22053504

What am I missing?

2 Answers 2


The C64 does not have these opcodes. The 6510/8500 CPU it uses was never produced in a CMOS variant, so it cannot even be upgraded to support these opcodes. The NMOS/HMOS versions interpret this opcode as a NOP instruction.

I'm not sure why the code you linked to uses them, but it is not possible to do so on a physical C64.

Update - the article in question was apparently copied from http://www.6502.org/source/ -- it was never intended to be C64 specific, and the site operators presumably did not notice when copying it that it wouldn't work on a C64.


As Jules correctly stated: The C64 does not have these opcodes (*1).

More important, the source does clearly point out this fact:

; UPPERCASE opcodes are 6502 codes
; lowercase opcodes are 65C02 codes

And lower case ones (65C02) used are not only stack related, but as well lda (zp) and stz. So that program should have failed way before reaching the PHX.

Bottom line: No need to read manuals - Inline Documentation is Your Friend.

*1 - Well, the C65 or a 65816 (SuperCPU) equipped C64 does. So there are C64 applications out there using them. Obscure but possible.

  • I believed until today that the C64 had a CMOS processor. Nov 10, 2018 at 18:43
  • A lot of games made use of undocumented opcodes of the 6502, especially within their copy-protection logic. I would guess the C65 was incompatible with those?
    – supercat
    Nov 10, 2018 at 19:56
  • @Wilson Nop. The C64's 6502 variants were all NMOS.
    – Raffzahn
    Nov 10, 2018 at 23:07
  • @supercat calling a lot is debatable - but yes, the 65CE02 does not have any of the illegal opcodes - like the 65C02. They also differs from the 65816 as well.
    – Raffzahn
    Nov 10, 2018 at 23:15
  • 1
    @Raffzahn You had an unfinished sentence in your answer. I've just approved an edit removing it, but I'm not sure whether the sentence should have more meaning than it has at the moment. Could you check it?
    – wizzwizz4
    Nov 11, 2018 at 10:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .