How to multiply on snes

Programming the SNES - covers hardware via 6502 emulation mode (65816 coming next year!)
Post Reply
jeffythedragonslayer
Posts: 9
Joined: Sun Aug 29, 2021 11:47 pm

How to multiply on snes

Post by jeffythedragonslayer » Wed May 11, 2022 5:58 pm

Alright so I've been reading this page (https://www.chibiakumas.com/6502/snes.php) and it looks like to do a genuine multiplication (not repeated addition) the multiplicands need to be put in the WRMPYA and WRMPYB ports, then the product read out of MPYL, MPYM, and MPYH. Isn't there an instruction I need to use to do the multiply, or does the result magically appear in those 3 MPY registers?

jeffythedragonslayer
Posts: 9
Joined: Sun Aug 29, 2021 11:47 pm

Re: How to multiply on snes

Post by jeffythedragonslayer » Sat May 21, 2022 8:26 pm

After discussion with Nova, I was able to crack this one:

Code: Select all

; multiply
   lda #$7     ; 1st multiplicand
   sta WRMPYA
   lda #$5     ; 2nd multiplicand
   sta WRMPYB 
   nop         ; wait 8 cycles
   nop
   nop
   nop
   lda $RDMPYL ; low byte of product
   lda $RDMPYH ; high byte of product

Post Reply

Return to “Super Nintendo Assembly Programming”