Advertisement
jskogsta

C64 FLD Test

Jul 14th, 2019
2,202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* ------------------------------------------------------------------------------------------------
  2. Empty project
  3. ------------------------------------------------------------------------------------------------ */
  4.  
  5. // here you put consts, vars etc.
  6. NumFLDLines:    .byte 0
  7.  
  8.  
  9. BasicUpstart2(start)
  10.  
  11. * = $3400 "Main Code"
  12.  
  13. start:  
  14.  
  15. main:
  16.     sei
  17. loop1:
  18.     bit $d011               // Wait for new frame
  19.     bpl loop1
  20. loop4:
  21.     bit $d011
  22.     bmi loop4
  23.  
  24.     lda #$1b                // Set y-scroll to normal position (because we do FLD later on..)
  25.     sta $d011
  26.  
  27.     jsr CalcNumLines        // Call sinus substitute routine
  28.  
  29.     lda #$40                // Wait for position where we want FLD to start
  30. wait_fld_position:
  31.     cmp $d012
  32.     bne wait_fld_position
  33.  
  34.     ldx NumFLDLines
  35.     beq loop1               // Skip if we want 0 lines FLD
  36. loop2:
  37.     lda $d012               // Wait for beginning of next line
  38. loop3:
  39.     cmp $d012
  40.     beq loop3
  41.  
  42.     clc                     // Do one line of FLD
  43.     lda $d011
  44.     adc #1
  45.     and #7
  46.     ora #$18
  47.     sta $d011
  48.  
  49.     dex                     // Decrease counter
  50.     bne loop2               // Branch if counter not 0
  51.  
  52.     jmp loop1               // Next frame
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60. CalcNumLines:
  61.     lda #0
  62.     bpl *+4
  63.     eor #$ff
  64.     lsr
  65.     lsr
  66.     lsr
  67.     sta NumFLDLines
  68.     inc CalcNumLines+1
  69.     rts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement