Banner
Views: 771,806,298
Time:
15 users online: bandicoot,  bebn legg, CalHal, chickaDEE Magazine, Dark Prince, DarkLion499,  Deakula, E-man38, Green Jerry, lbkaizo,  MarioFanGamer,  Meirdent, placeholdertest,  Sayuri, SuperMarioDs64 - Guests: 56 - Bots: 197Users: 40,542 (1,855 active)
Latest: Alejendroxxx84
Tip: When you're about to release your hack, make a patch first, patch it to a clean ROM, and then test that. This way, you are testing both the hack AND the patch.Not logged in.
Is it considered bad form to use reserve instruction WDM / Opcode $42?
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Is it considered bad form to use reserve instruction WDM / Opcode $42?
Pages: « 1 »
Before I decide to submit anything that takes advantage of it, I was wonder if it is considered a poor programming practice to use the reserved opcode "WDM". For those who don't know, opcode $42 is technically "reserved", which means it isn't used for anything. Essentially it acts like a NOP instruction with one key difference: WDM accepts a second byte, which it reads, but does nothing with. That means that, if put before a 1 byte instruction, it will "skip" over said instruction.

It could be used in a code like this:
Code
; .. something something
BPL +
    SEC
    WDM
+
CLC

Although I don't know if ASAR accepts WDM properly on its own like that, so I write the notably more ugly code
Code
BPL +
    SEC
    db $42 ; Skip the next instruction
+
CLC


I would understand if the community frowns upon its use -- it is obscure, not often useful and only saves one cycle and one byte over its alternative "BRA $01". I was just wondering because I had not seen it even mentioned before I started closely studying the technical documents on 65c816 ASM.
it'll also confuse debuggers because most of them have the option to break on WDM, which is actually pretty useful for simple breakpoints

also yeah asar automatically adds a 2nd byte to a plain WDM so you need to use db $42 to use that trick
Pages: « 1 »
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Is it considered bad form to use reserve instruction WDM / Opcode $42?

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2019 - SMW Central
Legal Information - Privacy Policy - Link To Us


Total queries: 9

Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • Talkhaus
  • SMBX Community
  • GTx0
  • Super Luigi Bros
  • ROMhacking.net
  • MFGG
  • Gaming Reinvented