Advertisement
majorflare

Multiply Code

Aug 7th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. PLA
  2.        LDA $04              ;\ multiply the cosine...
  3.        STA $4202            ; |
  4.        LDA !1594,x          ; |
  5.        LDY $05              ; |\ if $05 is 1, no need to do the multiplication
  6.        BNE .NoMultCos       ; |/
  7.        STA $4203            ; | ...with radius of circle (!1594,x)
  8.        NOP #4               ;/ waste some cycles while the result is calculated
  9.        ASL $4216            ; Product/Remainder Result (Low Byte)
  10.        LDA $4217            ; Product/Remainder Result (High Byte)
  11.        ADC #$00      
  12. .NoMultCos
  13.        LSR $01              ;\ if the high byte of the angle was set...
  14.        BCC .NotInvertCos    ; |
  15.        EOR #$FF             ; | ...then invert the cosine
  16.        INC                  ;/
  17. .NotInvertCos
  18.        STA $04              
  19.  
  20.        LDA $06              ;\ multiply the sine...
  21.        STA $4202            ; |
  22.        LDA !1594,x          ; |
  23.        LDY $07              ; |\ if $07 is 1, no need to do the multiplication
  24.        BNE .NoMultSin       ; |/
  25.        STA $4203            ; | ...with raidus of circle (!1594,x)
  26.        NOP #4               ;/ waste some cycles while the result is calculated
  27.        ASL $4216            ; Product/Remainder Result (Low Byte)
  28.        LDA $4217            ; Product/Remainder Result (High Byte)
  29.        ADC #$00      
  30. .NoMultSin
  31.        LSR $03              ;\ if the high byte of the angle was set...
  32.        BCC .NotInvertSin    ; |
  33.        EOR #$FF             ; | ...then invert the sine
  34.        INC                  ;/            
  35. .NotInvertSin
  36.        STA $06
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement