odd dirt effect

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
User avatar
jeffythedragonslayer
Posts: 344
Joined: Thu Dec 09, 2021 12:29 pm

odd dirt effect

Post by jeffythedragonslayer »

What is the odd dirt effect in https://problemkaputt.de/fullsnes.htm#s ... ablethings ?
fullsnes wrote:SPC700 Division Overflow/Result (DIV YA,X opcode)
The overall division mechanism (with and without overflows) is:

Code: Select all

  H = (X AND 0Fh)<=(Y AND 0Fh)   ;half carry flag (odd dirt effect)
  Temp = YA
  FOR i=1 TO 9
    Temp=Temp*2                                     ;\rotate within 17bits
    IF Temp AND 20000h THEN Temp=(Temp XOR 20001h)  ;/
    IF Temp>=(X*200h)  THEN Temp=(Temp XOR 1)
    IF Temp AND 1      THEN Temp=(Temp-(X*200h)) AND 1FFFFh
  NEXT i
  A = (Temp AND FFh) ;result.bit7-0
  V = (Temp.Bit8=1)  ;result.bit8
  Y = (Temp/200h)    ;remainder (aka temp.bit9-16)
  N = (A.Bit7=1)     ;sign-flag (on result.bit7) (though division is unsigned)
  Z = (A=00h)        ;zero-flag (on result.bit7-0)
This section of fullsnes seems to be about garbage values. Does it have something to do with garbage audio?
Joe
Posts: 650
Joined: Mon Apr 01, 2013 11:17 pm

Re: odd dirt effect

Post by Joe »

It means the half-carry flag contains a useless (garbage) value after performing division.
User avatar
jeffythedragonslayer
Posts: 344
Joined: Thu Dec 09, 2021 12:29 pm

Re: odd dirt effect

Post by jeffythedragonslayer »

Oh ok, it sounds like the half carry flag is for binary coded decimal, since it is in the same spot as the d flag on the Ricoh 5A22, and the DAA and DAS instructions add and subtract 6 depending on the state of this flag.
Post Reply