Advertisement
Guest User

Slowest stabilizer

a guest
Nov 14th, 2014
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Slowest solution ever, yet it works
  2. // ***********************************
  3.  
  4. .pc=$032c
  5. .byte <init,>init
  6.  
  7. .var extcounter =   $20
  8. .var longloop   =   184
  9. .var shrtloop   =   125
  10.  
  11. init:      
  12.         ldy #extcounter     // 2 Y: outer loop, A:inner loop
  13.     frameloop1:            
  14.         sec         // 2 C=1 => Long wait (11061 cycles)
  15.         ldx #longloop       // 2           
  16.     frameloop2:
  17.         bit NOP         // 3 C=0 => Short wait (7511 cycles)
  18.         bit NOP         // 3
  19.         sei         // 2                   
  20.        
  21.     fx:
  22.         stx $0420       // 4
  23.        
  24.         xtloop:
  25.             txs     // 2
  26.             ldx #10     // 2
  27.             !:         
  28.                 dex // 2
  29.                 bne !-  // 2
  30.             tsx     // 2           
  31.             dex     // 2
  32.             bne xtloop  // 3       
  33.        
  34.         bcc frameloop1      // 2/3
  35.         ldx #shrtloop       // 2 Here we're counting frames that's why
  36.         adc #$fe        // 2 we can skip A initialization (ie even/odd don't care)     
  37.         bcs !+          // 3/2
  38.         lda #$d0        // 2
  39.         dey         // 2       
  40.         bne frameloop2+1    // 3
  41.         sta fx+2        // 4 Nice solution Ruk!
  42.         bcc fx          // 3
  43.     !:                     
  44.         clc         // 2
  45.         bcc frameloop2      // 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement