predefs12.asm 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ; b = new colour for BG colour 0 (usually white) for 4 frames
  2. ChangeBGPalColor0_4Frames:
  3. call GetPredefRegisters
  4. ld a, [rBGP]
  5. or b
  6. ld [rBGP], a
  7. ld c, 4
  8. call DelayFrames
  9. ld a, [rBGP]
  10. and %11111100
  11. ld [rBGP], a
  12. ret
  13. PredefShakeScreenVertically:
  14. ; Moves the window down and then back in a sequence of progressively smaller
  15. ; numbers of pixels, starting at b.
  16. call GetPredefRegisters
  17. ld a, 1
  18. ld [wDisableVBlankWYUpdate], a
  19. xor a
  20. .loop
  21. ld [$ff96], a
  22. call .MutateWY
  23. call .MutateWY
  24. dec b
  25. ld a, b
  26. jr nz, .loop
  27. xor a
  28. ld [wDisableVBlankWYUpdate], a
  29. ret
  30. .MutateWY
  31. ld a, [$ff96]
  32. xor b
  33. ld [$ff96], a
  34. ld [rWY], a
  35. ld c, 3
  36. jp DelayFrames
  37. PredefShakeScreenHorizontally:
  38. ; Moves the window right and then back in a sequence of progressively smaller
  39. ; numbers of pixels, starting at b.
  40. call GetPredefRegisters
  41. xor a
  42. .loop
  43. ld [$ff97], a
  44. call .MutateWX
  45. ld c, 1
  46. call DelayFrames
  47. call .MutateWX
  48. dec b
  49. ld a, b
  50. jr nz, .loop
  51. ; restore normal WX
  52. ld a, 7
  53. ld [rWX], a
  54. ret
  55. .MutateWX
  56. ld a, [$ff97]
  57. xor b
  58. ld [$ff97], a
  59. bit 7, a
  60. jr z, .skipZeroing
  61. xor a ; zero a if it's negative
  62. .skipZeroing
  63. add 7
  64. ld [rWX], a
  65. ld c, 4
  66. jp DelayFrames