Advertisement
Mysoft

Untitled

Jan 14th, 2016
842
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ORG 0h
  2.  
  3. PUSHA
  4. MOV BP, SP
  5. PUSH ES
  6. PUSH DS
  7.  
  8.             ;Start pos on VRAM is [MinX + (MinY*320)]
  9. MOV BX, WORD [BP+4+16]  ;Get MinY
  10. IMUL AX, BX, 320
  11. ADD AX, WORD [BP+6+16]  ;Get MinX
  12. MOV DI, AX      ;Set DI to start position for drawing
  13.  
  14.  
  15. MOV DS, WORD [BP+12+16]    ;Bitmap Segment
  16. MOV SI, WORD [BP+10+16]    ;Bitmap Address
  17.  
  18. MOV BX, WORD [SI]   ;Read width*8
  19. SHR BX, 3       ;Shift bits right 3 (Same as divide by 8)
  20. MOV DX, 320
  21. SUB DX, BX      ;BX = 320-width
  22. MOV BH, BYTE [SI+2] ;Get height
  23.  
  24. ADD SI, 4       ;Goto bitmap pixels
  25.  
  26.  
  27. MOV AX, 0A000h      ;Set screen Segment
  28. MOV DS, AX
  29. mov AX, SS
  30. mov ES, AX
  31.  
  32. cli
  33. MOV AL, BYTE [BP+8+16]  ;Get scale mode
  34. MOV SS, WORD [BP+12+16]    ;Bitmap Segment
  35. MOV BP, SI
  36.  
  37. CMP AL, 2
  38. JE Zoomx2
  39. CMP AL, 3
  40. JE Zoomx3
  41. CMP AL, 4
  42. JE Zoomx4
  43.  
  44. ;;;;;;;;;;;;;;;;;;;;;;;;
  45. ; 2x Zoom Draw Routine ;
  46. ;;;;;;;;;;;;;;;;;;;;;;;;
  47. Zoomx2:
  48. ADD DX, Dx      ;How many lines to skip
  49.  
  50. .NextY:
  51. MOV CL, BL      ;Set counter to X pixel amount
  52.  
  53. .NextX:
  54. MOV AL, [BP]        ;Read a pixel
  55. MOV AH, AL
  56. MOV [DI], AX        ;Draw first row
  57. MOV [DI+320], AX    ;Draw second row
  58. INC BP
  59. ADD DI, 2
  60.  
  61. DEC CL          ;One pixel, still more?
  62. JNZ .NextX      ;Yes? Draw next pixel
  63. ADD DI, DX      ;Adjust target to next line
  64. DEC BH          ;One line done, still more?
  65. JNZ .NextY      ;Yes? Go back until done
  66. JMP End         ;Done
  67.  
  68. ;;;;;;;;;;;;;;;;;;;;;;;;
  69. ; 3x Zoom Draw Routine ;
  70. ;;;;;;;;;;;;;;;;;;;;;;;;
  71. Zoomx3:
  72. IMUL DX, 3      ;How far to move when finished a line
  73.  
  74. .NextY:
  75. MOV CL, BL      ;Set counter to x pixel amount
  76.  
  77. .NextX:
  78. MOV AL, [BP]        ;Read a pixel
  79. MOV AH, AL
  80. MOV [DI], AX        ;Draw first row
  81. MOV [DI+2], AL
  82. MOV [DI+320], AX    ;Draw second row
  83. MOV [DI+322], AL
  84. MOv [DI+640], AX    ;Draw third row
  85. MOV [DI+642], AL
  86. INC BP
  87. ADD DI, 3       ;Move 3 pixels forward on screen
  88.  
  89. DEC CL          ;One pixel, still more?
  90. JNZ .NextX      ;Yes? Draw next pixel
  91. ADD DI, DX      ;Adjust target to next line
  92. DEC BH          ;One line done, still more?
  93. JNZ .NextY      ;Yes? Go back until done
  94. JMP End         ;Done
  95.  
  96.  
  97. ;;;;;;;;;;;;;;;;;;;;;;;;
  98. ; 4x Zoom Draw Routine ;
  99. ;;;;;;;;;;;;;;;;;;;;;;;;
  100. Zoomx4:
  101. SHL DX, 2       ;How far to jump after a line
  102.  
  103. .NextY:
  104. MOV CL, BL      ;Set counter to x pixel amount
  105.  
  106. .NextX:
  107. MOV AL, [BP]        ;Read a pixel
  108. MOV AH, AL      ;AX full for 2 pixel write
  109. MOV SI, AX      ;Copy AX to BP
  110. SHL EAX, 16     ;Shift EAX over 2 bytes left
  111. MOV AX, SI      ;Copy BP back to the newly free'd AX
  112. MOV [DI], EAX       ;Draw first row
  113. MOV [DI+320], EAX   ;Draw second row
  114. MOV [DI+640], EAX   ;Draw third row
  115. MOV [DI+960], EAX   ;Draw fith row
  116. INC BP
  117. ADD DI, 4       ;Move 4 pixels forward on screen
  118.  
  119. DEC CL          ;One pixel, still more?
  120. JNZ .NextX      ;Yes? Draw next pixel
  121. ADD DI, DX      ;Adjust target to next line
  122. DEC BH          ;One line, still more?
  123. JNZ .NextY      ;Yes? Repeat until done
  124.  
  125. End:
  126. mov AX, ES
  127. mov SS, AX
  128. sti
  129. POP DS
  130. POP ES
  131. POPA
  132. RETF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement