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