用来在MEOS里抓取屏幕,不过这个版本并不完善。 在这个版本里,程序所用的方法是扫描屏幕上的点然后再写到缓存最后写到文件,这样就会导致速度很慢。 BMP格式文档可以去我的网络硬盘下载http://osdev.ys168.com ;======================================= ;    HotCats ;    Ver : 0.1 ;    BLOG: http://hotheart.go.3322.org ;======================================= bits 32 org    0×0 db ‘MENUET01′ ; 8 byte id dd 0×01                        ; header version dd START                        ; start of code dd I_END                        ; size of image dd 0×300000                    ; memory for app dd 0xffff                        ; esp dd 0×0 , 0×0                    ; I_Param , I_Icon START:                                ; start of execution mov eax,14                    ; 获取屏幕分辨率 int 0×40 xor ebx,ebx mov bx,ax shr eax,16 inc eax ; X size inc ebx ; Y size mov [scr_x],eax mov [scr_y],ebx mov [img_w],eax mov [img_h],ebx imul ebx imul eax,3                    ; image data size mov [img_s],eax add eax,0×36                ; BMP header size mov [imgf_s],eax mov [f_s],eax mov esi,bminfo                ; fill the header mov edi,filestart mov ecx,0×36/4 cld repz movsd call draw_window                ; draw the window still: mov eax,10                    ; wait here for event int 0×40 cmp eax,1                    ; redraw request ? je red cmp eax,2                    ; key in buffer ? je key cmp eax,3                    ; button in buffer ? je button jmp still red:                                ; redraw call draw_window jmp still key:                                ; key mov eax,2                    ; just read it and ignore int 0×40 jmp still button:                            ; button mov eax,17                    ; get id int 0×40 cmp ah,1                    ; button id=1 ? jne .cmdcap mov eax,-1                    ; close this program int 0×40 .cmdcap: cmp ah,cmdcap                ; is the Capture button ? jne .cmdsave call capall                    ; capture the whole screen jmp still .cmdsave: cmp ah,cmdsave                ; is the save button jne .end call savefile                ; save the file jmp still .end: jmp still ;   ********************************************* ;   *******  WINDOW DEFINITIONS AND DRAW ******** ;   ********************************************* draw_window: mov eax,12                    ; function 12:tell os about windowdraw mov ebx,1                    ; 1, start of draw int 0×40 ; DRAW WINDOW mov eax,0 mov ebx,[scr_x] sub ebx,win_w+5 imul ebx,65536 add ebx,win_w mov ecx,[scr_y] sub ecx,win_h+25 imul ecx,65536 add ecx,win_h mov edx,0x03ffffff mov esi,0x40ffffff mov edi,0x00ffffff int 0×40 ; WINDOW LABEL mov eax,4                    ; function 4 : write text to window mov ebx,8*65536+8            ; [x start] *65536 + [y start] mov ecx,0x10ddeeff            ; font 1 & color ( 0xF0RRGGBB ) mov edx,labelt                ; pointer to text beginning mov esi,labellen-labelt        ; text length int 0×40 ; Button Capture mov eax,8 mov ebx,10*65536+40 mov ecx,(win_h-10-14)*65536+14 mov edx,cmdcap mov esi,0xaabbcc int 0×40 ; Button Save mov eax,8 mov ebx,(10+40+10)*65536+40 mov ecx,(win_h-10-14)*65536+14 mov edx,cmdsave mov esi,0xaabbcc int 0×40 ; Button Text mov eax,4                        ; function 4 : write text to window mov ebx,18*65536+(win_h-10-14+4); [x start] *65536 + [y start] mov ecx,0×00444444                ; font 1 & color ( 0xF0RRGGBB ) mov edx,btext                    ; pointer to text beginning mov esi,btexte-btext            ; text length int 0×40 mov eax,12                    ; function 12:tell os about windowdraw mov ebx,2                    ; 2, end of draw int 0×40 ret mov eax,47                    ; display the screen size mov ebx,4*65536 mov ecx,[scr_x] mov edx,120*65536+30 mov esi,0×0 int 0×40 mov eax,47 mov ebx,4*65536 mov ecx,[scr_y] mov edx,120*65536+40 mov esi,0×0 int 0×40 capall: mov edi,imgarea mov ecx,[scr_y] cld .nextline: mov ebx,ecx dec ebx imul ebx,[scr_x] push ecx mov ecx,[scr_x] .capline: push edi push ebx mov eax,35                    ; get pixel int 0×40 stosd pop ebx pop edi inc ebx add edi,3 loop .capline pop ecx loop .nextline .end: ret savefile:                            ; save the file mov eax,58 mov ebx,fileinfo int 0×40 ret ; DATA AREA win_w        equ 250 win_h        equ 50 cmdcap        equ 2 cmdsave        equ 3 filestart    equ 0×20000 imgarea        equ filestart+0×36 scr_x    dd 0 scr_y    dd 0 zoom    dd 2 fileinfo: dd 1                    ; 1=WRITE dd 0×0                    ; not used f_s  dd 800*600*3+0×36        ; bytes to write dd filestart            ; source data pointer dd 0×10000                ; work area for os - 16384 bytes db ‘/HD/1/TEST.BMP’,0    ; ASCIIZ dir & filename btext:  db ‘ Cat     Save  ’ btexte: labelt: db ‘HotCats 0.1 - HotHeart HotWorks 2005′ labellen: bminfo: db ‘BM’ ; 0000-0001 位图标志 imgf_s    dd 800*600*3+0×36    ; 0002-0005 文件大小 dd 0×0                ; 0006-0009 保留 db 0×36,0×0,0×0,0×0; 000A-000D 文件头信息块大小,图像描述信息块的大小,图像颜色表的大小,保留(为01) dd 0×28            ; 000E-0011 图像描述信息块的大小,常为28H。 img_w    dd 800                ; 0012-0015    图像宽度。 img_h    dd 600                ; 0016-0019    图像高度。 dw 0×1                ; 001A-001B    图像的plane总数(恒为1)。 dw 24                ; 001C-001D    数据压缩方式(数值位0:不压缩;1:8位压缩;2:4位压缩)。 dd 0                ; 001E-0021    记录像素的位数,很重要的数值,图像的颜色数由该值决定。 img_s    dd 800*600*3        ; 0022-0025    图像区数据的大小。 dd 0×0                ; 0026-0029    水平每米有多少像素,在设备无关位图(.DIB)中,每字节以00H填写。 dd 0×0                ; 002A-002D    垂直每米有多少像素,在设备无关位图(.DIB)中,每字节以00H填写。 dd 0×0                ; 002E-0031    此图像所用的颜色数,如值为0,表示所有颜色一样重要。 dd 0×0                ; 0032-0035 未用 I_END: