写操作系统;;VGA模式下的写屏代码;
; getpixel 0xa0000~0xc0000
; in:
; eax = x coordinate
; ebx = y coordinate
; ret:
; ecx = 00 RR GG BB
getpixel:
push eax ebx edx edi
call dword [GETPIXEL]
pop edi edx ebx eax
ret
Vesa20_getpixel24:
; eax = x
; ebx = y
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [eax+eax*2] ; edi = x*3
add edi, ebx ; edi = x*3+(y*y multiplier)
mov ecx, [LFB_BASE+edi]
and ecx, 0xffffff
ret
Vesa20_getpixel32:
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
mov ecx, [LFB_BASE+edi]
and ecx, 0xffffff
ret
VESA SuperVGA BIOS v2.0+ - GET PROTECTED-MODE INTERFACE
AX = 4F0Ah
BL = 00h
Return:
AL = 4Fh if function supported
AH = status
00h successful
ES:DI -> protected-mode table (see #00087)
CX = length of table in bytes, included protected-mode code
01h failed
See Also: AX=4F00h - AX=4F05h - AX=4F07h - AX=4F09h
Format of VESA VBE 2.0 protected-mode table:
Offset Size Description (Table 00087)
00h WORD offset (within table) of protected-mode code for Function 5
(Set Window)
02h WORD offset of protected-mode code for Function 7 (Set Disp Start)
04h WORD offset of protected-mode code for Function 9 (Set Primary
Palette)
06h WORD offset (within table) of list of I/O ports and memory locations
for which I/O privilege may be required in protected mode
(0000h if no list) (see #04085)
08h var code and optional port/memory list
Format of VESA VBE 2.0+ protected-mode port/memory list:
Offset Size Description (Table 04085)
00h WORD I/O port number.
....
WORD FFFFh marking end of I/O port list.
DWORD memory region base address.
WORD memory region limit (one less than length).
WORD FFFFh marking end of memory region list
Note: The memory region is optional; if not present, there will be a word of FFFFh immediately following the FFFFh marking the end of the I/O port list
楼主是要写操作系统,不是调用已有系统的功能。
win32汇编调用api那在windows下可以,这里没有写好的
上面可以在得到保护模式调用bios表,但我没试过,没找到资料
ES:DI -> protected-mode table (see #00087)
CX = length of table in bytes, included protected-mode code
这句是说把bios代码表存入一个你指定地方,在调用...