13,7 → 13,8 |
|
$Revision$ |
|
|
;------------------------------------------------------------------------------ |
align 4 |
paletteVGA: |
|
;16 colour palette |
24,9 → 25,9 |
mov ecx, 16 |
mov dx, 0x3c9 |
xor eax, eax |
|
;-------------------------------------- |
align 4 |
palvganew: |
|
mov al, 0 |
test ah, 4 |
jz palvgalbl1 |
34,6 → 35,8 |
test ah, 8 |
jz palvgalbl1 |
add al, 32 |
;-------------------------------------- |
align 4 |
palvgalbl1: |
out dx, al; red 0,31 or 63 |
mov al, 0 |
43,6 → 46,8 |
test ah, 8 |
jz palvgalbl2 |
add al, 32 |
;-------------------------------------- |
align 4 |
palvgalbl2: |
out dx, al; blue 0,31 or 63 |
mov al, 0 |
52,6 → 57,8 |
test ah, 8 |
jz palvgalbl3 |
add al, 32 |
;-------------------------------------- |
align 4 |
palvgalbl3: |
out dx, al; green 0,31 or 63 |
add ah, 1 |
60,9 → 67,9 |
; mov ax, 0005h |
; out dx, ax |
ret |
|
;------------------------------------------------------------------------------ |
align 4 |
palette320x200: |
|
mov edx, 0x3c8 |
xor eax, eax |
out dx, al |
69,16 → 76,21 |
mov ecx, 256 |
mov edx, 0x3c9 |
xor eax, eax |
|
;-------------------------------------- |
align 4 |
palnew: |
mov al, 0 |
test ah, 64 |
jz pallbl1 |
add al, 21 |
;-------------------------------------- |
align 4 |
pallbl1: |
test ah, 128 |
jz pallbl2 |
add al, 42 |
;-------------------------------------- |
align 4 |
pallbl2: |
out dx, al |
mov al, 0 |
85,14 → 97,20 |
test ah, 8 |
jz pallbl3 |
add al, 8 |
;-------------------------------------- |
align 4 |
pallbl3: |
test ah, 16 |
jz pallbl4 |
add al, 15 |
;-------------------------------------- |
align 4 |
pallbl4: |
test ah, 32 |
jz pallbl5 |
add al, 40 |
;-------------------------------------- |
align 4 |
pallbl5: |
out dx, al |
mov al, 0 |
99,20 → 117,26 |
test ah, 1 |
jz pallbl6 |
add al, 8 |
;-------------------------------------- |
align 4 |
pallbl6: |
test ah, 2 |
jz pallbl7 |
add al, 15 |
;-------------------------------------- |
align 4 |
pallbl7: |
test ah, 4 |
jz pallbl8 |
add al, 40 |
;-------------------------------------- |
align 4 |
pallbl8: |
out dx, al |
add ah, 1 |
loop palnew |
|
ret |
;------------------------------------------------------------------------------ |
align 4 |
uglobal |
novesachecksum dd 0x0 |
123,13 → 147,12 |
temp: |
.cx dd 0 |
endg |
;------------------------------------------------------------------------------ |
align 4 |
checkVga_N13: |
|
cmp [SCR_MODE], dword 0x13 |
jne @f |
|
; cnvl: |
pushad |
cmp [EGA_counter], 1 |
je novesal |
137,9 → 160,12 |
cmp ecx, [novesachecksum] |
jne novesal |
popad |
;-------------------------------------- |
align 4 |
@@: |
ret |
|
;-------------------------------------- |
align 4 |
novesal: |
mov [novesachecksum], ecx |
mov ecx, 0 |
147,10 → 173,14 |
cmp eax, 100 |
jge m13l3 |
mov eax, 100 |
;-------------------------------------- |
align 4 |
m13l3: |
cmp eax, 480-100 |
jbe m13l4 |
mov eax, 480-100 |
;-------------------------------------- |
align 4 |
m13l4: |
sub eax, 100 |
imul eax, 640*4 |
159,10 → 189,14 |
cmp eax, 160 |
jge m13l1 |
mov eax, 160 |
;-------------------------------------- |
align 4 |
m13l1: |
cmp eax, 640-160 |
jbe m13l2 |
mov eax, 640-160 |
;-------------------------------------- |
align 4 |
m13l2: |
sub eax, 160 |
shl eax, 2 |
173,6 → 207,8 |
mov edx, 200 |
mov ecx, 320 |
cld |
;-------------------------------------- |
align 4 |
m13pix: |
lodsd |
test eax, eax |
188,6 → 224,8 |
and ebx, (128+64)*256*256; red |
shr ebx, 8+8 |
add eax, ebx |
;-------------------------------------- |
align 4 |
.save_pixel: |
stosb |
loop m13pix |
198,16 → 236,17 |
mov [EGA_counter], 0 |
popad |
ret |
|
;------------------------------------------------------------------------------ |
align 4 |
VGA_drawbackground: |
; draw all |
cmp [SCR_MODE], dword 0x12 |
jne .end |
pushad |
mov esi, [LFBAddress] |
mov edi, VGABasePtr |
mov ebx, 640/32; 640*480/(8*4) |
mov edx, 480 |
;-------------------------------------- |
align 4 |
@@: |
push ebx edx esi edi |
shl edx, 9 |
221,9 → 260,9 |
jnz @r |
call VGA_draw_long_line_1 |
popad |
.end: |
ret |
|
;------------------------------------------------------------------------------ |
align 4 |
VGA_draw_long_line: |
mov dx, 3ceh |
mov ax, 0ff08h |
231,6 → 270,8 |
out dx, ax |
mov ax, 0005h |
out dx, ax |
;-------------------------------------- |
align 4 |
m12pix: |
call VGA_draw_32_pixels |
dec ebx |
246,7 → 287,8 |
out dx, al |
sti |
ret |
|
;------------------------------------------------------------------------------ |
align 4 |
VGA_draw_32_pixels: |
xor eax, eax |
mov ebp, VGA_8_pixels |
255,8 → 297,12 |
mov [ebp+8], eax |
mov [ebp+12], eax |
mov ch, 4 |
;-------------------------------------- |
align 4 |
.main_loop: |
mov cl, 8 |
;-------------------------------------- |
align 4 |
.convert_pixels_to_VGA: |
lodsd ; eax = 24bit colour |
test eax, eax |
273,6 → 319,8 |
cmp al, 170 |
jbe .p13green |
or [ebp+12], ch |
;-------------------------------------- |
align 4 |
.p13green: |
cmp ah, 85 |
jbe .p13red |
280,6 → 328,8 |
cmp ah, 170 |
jbe .p13red |
or [ebp+12], ch |
;-------------------------------------- |
align 4 |
.p13red: |
shr eax, 8 |
cmp ah, 85 |
288,10 → 338,14 |
cmp ah, 170 |
jbe .p13cont |
or [ebp+12], ch |
;-------------------------------------- |
align 4 |
.p13cont: |
ror eax, 8 |
mov ch, ah |
inc cl |
;-------------------------------------- |
align 4 |
.end: |
dec cl |
jnz .convert_pixels_to_VGA |
303,6 → 357,8 |
mov esi, ebp |
mov dx, 3c4h |
mov ah, 1h |
;-------------------------------------- |
align 4 |
@@: |
mov al, 02h |
out dx, ax |
316,12 → 372,25 |
add edi, 4 |
pop esi |
ret |
|
;------------------------------------------------------------------------------ |
align 4 |
VGA_putpixel: |
; eax = x |
; ebx = y |
mov ecx, eax |
mov eax, [esp+32-8+4] ; color |
;-------------------------------------- |
push ecx |
shl ecx, 16 |
mov cx, bx |
; check mouse area for putpixel |
test eax, 0x04000000 |
jnz @f |
call [_display.check_mouse] |
;-------------------------------------- |
align 4 |
@@: |
pop ecx |
shl ebx, 9 |
lea ebx, [ebx+ebx*4] ; óìíîæåíèå íà 5 |
lea edx, [ebx+ecx*4] ; + x*BytesPerPixel (Vesa2.0 32) |
343,6 → 412,8 |
cmp al, 170 |
jbe .p13green |
or dl, 0x08 |
;-------------------------------------- |
align 4 |
.p13green: |
cmp ah, 85 |
jbe .p13red |
350,6 → 421,8 |
cmp ah, 170 |
jbe .p13red |
or dl, 0x08 |
;-------------------------------------- |
align 4 |
.p13red: |
shr eax, 8 |
cmp ah, 85 |
358,6 → 431,8 |
cmp ah, 170 |
jbe .p13cont |
or dl, 0x08 |
;-------------------------------------- |
align 4 |
.p13cont: |
ror edx, 8 |
inc cl |
371,14 → 446,12 |
rol edx, 8 |
mov [edi], dl |
popfd |
;.end: |
ret |
|
;------------------------------------------------------------------------------ |
align 4 |
VGA__putimage: |
; ecx = size [x|y] |
; edx = coordinates [x|y] |
cmp [SCR_MODE], dword 0x12 |
jne @f |
pushad |
rol edx, 16 |
movzx eax, dx |
389,16 → 462,14 |
movzx ecx, cx |
call VGA_draw_bar_1 |
popad |
@@: |
ret |
|
;------------------------------------------------------------------------------ |
align 4 |
VGA_draw_bar: |
; eax cx |
; ebx cy |
; ecx xe |
; edx ye |
cmp [SCR_MODE], dword 0x12 |
jne @f |
pushad |
sub ecx, eax |
sub edx, ebx |
408,9 → 479,9 |
and edx, 0xffff |
call VGA_draw_bar_1 |
popad |
@@: |
ret |
|
;------------------------------------------------------------------------------ |
align 4 |
VGA_draw_bar_1: |
mov [temp.cx], eax |
mov eax, [TASK_BASE] |
429,6 → 500,8 |
mov ebx, ecx |
shr ebx, 5 |
inc ebx |
;-------------------------------------- |
align 4 |
.main_loop: |
call VGA_draw_long_line_1 |
dec edx |
435,7 → 508,8 |
jnz .main_loop |
call VGA_draw_long_line_1 |
ret |
|
;------------------------------------------------------------------------------ |
align 4 |
VGA_draw_long_line_1: |
push ebx edx esi edi |
shl edx, 9 |
446,5 → 520,4 |
call VGA_draw_long_line |
pop edi esi edx ebx |
ret |
|
|
;------------------------------------------------------------------------------ |