screen_routines.s 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. *****************************************************************
  2. * MODULE TITLE :screen_routines *
  3. * *
  4. * DESCRIPTION :memory allocation and deallocation, basic *
  5. * screen handling *
  6. * *
  7. * *
  8. * NAME DATE *
  9. * *
  10. * LIST OF ROUTINES :setup_screen_memory *
  11. * deallocate_screen_memory *
  12. * clear_screen *
  13. * *
  14. * *
  15. *****************************************************************
  16. ***********************SCREEN ROUTINES*********************
  17. ***********************************************
  18. ***** SETUP SCREEN MEMORY *****
  19. ***********************************************
  20. setup_screen_memory
  21. *send MAINSCREEN struct in a0
  22. *allocates memory
  23. move.l a6,-(sp)
  24. move.l EXEC,a6 ; exec
  25. moveq #0,d0
  26. move.w screen_x_size(a0),d0
  27. asr.l #3,d0
  28. mulu screen_y_size(a0),d0
  29. mulu number_of_planes(a0),d0
  30. move.l #MEM_CHIP+MEM_CLEAR,d1 ; chip and clear
  31. move.l a0,-(sp)
  32. jsr -198(a6) ; try
  33. move.l (sp)+,a0
  34. move.l (sp)+,a6
  35. tst.l d0
  36. bne.s grabbed_mem
  37. rts
  38. grabbed_mem
  39. move.l d0,screen_mem(a0)
  40. rts
  41. ***********************************************
  42. ***** DEALLOCATE SCREEN MEMORY *****
  43. ***********************************************
  44. deallocate_screen_memory
  45. *send MAINSCREEN struct in a0
  46. *deallocates memory
  47. move.l a6,-(sp)
  48. move.l EXEC,a6 ; exec
  49. moveq #0,d0
  50. move.w screen_x_size(a0),d0
  51. asr.l #3,d0
  52. mulu screen_y_size(a0),d0
  53. mulu number_of_planes(a0),d0
  54. move.l screen_mem(a0),a1
  55. jsr -210(a6) ; try
  56. move.l (sp)+,a6
  57. rts
  58. ***********************************************
  59. ***** CLEAR SCREEN *****
  60. ***********************************************
  61. clear_screen
  62. ifnd hard_only
  63. bsr own_the_blitter
  64. endc
  65. move.l #main_screen_struct,a0
  66. move.l screen_mem(a0),a1
  67. move.w number_of_planes(a0),d0
  68. subq.w #1,d0
  69. move.w screen_y_size(a0),d1
  70. asl.w #6,d1
  71. move.w screen_x_size(a0),d2
  72. asr.w #3,d2
  73. move.w d2,d3
  74. asr.w #1,d2
  75. add.w d2,d1
  76. mulu screen_y_size(a0),d3
  77. clear_the_screen
  78. btst #14,DMACONR(a6)
  79. bne.s clear_the_screen
  80. move.w #0,bltadat(a6)
  81. move.l a1,bltdpt(a6)
  82. clr.w bltdmod(a6)
  83. move.w #$01f0,bltcon0(a6)
  84. clr.w bltcon1(a6)
  85. move.l #$ffffffff,bltafwm(a6)
  86. move.w d1,bltsize(a6)
  87. add.l d3,a1
  88. dbra d0,clear_the_screen
  89. wait_clear_the_screen
  90. btst #14,DMACONR(a6)
  91. bne.s wait_clear_the_screen
  92. ifnd hard_only
  93. bsr disown_the_blitter
  94. endc
  95. rts
  96. rsreset
  97. screen_x_size rs.w 1
  98. screen_y_size rs.w 1
  99. screen_x_pos rs.w 1 ;for future
  100. screen_y_pos rs.w 1 ;for future
  101. screen_mem rs.l 1
  102. number_of_planes rs.w 1
  103. screen_palette rs.l 1