Advertisement
Runer112

RectWindow

Oct 14th, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. RectWindow:
  2. ;bc=height, de=x, hl=y, (sp)=ret, (sp+2)=width
  3. ex (sp),hl
  4. pop af
  5. ex (sp),hl
  6. push bc
  7. ld bc,320
  8. push af
  9. ld a,$21*2
  10. call RectWindow_1
  11. pop de
  12. ex (sp),hl
  13. push bc
  14. ld bc,240
  15. ld a,$20*2
  16. call RectWindow_1
  17. ld a,h
  18. or l
  19. ld a,c
  20. Abort_2:
  21. pop bc
  22. pop de
  23. ret
  24. ;a=clipped height, bc=clipped width, de=x feedback, hl=y feedback
  25.  
  26.  
  27. RectWindow_1:
  28. ;a=aport*2, bc=sdim, de=p1, hl=rdim
  29. dec hl
  30. add hl,de
  31. rra
  32. ex de,hl
  33. push hl
  34. sbc hl,bc
  35. or a
  36. add hl,bc
  37. jr c,RectWindow_1_P1Ok
  38. ld l,a
  39. and h
  40. jp p,Abort_4
  41. ld a,l
  42. sbc hl,hl
  43. RectWindow_1_P1Ok:
  44. and $7F
  45. call LCD_Out_A_HL
  46. add a,8
  47. add a,a
  48. call LCD_Out_A_HL
  49. ex de,hl
  50. dec c
  51. sbc hl,bc
  52. jr c,RectWindow_1_P2Ok
  53. sbc hl,hl
  54. RectWindow_1_P2Ok:
  55. add hl,bc
  56. add a,1
  57. call LCD_Out_A_HL
  58. inc hl
  59. sbc hl,de
  60. ld b,h
  61. ld c,l
  62. pop hl
  63. sbc hl,de
  64. ret
  65. ;a=weport, bc=clipped rdim, de=clipped p1, hl=p1 feedback
  66.  
  67.  
  68. Abort_4:
  69. scf
  70. pop bc
  71. Abort_3:
  72. pop bc
  73. jr Abort_2
  74.  
  75.  
  76. LCD_Out_A_HL:
  77. push af
  78. out ($10),a
  79. out ($10),a
  80. ld a,h
  81. out ($11),a
  82. ld a,l
  83. out ($11),a
  84. pop af
  85. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement