/kernel/branches/gfx_kernel/vmode/clipping.asm |
---|
0,0 → 1,501 |
;----------------------------------------------------------------------------- |
;///// PART OF ATi RADEON 9000 DRIVER //////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; Copyright (c) 2004, mike.dld |
; Using BeOS driver - Copyright (c) 2002, Thomas Kurschel |
;----------------------------------------------------------------------------- |
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
; DEALINGS IN THE SOFTWARE. |
;----------------------------------------------------------------------------- |
include 'clipping.inc' |
struct RECT |
left dd ? |
top dd ? |
right dd ? |
bottom dd ? |
ends |
virtual at ebp |
r RECT |
end virtual |
virtual at edi |
r2 RECT |
end virtual |
SR = sizeof.RECT |
macro movl val,reg { |
mov reg,val |
} |
EQUAL_LEFT = 00000001b |
EQUAL_BOTTOM = 00000010b |
EQUAL_RIGHT = 00000100b |
EQUAL_TOP = 00001000b |
func calc_clipping_rects |
begin |
mov [cnt],0 |
movzx ebp,word[0x3000] |
shl ebp,5 |
cmp ebp,0x20 |
jne @f |
mov esi,viewport |
mov edi,rct |
mov ecx,sizeof.RECT/4 |
cld |
rep movsd |
jmp .lp1 |
@@: |
movsx eax,word[ebp+0x00] |
mov [rct.left],eax |
mov [rct.right],eax |
movsx eax,word[ebp+0x04] |
mov [rct.top],eax |
mov [rct.bottom],eax |
movzx eax,word[ebp+0x08] |
inc eax |
add [rct.right],eax |
movzx eax,word[ebp+0x0C] |
inc eax |
add [rct.bottom],eax |
.lp1: |
mov esi,viewport |
mov edi,tr |
mov ecx,sizeof.RECT/4 |
cld |
rep movsd |
mov ebp,rct |
call intersect_rect ; (ebp,tr)->(x1:edx,y1:eax,x2:ebx,y2:ecx)+CF |
jc .exit |
mov [rct.left],edx |
mov [rct.top],eax |
mov [rct.right],ebx |
mov [rct.bottom],ecx |
inc [cnt] |
comment ^ |
movsx eax,word[ebp+0x00] |
mov [rct.left],eax |
mov [rct.right],eax |
movsx eax,word[ebp+0x04] |
mov [rct.top],eax |
mov [rct.bottom],eax |
movsx eax,word[ebp+0x08] |
inc eax |
add [rct.right],eax |
movsx eax,word[ebp+0x0C] |
inc eax |
add [rct.bottom],eax |
^ |
movzx ecx,word[0x00003004] ; number of processes |
jif ecx,be,1,.exit |
; calculate clipping rectangles |
mov esi,1 |
; go forward through all windows |
.next_window: |
movzx edi,word[0x00003000] ; calling process number |
mov ax,[0x0000C000+esi*2] |
jif ax,be,[0x0000C000+edi*2],.end_window.2 |
mov ebp,[cnt] |
shl ebp,4 ; ebp *= SR |
jz .exit |
lea ebp,[rct+ebp-SR] |
push esi ;ecx esi |
shl esi,5 |
lodsd |
mov [tr.left],eax |
mov [tr.right],eax |
lodsd |
mov [tr.top],eax |
mov [tr.bottom],eax |
lodsd |
jif eax,z,eax,.end_window,test |
inc eax |
add [tr.right],eax |
lodsd |
jif eax,z,eax,.end_window,test |
inc eax |
add [tr.bottom],eax |
; go backward through all rectangles |
.next_rect: |
rc_top equ eax |
rc_right equ ebx |
rc_bottom equ ecx |
rc_left equ edx |
call intersect_rect ; (ebp,tr)->(x1:edx,y1:eax,x2:ebx,y2:ecx)+CF |
jc .is_finish |
xor edi,edi |
jif rc_top,ne,[r.top],@f |
or edi,EQUAL_TOP |
@@: jif rc_right,ne,[r.right],@f |
or edi,EQUAL_RIGHT |
@@: jif rc_bottom,ne,[r.bottom],@f |
or edi,EQUAL_BOTTOM |
@@: jif rc_left,ne,[r.left],@f |
or edi,EQUAL_LEFT |
@@: jmp [jtable_intersect+edi*4] |
.is_0000: |
call copy_current |
mov [r.left ],rc_right |
mov [r2.right -SR],rc_left |
mov [r2.left ],rc_left |
mov [r2.right ],rc_right |
mov [r2.bottom ],rc_top |
mov [r2.left +SR],rc_left |
mov [r2.right +SR],rc_right |
mov [r2.top +SR],rc_bottom |
movl [r.top ],esi |
mov [r2.top ],esi |
movl [r.bottom ],esi |
mov [r2.bottom+SR],esi |
add [cnt],2 |
jmp .is_finish |
.is_0001: |
call copy_current |
mov [r.top ],rc_bottom |
mov [r2.bottom-SR],rc_top |
mov [r2.left ],rc_right |
mov [r2.top ],rc_top |
mov [r2.bottom ],rc_bottom |
movl [r.right ],esi |
mov [r2.right ],esi |
inc [cnt] |
jmp .is_finish |
.is_0010: |
call copy_current |
mov [r.left ],rc_right |
mov [r2.right -SR],rc_left |
mov [r2.left ],rc_left |
mov [r2.right ],rc_right |
mov [r2.bottom ],rc_top |
movl [r.top ],esi |
mov [r2.top ],esi |
inc [cnt] |
jmp .is_finish |
.is_0011: |
call copy_current |
mov [r.bottom ],rc_top |
mov [r2.left -SR],rc_right |
mov [r2.top -SR],rc_top |
jmp .is_finish |
.is_0100: |
call copy_current |
mov [r.top ],rc_bottom |
mov [r2.bottom-SR],rc_top |
mov [r2.right ],rc_left |
mov [r2.top ],rc_top |
mov [r2.bottom ],rc_bottom |
movl [r.left ],esi |
mov [r2.left ],esi |
inc [cnt] |
jmp .is_finish |
.is_0101: |
call copy_current |
mov [r.top ],rc_bottom |
mov [r2.bottom-SR],rc_top |
jmp .is_finish |
.is_0110: |
call copy_current |
mov [r.bottom ],rc_top |
mov [r2.right -SR],rc_left |
mov [r2.top -SR],rc_top |
jmp .is_finish |
.is_0111: |
mov [r.bottom ],rc_top |
jmp .is_finish |
.is_1000: |
call copy_current |
mov [r.left ],rc_right |
mov [r2.right -SR],rc_left |
mov [r2.left ],rc_left |
mov [r2.right ],rc_right |
mov [r2.top ],rc_bottom |
movl [r.bottom ],esi |
mov [r2.bottom ],esi |
inc [cnt] |
jmp .is_finish |
.is_1001: |
call copy_current |
mov [r.top ],rc_bottom |
mov [r2.left -SR],rc_right |
mov [r2.bottom-SR],rc_bottom |
jmp .is_finish |
.is_1010: |
call copy_current |
mov [r.left ],rc_right |
mov [r2.right -SR],rc_left |
jmp .is_finish |
.is_1011: |
mov [r.left ],rc_right |
jmp .is_finish |
.is_1100: |
call copy_current |
mov [r.top ],rc_bottom |
mov [r2.right -SR],rc_left |
mov [r2.bottom-SR],rc_bottom |
jmp .is_finish |
.is_1101: |
mov [r.top ],rc_bottom |
jmp .is_finish |
.is_1110: |
mov [r.right ],rc_left |
jmp .is_finish |
.is_1111: |
call delete_current |
.is_finish: |
sub ebp,SR |
jif ebp,ae,rct,.next_rect |
.end_window: |
pop esi; ecx |
.end_window.2: |
inc esi |
jif esi,be,[0x00003004],.next_window |
; dec ecx |
; jnz .next_window |
; combine some rectangles if possible |
; with Result do begin |
; for i := cnt-1 downto 0 do if rct[i].Left >= 0 then |
; for j := cnt-1 downto 0 do if (j <> i) and (rct[j].Left >= 0) then |
; if (rct[i].Left = rct[j].Left) and (rct[i].Right = rct[j].Right) then begin |
; end else if (rct[i].Top = rct[j].Top) and (rct[i].Bottom = rct[j].Bottom) then begin |
; if (rct[i].Left = rct[j].Right) then begin |
; rct[i].Left := rct[j].Left; |
; rct[j].Left := -1; |
; end else if (rct[i].Right = rct[j].Left) then begin |
; rct[i].Right := rct[j].Right; |
; rct[j].Left := -1; |
; end; |
; end; |
; for i := cnt-1 downto 0 do if rct[i].Left < 0 then begin |
; for j := i to cnt-2 do |
; rct[j] := rct[j+1]; |
; dec(cnt); |
; end; |
; end; |
.combine_rects: |
mov esi,[cnt] |
shl esi,4 |
add esi,rct |
lea ebp,[esi-SR] |
push ebp |
.next_rect1: |
sub esi,SR |
jif esi,b,rct,.exit.combine |
jif [esi+RECT.left],e,-1,.next_rect1 |
push ebp |
.next_rect2: |
jif ebp,e,esi,.next_rect2.ok |
jif [ebp+RECT.left],e,-1,.next_rect2.ok |
mov eax,[ebp+RECT.left] |
mov ebx,[ebp+RECT.right] |
mov ecx,[ebp+RECT.top] |
mov edx,[ebp+RECT.bottom] |
jif eax,ne,[esi+RECT.left],.not_left_right |
jif ebx,ne,[esi+RECT.right],.not_left_right |
jif edx,ne,[esi+RECT.top],@f |
mov [esi+RECT.top],ecx |
jmp .next_rect2.mark |
@@: jif ecx,ne,[esi+RECT.bottom],.next_rect2.ok |
mov [esi+RECT.bottom],edx |
jmp .next_rect2.mark |
.not_left_right: |
jif ecx,ne,[esi+RECT.top],.next_rect2.ok |
jif edx,ne,[esi+RECT.bottom],.next_rect2.ok |
jif ebx,ne,[esi+RECT.left],@f |
mov [esi+RECT.left],eax |
jmp .next_rect2.mark |
@@: jif eax,ne,[esi+RECT.right],.next_rect2.ok |
mov [esi+RECT.right],ebx |
.next_rect2.mark: |
or [ebp+RECT.left],-1 |
.next_rect2.ok: |
sub ebp,SR |
jif ebp,ae,rct,.next_rect2 |
pop ebp |
jmp .next_rect1 |
.exit.combine: |
pop ebp |
.next_rect3: |
jif [ebp+RECT.left],ne,-1,@f |
call delete_current |
@@: sub ebp,SR |
jif ebp,ae,rct,.next_rect3 |
; remove unnecessary rectangles |
; for i := Result.cnt-1 downto 0 do with Result do |
; if not IntersectRect(rc,rct[i],r2) then begin |
; for j := i to cnt-2 do |
; rct[j] := rct[j+1]; |
; dec(cnt); |
; end; |
.exit: |
mov esi,rct |
mov ecx,[cnt] |
ret |
delete_current: |
push ecx |
lea esi,[ebp+SR] ; esi = ebp+SR |
mov edi,ebp ; edi = ebp |
mov ecx,[cnt] ; ecx = cnt |
shl ecx,4 ; ecx *= SR |
add ecx,rct-SR ; ecx += rct-SR |
sub ecx,ebp ; ecx -= ebp |
cld |
rep movsb |
dec [cnt] |
pop ecx |
ret |
copy_current: |
push ecx |
mov edi,[cnt] |
shl edi,4 |
lea edi,[rct+edi] |
mov esi,ebp |
mov ecx,4 |
cld |
rep movsd |
pop ecx |
inc [cnt] |
ret |
intersect_rect: ; ebp,tr |
mov rc_top,[tr.top] |
jif rc_top,ge,[r.bottom],.exit |
mov rc_right,[tr.right] |
jif rc_right,le,[r.left],.exit |
mov rc_bottom,[tr.bottom] |
jif rc_bottom,le,[r.top],.exit |
mov rc_left,[tr.left] |
jif rc_left,ge,[r.right],.exit |
jif rc_top,ge,[r.top],@f |
mov rc_top,[r.top] |
@@: jif rc_right,le,[r.right],@f |
mov rc_right,[r.right] |
@@: jif rc_bottom,le,[r.bottom],@f |
mov rc_bottom,[r.bottom] |
@@: jif rc_left,ge,[r.left],@f |
mov rc_left,[r.left] |
@@: clc |
ret |
.exit: |
stc |
ret |
endf |
func FC |
begin |
.x00: |
.x01: |
.x02: |
.x04: |
.x05: |
.x06: |
.x08: |
.x09: |
.x0A: |
.x10: |
.x11: |
.x12: |
.x14: |
.x15: |
.x16: |
.x18: |
.x19: |
.x1A: |
.x20: |
.x21: |
.x22: |
.x24: |
.x25: |
.x26: |
.x28: |
.x29: |
.x2A: |
.x40: |
.x41: |
.x42: |
.x44: |
.x45: |
.x46: |
.x48: |
.x49: |
.x4A: |
.x50: |
.x51: |
.x52: |
.x54: |
.x55: |
.x56: |
.x58: |
.x59: |
.x5A: |
.x60: |
.x61: |
.x62: |
.x64: |
.x65: |
.x66: |
.x68: |
.x69: |
.x6A: |
.x80: |
.x81: |
.x82: |
.x84: |
.x85: |
.x86: |
.x88: |
.x89: |
.x8A: |
.x90: |
.x91: |
.x92: |
.x94: |
.x95: |
.x96: |
.x98: |
.x99: |
.x9A: |
.xA0: |
.xA1: |
.xA2: |
.xA4: |
.xA5: |
.xA6: |
.xA8: |
.xA9: |
.xAA: |
ret |
.xXX: |
ret |
endf |
;----------------------------------------------------------------------------- |
;///// END /////////////////////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/kernel/branches/gfx_kernel/vmode/clipping.inc |
---|
0,0 → 1,25 |
align 4 |
jtable_intersect dd \ |
calc_clipping_rects.is_0000,calc_clipping_rects.is_0001,calc_clipping_rects.is_0010,calc_clipping_rects.is_0011,\ |
calc_clipping_rects.is_0100,calc_clipping_rects.is_0101,calc_clipping_rects.is_0110,calc_clipping_rects.is_0111,\ |
calc_clipping_rects.is_1000,calc_clipping_rects.is_1001,calc_clipping_rects.is_1010,calc_clipping_rects.is_1011,\ |
calc_clipping_rects.is_1100,calc_clipping_rects.is_1101,calc_clipping_rects.is_1110,calc_clipping_rects.is_1111 |
;jtable_fastclip dd \ |
; FC.x00,FC.x01,FC.x02,FC.xXX,FC.x04,FC.x05,FC.x06,FC.xXX,FC.x08,FC.x09,FC.x0A,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,\ |
; FC.x10,FC.x11,FC.x12,FC.xXX,FC.x14,FC.x15,FC.x16,FC.xXX,FC.x18,FC.x19,FC.x1A,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,\ |
; FC.x20,FC.x21,FC.x22,FC.xXX,FC.x24,FC.x25,FC.x26,FC.xXX,FC.x28,FC.x29,FC.x2A,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,\ |
; FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,\ |
; FC.x40,FC.x41,FC.x42,FC.xXX,FC.x44,FC.x45,FC.x46,FC.xXX,FC.x48,FC.x49,FC.x4A,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,\ |
; FC.x50,FC.x51,FC.x52,FC.xXX,FC.x54,FC.x55,FC.x56,FC.xXX,FC.x58,FC.x59,FC.x5A,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,\ |
; FC.x60,FC.x61,FC.x62,FC.xXX,FC.x64,FC.x65,FC.x66,FC.xXX,FC.x68,FC.x69,FC.x6A,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,\ |
; FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,\ |
; FC.x80,FC.x81,FC.x82,FC.xXX,FC.x84,FC.x85,FC.x86,FC.xXX,FC.x88,FC.x89,FC.x8A,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,\ |
; FC.x90,FC.x91,FC.x92,FC.xXX,FC.x94,FC.x95,FC.x96,FC.xXX,FC.x98,FC.x99,FC.x9A,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX,\ |
; FC.xA0,FC.xA1,FC.xA2,FC.xXX,FC.xA4,FC.xA5,FC.xA6,FC.xXX,FC.xA8,FC.xA9,FC.xAA,FC.xXX,FC.xXX,FC.xXX,FC.xXX,FC.xXX;,\ |
; FC.xB0,FC.xB1,FC.xB2,FC.xB3,FC.xB4,FC.xB5,FC.xB6,FC.xB7,FC.xB8,FC.xB9,FC.xBA,FC.xBB,FC.xBC,FC.xBD,FC.xBE,FC.xBF,\ |
; FC.xC0,FC.xC1,FC.xC2,FC.xC3,FC.xC4,FC.xC5,FC.xC6,FC.xC7,FC.xC8,FC.xC9,FC.xCA,FC.xCB,FC.xCC,FC.xCD,FC.xCE,FC.xCF,\ |
; FC.xD0,FC.xD1,FC.xD2,FC.xD3,FC.xD4,FC.xD5,FC.xD6,FC.xD7,FC.xD8,FC.xD9,FC.xDA,FC.xDB,FC.xDC,FC.xDD,FC.xDE,FC.xDF,\ |
; FC.xE0,FC.xE1,FC.xE2,FC.xE3,FC.xE4,FC.xE5,FC.xE6,FC.xE7,FC.xE8,FC.xE9,FC.xEA,FC.xEB,FC.xEC,FC.xED,FC.xEE,FC.xEF,\ |
; FC.xF0,FC.xF1,FC.xF2,FC.xF3,FC.xF4,FC.xF5,FC.xF6,FC.xF7,FC.xF8,FC.xF9,FC.xFA,FC.xFB,FC.xFC,FC.xFD,FC.xFE,FC.xFF |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/kernel/branches/gfx_kernel/vmode/makefile |
---|
0,0 → 1,12 |
FASM=fasm |
FENV=fasminc=/usr/fasm/include |
KSRC=vmode.asm |
KOUT=vmode.mdr |
en: $(KSRC) |
$(FENV) $(FASM) $(KSRC) $(KOUT) |
ru: $(KSRC) |
$(FENV) $(FASM) $(KSRC) $(KOUT) |
clean: |
rm -f $(KOUT) |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/kernel/branches/gfx_kernel/vmode/norm_04.inc |
---|
0,0 → 1,1017 |
func color_24_to_4_bits |
begin |
push edx |
mov dl,0 |
cmp al,85 ; blue |
jbe .p13green |
or dl,0x01 |
cmp al,170 |
jbe .p13green |
or dl,0x08 |
.p13green: |
shr eax,8 |
cmp al,85 ; green |
jbe .p13red |
or dl,0x02 |
cmp al,170 |
jbe .p13red |
or dl,0x08 |
.p13red: |
cmp ah,85 ; red |
jbe .p13cont |
or dl,0x04 |
cmp ah,170 |
jbe .p13cont |
or dl,0x08 |
.p13cont: |
mov eax,edx |
pop edx |
ret |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_draw_rect.04 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax - x start |
; ebx - y start |
; ecx - x end |
; edx - y end |
; edi - color |
;----------------------------------------------------------------------------- |
;- eax(ebx) [x start]*65536 + [x size] |
;- ebx(ecx) [y start]*65536 + [y size] |
;- ecx(edx) color 0x00RRGGBB |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
jif eax,e,ecx,.exit |
jif ebx,e,edx,.exit |
call get_cursor_rect |
push eax |
mov eax,edi |
call color_24_to_4_bits |
mov edi,eax |
pop eax |
mov ebp,[0x3010] |
movsx esi,word[ebp-0x3000+0] |
add eax,esi |
add ecx,esi |
movsx esi,word[ebp-0x3000+4] |
add ebx,esi |
add edx,esi |
; add eax,[ebp-0x3000+0] |
; add ebx,[ebp-0x3000+4] |
; add ecx,[ebp-0x3000+0] |
; add edx,[ebp-0x3000+4] |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov ebp,[esi] |
or ebp,ebp |
jz .exit |
add esi,4 |
.nx: jif ecx,le,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,le,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
pushad |
jif eax,ge,[rr.left],@f |
mov eax,[rr.left] |
@@: jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif ecx,l,[rr.right],@f |
mov ecx,[rr.right] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
@@: call is_intersect_rc |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: sub edx,ebx |
push edx edi ebx eax |
mov edi,ebx |
shl edi,6 |
shl ebx,4 |
add edi,ebx |
shr eax,3 |
add edi,eax |
add edi,0x000A0000 |
pop eax ebx |
mov ebx,eax |
mov esi,ecx |
sub esi,eax |
mov dx,0x03CE |
;edi = Offset in VMem |
;esi = Length |
;ebx = x |
; dx = Graphix Controller |
mov cl,bl ; Get StartBit |
and ecx,07h |
mov eax,esi |
add eax,ecx |
cmp eax,8 ; Is x+Length<One Byte |
jb .D_One |
mov ax,0xff08 ; 11111111b | BitMask Register |
shr ah,cl ; BitMask |
out dx,ax ; Write BitMask |
push ecx |
mov ah,[esp+4] |
mov ecx,[esp+4+4] |
push edi |
.D_LL: ; Draw Left of Box |
mov al,[edi] |
mov [edi],ah |
add edi,80 ; edi:=edi+80 |
dec ecx |
jnz .D_LL |
pop edi |
inc edi |
pop ecx |
mov ax,0xFF08 ; BitMask Register |
out dx,ax ; Write BitMask |
mov eax,esi |
mov ch,8 |
sub ch,cl |
movzx ecx,ch |
sub eax,ecx |
shr eax,3 ; Length div 8 |
push edi ebx |
mov ebx,[esp+8+4] |
mov edx,eax |
mov al,[esp+8] |
.D_LC: |
mov ecx,edx |
rep stosb |
add edi,80 |
sub edi,edx |
dec ebx |
jnz .D_LC |
pop ebx edi |
add edi,edx |
mov ecx,ebx ; ecx:=x+Length |
add ecx,esi |
and ecx,07h ; ecx and 07 |
mov ah,0ffh |
shr ah,cl ; BitMask |
jz .D_End |
not ah |
mov al,8 ; BitMask Register |
mov dx,03ceh ; Graphics Controller |
out dx,ax ; Write BitMask |
mov ecx,[esp+4] |
mov al,[esp] |
.D_LR: |
mov ah,[edi] |
mov [edi],al |
add edi,80 |
dec ecx |
jnz .D_LR |
jmp .D_End |
.D_One: |
mov ah,0ffh |
shr ah,cl ; Left BitMask |
add ebx,esi |
dec ebx |
and ebx,07h |
mov ecx,7 |
sub ecx,ebx |
mov bl,0ffh |
shl bl,cl ; Right BitMask |
and ah,bl ; Full BitMask |
mov al,8 ; BitMask Register |
out dx,ax ; Write BitMask |
mov ecx,[esp+4] |
mov al,[esp] |
.D_L: |
mov dl,[edi] ; Fill Latches |
mov [edi],al ; Write Pixel |
add edi,80 |
dec ecx |
jnz .D_L |
.D_End: |
pop edi |
add esp,4 |
popad |
.skip: |
add esi,SR |
dec ebp |
jnz .nx |
.exit: |
sti |
popad |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_draw_line.04 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax(ebx) [x start] shl 16 + [x end] |
; ebx(ecx) [y start] shl 16 + [y end] |
; ecx(edx) colour 0x00RRGGBB |
; edi = 0x00000001 force |
;----------------------------------------------------------------------------- |
begin |
push 0 |
pushad |
cli |
test ecx,0x01000000 |
jnz .exit |
call get_cursor_rect |
mov eax,ecx |
call color_24_to_4_bits |
; mov [esp+4*8],ecx |
mov [esp+4*8],al |
movsx eax,word[esp+4*7] ; x end |
cmp ax,[esp+4*7+2] ; x start |
je dl.vert_line |
movsx eax,word[esp+4*4] ; y end |
cmp ax,[esp+4*4+2] ; y start |
je dl.horz_line |
.exit: |
sti |
popad |
add esp,4 |
retn |
dl.vert_line: |
push eax |
mov cl,al |
and cl,7 |
mov ax,0x8008 |
shr ah,cl |
mov dx,0x03CE |
out dx,ax |
pop eax |
mov ecx,[esp+4*8] |
test edi,1 |
jnz .forced |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
.nx: movsx ebx,word[esp+4*4+2] ; y start |
movsx edx,word[esp+4*4] ; y end |
cmp ebx,edx |
je .exit |
jl @f |
xchg ebx,edx |
@@: jif eax,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
dec edx |
.draw: |
@@: call is_intersect_vln |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: push ebx eax |
mov ebp,ebx |
shl ebp,6 |
shl ebx,4 |
add ebp,ebx |
shr eax,3 |
add ebp,eax |
add ebp,0x000A0000 |
pop eax ebx |
@@: mov ch,[ebp] |
mov [ebp],cl |
add ebp,80 |
inc ebx |
cmp ebx,edx |
jle @b |
.skip: |
add esi,SR |
dec edi |
jnz .nx |
.exit: |
sti |
popad |
add esp,4 |
retn |
.forced: |
jif eax,l,[viewport.left],.exit |
jif eax,ge,[viewport.right],.exit |
movsx ebx,word[esp+4*4+2] ; y start |
movsx edx,word[esp+4*4] ; y end |
jif ebx,e,edx,.exit |
jl @f |
xchg ebx,edx |
@@: jif edx,l,[viewport.top],.exit |
jif ebx,ge,[viewport.bottom],.exit |
jif ebx,ge,[viewport.top],@f |
mov ebx,[viewport.top] |
@@: jif edx,l,[viewport.bottom],@f |
mov edx,[viewport.bottom] |
dec edx |
@@: mov edi,1 |
jmp .draw |
dl.horz_line: |
cld |
mov ecx,[esp+4*8] |
test edi,1 |
jnz .forced |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
.nx: movsx ebx,word[esp+4*7+2] ; x start |
movsx edx,word[esp+4*7] ; x end |
cmp ebx,edx |
je .exit |
jl @f |
xchg ebx,edx |
@@: jif eax,l,[rr.top],.skip |
jif eax,ge,[rr.bottom],.skip |
jif edx,l,[rr.left],.skip |
jif ebx,ge,[rr.right],.skip |
jif ebx,ge,[rr.left],@f |
mov ebx,[rr.left] |
@@: jif edx,l,[rr.right],@f |
mov edx,[rr.right] |
dec edx |
.draw: |
@@: call is_intersect_hln |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: push edi ebx eax |
mov edi,eax |
shl edi,6 |
shl eax,4 |
add edi,eax |
shr ebx,3 |
add edi,ebx |
add edi,0x000A0000 |
pop eax ebx |
push eax ebx edx esi ecx |
mov esi,edx |
sub esi,ebx |
inc esi |
mov dx,0x03CE |
;edi = Offset in VMem |
;esi = Length |
;ebx = x |
; dx = Graphix Controller |
mov cl,bl ; Get StartBit |
and ecx,07h |
mov eax,esi |
add eax,ecx |
cmp eax,8 ; Is x+Length<One Byte |
jb .D_One |
mov ax,0xFF08 ; 11111111b | BitMask Register |
shr ah,cl ; BitMask |
out dx,ax ; Write BitMask |
mov al,[edi] |
mov eax,[esp] |
mov [edi],al |
inc edi |
mov ax,0xFF08 ; BitMask | BitMask Register |
out dx,ax ; Write BitMask |
mov eax,esi |
mov ch,8 |
sub ch,cl |
mov cl,ch |
xor ch,ch |
sub eax,ecx |
shr eax,3 ; Length div 8 |
mov ecx,eax |
mov eax,[esp] |
rep stosb |
mov ecx,ebx ; ecx:=x+Length |
add ecx,esi |
and ecx,07h ; ecx and 07 |
mov ah,0ffh |
shr ah,cl ; BitMask |
jz .D_End |
not ah |
mov al,8 ; BitMask Register |
out dx,ax ; Write BitMask |
mov cl,[edi] |
mov eax,[esp] |
mov [edi],al |
jmp .D_End |
.D_One: |
mov ax,0xff08 ; | BitMask Register |
shr ah,cl ; Left BitMask |
add ebx,esi |
dec ebx |
and ebx,07h |
mov ecx,7 |
sub ecx,ebx |
mov bl,0ffh |
shl bl,cl ; Right BitMask |
and ah,bl ; Full BitMask |
out dx,ax ; Write BitMask |
mov dl,[edi] ; Fill Latches |
mov eax,[esp] |
mov [edi],al ; Write Pixel |
.D_End: |
pop ecx esi edx ebx eax edi |
; mov ebp,[bytes_per_scanline] |
; imul ebp,eax |
; lea ebp,[ebp+ebx*4] |
; add ebp,[lfb_address] |
; @@: test ecx,0x01000000 |
; jz .dr |
; mov ecx,[ebp] |
; not ecx |
; or ecx,0x01000000 |
; .dr: mov [ebp],ecx |
; add ebp,4 |
; inc ebx |
; cmp ebx,edx |
; jle @b |
.skip: |
add esi,SR |
dec edi |
jnz .nx |
.exit: |
sti |
popad |
add esp,4 |
retn |
.forced: |
jif eax,l,[viewport.top],.exit |
jif eax,ge,[viewport.bottom],.exit |
movsx ebx,word[esp+4*7+2] ; x start |
movsx edx,word[esp+4*7] ; x end |
cmp ebx,edx |
je .exit |
jl @f |
xchg ebx,edx |
@@: jif edx,l,[viewport.left],.exit |
jif ebx,ge,[viewport.right],.exit |
jif ebx,ge,[viewport.left],@f |
mov ebx,[viewport.left] |
@@: jif edx,l,[viewport.right],@f |
mov edx,[viewport.right] |
dec edx |
@@: mov edi,1 |
jmp .draw |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_put_pixel.04 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax = x coordinate |
; ebx = y coordinate |
; ecx = ?? RR GG BB ; 0x01000000 negation |
; edi = 0x00000001 force |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
; mov edx,[bytes_per_scanline] |
; imul edx,ebx |
; lea edx,[edx+eax*4] |
; add edx,[lfb_address] |
; test ecx,0x01000000 |
; jz @f |
; mov ecx,[edx] |
; not ecx |
@@: test edi,1 |
jnz .forced |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
@@: jif eax,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif ebx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
call get_cursor_rect |
call is_intersect_pt |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put:;mov [edx],ecx |
; mov ax,SegA000 {Calculate Offset} |
; mov es,ax |
; mov bx,[y] |
mov edi,ebx |
shl edi,6 ; 80*y |
shl ebx,4 |
add edi,ebx |
push ecx |
mov cl,al |
shr eax,3 ; /8 |
add edi,eax ; 80*y + (x/8) |
and cl,7 ; Get Bit that Changes |
mov ax,0x8008 |
shr ah,cl |
mov dx,0x03CE |
out dx,ax |
add edi,0x000A0000 |
call color_24_to_4_bits |
mov ah,[edi] ; dummy read |
mov [edi],al |
.exit: |
sti |
popad |
retn |
.skip: |
add esi,SR |
dec edi |
jnz @b |
jmp .exit |
.forced: |
jif eax,l,[viewport.left],.exit |
jif ebx,l,[viewport.top],.exit |
jif eax,ge,[viewport.right],.exit |
jif ebx,ge,[viewport.bottom],.exit |
; mov ax,SegA000 {Calculate Offset} |
; mov es,ax |
; mov bx,[y] |
mov edi,ebx |
shl edi,6 ; 80*y |
shl ebx,4 |
add edi,ebx |
push ecx |
mov cl,al |
shr eax,3 ; /8 |
add edi,eax ; 80*y + (x/8) |
and cl,7 ; Get Bit that Changes |
mov ax,0x8008 |
shr ah,cl |
mov dx,0x03CE |
out dx,ax |
add edi,0x000A0000 |
pop eax |
call color_24_to_4_bits |
mov ah,[edi] ; dummy read |
mov [edi],al |
sti |
popad |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_get_pixel.04 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax = x coordinate |
; ebx = y coordinate |
;----------------------------------------------------------------------------- |
clr_table dd \ |
0x00000000,0x00000080,0x00008000,0x00008080,\ |
0x00800000,0x00800080,0x00808000,0x00808080,\ |
0x00CCCCCC,0x000000FF,0x0000FF00,0x0000FFFF,\ |
0x00FF0000,0x00FF00FF,0x00FFFF00,0x00FFFFFF |
begin |
pushad |
cli |
mov edi,ebx |
shl edi,6 ; 80*y |
shl ebx,4 |
add edi,ebx |
mov cl,al |
shr eax,3 ; /8 |
add edi,eax ; 80*y + (x/8) |
add edi,0x000A0000 |
and ecx,7 |
neg ecx |
add cl,7 |
mov dx,0x03CE |
xor bl,bl |
mov ah,3 |
@1: |
mov al,4 |
out dx,al |
inc dx |
mov al,ah |
out dx,al |
dec dx |
mov al,[edi] |
shr al,cl |
and al,1 |
xchg cl,ah |
shl al,cl |
xchg cl,ah |
or bl,al |
dec ah |
jns @1 |
and ebx,0x0000000F |
mov eax,[ebx*4+clr_table] |
mov [esp+4*6],eax |
sti |
popad |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_put_image.04 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax(ebx) pointer to image in memory - RRGGBBRRGGBB.. |
; ebx(ecx) image size [x]*65536+[y] |
; ecx(edx) image position in window [x]*65536+[y] |
; ret: eax 0 succesful, 1 overlapped |
;----------------------------------------------------------------------------- |
begin |
mov eax,ebx |
mov ebx,ecx |
mov ecx,edx |
.direct: |
pushad |
cli |
jif ebx,z,0x0000FFFF,.exit,test |
jif ebx,z,0xFFFF0000,.exit,test |
cld |
call get_cursor_rect |
mov ebp,eax |
movsx eax,word[esp+4*6+2] |
movsx ebx,word[esp+4*6] |
movsx ecx,word[esp+4*4+2] |
movsx edx,word[esp+4*4] |
lea edi,[ecx*3] |
push edi |
add ecx,eax |
add edx,ebx |
mov edi,[0x00003010] |
movsx esi,word[edi-0x3000+0] |
add eax,esi |
add ecx,esi |
movsx esi,word[edi-0x3000+4] |
add ebx,esi |
add edx,esi |
; add eax,[esi-0x3000+0] |
; add ebx,[esi-0x3000+4] |
; add ecx,[esi-0x3000+0] |
; add edx,[esi-0x3000+4] |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
cld |
.nx: jif ecx,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
pushad |
jif eax,ge,[rr.left],@f |
mov eax,[rr.left] |
@@: jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif ecx,l,[rr.right],@f |
mov ecx,[rr.right] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
@@: call is_intersect_rc |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: |
mov esi,ebx |
sub esi,[esp+4*4] |
imul esi,[esp+4*8] |
mov edi,eax |
sub edi,[esp+4*7] |
lea edi,[edi*3] |
add esi,edi |
add esi,ebp |
mov edi,ebx |
mov ebp,ebx |
shl edi,6 ; 80*y |
shl ebp,4 |
add edi,ebp |
add edi,0x000A0000 |
.xxx: push eax edx esi edi ebx eax |
or ebp,-1 |
mov edx,0x03CE |
@@: mov eax,[esp] |
push ecx edi |
mov cl,al |
shr eax,3 ; /8 |
add edi,eax ; 80*y + (x/8) |
mov eax,0x8008 |
and cl,7 ; Get Bit that Changes |
shr ah,cl |
out dx,ax |
lodsd |
dec esi |
and eax,0x00FFFFFF |
cmp eax,ebp |
jne .ppp |
mov cl,bl |
jmp .ppp.2 |
.ppp: |
mov ebp,eax |
call color_24_to_4_bits |
mov bl,al |
.ppp.2: |
mov al,[edi] ; dummy read |
mov [edi],cl |
pop edi ecx |
inc dword[esp] |
cmp [esp],ecx |
jl @b |
pop eax ebx edi esi edx eax |
inc ebx |
add esi,[esp+4*8] |
add edi,80 |
cmp ebx,edx |
jl .xxx |
popad |
.skip: |
add esi,SR |
dec edi |
jnz .nx |
.exit: |
add esp,4 |
sti |
popad |
xor eax,eax |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_draw_bg.04 ;///////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
begin |
pushad |
cmp byte[0x460000-12],1 |
je .tiled |
mov eax,[viewport.left] |
mov ebx,[viewport.top] |
mov ecx,[viewport.right] |
mov edx,[viewport.bottom] |
mov edi,[0x00300000] |
cli |
jif eax,e,ecx,.exit |
jif ebx,e,edx,.exit |
call get_cursor_rect |
push eax |
mov eax,edi |
call color_24_to_4_bits |
mov edi,eax |
pop eax |
mov esi,[CLIP_RECTS+4] |
mov ebp,[esi] |
or ebp,ebp |
jz .exit |
add esi,4 |
.nx: jif ecx,le,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,le,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
pushad |
jif eax,ge,[rr.left],@f |
mov eax,[rr.left] |
@@: jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif ecx,l,[rr.right],@f |
mov ecx,[rr.right] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
@@: call is_intersect_rc |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: sub edx,ebx |
push edx edi ebx eax |
mov edi,ebx |
shl edi,6 |
shl ebx,4 |
add edi,ebx |
shr eax,3 |
add edi,eax |
add edi,0x000A0000 |
pop eax ebx |
mov ebx,eax |
mov esi,ecx |
sub esi,eax |
mov dx,0x03CE |
;edi = Offset in VMem |
;esi = Length |
;ebx = x |
; dx = Graphix Controller |
mov cl,bl ; Get StartBit |
and ecx,07h |
mov eax,esi |
add eax,ecx |
cmp eax,8 ; Is x+Length<One Byte |
jb .D_One |
mov ax,0xff08 ; 11111111b | BitMask Register |
shr ah,cl ; BitMask |
out dx,ax ; Write BitMask |
push ecx |
mov ah,[esp+4] |
mov ecx,[esp+4+4] |
push edi |
.D_LL: ; Draw Left of Box |
mov al,[edi] |
mov [edi],ah |
add edi,80 ; edi:=edi+80 |
dec ecx |
jnz .D_LL |
pop edi |
inc edi |
pop ecx |
mov ax,0xFF08 ; BitMask Register |
out dx,ax ; Write BitMask |
mov eax,esi |
mov ch,8 |
sub ch,cl |
movzx ecx,ch |
sub eax,ecx |
shr eax,3 ; Length div 8 |
push edi ebx |
mov ebx,[esp+8+4] |
mov edx,eax |
mov al,[esp+8] |
.D_LC: |
mov ecx,edx |
rep stosb |
add edi,80 |
sub edi,edx |
dec ebx |
jnz .D_LC |
pop ebx edi |
add edi,edx |
mov ecx,ebx ; ecx:=x+Length |
add ecx,esi |
and ecx,07h ; ecx and 07 |
mov ah,0ffh |
shr ah,cl ; BitMask |
jz .D_End |
not ah |
mov al,8 ; BitMask Register |
mov dx,03ceh ; Graphics Controller |
out dx,ax ; Write BitMask |
mov ecx,[esp+4] |
mov al,[esp] |
.D_LR: |
mov ah,[edi] |
mov [edi],al |
add edi,80 |
dec ecx |
jnz .D_LR |
jmp .D_End |
.D_One: |
mov ah,0ffh |
shr ah,cl ; Left BitMask |
add ebx,esi |
dec ebx |
and ebx,07h |
mov ecx,7 |
sub ecx,ebx |
mov bl,0ffh |
shl bl,cl ; Right BitMask |
and ah,bl ; Full BitMask |
mov al,8 ; BitMask Register |
out dx,ax ; Write BitMask |
mov ecx,[esp+4] |
mov al,[esp] |
.D_L: |
mov dl,[edi] ; Fill Latches |
mov [edi],al ; Write Pixel |
add edi,80 |
dec ecx |
jnz .D_L |
.D_End: |
pop edi |
add esp,4 |
popad |
.skip: |
add esi,SR |
dec ebp |
jnz .nx |
.exit: |
sti |
popad |
retn |
.tiled: |
mov eax,bg_address |
mov ebx,[bg_width-2] |
mov bx,word[bg_height] |
xor ecx,ecx |
xor edx,edx |
.lp1: push eax |
call vm_mike_put_image.04.direct |
pop eax |
add edx,[bg_width] |
cmp edx,[screen_width] |
jae @f |
shl edx,16 |
add ecx,edx |
shr edx,16 |
jmp .lp1 |
@@: and ecx,0x0000FFFF |
xor edx,edx |
add ecx,[bg_height] |
cmp ecx,[screen_height] |
jb .lp1 |
popad |
retn |
endf |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/kernel/branches/gfx_kernel/vmode/norm_08.inc |
---|
0,0 → 1,747 |
;----------------------------------------------------------------------------- |
func vm_mike_draw_rect.08 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax - x start |
; ebx - y start |
; ecx - x end |
; edx - y end |
; edi - color |
;----------------------------------------------------------------------------- |
;- eax(ebx) [x start]*65536 + [x size] |
;- ebx(ecx) [y start]*65536 + [y size] |
;- ecx(edx) color 0x00RRGGBB |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
jif eax,e,ecx,.exit |
jif ebx,e,edx,.exit |
call get_cursor_rect |
mov ebp,[0x3010] |
movsx esi,word[ebp-0x3000+0] |
add eax,esi |
add ecx,esi |
movsx esi,word[ebp-0x3000+4] |
add ebx,esi |
add edx,esi |
; add eax,[ebp-0x3000+0] |
; add ebx,[ebp-0x3000+4] |
; add ecx,[ebp-0x3000+0] |
; add edx,[ebp-0x3000+4] |
push ecx |
mov ecx,edi |
call color_24_to_8_bits |
mov edi,ecx |
pop ecx |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov ebp,[esi] |
or ebp,ebp |
jz .exit |
add esi,4 |
.nx: jif ecx,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
pushad |
jif eax,ge,[rr.left],@f |
mov eax,[rr.left] |
@@: jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif ecx,l,[rr.right],@f |
mov ecx,[rr.right] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
@@: call is_intersect_rc |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,ebx |
add ebp,eax |
add ebp,[lfb_address] |
.xxx: push eax ebp |
xchg eax,edi |
@@: push ebp |
call [set_bank] |
mov [ebp],al |
pop ebp |
; mov [ebp],di |
inc ebp |
inc edi |
cmp edi,ecx |
jl @b |
xchg eax,edi |
pop ebp eax |
add ebp,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jl .xxx |
popad |
.skip: |
add esi,SR |
dec ebp |
jnz .nx |
.exit: |
sti |
popad |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_draw_line.08 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax(ebx) [x start] shl 16 + [x end] |
; ebx(ecx) [y start] shl 16 + [y end] |
; ecx(edx) colour 0x00RRGGBB |
; edi = 0x00000001 force |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
call get_cursor_rect |
mov eax,ecx |
call color_24_to_8_bits |
and eax,0x01000000 |
or ecx,eax |
movsx eax,word[esp+4*7] ; x end |
cmp ax,[esp+4*7+2] ; x start |
je dl.08.vert_line |
movsx eax,word[esp+4*4] ; y end |
cmp ax,[esp+4*4+2] ; y start |
je dl.08.horz_line |
sti |
popad |
retn |
dl.08.vert_line: |
test edi,1 |
jnz .forced |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
.nx: movsx ebx,word[esp+4*4+2] ; y start |
movsx edx,word[esp+4*4] ; y end |
cmp ebx,edx |
je .exit |
jl @f |
xchg ebx,edx |
@@: jif eax,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
dec edx |
.draw: |
@@: call is_intersect_vln |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,ebx |
add ebp,eax |
add ebp,[lfb_address] |
@@: push ebp |
call [set_bank] |
test ecx,0x01000000 |
jz .dr |
movzx ecx,byte[ebp] |
mov ecx,dword[palette_8_256+ecx*3] |
not ecx |
call color_24_to_8_bits |
or ecx,0x01000000 |
.dr: mov [ebp],cl |
pop ebp |
; test ecx,0x01000000 |
; jz .dr |
; mov cx,[ebp] |
; not cx |
; .dr: mov [ebp],cx |
add ebp,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jle @b |
.skip: |
add esi,SR |
dec edi |
jnz .nx |
.exit: |
sti |
popad |
retn |
.forced: |
jif eax,l,[viewport.left],.exit |
jif eax,ge,[viewport.right],.exit |
movsx ebx,word[esp+4*4+2] ; y start |
movsx edx,word[esp+4*4] ; y end |
jif ebx,e,edx,.exit |
jl @f |
xchg ebx,edx |
@@: jif edx,l,[viewport.top],.exit |
jif ebx,ge,[viewport.bottom],.exit |
jif ebx,ge,[viewport.top],@f |
mov ebx,[viewport.top] |
@@: jif edx,l,[viewport.bottom],@f |
mov edx,[viewport.bottom] |
dec edx |
@@: mov edi,1 |
jmp .draw |
dl.08.horz_line: |
test edi,1 |
jnz .forced |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
.nx: movsx ebx,word[esp+4*7+2] ; x start |
movsx edx,word[esp+4*7] ; x end |
cmp ebx,edx |
je .exit |
jl @f |
xchg ebx,edx |
@@: jif eax,l,[rr.top],.skip |
jif eax,ge,[rr.bottom],.skip |
jif edx,l,[rr.left],.skip |
jif ebx,ge,[rr.right],.skip |
jif ebx,ge,[rr.left],@f |
mov ebx,[rr.left] |
@@: jif edx,l,[rr.right],@f |
mov edx,[rr.right] |
dec edx |
.draw: |
@@: call is_intersect_hln |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,eax |
add ebp,ebx |
add ebp,[lfb_address] |
@@: push ebp |
call [set_bank] |
test ecx,0x01000000 |
jz .dr |
movzx ecx,byte[ebp] |
mov ecx,dword[palette_8_256+ecx*3] |
not ecx |
call color_24_to_8_bits |
or ecx,0x01000000 |
.dr: mov [ebp],cl |
pop ebp |
; test ecx,0x01000000 |
; jz .dr |
; mov cx,[ebp] |
; not cx |
; .dr: mov [ebp],cx |
inc ebp |
inc ebx |
cmp ebx,edx |
jle @b |
.skip: |
add esi,SR |
dec edi |
jnz .nx |
.exit: |
sti |
popad |
retn |
.forced: |
jif eax,l,[viewport.top],.exit |
jif eax,ge,[viewport.bottom],.exit |
movsx ebx,word[esp+4*7+2] ; x start |
movsx edx,word[esp+4*7] ; x end |
cmp ebx,edx |
je .exit |
jl @f |
xchg ebx,edx |
@@: jif edx,l,[viewport.left],.exit |
jif ebx,ge,[viewport.right],.exit |
jif ebx,ge,[viewport.left],@f |
mov ebx,[viewport.left] |
@@: jif edx,l,[viewport.right],@f |
mov edx,[viewport.right] |
dec edx |
@@: mov edi,1 |
jmp .draw |
endf |
func color_24_to_8_bits |
begin |
push ecx |
cmp byte[esp+2],0 ; red=0 ? |
pop ecx |
jne .lp1 |
cmp ch,0 ; green=0 ? |
jne @f |
shr cl,2 |
add cl,192 |
ret |
@@: cmp cl,0 ; blue=0 ? |
jne .lp1 |
shr cx,8+2 |
add cl,128 |
ret |
.lp1: cmp cx,0 ; green=0 && blue=0 ? |
jne @f |
shr ecx,16+2 |
and cl,0x3F |
add cl,64 |
ret |
@@: and ecx,0x00FFFFFF |
shr ecx,6 |
shl cx,6 |
shr ecx,6 |
shl cl,6 |
shr ecx,6 |
ret |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_put_pixel.08 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax = x coordinate |
; ebx = y coordinate |
; ecx = ?? RR GG BB ; 0x01000000 negation |
; edi = 0x00000001 force |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
mov edx,[bytes_per_scanline] |
imul edx,ebx |
add edx,eax |
add edx,[lfb_address] |
test edi,1 |
jnz .forced |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
@@: jif eax,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif ebx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
call get_cursor_rect |
call is_intersect_pt |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: push edx |
call [set_bank] |
pop edx |
test ecx,0x01000000 |
jz .lp1 |
not byte[ebp] |
jmp .exit |
.lp1: call color_24_to_8_bits |
mov [ebp],cl |
.exit: |
sti |
popad |
retn |
.skip: |
add esi,SR |
dec edi |
jnz @b |
jmp .exit |
.forced: |
jif eax,l,[viewport.left],.exit |
jif ebx,l,[viewport.top],.exit |
jif eax,ge,[viewport.right],.exit |
jif ebx,ge,[viewport.bottom],.exit |
push edx |
call [set_bank] |
pop edx |
test ecx,0x01000000 |
jz @f |
movzx eax,byte[ebp] |
mov ecx,dword[palette_8_256+eax*3] |
not ecx |
call color_24_to_8_bits |
mov byte[ebp],cl |
;not byte[ebp] |
jmp .exit |
@@: call color_24_to_8_bits |
mov [ebp],cl |
jmp .exit |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_get_pixel.08 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax = x coordinate |
; ebx = y coordinate |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
imul ebx,[bytes_per_scanline] |
add eax,ebx |
add eax,[lfb_address] |
push eax |
call [set_bank] |
pop eax |
movzx eax,byte[ebp] |
mov eax,dword[palette_8_256+eax*3] |
and eax,0x00FFFFFF |
mov [esp+4*6],eax |
sti |
popad |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_put_image.08 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax(ebx) pointer to image in memory - RRGGBBRRGGBB.. |
; ebx(ecx) image size [x]*65536+[y] |
; ecx(edx) image position in window [x]*65536+[y] |
; ret: eax 0 succesful, 1 overlapped |
;----------------------------------------------------------------------------- |
begin |
mov eax,ebx |
mov ebx,ecx |
mov ecx,edx |
.direct: |
pushad |
cli |
jif ebx,z,0x0000FFFF,.exit,test |
jif ebx,z,0xFFFF0000,.exit,test |
call get_cursor_rect |
mov ebp,eax |
movsx eax,word[esp+4*6+2] |
movsx ebx,word[esp+4*6] |
movsx ecx,word[esp+4*4+2] |
movsx edx,word[esp+4*4] |
lea edi,[ecx*3] |
push edi |
add ecx,eax |
add edx,ebx |
mov edi,[0x00003010] |
movsx esi,word[edi-0x3000+0] |
add eax,esi |
add ecx,esi |
movsx esi,word[edi-0x3000+4] |
add ebx,esi |
add edx,esi |
; add eax,[esi-0x3000+0] |
; add ebx,[esi-0x3000+4] |
; add ecx,[esi-0x3000+0] |
; add edx,[esi-0x3000+4] |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
cld |
.nx: jif ecx,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
pushad |
jif eax,ge,[rr.left],@f |
mov eax,[rr.left] |
@@: jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif ecx,l,[rr.right],@f |
mov ecx,[rr.right] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
@@: call is_intersect_rc |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov esi,ebx |
sub esi,[esp+4*4] |
imul esi,[esp+4*8] |
mov edi,eax |
sub edi,[esp+4*7] |
lea edi,[edi*3] |
add esi,edi |
add esi,ebp |
mov edi,[bytes_per_scanline] |
imul edi,ebx |
add edi,eax |
add edi,[lfb_address] |
.xxx: push eax esi edi eax |
@@: lodsd |
xchg eax,ecx |
call color_24_to_8_bits |
xchg eax,ecx |
push ebp edi |
call [set_bank] |
mov [ebp],al |
pop edi ebp |
inc edi |
dec esi |
inc dword[esp] |
cmp [esp],ecx |
jl @b |
pop eax edi esi eax |
add esi,[esp+4*8] |
add edi,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jl .xxx |
popad |
.skip: |
add esi,SR |
dec edi |
jnz .nx |
.exit: |
add esp,4 |
sti |
popad |
xor eax,eax |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_draw_bg.08 ;///////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
begin |
pushad |
mov eax,[viewport.left] |
mov ebx,[viewport.top] |
mov ecx,[viewport.right] |
mov edx,[viewport.bottom] |
cli |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
mov esi,[CLIP_RECTS+4] |
mov ebp,[esi] |
or ebp,ebp |
jz .exit |
add esi,4 |
.nx: pushad |
; jif eax,ge,[rr.left],@f |
; mov eax,[rr.left] |
; @@: jif ebx,ge,[rr.top],@f |
; mov ebx,[rr.top] |
; @@: jif ecx,l,[rr.right],@f |
; mov ecx,[rr.right] |
; @@: jif edx,l,[rr.bottom],@f |
; mov edx,[rr.bottom] |
; @@: |
mov eax,[rr.left] |
mov ebx,[rr.top] |
mov ecx,[rr.right] |
mov edx,[rr.bottom] |
dec ecx |
dec edx |
mov edi,0x007F7F7F |
call vm_mike_draw_rect.08 |
xor edi,edi |
pushad |
shl eax,16 |
mov ax,cx |
push bx |
shl ebx,16 |
pop bx |
mov ecx,0x00CCCCCC |
call vm_mike_draw_line.08 |
add ebx,0x00010001 |
call vm_mike_draw_line.08 |
popad |
pushad |
shl ebx,16 |
mov bx,dx |
push ax |
shl eax,16 |
pop ax |
mov ecx,0x00CCCCCC |
call vm_mike_draw_line.08 |
add eax,0x00010001 |
call vm_mike_draw_line.08 |
popad |
pushad |
shl eax,16 |
mov ax,cx |
mov ebx,edx |
shl ebx,16 |
mov bx,dx |
mov ecx,0x00333333 |
call vm_mike_draw_line.08 |
sub ebx,0x00010001 |
add eax,0x00010000 |
call vm_mike_draw_line.08 |
popad |
pushad |
mov eax,ecx |
shl eax,16 |
mov ax,cx |
shl ebx,16 |
mov bx,dx |
mov ecx,0x00333333 |
call vm_mike_draw_line.08 |
sub eax,0x00010001 |
add ebx,0x00010000 |
call vm_mike_draw_line.08 |
popad |
popad |
.skip: |
add esi,SR |
dec ebp |
jnz .nx |
.exit: |
sti |
popad |
retn |
macro sdfsdSAFSDFG { |
pushad |
cmp byte[bg_type],BGT_TILE |
je .tiled |
mov eax,[bg_width] |
cmp eax,[screen_width] |
jne @f |
mov eax,[bg_height] |
cmp eax,[screen_height] |
je .tiled |
@@: |
imul eax,[bg_width],3 |
mov [bg_bytes_per_scanline],eax |
mov eax,[viewport.left] |
mov ebx,[viewport.top] |
mov ecx,[viewport.right] |
mov edx,[viewport.bottom] |
cmp [bg_width],1 |
jne @f |
cmp [bg_height],1 |
je .color |
@@: |
cli |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
mov esi,[CLIP_RECTS+4] |
mov ebp,[esi] |
or ebp,ebp |
jz .exit |
add esi,4 |
.nx: jif ecx,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
pushad |
jif eax,ge,[rr.left],@f |
mov eax,[rr.left] |
@@: jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif ecx,l,[rr.right],@f |
mov ecx,[rr.right] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
@@: call is_intersect_rc |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,ebx |
add ebp,eax |
add ebp,[lfb_address] |
.xxx: push eax ebp |
@@: push ebp |
call [set_bank] |
mov [ebp],di |
pop ebp |
; mov [ebp],di |
inc ebp |
inc eax |
cmp eax,ecx |
jl @b |
pop ebp eax |
add ebp,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jl .xxx |
popad |
.skip: |
add esi,SR |
dec ebp |
jnz .nx |
.exit: |
sti |
popad |
retn |
.tiled: |
mov eax,bg_address |
mov ebx,[bg_width-2] |
mov bx,word[bg_height] |
xor ecx,ecx |
.lp1: push eax |
call vm_mike_put_image.08.direct |
pop eax |
rol ecx,16 |
add cx,word[bg_width] |
cmp cx,word[screen_width] |
jae @f |
rol ecx,16 |
jmp .lp1 |
@@: shr ecx,16 |
add ecx,[bg_height] |
cmp ecx,[screen_height] |
jb .lp1 |
popad |
retn |
.color: |
mov edi,[bg_address] |
and edi,0x00FFFFFF |
call vm_mike_draw_rect.08 |
popad |
retn |
} |
endf |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/kernel/branches/gfx_kernel/vmode/norm_15.inc |
---|
0,0 → 1,651 |
;----------------------------------------------------------------------------- |
func vm_mike_draw_rect.15 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax - x start |
; ebx - y start |
; ecx - x end |
; edx - y end |
; edi - color |
;----------------------------------------------------------------------------- |
;- eax(ebx) [x start]*65536 + [x size] |
;- ebx(ecx) [y start]*65536 + [y size] |
;- ecx(edx) color 0x00RRGGBB |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
jif eax,e,ecx,.exit |
jif ebx,e,edx,.exit |
call get_cursor_rect |
mov ebp,[0x3010] |
movsx esi,word[ebp-0x3000+0] |
add eax,esi |
add ecx,esi |
movsx esi,word[ebp-0x3000+4] |
add ebx,esi |
add edx,esi |
; add eax,[ebp-0x3000+0] |
; add ebx,[ebp-0x3000+4] |
; add ecx,[ebp-0x3000+0] |
; add edx,[ebp-0x3000+4] |
push eax |
mov eax,edi |
shr eax,3 |
shl ax,3 |
shr eax,3 |
shl al,3 |
shr eax,3 |
mov di,ax |
pop eax |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov ebp,[esi] |
or ebp,ebp |
jz .exit |
add esi,4 |
.nx: jif ecx,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
pushad |
jif eax,ge,[rr.left],@f |
mov eax,[rr.left] |
@@: jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif ecx,l,[rr.right],@f |
mov ecx,[rr.right] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
@@: call is_intersect_rc |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,ebx |
lea ebp,[ebp+eax*2] |
add ebp,[lfb_address] |
.xxx: push eax ebp |
@@: push ebp |
call [set_bank] |
mov [ebp],di |
pop ebp |
; mov [ebp],di |
add ebp,2 |
inc eax |
cmp eax,ecx |
jl @b |
pop ebp eax |
add ebp,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jl .xxx |
popad |
.skip: |
add esi,SR |
dec ebp |
jnz .nx |
.exit: |
sti |
popad |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_draw_line.15 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax(ebx) [x start] shl 16 + [x end] |
; ebx(ecx) [y start] shl 16 + [y end] |
; ecx(edx) colour 0x00RRGGBB |
; edi = 0x00000001 force |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
call get_cursor_rect |
mov eax,ecx |
shr ecx,3 |
shl cx,3 |
shr ecx,3 |
shl cl,3 |
shr ecx,3 |
and eax,0x01000000 |
or ecx,eax |
movsx eax,word[esp+4*7] ; x end |
cmp ax,[esp+4*7+2] ; x start |
je dl.15.vert_line |
movsx eax,word[esp+4*4] ; y end |
cmp ax,[esp+4*4+2] ; y start |
je dl.15.horz_line |
sti |
popad |
retn |
dl.15.vert_line: |
test edi,1 |
jnz .forced |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
.nx: movsx ebx,word[esp+4*4+2] ; y start |
movsx edx,word[esp+4*4] ; y end |
cmp ebx,edx |
je .exit |
jl @f |
xchg ebx,edx |
@@: jif eax,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
dec edx |
.draw: |
@@: call is_intersect_vln |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,ebx |
lea ebp,[ebp+eax*2] |
add ebp,[lfb_address] |
@@: push ebp |
call [set_bank] |
test ecx,0x01000000 |
jz .dr |
mov cx,[ebp] |
not cx |
.dr: mov [ebp],cx |
pop ebp |
; test ecx,0x01000000 |
; jz .dr |
; mov cx,[ebp] |
; not cx |
; .dr: mov [ebp],cx |
add ebp,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jle @b |
.skip: |
add esi,SR |
dec edi |
jnz .nx |
.exit: |
sti |
popad |
retn |
.forced: |
jif eax,l,[viewport.left],.exit |
jif eax,ge,[viewport.right],.exit |
movsx ebx,word[esp+4*4+2] ; y start |
movsx edx,word[esp+4*4] ; y end |
jif ebx,e,edx,.exit |
jl @f |
xchg ebx,edx |
@@: jif edx,l,[viewport.top],.exit |
jif ebx,ge,[viewport.bottom],.exit |
jif ebx,ge,[viewport.top],@f |
mov ebx,[viewport.top] |
@@: jif edx,l,[viewport.bottom],@f |
mov edx,[viewport.bottom] |
dec edx |
@@: mov edi,1 |
jmp .draw |
dl.15.horz_line: |
test edi,1 |
jnz .forced |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
.nx: movsx ebx,word[esp+4*7+2] ; x start |
movsx edx,word[esp+4*7] ; x end |
cmp ebx,edx |
je .exit |
jl @f |
xchg ebx,edx |
@@: jif eax,l,[rr.top],.skip |
jif eax,ge,[rr.bottom],.skip |
jif edx,l,[rr.left],.skip |
jif ebx,ge,[rr.right],.skip |
jif ebx,ge,[rr.left],@f |
mov ebx,[rr.left] |
@@: jif edx,l,[rr.right],@f |
mov edx,[rr.right] |
dec edx |
.draw: |
@@: call is_intersect_hln |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,eax |
lea ebp,[ebp+ebx*2] |
add ebp,[lfb_address] |
@@: push ebp |
call [set_bank] |
test ecx,0x01000000 |
jz .dr |
mov cx,[ebp] |
not cx |
.dr: mov [ebp],cx |
pop ebp |
; test ecx,0x01000000 |
; jz .dr |
; mov cx,[ebp] |
; not cx |
; .dr: mov [ebp],cx |
add ebp,2 |
inc ebx |
cmp ebx,edx |
jle @b |
.skip: |
add esi,SR |
dec edi |
jnz .nx |
.exit: |
sti |
popad |
retn |
.forced: |
jif eax,l,[viewport.top],.exit |
jif eax,ge,[viewport.bottom],.exit |
movsx ebx,word[esp+4*7+2] ; x start |
movsx edx,word[esp+4*7] ; x end |
cmp ebx,edx |
je .exit |
jl @f |
xchg ebx,edx |
@@: jif edx,l,[viewport.left],.exit |
jif ebx,ge,[viewport.right],.exit |
jif ebx,ge,[viewport.left],@f |
mov ebx,[viewport.left] |
@@: jif edx,l,[viewport.right],@f |
mov edx,[viewport.right] |
dec edx |
@@: mov edi,1 |
jmp .draw |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_put_pixel.15 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax = x coordinate |
; ebx = y coordinate |
; ecx = ?? RR GG BB ; 0x01000000 negation |
; edi = 0x00000001 force |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
mov edx,[bytes_per_scanline] |
imul edx,ebx |
lea edx,[edx+eax*2] |
add edx,[lfb_address] |
test edi,1 |
jnz .forced |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
@@: jif eax,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif ebx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
call get_cursor_rect |
call is_intersect_pt |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: push edx |
call [set_bank] |
pop edx |
test ecx,0x01000000 |
jz .lp1 |
not word[ebp] |
jmp .exit |
.lp1: shr ecx,3 |
shl cx,3 |
shr ecx,3 |
shl cl,3 |
shr ecx,3 |
mov [ebp],cx |
.exit: |
sti |
popad |
retn |
.skip: |
add esi,SR |
dec edi |
jnz @b |
jmp .exit |
.forced: |
jif eax,l,[viewport.left],.exit |
jif ebx,l,[viewport.top],.exit |
jif eax,ge,[viewport.right],.exit |
jif ebx,ge,[viewport.bottom],.exit |
push edx |
call [set_bank] |
pop edx |
test ecx,0x01000000 |
jz @f |
not word[ebp] |
jmp .exit |
@@: shr ecx,3 |
shl cx,3 |
shr ecx,3 |
shl cl,3 |
shr ecx,3 |
mov [ebp],cx |
jmp .exit |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_get_pixel.15 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax = x coordinate |
; ebx = y coordinate |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
imul ebx,[bytes_per_scanline] |
shl eax,1 |
add eax,ebx |
add eax,[lfb_address] |
push eax |
call [set_bank] |
pop eax |
movzx eax,word[ebp] |
shl eax,3 |
shr al,3 |
shl eax,3 |
shr ax,3 |
shl eax,3 |
and eax,0x00FFFFFF |
mov [esp+4*6],eax |
sti |
popad |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_put_image.15 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax(ebx) pointer to image in memory - RRGGBBRRGGBB.. |
; ebx(ecx) image size [x]*65536+[y] |
; ecx(edx) image position in window [x]*65536+[y] |
; ret: eax 0 succesful, 1 overlapped |
;----------------------------------------------------------------------------- |
begin |
mov eax,ebx |
mov ebx,ecx |
mov ecx,edx |
.direct: |
pushad |
cli |
jif ebx,z,0x0000FFFF,.exit,test |
jif ebx,z,0xFFFF0000,.exit,test |
call get_cursor_rect |
mov ebp,eax |
movsx eax,word[esp+4*6+2] |
movsx ebx,word[esp+4*6] |
movsx ecx,word[esp+4*4+2] |
movsx edx,word[esp+4*4] |
lea edi,[ecx*3] |
push edi |
add ecx,eax |
add edx,ebx |
mov edi,[0x00003010] |
movsx esi,word[edi-0x3000+0] |
add eax,esi |
add ecx,esi |
movsx esi,word[edi-0x3000+4] |
add ebx,esi |
add edx,esi |
; add eax,[esi-0x3000+0] |
; add ebx,[esi-0x3000+4] |
; add ecx,[esi-0x3000+0] |
; add edx,[esi-0x3000+4] |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
cld |
.nx: jif ecx,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
pushad |
jif eax,ge,[rr.left],@f |
mov eax,[rr.left] |
@@: jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif ecx,l,[rr.right],@f |
mov ecx,[rr.right] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
@@: call is_intersect_rc |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov esi,ebx |
sub esi,[esp+4*4] |
imul esi,[esp+4*8] |
mov edi,eax |
sub edi,[esp+4*7] |
lea edi,[edi*3] |
add esi,edi |
add esi,ebp |
mov edi,[bytes_per_scanline] |
imul edi,ebx |
lea edi,[edi+eax*2] |
add edi,[lfb_address] |
.xxx: push eax esi edi eax |
@@: lodsd |
shr eax,3 |
shl ax,3 |
shr eax,3 |
shl al,3 |
shr eax,3 |
push ebp edi |
call [set_bank] |
mov [ebp],ax |
pop edi ebp |
add edi,2 |
dec esi |
inc dword[esp] |
cmp [esp],ecx |
jl @b |
pop eax edi esi eax |
add esi,[esp+4*8] |
add edi,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jl .xxx |
popad |
.skip: |
add esi,SR |
dec edi |
jnz .nx |
.exit: |
add esp,4 |
sti |
popad |
xor eax,eax |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_draw_bg.15 ;///////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
begin |
pushad |
cmp byte[bg_type],BGT_TILE |
je .tiled |
mov eax,[bg_width] |
cmp eax,[screen_width] |
jne @f |
mov eax,[bg_height] |
cmp eax,[screen_height] |
je .tiled |
@@: |
imul eax,[bg_width],3 |
mov [bg_bytes_per_scanline],eax |
mov eax,[viewport.left] |
mov ebx,[viewport.top] |
mov ecx,[viewport.right] |
mov edx,[viewport.bottom] |
cmp [bg_width],1 |
jne @f |
cmp [bg_height],1 |
je .color |
@@: |
cli |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
mov esi,[CLIP_RECTS+4] |
mov ebp,[esi] |
or ebp,ebp |
jz .exit |
add esi,4 |
.nx: jif ecx,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
pushad |
jif eax,ge,[rr.left],@f |
mov eax,[rr.left] |
@@: jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif ecx,l,[rr.right],@f |
mov ecx,[rr.right] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
@@: ;call is_intersect_rc |
;jc .put |
;cmp [mouse_invisible],0 |
;jne .put |
;call [SF.draw_mouse_under] |
;mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,ebx |
lea ebp,[ebp+eax*2] |
add ebp,[lfb_address] |
.xxx: push eax ebp |
@@: push ebp |
call [set_bank] |
push eax edx |
mul [bg_width] |
div [screen_width] |
lea edi,[eax*3] |
mov eax,ebx |
mul [bg_height] |
div [screen_height] |
mul [bg_bytes_per_scanline] |
add edi,eax |
add edi,bg_address |
mov eax,[edi] |
shr eax,3 |
shl ax,3 |
shr eax,3 |
shl al,3 |
shr eax,3 |
mov [ebp],ax |
pop edx eax |
pop ebp |
inc ebp |
inc ebp |
inc eax |
cmp eax,ecx |
jl @b |
pop ebp eax |
add ebp,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jl .xxx |
popad |
.skip: |
add esi,SR |
dec ebp |
jnz .nx |
.exit: |
sti |
popad |
retn |
.tiled: |
mov eax,bg_address |
mov ebx,[bg_width-2] |
mov bx,word[bg_height] |
xor ecx,ecx |
.lp1: push eax |
call vm_mike_put_image.15.direct |
pop eax |
rol ecx,16 |
add cx,word[bg_width] |
cmp cx,word[screen_width] |
jae @f |
rol ecx,16 |
jmp .lp1 |
@@: shr ecx,16 |
add ecx,[bg_height] |
cmp ecx,[screen_height] |
jb .lp1 |
popad |
retn |
.color: |
mov edi,[bg_address] |
and edi,0x00FFFFFF |
call vm_mike_draw_rect.15 |
popad |
retn |
endf |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/kernel/branches/gfx_kernel/vmode/norm_16.inc |
---|
0,0 → 1,646 |
;----------------------------------------------------------------------------- |
func vm_mike_draw_rect.16 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax - x start |
; ebx - y start |
; ecx - x end |
; edx - y end |
; edi - color |
;----------------------------------------------------------------------------- |
;- eax(ebx) [x start]*65536 + [x size] |
;- ebx(ecx) [y start]*65536 + [y size] |
;- ecx(edx) color 0x00RRGGBB |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
jif eax,e,ecx,.exit |
jif ebx,e,edx,.exit |
call get_cursor_rect |
mov ebp,[0x3010] |
movsx esi,word[ebp-0x3000+0] |
add eax,esi |
add ecx,esi |
movsx esi,word[ebp-0x3000+4] |
add ebx,esi |
add edx,esi |
; add eax,[ebp-0x3000+0] |
; add ebx,[ebp-0x3000+4] |
; add ecx,[ebp-0x3000+0] |
; add edx,[ebp-0x3000+4] |
push eax |
mov eax,edi |
shr eax,3 |
shl ax,3 |
shr eax,2 |
shl al,2 |
shr eax,3 |
mov di,ax |
pop eax |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov ebp,[esi] |
or ebp,ebp |
jz .exit |
add esi,4 |
.nx: jif ecx,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
pushad |
jif eax,ge,[rr.left],@f |
mov eax,[rr.left] |
@@: jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif ecx,l,[rr.right],@f |
mov ecx,[rr.right] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
@@: call is_intersect_rc |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,ebx |
lea ebp,[ebp+eax*2] |
add ebp,[lfb_address] |
.xxx: push eax ebp |
@@: push ebp |
call [set_bank] |
mov [ebp],di |
pop ebp |
; mov [ebp],di |
add ebp,2 |
inc eax |
cmp eax,ecx |
jl @b |
pop ebp eax |
add ebp,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jl .xxx |
popad |
.skip: |
add esi,SR |
dec ebp |
jnz .nx |
.exit: |
sti |
popad |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_draw_line.16 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax(ebx) [x start] shl 16 + [x end] |
; ebx(ecx) [y start] shl 16 + [y end] |
; ecx(edx) colour 0x00RRGGBB |
; edi = 0x00000001 force |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
call get_cursor_rect |
mov eax,ecx |
shr ecx,3 |
shl cx,3 |
shr ecx,2 |
shl cl,2 |
shr ecx,3 |
and eax,0x01000000 |
or ecx,eax |
movsx eax,word[esp+4*7] ; x end |
cmp ax,[esp+4*7+2] ; x start |
je dl.16.vert_line |
movsx eax,word[esp+4*4] ; y end |
cmp ax,[esp+4*4+2] ; y start |
je dl.16.horz_line |
sti |
popad |
retn |
dl.16.vert_line: |
test edi,1 |
jnz .forced |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
.nx: movsx ebx,word[esp+4*4+2] ; y start |
movsx edx,word[esp+4*4] ; y end |
cmp ebx,edx |
je .exit |
jl @f |
xchg ebx,edx |
@@: jif eax,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
dec edx |
.draw: |
@@: call is_intersect_vln |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,ebx |
lea ebp,[ebp+eax*2] |
add ebp,[lfb_address] |
@@: push ebp |
call [set_bank] |
test ecx,0x01000000 |
jz .dr |
mov cx,[ebp] |
not cx |
.dr: mov [ebp],cx |
pop ebp |
; mov [ebp],cx |
add ebp,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jle @b |
.skip: |
add esi,SR |
dec edi |
jnz .nx |
.exit: |
sti |
popad |
retn |
.forced: |
jif eax,l,[viewport.left],.exit |
jif eax,ge,[viewport.right],.exit |
movsx ebx,word[esp+4*4+2] ; y start |
movsx edx,word[esp+4*4] ; y end |
jif ebx,e,edx,.exit |
jl @f |
xchg ebx,edx |
@@: jif edx,l,[viewport.top],.exit |
jif ebx,ge,[viewport.bottom],.exit |
jif ebx,ge,[viewport.top],@f |
mov ebx,[viewport.top] |
@@: jif edx,l,[viewport.bottom],@f |
mov edx,[viewport.bottom] |
dec edx |
@@: mov edi,1 |
jmp .draw |
dl.16.horz_line: |
test edi,1 |
jnz .forced |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
.nx: movsx ebx,word[esp+4*7+2] ; x start |
movsx edx,word[esp+4*7] ; x end |
cmp ebx,edx |
je .exit |
jl @f |
xchg ebx,edx |
@@: jif eax,l,[rr.top],.skip |
jif eax,ge,[rr.bottom],.skip |
jif edx,l,[rr.left],.skip |
jif ebx,ge,[rr.right],.skip |
jif ebx,ge,[rr.left],@f |
mov ebx,[rr.left] |
@@: jif edx,l,[rr.right],@f |
mov edx,[rr.right] |
dec edx |
.draw: |
@@: call is_intersect_hln |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,eax |
lea ebp,[ebp+ebx*2] |
add ebp,[lfb_address] |
@@: push ebp |
call [set_bank] |
test ecx,0x01000000 |
jz .dr |
mov cx,[ebp] |
not cx |
.dr: mov [ebp],cx |
pop ebp |
; mov [ebp],cx |
add ebp,2 |
inc ebx |
cmp ebx,edx |
jle @b |
.skip: |
add esi,SR |
dec edi |
jnz .nx |
.exit: |
sti |
popad |
retn |
.forced: |
jif eax,l,[viewport.top],.exit |
jif eax,ge,[viewport.bottom],.exit |
movsx ebx,word[esp+4*7+2] ; x start |
movsx edx,word[esp+4*7] ; x end |
cmp ebx,edx |
je .exit |
jl @f |
xchg ebx,edx |
@@: jif edx,l,[viewport.left],.exit |
jif ebx,ge,[viewport.right],.exit |
jif ebx,ge,[viewport.left],@f |
mov ebx,[viewport.left] |
@@: jif edx,l,[viewport.right],@f |
mov edx,[viewport.right] |
dec edx |
@@: mov edi,1 |
jmp .draw |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_put_pixel.16 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax = x coordinate |
; ebx = y coordinate |
; ecx = ?? RR GG BB ; 0x01000000 negation |
; edi = 0x00000001 force |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
mov edx,[bytes_per_scanline] |
imul edx,ebx |
lea edx,[edx+eax*2] |
add edx,[lfb_address] |
test edi,1 |
jnz .forced |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
@@: jif eax,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif ebx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
call get_cursor_rect |
call is_intersect_pt |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: push edx |
call [set_bank] |
pop edx |
test ecx,0x01000000 |
jz .lp1 |
not word[ebp] |
jmp .exit |
.lp1: shr ecx,3 |
shl cx,3 |
shr ecx,2 |
shl cl,2 |
shr ecx,3 |
mov [ebp],cx |
.exit: |
sti |
popad |
retn |
.skip: |
add esi,SR |
dec edi |
jnz @b |
jmp .exit |
.forced: |
jif eax,l,[viewport.left],.exit |
jif ebx,l,[viewport.top],.exit |
jif eax,ge,[viewport.right],.exit |
jif ebx,ge,[viewport.bottom],.exit |
test ecx,0x01000000 |
jz @f |
push edx |
call [set_bank] |
pop edx |
not word[ebp] |
jmp .exit |
@@: shr ecx,3 |
shl cx,3 |
shr ecx,2 |
shl cl,2 |
shr ecx,3 |
push edx |
call [set_bank] |
pop edx |
mov [ebp],cx |
jmp .exit |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_get_pixel.16 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax = x coordinate |
; ebx = y coordinate |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
imul ebx,[bytes_per_scanline] |
shl eax,1 |
add eax,ebx |
add eax,[lfb_address] |
push eax |
call [set_bank] |
pop eax |
movzx eax,word[ebp] |
shl eax,3 |
shr al,2 |
shl eax,2 |
shr ax,3 |
shl eax,3 |
and eax,0x00FFFFFF |
mov [esp+4*6],eax |
sti |
popad |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_put_image.16 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax(ebx) pointer to image in memory - RRGGBBRRGGBB.. |
; ebx(ecx) image size [x]*65536+[y] |
; ecx(edx) image position in window [x]*65536+[y] |
; ret: eax 0 succesful, 1 overlapped |
;----------------------------------------------------------------------------- |
begin |
mov eax,ebx |
mov ebx,ecx |
mov ecx,edx |
.direct: |
pushad |
cli |
jif ebx,z,0x0000FFFF,.exit,test |
jif ebx,z,0xFFFF0000,.exit,test |
call get_cursor_rect |
mov ebp,eax |
movsx eax,word[esp+4*6+2] |
movsx ebx,word[esp+4*6] |
movsx ecx,word[esp+4*4+2] |
movsx edx,word[esp+4*4] |
lea edi,[ecx*3] |
push edi |
add ecx,eax |
add edx,ebx |
mov edi,[0x00003010] |
movsx esi,word[edi-0x3000+0] |
add eax,esi |
add ecx,esi |
movsx esi,word[edi-0x3000+4] |
add ebx,esi |
add edx,esi |
; add eax,[esi-0x3000+0] |
; add ebx,[esi-0x3000+4] |
; add ecx,[esi-0x3000+0] |
; add edx,[esi-0x3000+4] |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
cld |
.nx: jif ecx,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
pushad |
jif eax,ge,[rr.left],@f |
mov eax,[rr.left] |
@@: jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif ecx,l,[rr.right],@f |
mov ecx,[rr.right] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
@@: call is_intersect_rc |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov esi,ebx |
sub esi,[esp+4*4] |
imul esi,[esp+4*8] |
mov edi,eax |
sub edi,[esp+4*7] |
lea edi,[edi*3] |
add esi,edi |
add esi,ebp |
mov edi,[bytes_per_scanline] |
imul edi,ebx |
lea edi,[edi+eax*2] |
add edi,[lfb_address] |
.xxx: push eax esi edi eax |
@@: lodsd |
shr eax,3 |
shl ax,3 |
shr eax,2 |
shl al,2 |
shr eax,3 |
push ebp edi |
call [set_bank] |
mov [ebp],ax |
pop edi ebp |
add edi,2 |
dec esi |
inc dword[esp] |
cmp [esp],ecx |
jl @b |
pop eax edi esi eax |
add esi,[esp+4*8] |
add edi,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jl .xxx |
popad |
.skip: |
add esi,SR |
dec edi |
jnz .nx |
.exit: |
add esp,4 |
sti |
popad |
xor eax,eax |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_draw_bg.16 ;///////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
begin |
pushad |
cmp byte[bg_type],BGT_TILE |
je .tiled |
mov eax,[bg_width] |
cmp eax,[screen_width] |
jne @f |
mov eax,[bg_height] |
cmp eax,[screen_height] |
je .tiled |
@@: |
imul eax,[bg_width],3 |
mov [bg_bytes_per_scanline],eax |
mov eax,[viewport.left] |
mov ebx,[viewport.top] |
mov ecx,[viewport.right] |
mov edx,[viewport.bottom] |
cmp [bg_width],1 |
jne @f |
cmp [bg_height],1 |
je .color |
@@: |
cli |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
mov esi,[CLIP_RECTS+4] |
mov ebp,[esi] |
or ebp,ebp |
jz .exit |
add esi,4 |
.nx: jif ecx,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
pushad |
jif eax,ge,[rr.left],@f |
mov eax,[rr.left] |
@@: jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif ecx,l,[rr.right],@f |
mov ecx,[rr.right] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
@@: ;call is_intersect_rc |
;jc .put |
;cmp [mouse_invisible],0 |
;jne .put |
;call [SF.draw_mouse_under] |
;mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,ebx |
lea ebp,[ebp+eax*2] |
add ebp,[lfb_address] |
.xxx: push eax ebp |
@@: push ebp |
call [set_bank] |
push eax edx |
mul [bg_width] |
div [screen_width] |
lea edi,[eax*3] |
mov eax,ebx |
mul [bg_height] |
div [screen_height] |
mul [bg_bytes_per_scanline] |
add edi,eax |
add edi,bg_address |
mov eax,[edi] |
shr eax,3 |
shl ax,3 |
shr eax,2 |
shl al,2 |
shr eax,3 |
mov [ebp],ax |
pop edx eax |
pop ebp |
inc ebp |
inc ebp |
inc eax |
cmp eax,ecx |
jl @b |
pop ebp eax |
add ebp,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jl .xxx |
popad |
.skip: |
add esi,SR |
dec ebp |
jnz .nx |
.exit: |
sti |
popad |
retn |
.tiled: |
mov eax,bg_address |
mov ebx,[bg_width-2] |
mov bx,word[bg_height] |
xor ecx,ecx |
.lp1: push eax |
call vm_mike_put_image.16.direct |
pop eax |
rol ecx,16 |
add cx,word[bg_width] |
cmp cx,word[screen_width] |
jae @f |
rol ecx,16 |
jmp .lp1 |
@@: shr ecx,16 |
add ecx,[bg_height] |
cmp ecx,[screen_height] |
jb .lp1 |
popad |
retn |
.color: |
mov edi,[bg_address] |
and edi,0x00FFFFFF |
call vm_mike_draw_rect.16 |
popad |
retn |
endf |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/kernel/branches/gfx_kernel/vmode/norm_24.inc |
---|
0,0 → 1,602 |
;----------------------------------------------------------------------------- |
func vm_mike_draw_rect.24 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax - x start |
; ebx - y start |
; ecx - x end |
; edx - y end |
; edi - color |
;----------------------------------------------------------------------------- |
;- eax(ebx) [x start]*65536 + [x size] |
;- ebx(ecx) [y start]*65536 + [y size] |
;- ecx(edx) color 0x00RRGGBB |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
jif eax,e,ecx,.exit |
jif ebx,e,edx,.exit |
call get_cursor_rect |
mov ebp,[0x3010] |
movsx esi,word[ebp-0x3000+0] |
add eax,esi |
add ecx,esi |
movsx esi,word[ebp-0x3000+4] |
add ebx,esi |
add edx,esi |
; add eax,[ebp-0x3000+0] |
; add ebx,[ebp-0x3000+4] |
; add ecx,[ebp-0x3000+0] |
; add edx,[ebp-0x3000+4] |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov ebp,[esi] |
or ebp,ebp |
jz .exit |
add esi,4 |
.nx: jif ecx,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
pushad |
jif eax,ge,[rr.left],@f |
mov eax,[rr.left] |
@@: jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif ecx,l,[rr.right],@f |
mov ecx,[rr.right] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
@@: call is_intersect_rc |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,ebx |
push eax |
lea eax,[eax*3] |
add ebp,eax |
pop eax |
add ebp,[lfb_address] |
.xxx: push eax ebp |
@@: push eax |
mov eax,edi |
mov [ebp],ax |
shr eax,16 |
mov [ebp+2],al |
pop eax |
add ebp,3 |
inc eax |
cmp eax,ecx |
jl @b |
pop ebp eax |
add ebp,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jl .xxx |
popad |
.skip: |
add esi,SR |
dec ebp |
jnz .nx |
.exit: |
sti |
popad |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_draw_line.24 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax(ebx) [x start] shl 16 + [x end] |
; ebx(ecx) [y start] shl 16 + [y end] |
; ecx(edx) colour 0x00RRGGBB |
; edi = 0x00000001 force |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
call get_cursor_rect |
movsx eax,word[esp+4*7] ; x end |
cmp ax,[esp+4*7+2] ; x start |
je dl.24.vert_line |
movsx eax,word[esp+4*4] ; y end |
cmp ax,[esp+4*4+2] ; y start |
je dl.24.horz_line |
sti |
popad |
retn |
dl.24.vert_line: |
test edi,1 |
jnz .forced |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
.nx: movsx ebx,word[esp+4*4+2] ; y start |
movsx edx,word[esp+4*4] ; y end |
cmp ebx,edx |
je .exit |
jl @f |
xchg ebx,edx |
@@: jif eax,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
dec edx |
.draw: |
@@: call is_intersect_vln |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,ebx |
push eax |
lea eax,[eax*3] |
add ebp,eax |
pop eax |
add ebp,[lfb_address] |
@@: test ecx,0x01000000 |
jz .dr |
mov ecx,[ebp] |
not ecx |
or ecx,0x01000000 |
.dr: mov [ebp],cx |
ror ecx,8 |
mov [ebp+2],ch |
rol ecx,8 |
add ebp,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jle @b |
.skip: |
add esi,SR |
dec edi |
jnz .nx |
.exit: |
sti |
popad |
retn |
.forced: |
jif eax,l,[viewport.left],.exit |
jif eax,ge,[viewport.right],.exit |
movsx ebx,word[esp+4*4+2] ; y start |
movsx edx,word[esp+4*4] ; y end |
jif ebx,e,edx,.exit |
jl @f |
xchg ebx,edx |
@@: jif edx,l,[viewport.top],.exit |
jif ebx,ge,[viewport.bottom],.exit |
jif ebx,ge,[viewport.top],@f |
mov ebx,[viewport.top] |
@@: jif edx,l,[viewport.bottom],@f |
mov edx,[viewport.bottom] |
dec edx |
@@: mov edi,1 |
jmp .draw |
dl.24.horz_line: |
test edi,1 |
jnz .forced |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
.nx: movsx ebx,word[esp+4*7+2] ; x start |
movsx edx,word[esp+4*7] ; x end |
cmp ebx,edx |
je .exit |
jl @f |
xchg ebx,edx |
@@: jif eax,l,[rr.top],.skip |
jif eax,ge,[rr.bottom],.skip |
jif edx,l,[rr.left],.skip |
jif ebx,ge,[rr.right],.skip |
jif ebx,ge,[rr.left],@f |
mov ebx,[rr.left] |
@@: jif edx,l,[rr.right],@f |
mov edx,[rr.right] |
dec edx |
.draw: |
@@: call is_intersect_hln |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,eax |
push eax |
lea eax,[ebx*3] |
add ebp,eax |
pop eax |
add ebp,[lfb_address] |
@@: test ecx,0x01000000 |
jz .dr |
mov ecx,[ebp] |
not ecx |
or ecx,0x01000000 |
.dr: mov [ebp],cx |
ror ecx,8 |
mov [ebp+2],ch |
rol ecx,8 |
add ebp,3 |
inc ebx |
cmp ebx,edx |
jle @b |
.skip: |
add esi,SR |
dec edi |
jnz .nx |
.exit: |
sti |
popad |
retn |
.forced: |
jif eax,l,[viewport.top],.exit |
jif eax,ge,[viewport.bottom],.exit |
movsx ebx,word[esp+4*7+2] ; x start |
movsx edx,word[esp+4*7] ; x end |
cmp ebx,edx |
je .exit |
jl @f |
xchg ebx,edx |
@@: jif edx,l,[viewport.left],.exit |
jif ebx,ge,[viewport.right],.exit |
jif ebx,ge,[viewport.left],@f |
mov ebx,[viewport.left] |
@@: jif edx,l,[viewport.right],@f |
mov edx,[viewport.right] |
dec edx |
@@: mov edi,1 |
jmp .draw |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_put_pixel.24 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax = x coordinate |
; ebx = y coordinate |
; ecx = ?? RR GG BB ; 0x01000000 negation |
; edi = 0x00000001 force |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
mov edx,[bytes_per_scanline] |
imul edx,ebx |
add edx,eax ; lea esi,[eax*3] |
lea edx,[edx+eax*2] ; add edx,esi |
add edx,[lfb_address] |
test ecx,0x01000000 |
jz @f |
mov ecx,[edx] |
not ecx |
@@: test edi,1 |
jnz .forced |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
@@: jif eax,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif ebx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
call get_cursor_rect |
call is_intersect_pt |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov [edx],cx |
shr ecx,16 |
mov [edx+2],cl |
.exit: |
sti |
popad |
retn |
.skip: |
add esi,SR |
dec edi |
jnz @b |
jmp .exit |
.forced: |
jif eax,l,[viewport.left],.exit |
jif ebx,l,[viewport.top],.exit |
jif eax,ge,[viewport.right],.exit |
jif ebx,ge,[viewport.bottom],.exit |
mov [edx],cx |
shr ecx,16 |
mov [edx+2],cl |
sti |
popad |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_get_pixel.24 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax = x coordinate |
; ebx = y coordinate |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
imul ebx,[bytes_per_scanline] |
lea eax,[eax*3] |
add eax,ebx |
add eax,[lfb_address] |
mov eax,[eax] |
and eax,0x00FFFFFF |
mov [esp+4*6],eax |
sti |
popad |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_put_image.24 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax(ebx) pointer to image in memory - RRGGBBRRGGBB.. |
; ebx(ecx) image size [x]*65536+[y] |
; ecx(edx) image position in window [x]*65536+[y] |
; ret: eax 0 succesful, 1 overlapped |
;----------------------------------------------------------------------------- |
begin |
mov eax,ebx |
mov ebx,ecx |
mov ecx,edx |
.direct: |
pushad |
cli |
jif ebx,z,0x0000FFFF,.exit,test |
jif ebx,z,0xFFFF0000,.exit,test |
call get_cursor_rect |
mov ebp,eax |
movsx eax,word[esp+4*6+2] |
movsx ebx,word[esp+4*6] |
movsx ecx,word[esp+4*4+2] |
movsx edx,word[esp+4*4] |
lea edi,[ecx*3] |
push edi |
add ecx,eax |
add edx,ebx |
mov edi,[0x00003010] |
movsx esi,word[edi-0x3000+0] |
add eax,esi |
add ecx,esi |
movsx esi,word[edi-0x3000+4] |
add ebx,esi |
add edx,esi |
; add eax,[edi-0x3000+0] |
; add ebx,[edi-0x3000+4] |
; add ecx,[edi-0x3000+0] |
; add edx,[edi-0x3000+4] |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
cld |
.nx: jif ecx,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
pushad |
jif eax,ge,[rr.left],@f |
mov eax,[rr.left] |
@@: jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif ecx,l,[rr.right],@f |
mov ecx,[rr.right] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
@@: call is_intersect_rc |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov esi,ebx |
sub esi,[esp+4*4] |
imul esi,[esp+4*8] |
mov edi,eax |
sub edi,[esp+4*7] |
lea edi,[edi*3] |
add esi,edi |
add esi,ebp |
mov edi,[bytes_per_scanline] |
imul edi,ebx |
push eax |
lea eax,[eax*3] |
add edi,eax |
pop eax |
add edi,[lfb_address] |
.xxx: push eax esi edi eax |
@@: ;movsd |
;dec esi |
;dec edi |
movsw |
movsb |
inc dword[esp] |
cmp [esp],ecx |
jl @b |
pop eax edi esi eax |
add esi,[esp+4*8] |
add edi,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jl .xxx |
popad |
.skip: |
add esi,SR |
dec edi |
jnz .nx |
.exit: |
add esp,4 |
sti |
popad |
xor eax,eax |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_draw_bg.24 ;///////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
begin |
pushad |
cmp byte[bg_type],BGT_TILE |
je .tiled |
mov eax,[bg_width] |
cmp eax,[screen_width] |
jne @f |
mov eax,[bg_height] |
cmp eax,[screen_height] |
je .tiled |
@@: |
imul eax,[bg_width],3 |
mov [bg_bytes_per_scanline],eax |
mov eax,[viewport.left] |
mov ebx,[viewport.top] |
mov ecx,[viewport.right] |
mov edx,[viewport.bottom] |
cmp [bg_width],1 |
jne @f |
cmp [bg_height],1 |
je .color |
@@: |
cli |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
mov esi,[CLIP_RECTS+4] |
mov ebp,[esi] |
or ebp,ebp |
jz .exit |
add esi,4 |
.nx: jif ecx,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
pushad |
jif eax,ge,[rr.left],@f |
mov eax,[rr.left] |
@@: jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif ecx,l,[rr.right],@f |
mov ecx,[rr.right] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
@@: ;call is_intersect_rc |
;jc .put |
;cmp [mouse_invisible],0 |
;jne .put |
;call [SF.draw_mouse_under] |
;mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,ebx |
push eax |
lea eax,[eax*3] |
add ebp,eax |
pop eax |
add ebp,[lfb_address] |
.xxx: push eax ebp |
@@: push ebp |
call [set_bank] |
push eax edx |
mul [bg_width] |
div [screen_width] |
lea edi,[eax*3] |
mov eax,ebx |
mul [bg_height] |
div [screen_height] |
mul [bg_bytes_per_scanline] |
add edi,eax |
add edi,bg_address |
mov eax,[edi] |
mov [ebp],eax |
pop edx eax |
pop ebp |
add ebp,3 |
inc eax |
cmp eax,ecx |
jl @b |
pop ebp eax |
add ebp,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jl .xxx |
popad |
.skip: |
add esi,SR |
dec ebp |
jnz .nx |
.exit: |
sti |
popad |
retn |
.tiled: |
mov eax,bg_address |
mov ebx,[bg_width-2] |
mov bx,word[bg_height] |
xor ecx,ecx |
.lp1: push eax |
call vm_mike_put_image.24.direct |
pop eax |
rol ecx,16 |
add cx,word[bg_width] |
cmp cx,word[screen_width] |
jae @f |
rol ecx,16 |
jmp .lp1 |
@@: shr ecx,16 |
add ecx,[bg_height] |
cmp ecx,[screen_height] |
jb .lp1 |
popad |
retn |
.color: |
mov edi,[bg_address] |
and edi,0x00FFFFFF |
call vm_mike_draw_rect.24 |
popad |
retn |
endf |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/kernel/branches/gfx_kernel/vmode/norm_32.inc |
---|
0,0 → 1,617 |
;----------------------------------------------------------------------------- |
func vm_mike_draw_rect.32 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax - x start |
; ebx - y start |
; ecx - x end |
; edx - y end |
; edi - color |
;----------------------------------------------------------------------------- |
;- eax(ebx) [x start]*65536 + [x size] |
;- ebx(ecx) [y start]*65536 + [y size] |
;- ecx(edx) color 0x00RRGGBB |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
jif eax,e,ecx,.exit |
jif ebx,e,edx,.exit |
call get_cursor_rect |
mov ebp,[0x3010] |
movsx esi,word[ebp-0x3000+0] |
add eax,esi |
add ecx,esi |
movsx esi,word[ebp-0x3000+4] |
add ebx,esi |
add edx,esi |
; add eax,[ebp-0x3000+0] |
; add ebx,[ebp-0x3000+4] |
; add ecx,[ebp-0x3000+0] |
; add edx,[ebp-0x3000+4] |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov ebp,[esi] |
or ebp,ebp |
jz .exit |
add esi,4 |
.nx: jif ecx,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
pushad |
jif eax,ge,[rr.left],@f |
mov eax,[rr.left] |
@@: jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif ecx,l,[rr.right],@f |
mov ecx,[rr.right] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
@@: call is_intersect_rc |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,ebx |
lea ebp,[ebp+eax*4] |
add ebp,[lfb_address] |
.xxx: push eax ebp |
@@: push ebp |
call [set_bank] |
mov [ebp],edi |
pop ebp |
; mov [ebp],edi |
add ebp,4 |
inc eax |
cmp eax,ecx |
jl @b |
pop ebp eax |
add ebp,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jl .xxx |
popad |
.skip: |
add esi,SR |
dec ebp |
jnz .nx |
.exit: |
sti |
popad |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_draw_line.32 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax(ebx) [x start] shl 16 + [x end] |
; ebx(ecx) [y start] shl 16 + [y end] |
; ecx(edx) colour 0x00RRGGBB |
; edi = 0x00000001 force |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
call get_cursor_rect |
movsx eax,word[esp+4*7] ; x end |
cmp ax,[esp+4*7+2] ; x start |
je dl.32.vert_line |
movsx eax,word[esp+4*4] ; y end |
cmp ax,[esp+4*4+2] ; y start |
je dl.32.horz_line |
sti |
popad |
retn |
dl.32.vert_line: |
test edi,1 |
jnz .forced |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
.nx: movsx ebx,word[esp+4*4+2] ; y start |
movsx edx,word[esp+4*4] ; y end |
cmp ebx,edx |
je .exit |
jl @f |
xchg ebx,edx |
@@: jif eax,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
dec edx |
.draw: |
@@: call is_intersect_vln |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,ebx |
lea ebp,[ebp+eax*4] |
add ebp,[lfb_address] |
@@: push ebp |
call [set_bank] |
test ecx,0x01000000 |
jz .dr |
mov ecx,[ebp] |
not ecx |
or ecx,0x01000000 |
.dr: mov [ebp],ecx |
pop ebp |
; test ecx,0x01000000 |
; jz .dr |
; mov ecx,[ebp] |
; not ecx |
; or ecx,0x01000000 |
; .dr: mov [ebp],ecx |
add ebp,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jle @b |
.skip: |
add esi,SR |
dec edi |
jnz .nx |
.exit: |
sti |
popad |
retn |
.forced: |
jif eax,l,[viewport.left],.exit |
jif eax,ge,[viewport.right],.exit |
movsx ebx,word[esp+4*4+2] ; y start |
movsx edx,word[esp+4*4] ; y end |
jif ebx,e,edx,.exit |
jl @f |
xchg ebx,edx |
@@: jif edx,l,[viewport.top],.exit |
jif ebx,ge,[viewport.bottom],.exit |
jif ebx,ge,[viewport.top],@f |
mov ebx,[viewport.top] |
@@: jif edx,l,[viewport.bottom],@f |
mov edx,[viewport.bottom] |
dec edx |
@@: mov edi,1 |
jmp .draw |
dl.32.horz_line: |
test edi,1 |
jnz .forced |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
.nx: movsx ebx,word[esp+4*7+2] ; x start |
movsx edx,word[esp+4*7] ; x end |
cmp ebx,edx |
je .exit |
jl @f |
xchg ebx,edx |
@@: jif eax,l,[rr.top],.skip |
jif eax,ge,[rr.bottom],.skip |
jif edx,l,[rr.left],.skip |
jif ebx,ge,[rr.right],.skip |
jif ebx,ge,[rr.left],@f |
mov ebx,[rr.left] |
@@: jif edx,l,[rr.right],@f |
mov edx,[rr.right] |
dec edx |
.draw: |
@@: call is_intersect_hln |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,eax |
lea ebp,[ebp+ebx*4] |
add ebp,[lfb_address] |
@@: push ebp |
call [set_bank] |
test ecx,0x01000000 |
jz .dr |
mov ecx,[ebp] |
not ecx |
or ecx,0x01000000 |
.dr: mov [ebp],ecx |
pop ebp |
; test ecx,0x01000000 |
; jz .dr |
; mov ecx,[ebp] |
; not ecx |
; or ecx,0x01000000 |
; .dr: mov [ebp],ecx |
add ebp,4 |
inc ebx |
cmp ebx,edx |
jle @b |
.skip: |
add esi,SR |
dec edi |
jnz .nx |
.exit: |
sti |
popad |
retn |
.forced: |
jif eax,l,[viewport.top],.exit |
jif eax,ge,[viewport.bottom],.exit |
movsx ebx,word[esp+4*7+2] ; x start |
movsx edx,word[esp+4*7] ; x end |
cmp ebx,edx |
je .exit |
jl @f |
xchg ebx,edx |
@@: jif edx,l,[viewport.left],.exit |
jif ebx,ge,[viewport.right],.exit |
jif ebx,ge,[viewport.left],@f |
mov ebx,[viewport.left] |
@@: jif edx,l,[viewport.right],@f |
mov edx,[viewport.right] |
dec edx |
@@: mov edi,1 |
jmp .draw |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_put_pixel.32 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax = x coordinate |
; ebx = y coordinate |
; ecx = ?? RR GG BB ; 0x01000000 negation |
; edi = 0x00000001 force |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
mov edx,[bytes_per_scanline] |
imul edx,ebx |
lea edx,[edx+eax*4] |
add edx,[lfb_address] |
; test ecx,0x01000000 |
; jz @f |
; mov ecx,[edx] |
; not ecx |
@@: test edi,1 |
jnz .forced |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
@@: jif eax,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif ebx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
call get_cursor_rect |
call is_intersect_pt |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: push edx |
call [set_bank] |
pop edx |
test ecx,0x01000000 |
jz .lp1 |
not dword[ebp] |
jmp .exit |
.lp1: mov [ebp],ecx |
.exit: |
sti |
popad |
retn |
.skip: |
add esi,SR |
dec edi |
jnz @b |
jmp .exit |
.forced: |
jif eax,l,[viewport.left],.exit |
jif ebx,l,[viewport.top],.exit |
jif eax,ge,[viewport.right],.exit |
jif ebx,ge,[viewport.bottom],.exit |
push edx |
call [set_bank] |
pop edx |
test ecx,0x01000000 |
jz .lp2 |
not dword[ebp] |
jmp .exit |
.lp2: mov [ebp],ecx |
jmp .exit |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_get_pixel.32 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax = x coordinate |
; ebx = y coordinate |
;----------------------------------------------------------------------------- |
begin |
pushad |
cli |
imul ebx,[bytes_per_scanline] |
shl eax,2 |
add eax,ebx |
add eax,[lfb_address] |
push eax |
call [set_bank] |
pop eax |
mov eax,[ebp] |
and eax,0x00FFFFFF |
mov [esp+4*6],eax |
sti |
popad |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_put_image.32 ;/////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; eax(ebx) pointer to image in memory - RRGGBBRRGGBB.. |
; ebx(ecx) image size [x]*65536+[y] |
; ecx(edx) image position in window [x]*65536+[y] |
; ret: eax 0 succesful, 1 overlapped |
;----------------------------------------------------------------------------- |
begin |
mov eax,ebx |
mov ebx,ecx |
mov ecx,edx |
.direct: |
pushad |
cli |
jif ebx,z,0x0000FFFF,.exit,test |
jif ebx,z,0xFFFF0000,.exit,test |
call get_cursor_rect |
mov ebp,eax |
movsx eax,word[esp+4*6+2] |
movsx ebx,word[esp+4*6] |
movsx ecx,word[esp+4*4+2] |
movsx edx,word[esp+4*4] |
lea edi,[ecx*3] |
push edi |
add ecx,eax |
add edx,ebx |
mov edi,[0x00003010] |
movsx esi,word[edi-0x3000+0] |
add eax,esi |
add ecx,esi |
movsx esi,word[edi-0x3000+4] |
add ebx,esi |
add edx,esi |
; add eax,[esi-0x3000+0] |
; add ebx,[esi-0x3000+4] |
; add ecx,[esi-0x3000+0] |
; add edx,[esi-0x3000+4] |
; cmp eax,640 |
; jb @f |
; SHFLOW '%x %x %x %x',eax,ebx,ecx,edx |
; @@: |
mov esi,[0x00003000] |
mov esi,[CLIP_RECTS+esi*4] |
mov edi,[esi] |
or edi,edi |
jz .exit |
add esi,4 |
cld |
.nx: jif ecx,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
pushad |
jif eax,ge,[rr.left],@f |
mov eax,[rr.left] |
@@: jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif ecx,l,[rr.right],@f |
mov ecx,[rr.right] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
@@: call is_intersect_rc |
jc .put |
cmp [mouse_invisible],0 |
jne .put |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
.put: mov esi,ebx |
sub esi,[esp+4*4] |
imul esi,[esp+4*8] |
mov edi,eax |
sub edi,[esp+4*7] |
lea edi,[edi*3] |
add esi,edi |
add esi,ebp |
mov edi,[bytes_per_scanline] |
imul edi,ebx |
lea edi,[edi+eax*4] |
add edi,[lfb_address] |
.xxx: push eax esi edi eax |
@@: lodsd |
push ebp edi |
call [set_bank] |
mov [ebp],eax |
pop edi ebp |
add edi,4 |
dec esi |
inc dword[esp] |
cmp [esp],ecx |
jl @b |
pop eax edi esi eax |
add esi,[esp+4*8] |
add edi,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jl .xxx |
popad |
.skip: |
add esi,SR |
dec edi |
jnz .nx |
.exit: |
add esp,4 |
sti |
popad |
xor eax,eax |
retn |
endf |
;----------------------------------------------------------------------------- |
func vm_mike_draw_bg.32 ;///////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
begin |
pushad |
cmp byte[bg_type],BGT_TILE |
je .tiled |
mov eax,[bg_width] |
cmp eax,[screen_width] |
jne @f |
mov eax,[bg_height] |
cmp eax,[screen_height] |
je .tiled |
@@: |
imul eax,[bg_width],3 |
mov [bg_bytes_per_scanline],eax |
mov eax,[viewport.left] |
mov ebx,[viewport.top] |
mov ecx,[viewport.right] |
mov edx,[viewport.bottom] |
cmp [bg_width],1 |
jne @f |
cmp [bg_height],1 |
je .color |
@@: |
cli |
call [SF.draw_mouse_under] |
mov [mouse_invisible],1 |
mov esi,[CLIP_RECTS+4] |
mov ebp,[esi] |
or ebp,ebp |
jz .exit |
add esi,4 |
.nx: jif ecx,l,[rr.left],.skip |
jif eax,ge,[rr.right],.skip |
jif edx,l,[rr.top],.skip |
jif ebx,ge,[rr.bottom],.skip |
pushad |
jif eax,ge,[rr.left],@f |
mov eax,[rr.left] |
@@: jif ebx,ge,[rr.top],@f |
mov ebx,[rr.top] |
@@: jif ecx,l,[rr.right],@f |
mov ecx,[rr.right] |
@@: jif edx,l,[rr.bottom],@f |
mov edx,[rr.bottom] |
@@: ;call is_intersect_rc |
;jc .put |
;cmp [mouse_invisible],0 |
;jne .put |
;call [SF.draw_mouse_under] |
;mov [mouse_invisible],1 |
.put: mov ebp,[bytes_per_scanline] |
imul ebp,ebx |
lea ebp,[ebp+eax*4] |
add ebp,[lfb_address] |
.xxx: push eax ebp |
@@: push ebp |
call [set_bank] |
push eax edx |
mul [bg_width] |
div [screen_width] |
lea edi,[eax*3] |
mov eax,ebx |
mul [bg_height] |
div [screen_height] |
mul [bg_bytes_per_scanline] |
add edi,eax |
add edi,bg_address |
mov eax,[edi] |
mov [ebp],eax |
pop edx eax |
pop ebp |
add ebp,4 |
inc eax |
cmp eax,ecx |
jl @b |
pop ebp eax |
add ebp,[bytes_per_scanline] |
inc ebx |
cmp ebx,edx |
jl .xxx |
popad |
.skip: |
add esi,SR |
dec ebp |
jnz .nx |
.exit: |
sti |
popad |
retn |
.tiled: |
mov eax,bg_address |
mov ebx,[bg_width-2] |
mov bx,word[bg_height] |
xor ecx,ecx |
.lp1: push eax |
call vm_mike_put_image.32.direct |
pop eax |
rol ecx,16 |
add cx,word[bg_width] |
cmp cx,word[screen_width] |
jae @f |
rol ecx,16 |
jmp .lp1 |
@@: shr ecx,16 |
add ecx,[bg_height] |
cmp ecx,[screen_height] |
jb .lp1 |
popad |
retn |
.color: |
mov edi,[bg_address] |
and edi,0x00FFFFFF |
call vm_mike_draw_rect.32 |
popad |
retn |
endf |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/kernel/branches/gfx_kernel/vmode/normal.asm |
---|
0,0 → 1,643 |
;----------------------------------------------------------------------------- |
;///// PART OF ATi RADEON 9000 DRIVER //////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; Copyright (c) 2004, mike.dld |
; Using BeOS driver - Copyright (c) 2002, Thomas Kurschel |
;----------------------------------------------------------------------------- |
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
; DEALINGS IN THE SOFTWARE. |
;----------------------------------------------------------------------------- |
DRIVER_CODE_START: |
;----------------------------------------------------------------------------- |
include 'normal.inc' |
include 'clipping.asm' |
;----------------------------------------------------------------------------- |
struct graph_funcs |
draw_line dd ? |
disable_mouse dd ? |
draw_pointer dd ? |
draw_mouse_under dd ? |
drawbar dd ? |
putpixel dd ? |
getpixel dd ? |
sys_putimage dd ? |
drawbackground dd ? |
calculatescreen dd ? |
setscreen dd ? |
ends |
SF graph_funcs |
call_cnt dd 0 |
viewport RECT |
set_bank dd set_bank1 |
setbnk dd set_bank0,set_bank1,set_s3_bank,set_bank3 |
virtual at esi |
rr RECT |
end virtual |
virtual at 0x00010008 |
GF graph_funcs |
end virtual |
;----------------------------------------------------------------------------- |
CLIP_RECTS = 0x00720000 ; 0x00780000 |
bg_address = 0x300000 |
;label bg_bytes_per_scanline dword at 0x600000-16;0x460000-16 |
;label bg_type dword at 0x600000-12;0x460000-12 |
;label bg_width dword at 0x600000-8;0x460000-8 |
;label bg_height dword at 0x600000-4;0x460000-4 |
label bg_bytes_per_scanline dword at 0x460000-16 |
label bg_type dword at 0x460000-12 |
label bg_width dword at 0x460000-8 |
label bg_height dword at 0x460000-4 |
label lfb_address dword at 0x0000FE80 |
label mouse_invisible dword at 0x0000F204 |
label screen_width dword at 0x0000FE00 |
label screen_height dword at 0x0000FE04 |
label bytes_per_scanline dword at 0x0000FE08 |
BGT_TILE = 1 |
BGT_STRETCH = 2 |
;----------------------------------------------------------------------------- |
CRTC_INDX equ 3D4h |
func vm_mike_init |
begin |
; jif dword[mdrvm],e,0,.exit |
mov eax,[0x00010004] |
jif eax,e,'ENUE',.exit |
jif [call_cnt],a,0,.exit.2 |
add eax, 0x00010000 |
mov [systlb],eax |
; SHFLOW 'System funcs table offset: 0x%x',eax |
;-------------------------------------- |
mov esi,0x00010008 |
mov edi,SF |
mov ecx,sizeof.graph_funcs/4 |
cld |
rep movsd |
; push dword[0x00003000] |
; mov dword[0x00003000],1 |
; call [SF.disable_mouse] |
; pop dword[0x00003000] |
mov [viewport.left],0 |
mov [viewport.top],0 |
m2m [viewport.right],[0x0000FE00] |
m2m [viewport.bottom],[0x0000FE04] |
movzx eax,byte[0xE035] |
cmp byte[0xE034],'2' |
jb @f |
mov al,0 |
@@: mov eax,[setbnk+eax*4] |
mov [set_bank],eax |
mov al,[0xFBF1] |
cmp al,32 |
jne @f |
; SHFLOW 'Driver initialized in 32-bit mode' |
mov [GF.draw_line],vm_mike_draw_line.32 |
;; mov [GF.disable_mouse],vm_mike_disable_mouse.32 |
;; mov [GF.draw_pointer],vm_mike_draw_pointer.32 |
mov [GF.drawbar],vm_mike_draw_rect.32 |
mov [GF.putpixel],vm_mike_put_pixel.32 |
mov [GF.getpixel],vm_mike_get_pixel.32 |
mov [GF.sys_putimage],vm_mike_put_image.32 |
mov [GF.drawbackground],vm_mike_draw_bg.32 |
jmp .exit.2 |
@@: cmp al,24 |
jne @f |
; SHFLOW 'Driver initialized in 24-bit mode' |
mov [GF.draw_line],vm_mike_draw_line.24 |
; mov [GF.disable_mouse],vm_mike_disable_mouse.24 |
; mov [GF.draw_pointer],vm_mike_draw_pointer.24 |
mov [GF.drawbar],vm_mike_draw_rect.24 |
mov [GF.putpixel],vm_mike_put_pixel.24 |
mov [GF.getpixel],vm_mike_get_pixel.24 |
mov [GF.sys_putimage],vm_mike_put_image.24 |
mov [GF.drawbackground],vm_mike_draw_bg.24 |
jmp .exit.2 |
@@: cmp al,16 |
jne @f |
; SHFLOW 'Driver initialized in 16-bit mode' |
mov [GF.draw_line],vm_mike_draw_line.16 |
; mov [GF.disable_mouse],vm_mike_disable_mouse.16 |
; mov [GF.draw_pointer],vm_mike_draw_pointer.16 |
mov [GF.drawbar],vm_mike_draw_rect.16 |
mov [GF.putpixel],vm_mike_put_pixel.16 |
mov [GF.getpixel],vm_mike_get_pixel.16 |
mov [GF.sys_putimage],vm_mike_put_image.16 |
mov [GF.drawbackground],vm_mike_draw_bg.16 |
jmp .exit.2 |
@@: cmp al,15 |
jne @f |
; SHFLOW 'Driver initialized in 15-bit mode' |
mov [GF.draw_line],vm_mike_draw_line.15 |
; mov [GF.disable_mouse],vm_mike_disable_mouse.15 |
; mov [GF.draw_pointer],vm_mike_draw_pointer.15 |
mov [GF.drawbar],vm_mike_draw_rect.15 |
mov [GF.putpixel],vm_mike_put_pixel.15 |
mov [GF.getpixel],vm_mike_get_pixel.15 |
mov [GF.sys_putimage],vm_mike_put_image.15 |
mov [GF.drawbackground],vm_mike_draw_bg.15 |
jmp .exit.2 |
@@: cmp al,8 |
jne @f |
; SHFLOW 'Driver initialized in 8-bit mode' |
call setup_palette_8 |
mov [GF.draw_line],vm_mike_draw_line.08 |
; mov [GF.disable_mouse],vm_mike_disable_mouse.08 |
; mov [GF.draw_pointer],vm_mike_draw_pointer.08 |
mov [GF.drawbar],vm_mike_draw_rect.08 |
mov [GF.putpixel],vm_mike_put_pixel.08 |
mov [GF.getpixel],vm_mike_get_pixel.08 |
mov [GF.sys_putimage],vm_mike_put_image.08 |
mov [GF.drawbackground],vm_mike_draw_bg.08 |
jmp .exit.2 |
@@: cmp al,4 |
jne .exit |
; SHFLOW 'Driver initialized in 4-bit mode' |
mov [GF.draw_line],vm_mike_draw_line.04 |
; mov [GF.disable_mouse],vm_mike_disable_mouse.04 |
; mov [GF.draw_pointer],vm_mike_draw_pointer.04 |
mov [GF.drawbar],vm_mike_draw_rect.04 |
mov [GF.putpixel],vm_mike_put_pixel.04 |
mov [GF.getpixel],vm_mike_get_pixel.04 |
mov [GF.sys_putimage],vm_mike_put_image.04 |
mov [GF.drawbackground],vm_mike_draw_bg.04 |
;-------------------------------------- |
.exit.2: |
mov [GF.calculatescreen],vm_mike_calculatescreen |
mov [GF.setscreen],vm_mike_setscreen |
inc [call_cnt] |
xor eax,eax |
.exit.3: |
retn |
.exit: |
xor eax,eax |
dec eax |
retn |
endf |
func vm_mike_calculatescreen |
begin |
; call [SF.calculatescreen] |
.direct: |
pushad |
cli |
movzx ecx,word[0x00003004] ; number of processes |
lea edi,[CLIP_RECTS+ecx*4+4] |
push dword[0x00003000] |
xor eax,eax |
.next_window: |
inc eax |
push ecx ebx eax edi |
mov [0x00003000],ax |
call calc_clipping_rects |
pop edi eax ebx |
mov [CLIP_RECTS+eax*4],edi |
mov [edi],ecx |
add edi,4 |
shl ecx,2 |
rep movsd |
pop ecx |
loop .next_window |
pop dword[0x00003000] |
sti |
popad |
ret |
endf |
func vm_mike_setscreen |
begin |
; call [SF.setscreen] |
call vm_mike_calculatescreen.direct |
ret |
endf |
func vm_mike_uninit |
begin |
; jif dword[mdrvm],e,0,.exit |
jif [call_cnt],nz,,.exit.2,dec |
mov esi,SF |
mov edi,GF |
mov ecx,sizeof.graph_funcs/4 |
rep movsd |
.exit.2: |
xor eax,eax |
retn |
.exit: |
xor eax,eax |
dec eax |
retn |
endf |
;----------------------------------------------------------------------------- |
include 'norm_04.inc' |
include 'norm_08.inc' |
include 'norm_15.inc' |
include 'norm_16.inc' |
include 'norm_24.inc' |
include 'norm_32.inc' |
;----------------------------------------------------------------------------- |
func is_intersect_rc |
begin |
jif ecx,l,[tr.left],.exit |
jif edx,l,[tr.top],.exit |
jif ebx,ge,[tr.bottom],.exit |
jif eax,ge,[tr.right],.exit |
clc |
ret |
.exit: |
stc |
ret |
endf |
func is_intersect_hln |
begin |
jif edx,l,[tr.left],.exit |
jif eax,l,[tr.top],.exit |
jif eax,ge,[tr.bottom],.exit |
jif ebx,ge,[tr.right],.exit |
clc |
ret |
.exit: |
stc |
ret |
endf |
func is_intersect_vln |
begin |
jif eax,l,[tr.left],.exit |
jif edx,l,[tr.top],.exit |
jif ebx,ge,[tr.bottom],.exit |
jif eax,ge,[tr.right],.exit |
clc |
ret |
.exit: |
stc |
ret |
endf |
func is_intersect_pt |
begin |
jif eax,l,[tr.left],.exit |
jif ebx,l,[tr.top],.exit |
jif ebx,ge,[tr.bottom],.exit |
jif eax,ge,[tr.right],.exit |
clc |
ret |
.exit: |
stc |
ret |
endf |
func get_cursor_rect |
begin |
push eax |
movsx eax,word[0x0000FB0A] |
mov [tr.left],eax |
add eax,31 |
mov [tr.right],eax |
movsx eax,word[0x0000FB0C] |
mov [tr.top],eax |
add eax,31 |
mov [tr.bottom],eax |
pop eax |
ret |
endf |
;----------------------------------------------------------------------------- |
gamma_4_0 = 0x00 |
gamma_4_1 = 0x1F |
gamma_4_2 = 0x2F |
gamma_4_3 = 0x3F |
align 16 |
palette_8_64 rb 256*3 |
palette_8_256 rb 256*3 |
rept 4 red:0 |
{ |
\rept 4 green:0 |
\{ |
\\rept 4 blue:0 |
\\{ |
index = ((red shl 4) or (green shl 2) or blue)*3 |
store gamma_4_ #red at palette_8_64+index+0 |
store gamma_4_ \#green at palette_8_64+index+1 |
store gamma_4_\\#blue at palette_8_64+index+2 |
store gamma_4_ #red *4+red at palette_8_256+index+0 |
store gamma_4_ \#green*4+green at palette_8_256+index+1 |
store gamma_4_\\#blue *4+blue at palette_8_256+index+2 |
\\} |
\} |
} |
;rept 64 clr1:0 |
;{ |
; index = clr1*3+64*3 |
; clr2 = clr*4+(clr shr 4) |
; store clr1 at palette_8_64 +index |
; store clr2 at palette_8_256+index |
; index = index + 64*3 + 1 |
; store clr1 at palette_8_64 +index |
; store clr2 at palette_8_256+index |
; index = index + 64*3 + 1 |
; store clr1 at palette_8_64 +index |
; store clr2 at palette_8_256+index |
;} |
func setup_palette_8 |
begin |
mov edx,0x03C8 |
xor al,al |
out dx,al |
mov ecx,256*3 |
mov edx,0x03C9 |
mov esi,palette_8_64 |
cld |
rep outsb |
ret |
endf |
;----------------------------------------------------------------------------- |
func set_bank0 |
begin |
mov ebp,[esp+4*1] |
ret |
endf |
; i810/i815 |
; by Protopopius |
func set_bank1 |
begin |
cli |
push eax edx |
mov eax,[esp+4*3] |
mov ebp,eax |
shr eax,16 |
sub al,0x0A |
cmp al,[0xfff2] |
je .exit |
mov [0xfff2],al |
mov dx,3CEh |
mov ah,al ; Save value for later use |
mov al,10h ; Index GR10 (Address Mapping) |
out dx,al ; Select GR10 |
inc dl |
mov al,3 ; Set bits 0 and 1 (Enable linear page mapping) |
out dx,al ; Write value |
dec dl |
mov al,11h ; Index GR11 (Page Selector) |
out dx,al ; Select GR11 |
inc dl |
mov al,ah ; Write address |
out dx,al ; Write the value |
.exit: |
and ebp,0x0000FFFF |
add ebp,0x000A0000 |
pop edx eax |
sti |
ret |
endf |
; S3 |
; by kmeaw |
func set_bank2 |
begin |
cli |
push eax edx ecx |
mov eax,[esp+4*4] |
mov ebp,eax |
shr eax,16 |
sub al,0x0A |
cmp al,[0xfff2] |
je .exit |
mov [0xfff2],al |
mov cl,al |
mov dx,0x3D4 |
mov al,0x38 |
out dx,al |
inc dx |
mov al,0x48 |
out dx,al |
dec dx |
mov al,0x31 |
out dx,al |
inc dx |
in al,dx |
dec dx |
mov ah,al |
mov al,0x31 |
out dx,ax |
mov al,ah |
or al,9 |
inc dx |
out dx,al |
dec dx |
mov al,0x35 |
out dx,al |
inc dx |
in al,dx |
dec dx |
and al,0xF0 |
mov ch,cl |
and ch,0x0F |
or ch,al |
mov al,0x35 |
out dx,al |
inc dx |
mov al,ch |
out dx,ax |
dec dx |
mov al,0x51 |
out dx,al |
inc dx |
in al,dx |
dec dx |
and al,0xF3 |
shr cl,2 |
and cl,0x0C |
or cl,al |
mov al,0x51 |
out dx,al |
inc dx |
mov al,cl |
out dx,al |
dec dx |
mov al,0x38 |
out dx,al |
inc dx |
xor al,al |
out dx,al |
.exit: |
and ebp,0x0000FFFF |
add ebp,0x000A0000 |
pop ecx edx eax |
sti |
ret |
endf |
; from http://my.execpc.com/CE/AC/geezer/os/slfb.asm |
func set_s3_bank |
begin |
cli |
push eax edx |
mov eax,[esp+4*3] |
mov ebp,eax |
shr eax,16 |
sub al,0x0A |
cmp al,[0xfff2] |
je .exit |
mov [0xfff2],al |
mov ah,al |
; grrrr...mode-set locked the S3 registers, so unlock them again |
; xxx - do this after mode-set |
mov dx,CRTC_INDX |
mov al,38h |
out dx,al |
inc edx |
mov al,48h |
out dx,al |
dec edx |
mov al,39h |
out dx,al |
inc edx |
mov al,0A5h |
out dx,al |
; now: do the bank-switch |
mov dx,CRTC_INDX |
mov al,35h |
out dx,al |
inc edx |
in al,dx |
and al,0F0h |
or al,ah |
out dx,al |
.exit: |
and ebp,0x0000FFFF |
add ebp,0x000A0000 |
pop edx eax |
sti |
ret |
endf |
func set_bank3 |
begin |
cli |
push eax edx |
mov eax,[esp+4*3] |
mov ebp,eax |
shr eax,16 |
sub al,0x0A |
cmp al,[0xfff2] |
je .exit |
mov [0xfff2],al |
mov ah,al |
mov dx,0x03D4 |
mov al,0x39 |
out dx,al |
inc dl |
mov al,0xA5 |
out dx,al |
dec dl |
mov al,6Ah |
out dx,al |
inc dl |
mov al,ah |
out dx,al |
dec dl |
mov al,0x39 |
out dx,al |
inc dl |
mov al,0x5A |
out dx,al |
dec dl |
.exit: |
and ebp,0x0000FFFF |
add ebp,0x000A0000 |
pop edx eax |
sti |
ret |
endf |
;----------------------------------------------------------------------------- |
DRIVER_CODE_END: |
diff10 'driver code size',DRIVER_CODE_START,DRIVER_CODE_END |
;----------------------------------------------------------------------------- |
;///// END /////////////////////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/kernel/branches/gfx_kernel/vmode/normal.inc |
---|
0,0 → 1,375 |
;----------------------------------------------------------------------------- |
;///// PART OF ATi RADEON 9000 DRIVER //////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; Copyright (c) 2004, mike.dld |
; Using BeOS driver - Copyright (c) 2002, Thomas Kurschel |
;----------------------------------------------------------------------------- |
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
; DEALINGS IN THE SOFTWARE. |
;----------------------------------------------------------------------------- |
macro __include_debug_strings dummy,[_id,_fmt,_len] { |
common |
local c1,a1,a2 |
forward |
_id rb _len+1 |
db 0 |
a1 = 0 |
a2 = 0 |
if ~ _len eq |
repeat _len-1 |
virtual at 0 |
db _fmt,13,10,0,0 |
load c1 word from %+a2-1 |
end virtual |
if (c1='%s')|(c1='%x')|(c1='%d') |
store byte 0 at _id+%+a1-1 |
a2 = a2 + 1 |
else if (c1='\n') |
store word $0A0D at _id+%+a1-1 |
a1 = a1 + 1 |
a2 = a2 + 1 |
else |
store word c1 at _id+%+a1-1 |
end if |
end repeat |
end if |
common |
} |
macro include_debug_strings { __include_debug_strings __debug_strings } |
SHINFO0 fix SHINFO |
macro SHINFO _num,_format,[_arg] { |
common |
SHFLOW _format,_arg |
} |
macro SHFLOW _format,[_arg] { |
common |
if __DEBUG__ = 1 |
local ..f1,f2,a1,a2,c1,c2,..lbl |
_debug_str_ fix __debug_str_ # a1 |
a1 = 0 |
c2 = 0 |
f2 = 0 |
repeat ..lbl-..f1-1 |
virtual at 0 |
db _format,13,10,0 |
load c1 word from %-1 |
end virtual |
if c1 = '%s' |
virtual at 0 |
db _format,13,10,0 |
store word 0 at %-1 |
load c1 from f2-c2 |
end virtual |
if c1 <> 0 |
DEBUGS _debug_str_+f2-c2 |
end if |
c2 = c2 + 1 |
f2 = %+1 |
a2 = 0 |
forward |
if a2 = a1 |
DEBUGS _arg |
end if |
a2 = a2+1 |
common |
a1 = a1+1 |
else if c1 = '%x' |
virtual at 0 |
db _format,13,10,0 |
store word 0 at %-1 |
load c1 from f2-c2 |
end virtual |
if c1 <> 0 |
DEBUGS _debug_str_+f2-c2 |
end if |
c2 = c2 + 1 |
f2 = %+1 |
a2 = 0 |
forward |
if a2 = a1 |
DEBUGH _arg |
end if |
a2 = a2+1 |
common |
a1 = a1+1 |
else if c1 = '%d' |
virtual at 0 |
db _format,13,10,0 |
store word 0 at %-1 |
load c1 from f2-c2 |
end virtual |
if c1 <> 0 |
DEBUGS _debug_str_+f2-c2 |
end if |
c2 = c2 + 1 |
f2 = %+1 |
a2 = 0 |
forward |
if a2 = a1 |
DEBUGD _arg |
end if |
a2 = a2+1 |
common |
a1 = a1+1 |
end if |
end repeat |
virtual at 0 |
db _format,13,10,0 |
load c1 from f2-c2 |
end virtual |
if c1 <> 0 |
DEBUGS _debug_str_+f2-c2 |
end if |
virtual at 0 |
..f1 db _format,13,10,0 |
..lbl: |
__debug_strings fix __debug_strings,_debug_str_,_format,..lbl-..f1-1-c2 |
end virtual |
end if |
pushad |
mov edi,sys_delay |
mov eax,1 |
call sys_int |
popad |
} |
;----------------------------------------------------------------------------- |
macro jif _op1,_cond,_op2,_label,_op { |
if _op eq |
cmp _op1,_op2 |
else |
if _op2 eq |
_op _op1 |
else |
_op _op1,_op2 |
end if |
end if |
j#_cond _label |
} |
macro m2m op1,op2 { |
pushd op2 |
popd op1 |
} |
macro BITFIELD _bfnum,_size,[_name,_nbits] { |
common |
local _shift,_mask |
_shift = 0 |
.bit_field#_bfnum rb _size |
if B_HOST eq HOST_BENDIAN |
forward |
_mask = 0 |
repeat _nbits |
_mask = (_mask shl 1) or 1 |
end repeat |
_name = _mask shl _shift |
_name#_shift = _shift |
_shift = _shift + _nbits |
common |
else |
forward |
_mask = 0 |
repeat _nbits |
_mask = (_mask shl 1) or 1 |
end repeat |
_name = _mask shl (_size-_shift-_nbits) |
_name#_shift = _size-_shift-_nbits |
_shift = _shift + _nbits |
common |
end if |
} |
;----------------------------------------------------------------------------- |
sys_delay = 5*4 |
sys_pci = 62*4 |
sys_debug_board = 63*4 |
;----------------------------------------------------------------------------- |
func sys_int |
begin |
pushad |
push eax |
add edi,[systlb] |
call dword[edi] |
pop eax |
popad |
ret |
endf |
func debug_outstr |
begin |
mov eax,1 |
.l1: |
mov bl,[edx] |
test bl,bl |
jz .l2 |
mov edi,sys_debug_board |
call sys_int |
inc edx |
jmp .l1 |
.l2: |
ret |
endf |
macro DEBUGS [_str] { |
common |
pushf |
pushad |
local ..str,..label,..is_str |
..is_str = 0 |
forward |
if _str eqtype '' |
..is_str = 1 |
end if |
common |
if ..is_str = 1 |
jmp ..label |
..str db _str,0 |
..label: |
mov edx,..str |
call debug_outstr |
else |
mov edx,_str |
call debug_outstr |
end if |
popad |
popf |
} |
macro DEBUGF [_str] { |
common |
DEBUGS _str,13,10 |
} |
func debug_outchar |
begin |
pushad |
mov bl,al |
mov eax,1 |
mov edi,sys_debug_board |
call sys_int |
popad |
ret |
endf |
func debug_outdec |
begin |
mov ecx,10 |
push -'0' |
.l1: |
xor edx,edx |
div ecx |
push edx |
test eax,eax |
jnz .l1 |
.l2: |
pop eax |
add al,'0' |
jz .l3 |
call debug_outchar |
jmp .l2 |
.l3: |
ret |
endf |
macro DEBUGD _dec { |
pushf |
pushad |
if _dec eqtype eax |
if _dec in <ebx,ecx,edx,esi,edi,ebp,esp> |
mov eax,_dec |
else if _dec in <ax,bx,cx,dx,si,di,bp,sp,al,ah,bl,bh,cl,ch,dl,dh> |
movzx eax,_dec |
end if |
else |
if (_dec eqtype word[])|(_dec eqtype byte[]) |
movzx eax,_dec |
else |
mov eax,_dec |
end if |
end if |
call debug_outdec |
popad |
popf |
} |
func debug_outhex |
__hexdigits db '0123456789ABCDEF' |
begin |
mov edx,8 |
.l1: |
rol eax,4 |
push eax |
and eax,0x0000000F |
mov al,[__hexdigits+eax] |
call debug_outchar |
pop eax |
dec edx |
jnz .l1 |
ret |
endf |
macro DEBUGH _hex { |
pushf |
pushad |
if ~_hex eq eax |
mov eax,_hex |
end if |
call debug_outhex |
popad |
popf |
} |
macro diff16 title,l1,l2 |
{ |
local s,d |
s = l2-l1 |
display title,': 0x' |
repeat 8 |
d = '0' + s shr ((8-%) shl 2) and $0F |
if d > '9' |
d = d + 'A'-'9'-1 |
end if |
display d |
end repeat |
display 13,10 |
} |
macro diff10 title,l1,l2 |
{ |
local s,d,z,m |
s = l2-l1 |
z = 0 |
m = 1000000000 |
display title,': ' |
repeat 10 |
d = '0' + s / m |
s = s - (s/m)*m |
m = m / 10 |
if d <> '0' |
z = 1 |
end if |
if z <> 0 |
display d |
end if |
end repeat |
display 13,10 |
} |
;----------------------------------------------------------------------------- |
;///// END /////////////////////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/kernel/branches/gfx_kernel/vmode/struct.inc |
---|
0,0 → 1,180 |
; Macroinstructions for defining data structures |
macro struct name |
{ fields@struct equ name |
match child parent, name \{ fields@struct equ child,fields@\#parent \} |
sub@struct equ |
struc db [val] \{ \common fields@struct equ fields@struct,.,db,<val> \} |
struc dw [val] \{ \common fields@struct equ fields@struct,.,dw,<val> \} |
struc du [val] \{ \common fields@struct equ fields@struct,.,du,<val> \} |
struc dd [val] \{ \common fields@struct equ fields@struct,.,dd,<val> \} |
struc dp [val] \{ \common fields@struct equ fields@struct,.,dp,<val> \} |
struc dq [val] \{ \common fields@struct equ fields@struct,.,dq,<val> \} |
struc dt [val] \{ \common fields@struct equ fields@struct,.,dt,<val> \} |
struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \} |
struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \} |
struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \} |
struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \} |
struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \} |
struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \} |
macro db [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,db,<val> \} |
macro dw [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,dw,<val> \} |
macro du [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,du,<val> \} |
macro dd [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,dd,<val> \} |
macro dp [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,dp,<val> \} |
macro dq [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,dq,<val> \} |
macro dt [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,dt,<val> \} |
macro rb count \{ \local anonymous |
fields@struct equ fields@struct,anonymous,db,count dup (?) \} |
macro rw count \{ \local anonymous |
fields@struct equ fields@struct,anonymous,dw,count dup (?) \} |
macro rd count \{ \local anonymous |
fields@struct equ fields@struct,anonymous,dd,count dup (?) \} |
macro rp count \{ \local anonymous |
fields@struct equ fields@struct,anonymous,dp,count dup (?) \} |
macro rq count \{ \local anonymous |
fields@struct equ fields@struct,anonymous,dq,count dup (?) \} |
macro rt count \{ \local anonymous |
fields@struct equ fields@struct,anonymous,dt,count dup (?) \} |
macro union \{ fields@struct equ fields@struct,,union,< |
sub@struct equ union \} |
macro struct \{ fields@struct equ fields@struct,,substruct,< |
sub@struct equ substruct \} |
virtual at 0 } |
macro ends |
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt |
restruc rb,rw,rd,rp,rq,rt |
purge db,dw,du,dd,dp,dq,dt |
purge rb,rw,rd,rp,rq,rt |
purge union,struct |
match name=,fields,fields@struct \\{ fields@struct equ |
make@struct name,fields |
fields@\\#name equ fields \\} |
end virtual \} |
match any, sub@struct \{ fields@struct equ fields@struct> \} |
restore sub@struct } |
macro make@struct name,[field,type,def] |
{ common |
if $ |
display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah |
err |
end if |
local define |
define equ name |
forward |
local sub |
match , field \{ make@substruct type,name,sub def |
define equ define,.,sub, \} |
match any, field \{ define equ define,.#field,type,<def> \} |
common |
match fields, define \{ define@struct fields \} } |
macro define@struct name,[field,type,def] |
{ common |
local list |
list equ |
forward |
if ~ field eq . |
name#field type def |
sizeof.#name#field = $ - name#field |
else |
rb sizeof.#type |
end if |
local value |
match any, list \{ list equ list, \} |
list equ list <value> |
common |
sizeof.#name = $ |
restruc name |
match values, list \{ |
struc name value \\{ |
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\} |
match , fields@struct \\\{ label . |
forward |
match , value \\\\{ field type def \\\\} |
match any, value \\\\{ field type value |
if ~ field eq . |
rb sizeof.#name#field - ($-field) |
end if \\\\} |
common \\\} \\} \} } |
macro enable@substruct |
{ macro make@substruct substruct,parent,name,[field,type,def] |
\{ \common |
\local define |
define equ parent,name |
\forward |
\local sub |
match , field \\{ match any, type \\\{ enable@substruct |
make@substruct type,name,sub def |
purge make@substruct |
define equ define,.,sub, \\\} \\} |
match any, field \\{ define equ define,.\#field,type,<def> \\} |
\common |
match fields, define \\{ define@\#substruct fields \\} \} } |
enable@substruct |
macro define@union parent,name,[field,type,def] |
{ common |
virtual at 0 |
forward |
if ~ field eq . |
virtual at 0 |
parent#field type def |
sizeof.#parent#field = $ - parent#field |
end virtual |
if sizeof.#parent#field > $ |
rb sizeof.#parent#field - $ |
end if |
else if sizeof.#type > $ |
rb sizeof.#type - $ |
end if |
common |
sizeof.#name = $ |
end virtual |
struc name [value] \{ \common |
label .\#name |
last@union equ |
forward |
match any, last@union \\{ virtual at .\#name |
field type def |
end virtual \\} |
match , last@union \\{ match , value \\\{ field type def \\\} |
match any, value \\\{ field type value \\\} \\} |
last@union equ field |
common rb sizeof.#name - ($ - .\#name) \} } |
macro define@substruct parent,name,[field,type,def] |
{ common |
virtual at 0 |
forward |
if ~ field eq . |
parent#field type def |
sizeof.#parent#field = $ - parent#field |
else |
rb sizeof.#type |
end if |
local value |
common |
sizeof.#name = $ |
end virtual |
struc name value \{ |
label .\#name |
forward |
match , value \\{ field type def \\} |
match any, value \\{ field type value |
if ~ field eq . |
rb sizeof.#parent#field - ($-field) |
end if \\} |
common \} } |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/kernel/branches/gfx_kernel/vmode/vmode.asm |
---|
0,0 → 1,814 |
; |
; MenuetOS Driver (vmode.mdr) |
; Target: Vertical Refresh Rate programming and videomode changing |
; |
; Author: Trans <<<<<13>>>>> |
; Date: 20.07.2003 |
; |
; Version: 1.0 |
; OS: MenuetOS |
; Compiler: FASM |
; |
use32 |
__DEBUG__ = 1 |
;macro align value { rb (value-1) - ($ + value-1) mod value } |
macro func name { |
if used name |
align 4 |
name@of@func equ name |
; _numb `name,name |
} |
macro begin { |
align 4 |
name@of@func: |
} |
endf fix end if |
macro return _val { |
if ~_val eq eax |
mov eax,_val |
end if |
ret |
} |
macro comment symb { ;s |
if 0=1 |
} |
^ fix end if |
include 'struct.inc' |
B_HOST fix HOST_BENDIAN ; HOST_LENDIAN |
;----------------------------------------------------------------------------- |
org 0x760000 |
headerstart=$ |
mdid db 'MDAZ' ; 4 byte id |
mdhver dd 0x00 ; header version |
mdcode dd MDSTART ; start of code |
mdver dd 0x00000001 ; driver version (subversion*65536+version) |
mdname db 'Trans VideoDriver' ; 32 bytes of full driver name |
times (32-($-mdname)) db ' ' ; |
headerlen=$-headerstart |
times (256-headerlen) db 0 ; reserved area for future |
MDSTART: ; start of driver code ( base_adr+256 bytes) |
; ebx(=ecx in program): |
; 1 - Get DriverInfo and Driver Initial Set |
; 2 - Get Current Video Mode With Vertical Refresh Rate |
; 3 - Change Video Mode |
; 4 - Return at Start System Video Mode |
; 5 - Change vertical and horizontal size of visible screen area |
; 6 - Change Vert/Hor position visible area on screen (not complete yet) |
; |
; MAXF - ... |
MAXF=7 |
;-------Main Manager------------- |
pushad |
cmp ebx,1 |
jb mdvm_00 |
cmp ebx,MAXF |
ja mdvm_00 |
call dword [mdvm_func_table+ebx*4] |
mov [esp+28],eax |
mov [esp+24],ecx |
mov [esp+20],edx |
mov [esp+16],ebx |
popad |
retn |
mdvm_00: |
popad |
xor eax,eax |
dec eax |
retn |
; ------Drivers Functions---------- |
; EBX=1 (in applications ECX=1)- Get DriverInfo and Driver Initial Set |
; |
; IN: ecx (in app. edx) - pointer to 512-bytes info area in application |
; OUT: |
; |
func vm_info_init |
begin |
push ecx |
cmp [mdrvm],dword 0 |
jnz .vmii_00 |
call vm_safe_reg |
call vm_get_initial_videomode |
mov eax,[initvm] |
mov [currvm],eax |
; call vm_search_sys_func_table |
call vm_get_cur_vert_rate |
mov [initrr],eax |
call vm_calc_pixelclock |
call vm_calc_refrate |
inc [mdrvm] |
.vmii_00: |
pop ecx |
call vm_transfer_drv_info |
mov ebx,dword [refrate] |
mov eax,dword [mdid] ;dword [systlb] |
retn |
endf |
; EBX=2 (in applications ECX=2)- Get Current Video Mode |
; |
; OUT: eax = X_screen*65536+Y_screen |
; ebx = current vertical rate |
; ecx = current video mode (number) |
func vm_get_cur_mode |
begin |
cmp [mdrvm],dword 0 |
jz .vmgcm_00 |
call vm_get_cur_vert_rate |
mov eax,[0FE00h] |
mov ebx,[0FE04h] |
shl eax,16 |
add eax,ebx |
add eax,00010001h |
mov ebx,[refrate] |
mov ecx,[currvm] |
retn |
.vmgcm_00: |
xor eax,eax |
dec eax |
retn |
endf |
; EBX=3 (in applications ECX=3)- Change Video Mode |
; |
; IN: ecx = VertRate*65536+VideoMode |
; OUT: eax = 0 if no error |
; |
func vm_set_video_mode |
begin |
cmp [mdrvm],dword 0 |
jz .vmsvm_00 |
call vm_set_selected_mode |
; xor eax,eax |
retn |
.vmsvm_00: |
xor eax,eax |
dec eax |
retn |
endf |
; EBX=4 (in applications ECX=4)- Return at Start System Video Mode |
; |
; IN: |
; OUT: eax = = 0 if no error |
; |
func vm_restore_init_video_mode |
begin |
cmp [mdrvm],dword 0 |
jz .vmrivm_00 |
call vm_restore_reg |
xor eax,eax |
retn |
.vmrivm_00: |
xor eax,eax |
dec eax |
retn |
endf |
; EBX=5 (in applications ECX=5)- Change vertical and horizontal size |
; of visible screen area |
; IN: ecx (in app. edx) = 0/1 - -/+ horizontal size on 1 position |
; = 2/3 - -/+ vertical size on 1 position (8 pixels) |
; ^-^----- not complete yet |
; OUT: eax = = 0 if no error |
; |
func vm_change_screen_size |
begin |
cmp [mdrvm],dword 0 |
jz .vmcss_00 |
cmp cl,1 |
ja .vmcss_01 |
mov eax,ecx |
call vm_inc_dec_width |
xor eax,eax |
retn |
.vmcss_01: |
and ecx,01h |
mov eax,ecx |
; call vm_inc_dec_high ; not complete yet |
xor eax,eax |
retn |
.vmcss_00: |
xor eax,eax |
dec eax |
retn |
endf |
; EBX=6 (in applications ECX=6)- Change Vert/Hor position visible area on screen |
; |
; IN: ecx (in app. edx) = 0/1 - -/+ horizontal position on 1 point |
; = 2/3 - -/+ vertical position on 1 pixel |
; ^-^----- not complete yet |
; OUT: eax = 0 if no error |
; |
func vm_change_position_screen |
begin |
cmp [mdrvm],dword 0 |
jz .vmcps_00 |
; ... |
xor eax,eax |
retn |
.vmcps_00: |
xor eax,eax |
dec eax |
retn |
endf |
;-----Drivers Subfunctions--------- |
; |
; Searching i40 system functions pointer table in kernel area location |
; |
func vm_search_sys_func_table |
begin |
push eax ; eax - current value |
push ecx ; ecx - will be counter of equevalent value |
push edx ; edx - last value |
push esi ; esi - current address |
xor ecx,ecx |
mov esi,010000h ; Start address of kernel location |
lodsd |
mov edx,eax |
cld |
.vmssft_00: |
cmp esi,30000h |
ja .vmssft_03 |
inc ecx |
lodsd |
cmp edx,eax |
mov edx,eax |
je .vmssft_00 |
cmp ecx,128 |
ja .vmssft_02 |
.vmssft_01: |
xor ecx,ecx |
jmp .vmssft_00 |
.vmssft_02: |
cmp edx,0 |
je .vmssft_01 |
sub esi,256*4-1 |
mov [systlb],esi |
xor ecx,ecx |
.vmssft_03_0: |
inc ecx |
lodsd |
cmp edx,eax |
mov edx,eax |
jne .vmssft_03_0 |
mov esi,dword [systlb] |
cmp cx,60 |
jae .vmssft_03 |
add esi,256*4-4 |
lodsb |
mov edx,eax |
jmp .vmssft_01 |
.vmssft_03: |
mov [systlb],esi |
pop esi |
pop edx |
pop ecx |
pop eax |
retn |
endf |
; IN: |
; OUT: eax= vertical rate in Hz |
func vm_get_cur_vert_rate |
begin |
push edx |
push ebx |
xor eax,eax |
mov edx,eax |
mov ebx,eax |
mov dx,03DAh |
.vmgcvt_00: |
in al,dx |
test al,8 |
jz .vmgcvt_00 |
.vmgcvt_01: |
in al,dx |
test al,8 |
jnz .vmgcvt_01 |
mov ebx,edx |
rdtsc |
mov edx,ebx |
mov ebx,eax |
.vmgcvt_02: |
in al,dx |
test al,8 |
jz .vmgcvt_02 |
.vmgcvt_03: |
in al,dx |
test al,8 |
jnz .vmgcvt_03 |
rdtsc |
sub eax,ebx |
mov ebx,eax |
mov eax,[0F600h] |
xor edx,edx |
div ebx |
inc eax |
mov [refrate],eax |
pop ebx |
pop edx |
retn |
endf |
func vm_calc_pixelclock |
begin |
push ebx |
push edx |
xor eax,eax |
mov al,[_00] |
add ax,5 |
shl eax,3 |
xor ebx,ebx |
mov bl,[_06] |
mov bh,[_07] |
and bh,00100001b |
btr bx,13 |
jnc .vmcpc_00 |
or bh,2 |
.vmcpc_00: |
xor edx,edx |
mul ebx |
xor edx,edx |
mul [initrr] |
mov [pclock],eax |
pop edx |
pop ebx |
retn |
endf |
; |
; Safe of initial CRTC state |
; |
func vm_safe_reg |
begin |
push edx |
push ebx |
push ecx |
push edi |
cli |
mov dx,3d4h ; CRTC |
mov al,11h |
out dx,al |
inc dx |
in al,dx |
and al,7fh |
out dx,al ; Clear protection bit |
dec dx |
xor ecx,ecx |
mov cl,19h |
xor bl,bl |
mov edi,CRTCreg |
.vmsr_00: |
mov al,bl |
out dx,al |
inc dx |
in al,dx |
dec dx |
stosb |
inc bl |
loop .vmsr_00 |
sti |
pop edi |
pop ecx |
pop ebx |
pop edx |
retn |
endf |
; |
; Restore of initial CRTC state |
; |
func vm_restore_reg |
begin |
push eax |
push ebx |
push edx |
push esi |
mov eax,[oldX] |
mov [0FE00h],eax |
mov eax,[oldY] |
mov [0FE04h],eax |
mov dx,03dah |
.vmrr_00: |
in al,dx |
test al,8 |
jnz .vmrr_00 |
.vmrr_01: |
in al,dx |
test al,8 |
jnz .vmrr_01 |
cli |
mov dx,03c4h |
mov ax,0101h |
out dx,ax |
mov dx,3d4h ; CRTC |
mov al,11h |
out dx,al |
inc dx |
in al,dx |
and al,7fh ; Clear Protection bit |
out dx,al |
dec dx |
xor ecx,ecx |
mov cl,19h |
mov esi,CRTCreg |
xor bl,bl |
.vmrr_02: |
lodsb |
mov ah,al |
mov al,bl |
out dx,ax |
inc bl |
loop .vmrr_02 |
sti |
; call ref_screen |
pop esi |
pop edx |
pop ecx |
pop eax |
retn |
endf |
; Calculate of possible vertical refrash rate |
; (light version of function) |
func vm_calc_refrate |
begin |
push ebx |
push ecx |
push edx |
push edi |
push esi |
mov eax,[pclock] |
xor edx,edx |
mov edi,_m1 |
mov ebx,eax |
mov ecx,(1696*1065) |
div ecx |
xor edx,edx |
stosw |
add edi,8 |
mov eax,ebx |
mov ecx,(1344*804) |
div ecx |
xor edx,edx |
stosw |
add edi,8 |
mov eax,ebx |
mov ecx,(1056*636) |
div ecx |
xor edx,edx |
stosw |
add edi,8 |
mov eax,ebx |
mov ecx,(800*524) |
div ecx |
xor edx,edx |
stosw |
mov edi,_m1 |
mov esi,edi |
mov ecx,5*4 |
.vmcrr_00: |
lodsw |
cmp ax,55 |
jb .vmcrr_01 |
stosw |
loop .vmcrr_00 |
pop esi |
pop edi |
pop edx |
pop ecx |
pop ebx |
retn |
.vmcrr_01: |
xor ax,ax |
stosw |
loop .vmcrr_00 |
pop esi |
pop edi |
pop edx |
pop ecx |
pop ebx |
retn |
endf |
func vm_get_initial_videomode |
begin |
push eax |
mov eax,dword [0FE00h] |
mov [oldX],eax |
mov eax,dword [0FE04h] |
mov [oldY],eax |
mov eax,dword [0FE0Ch] ; initial video mode |
and ax,01FFh |
mov dword [initvm],eax |
pop eax |
retn |
endf |
; IN: eax = 0/1 - -/+ 1 position of width |
func vm_inc_dec_width |
begin |
push ebx |
push edx |
mov ebx,eax |
mov dx,3d4h ; CRTC |
mov al,11h |
out dx,al |
inc dx |
in al,dx |
and al,7fh ; Clear Protection bit |
out dx,al |
dec dx |
xor al,al |
out dx,al |
inc dx |
in al,dx |
dec al |
cmp bl,0 |
jnz .vmidr_00 |
inc al |
inc al |
.vmidr_00: |
out dx,al |
pop edx |
pop ebx |
retn |
endf |
; |
; Copy driver info to application area |
; |
; IN: ecx (in app. edx) - pointer to 512-bytes info area in application |
; OUT: |
func vm_transfer_drv_info |
begin |
push ecx |
push edi |
push esi |
mov eax,ecx |
xor ecx,ecx |
mov cl,32/4 |
mov esi,mdname |
mov edi,drvname |
rep movsd |
mov ecx,eax |
mov eax,[mdver] |
mov [drvver],eax |
mov edi,[3010h] |
mov edi,[edi+10h] |
add edi,ecx |
mov esi,drvinfo |
xor ecx,ecx |
mov cx,512 |
rep movsb |
pop esi |
pop edi |
pop ecx |
retn |
endf |
; |
; Set selected video mode |
; (light version) |
; |
; IN: ecx = VertRate*65536+VideoMode |
; |
func vm_set_selected_mode |
begin |
push edx |
push ecx |
push esi |
ror ecx,16 |
cmp cx,00h |
je .vmssm_03 |
rol ecx,16 |
mov eax,ecx |
shl eax,16 |
shr eax,16 |
mov [currvm],eax |
cmp cx,112h |
jne .vmssm_00 |
mov esi,mode0 |
mov ecx,639 |
mov edx,479 |
jmp .vmssm_st00 |
.vmssm_00: |
cmp cx,115h |
jne .vmssm_01 |
mov esi,mode1 |
mov ecx,799 |
mov edx,599 |
jmp .vmssm_st00 |
.vmssm_01: |
cmp cx,118h |
jne .vmssm_02 |
mov esi,mode2 |
mov ecx,1023 |
mov edx,767 |
jmp .vmssm_st00 |
.vmssm_02: |
cmp cx,11Bh |
jne .vmssm_03 |
mov esi,mode2 |
mov ecx,1279 |
mov edx,1023 |
jmp .vmssm_st00 |
.vmssm_03: |
xor eax,eax |
dec eax |
pop esi |
pop ecx |
pop edx |
retn |
.vmssm_st00: |
mov [0FE00h],ecx |
mov [0FE04h],edx |
cli |
mov dx,03c4h |
lodsw |
out dx,ax |
mov dx,03d4h |
mov al,11h |
out dx,al |
inc dx |
in al,dx |
and al,7fh |
out dx,al |
dec dx |
mov ecx,13 |
.vmssm_st01: |
lodsw |
out dx,ax |
loop .vmssm_st01 |
sti |
xor eax,eax |
pop esi |
pop ecx |
pop edx |
retn |
endf |
;-[ mike.dld ]- begin --------------- |
include 'normal.asm' |
;-[ mike.dld ]- end ----------------- |
;------------DATA AREA--------------- |
align 4 |
mdvm_func_table: |
dd MDSTART |
dd vm_info_init, vm_get_cur_mode |
dd vm_set_video_mode, vm_restore_init_video_mode |
dd vm_change_screen_size ;vm_change_position_screen |
;-[ mike.dld ]- begin --------------- |
dd vm_mike_init |
; dd vm_mike_cursor_pos |
dd vm_mike_uninit |
;-[ mike.dld ]- end ----------------- |
;1280x1024 - 11Bh |
mode3: |
dw 0101h |
dw 0d000h,9f01h,9f02h,9303h,0a904h,1905h,2806h,5a07h |
dw 0110h,8411h,0ff12h,0ff15h,2916h |
;1024x768 - 118h |
mode2: |
dw 0101h |
dw 0a400h,7f01h,7f02h,8703h,8404h,9505h,2406h,0f507h |
dw 0310h,8911h,0ff12h,0ff15h,2516h |
;800x600 - 115h |
mode1: |
dw 0101h |
dw 8000h,6301h,6302h,8303h,6a04h,1a05h,7206h,0f007h |
dw 5910h,8d11h,5712h,5715h,7316h |
;640x480 - 112h, 12h |
mode0: |
dw 0101h |
dw 6000h,4f01h,4f02h,8303h,5304h,9f05h,00b06h,3e07h |
dw 0ea10h,8c11h,0df12h,0df15h,0c16h |
; 640x400 |
;mymode0: |
; dw 0101h |
;_0_7 dw 5f00h,4f01h,4f02h,8303h,5304h,9f05h,0BF06h,1f07h |
; dw 9c10h,8e11h,8f12h,9615h,0B916h ;,4013h |
; 640x800 |
;mymode1: |
; dw 0101h |
; dw 5f00h,4f01h,4f02h,8003h,5004h,9f05h,06006h,0FF07h |
; dw 2d10h,8f11h,2012h,2615h,05716h ;,4013h |
align 4 |
;-[ mike.dld ]- begin --------------- |
;oldX dd ? |
;oldY dd ? |
;initvm dd ? |
currvm dd 0 |
refrate dd 0 |
initrr dd 0 |
systlb dd 0 |
;pclock dd ? |
mdrvm dd 0 ; 0 - not drv init yet, 1 - already drv init |
;-[ mike.dld ]- end ----------------- |
drvinfo: |
drvname: times 32 db ' ' |
drvver dd 0 |
times (32-($-drvver))/4 dd 0 |
drvmode dw 011Bh,0118h,0115h,0112h |
times (64-($-drvmode))/2 dw 00h |
_m1 dw 0,0,0,0,0 |
_m2 dw 0,0,0,0,0 |
_m3 dw 0,0,0,0,0 |
_m4 dw 0,0,0,0,0 |
_m5 dw 0,0,0,0,0 |
times (512-($-drvinfo)) db 0 |
drvinfoend: |
;-[ mike.dld ]- begin --------------- |
align 4 |
include_debug_strings |
;-[ mike.dld ]- end ----------------- |
DRVM_END: |
align 4 |
;-[ mike.dld ]- begin --------------- |
oldX dd ? |
oldY dd ? |
initvm dd ? |
pclock dd ? |
;-[ mike.dld ]- end ----------------- |
CRTCreg: |
_00 db ? |
_01 db ? |
_02 db ? |
_03 db ? |
_04 db ? |
_05 db ? |
_06 db ? |
_07 db ? |
_08 db ? |
_09 db ? |
_0a db ? |
_0b db ? |
_0c db ? |
_0d db ? |
_0e db ? |
_0f db ? |
_10 db ? |
_11 db ? |
_12 db ? |
_13 db ? |
_14 db ? |
_15 db ? |
_16 db ? |
_17 db ? |
_18 db ? |
_19 db ? |
;-[ mike.dld ]- begin --------------- |
align 4 |
x_res fix 0x0000FE00 ; dd ? |
y_res fix 0x0000FE04 ; dd ? |
cnt dd ? |
align 16 |
tr RECT |
rct RECT |
;rb 40*sizeof.RECT |
;-[ mike.dld ]- end ----------------- |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/kernel/branches/gfx_kernel/vmode/vmode.txt |
---|
0,0 → 1,53 |
Video Mode Driver ver.1.0 for MenuetOS |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
This driver provide of hardware operation of all VGA-compatible videocard |
P.S. |
It may be added to SYSFUNCS.TXT |
21 = SETUP FOR DEVICES |
ebx = 13 - videodriver enable |
ecx = 1 - Get DriverInfo and Driver Initial Set |
edx = offset to 512-bytes area for DriverInfo |
RETURN: eax = -1 - errors or driver not installed in system |
eax = 'MDAZ' - driver ID => set information in info area |
Info Structure: |
+0 - Full driver name (ASCII string ) |
+32 - Driver version (dword) |
+36 - Reserved |
+64 - List of support videomodes |
(max 32 positions) (word) |
+128 - List of Support vertical rate |
to each present mode (word): |
+0 - 1st ver.rate for mode0 |
+2 - 2st ver.rate for mode0 |
+4 - 3st ver.rate for mode0 |
+8 - 4st ver.rate for mode0 |
+10 - 5st ver.rate for mode0 |
+12 - 1st ver.rate for mode1 |
+14 - 2st ver.rate for mode1 |
+16 - 3st ver.rate for mode1 |
+18 - 4st ver.rate for mode1 |
+20 - 5st ver.rate for mode1 |
ecx = 2 - Get Current Video Mode With Vertical Refresh Rate |
RETURN: eax = -1 - errors |
eax = X_screen*65536+Y_screen |
ebx = current vertical rate |
ecx = current video mode (number) [see infostruct] |
ecx = 3 - Change Video Mode |
edx = VertRate*65536+VideoMode [see infostruct] |
RETURN: eax = -1 - errors |
eax = 0 - set new videomode |
ecx = 4 - Return at Start System Video Mode |
RETURN: eax = -1 - errors |
eax = 0 - set initial videomode |
ecx = 5 - Change vertical and horizontal size of visible screen area |
edx = 0/1 - -/+ horizontal size on 1 position |
= 2/3 - -/+ vertical size on 1 position (8 pixels) (not complete yet) |
RETURN: eax = -1 - errors |
eax = 0 - succesfull |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |