Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ORG 0h
- PUSHA
- MOV BP, SP
- PUSH ES
- PUSH DS
- ;Start pos on VRAM is [MinX + (MinY*320)]
- MOV BX, WORD [BP+4+16] ;Get MinY
- IMUL AX, BX, 320
- ADD AX, WORD [BP+6+16] ;Get MinX
- MOV DI, AX ;Set DI to start position for drawing
- MOV DS, WORD [BP+12+16] ;Bitmap Segment
- MOV SI, WORD [BP+10+16] ;Bitmap Address
- MOV BX, WORD [SI] ;Read width*8
- SHR BX, 3 ;Shift bits right 3 (Same as divide by 8)
- MOV DX, 320
- SUB DX, BX ;BX = 320-width
- MOV BH, BYTE [SI+2] ;Get height
- ADD SI, 4 ;Goto bitmap pixels
- MOV AX, 0A000h ;Set screen Segment
- MOV DS, AX
- mov AX, SS
- mov ES, AX
- cli
- MOV AL, BYTE [BP+8+16] ;Get scale mode
- MOV SS, WORD [BP+12+16] ;Bitmap Segment
- MOV BP, SI
- CMP AL, 2
- JE Zoomx2
- CMP AL, 3
- JE Zoomx3
- CMP AL, 4
- JE Zoomx4
- ;;;;;;;;;;;;;;;;;;;;;;;;
- ; 2x Zoom Draw Routine ;
- ;;;;;;;;;;;;;;;;;;;;;;;;
- Zoomx2:
- ADD DX, Dx ;How many lines to skip
- .NextY:
- MOV CL, BL ;Set counter to X pixel amount
- .NextX:
- MOV AL, [BP] ;Read a pixel
- MOV AH, AL
- MOV [DI], AX ;Draw first row
- MOV [DI+320], AX ;Draw second row
- INC BP
- ADD DI, 2
- DEC CL ;One pixel, still more?
- JNZ .NextX ;Yes? Draw next pixel
- ADD DI, DX ;Adjust target to next line
- DEC BH ;One line done, still more?
- JNZ .NextY ;Yes? Go back until done
- JMP End ;Done
- ;;;;;;;;;;;;;;;;;;;;;;;;
- ; 3x Zoom Draw Routine ;
- ;;;;;;;;;;;;;;;;;;;;;;;;
- Zoomx3:
- IMUL DX, 3 ;How far to move when finished a line
- .NextY:
- MOV CL, BL ;Set counter to x pixel amount
- .NextX:
- MOV AL, [BP] ;Read a pixel
- MOV AH, AL
- MOV [DI], AX ;Draw first row
- MOV [DI+2], AL
- MOV [DI+320], AX ;Draw second row
- MOV [DI+322], AL
- MOv [DI+640], AX ;Draw third row
- MOV [DI+642], AL
- INC BP
- ADD DI, 3 ;Move 3 pixels forward on screen
- DEC CL ;One pixel, still more?
- JNZ .NextX ;Yes? Draw next pixel
- ADD DI, DX ;Adjust target to next line
- DEC BH ;One line done, still more?
- JNZ .NextY ;Yes? Go back until done
- JMP End ;Done
- ;;;;;;;;;;;;;;;;;;;;;;;;
- ; 4x Zoom Draw Routine ;
- ;;;;;;;;;;;;;;;;;;;;;;;;
- Zoomx4:
- SHL DX, 2 ;How far to jump after a line
- .NextY:
- MOV CL, BL ;Set counter to x pixel amount
- .NextX:
- MOV AL, [BP] ;Read a pixel
- MOV AH, AL ;AX full for 2 pixel write
- MOV SI, AX ;Copy AX to BP
- SHL EAX, 16 ;Shift EAX over 2 bytes left
- MOV AX, SI ;Copy BP back to the newly free'd AX
- MOV [DI], EAX ;Draw first row
- MOV [DI+320], EAX ;Draw second row
- MOV [DI+640], EAX ;Draw third row
- MOV [DI+960], EAX ;Draw fith row
- INC BP
- ADD DI, 4 ;Move 4 pixels forward on screen
- DEC CL ;One pixel, still more?
- JNZ .NextX ;Yes? Draw next pixel
- ADD DI, DX ;Adjust target to next line
- DEC BH ;One line, still more?
- JNZ .NextY ;Yes? Repeat until done
- End:
- mov AX, ES
- mov SS, AX
- sti
- POP DS
- POP ES
- POPA
- RETF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement