Menu

#80 65816 MVN/MVP parameter order swapped

1.60.3243
pending-invalid
nobody
None
5
4 days ago
4 days ago
mrehkopf
No

According to Eyes & Lichty, pp. 466 & 467 (archive.org), the syntax for MVN/MVP is "MVN src, dest":

Assembler syntax for the block move instruction calls for the operand field to be coded as two addresses, source first, then destination — the more intuitive ordering, but the opposite of the actual operand order in the object code. The assembler strips the bank bytes from the addresses (ignoring the rest) and reverses them to object code order.

(Also the assembler is apparently supposed to be accepting full addresses and just implicitly use their bank bytes to form the operands - ca65 does accept it that way - but personally I am fine with the recent switch to immediates.)

So for the instruction:

MVN #$7E, #$C0 ; Move from Bank 7E to Bank C0

64tass should emit the bytes

54 C0 7E

But currently it produces:

54 7E C0

so the source and destination banks are swapped.

Discussion

  • Soci/Singular

    Soci/Singular - 4 days ago

    Hello!

    Looks correct to me:

    ; 64tass Turbo Assembler Macro V1.60.3243 listing file
    ; 64tass -x -L - a.asm
    ; Sun Apr  5 14:56:24 2026
    
    ;Offset ;Hex        ;Monitor    ;Source
    
    ;******  Processing input file: a.asm
    
    .0000   54 c0 7e    mvn #$7e,#$c0   MVN #$7E, #$C0
    
    ;******  End of listing
    

    I have V2.15 ca65 around and there it's reverse but I think they've fixed that back in 2018.

     
  • Soci/Singular

    Soci/Singular - 4 days ago
    • status: open --> pending-invalid
     
    👍
    1
  • mrehkopf

    mrehkopf - 4 days ago

    Hi!
    Indeed I can acknowledge that it does work as intended. Must have been masked by another issue with my code that I resolved without noticing after planning to open the ticket.
    Sorry for the noise, I could have avoided that by double-checking :(

     

Log in to post a comment.

MongoDB Logo MongoDB