Guest User

Untitled

a guest
Nov 16th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. REP #$20 ;\ Set processor 16 bit
  2. LDA #$0F02 ;| $4340 = $210F
  3. STA $4340 ;| $4341 = Mode 02
  4. LDA #$9F00 ;|
  5. STA $4342 ;| Destination: $7F9F00
  6. LDY #$7F ;| (low and high byte)
  7. STY $4344 ;|
  8. SEP #$20 ;/ Set processor 8 bit
  9.  
  10. LDA #$10 ;\ Enable HDMA
  11. TSB $0D9F ;/ on channel 4
  12.  
  13. ; main code
  14.  
  15. LDX #$00 ;\ Init of
  16. LDY #$00 ;/ X and Y
  17.  
  18. SEP #$20 ;\ Set processor 8 bit
  19. LDA $13 ;| Set speed of waves
  20. LSR A ;| Adding more LSR A
  21. LSR A ;| will make it slower
  22. STA $00 ;/ Store in scratch RAM
  23.  
  24. PHB ;\ Push data bank
  25. PHK ;| Push program bank
  26. PLB ;/ Pull data bank
  27.  
  28. Wave_Loop:
  29. LDA #$06 ;\ Set scanline height
  30. STA $7F9F00,x ;| for each wave
  31. TYA ;| Transfer Y to A
  32. ADC $00 ;| Add in scratch RAM
  33. AND #$1F ;| and transfer #$0F bytes
  34. PHY ;| Push Y
  35. TAY ;/ Transfer A to Y
  36.  
  37. LDA.w Wave_Table,y ;\ Load in wave values
  38. LSR A ;| half of waves only
  39. CLC ;| Clear carry flag
  40. ADC $1466 ;| Apply to layer 2
  41. STA $7F9F01,x ;| X position low byte
  42. LDA $1467 ;| And add nothing to
  43. ADC #$00 ;| layer 2 X position
  44. STA $7F9F02,x ;/ high byte
  45.  
  46. PLY ;\ Pull Y
  47. CPY #$25 ;| Compare with #$25 scanlines
  48. BPL End_Wave ;| If bigger, end HDMA
  49. INX ;| Increase X
  50. INX ;| Increase X
  51. INX ;| Increase X
  52. INY ;| Increase Y
  53. BRA Wave_Loop ;/ Do the loop
  54.  
  55. End_Wave:
  56. PLB ;\ Pull data bank
  57. LDA #$00 ;| End HMDA by writing
  58. STA $7F9F03,x ;| #$00 here
  59. RTS ;/ Return
Add Comment
Please, Sign In to add comment