From dd7a8c05ee79f59ebe7d3c7041e289141b758946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Hord=C3=A9?= Date: Wed, 28 Mar 2007 15:54:19 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20mise=20=C3=A0=20jour=20du=20code=20pour?= =?UTF-8?q?=20compilation=20sur=20LZASM=20en=20stdcall?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bmp.asm | 102 ++++++++++++++++++++++++---------------------------- 1 file changed, 46 insertions(+), 56 deletions(-) diff --git a/lib/bmp.asm b/lib/bmp.asm index 114b1ab..a40ded7 100644 --- a/lib/bmp.asm +++ b/lib/bmp.asm @@ -1,77 +1,71 @@ -.model tiny -.486 -smart +model tiny,stdcall +p586N locals -.code +jumps +codeseg +option procalign:byte + +include "..\include\mem.h" +include "..\include\divers.h" +include "..\include\bmp.h" + org 0h -include ..\include\mem.h -include ..\include\bmp.h - start: -header exe <,1,0,,,,offset exports,> - -exports: - db "showbmp",0 - dw showbmp - db "loadbmppalet",0 - dw loadbmppalet - dw 0 +header exe <"CE",1,0,0,offset exports,offset imports,,> +exporting +declare showbmp +declare loadbmppalet +ende + +importing +use VIDEO,showpixel +endi ;==========SHOWBMP========= ;Affiche le BMP pointée par DS:%0 en %1, %2 ;<- DS:%0 BMP, %1 coordonnées X, %2 coordonnées Y ;-> ;========================== -showbmp PROC FAR - ARG pointer:word, x:word, y:word=taille - push bp - mov bp,sp - push ax bx cx dx si di - mov si,[pointer] - cmp word ptr [si+BMP_file.BMP_FileType],"MB" +PROC showbmp FAR + ARG @pointer:word, @x:word, @y:word + USES ax,bx,cx,dx,si,di + mov si,[@pointer] + cmp [word ptr (bmp_file si).bmp_filetype],"MB" jne @@errorshowing - mov edi,[si+BMP_BitMapOffset] + mov edi,[(bmp_file si).bmp_bitmapoffset] add di,si - mov ah,8 xor ebx,ebx - mov ecx,[si+offset BMP_File.BMP_height] - mov edx,[si+offset BMP_File.BMP_width] + mov ecx,[(bmp_file si).bmp_height] + mov edx,[(bmp_file si).bmp_width] and dx,11111100b - cmp edx,[si+offset BMP_File.BMP_width] + cmp edx,[(bmp_file si).bmp_width] jae @@noadjust add dx,4 @@noadjust: - sub dx,[si+offset BMP_File.BMP_width] + sub edx,[(bmp_file si).bmp_width] @@bouclette: - mov al,[di] push bx cx - add bx,[x] - add cx,[y] - int 47h + add bx,[@x] + add cx,[@y] + call [showpixel],bx,cx,[word ptr di] pop cx bx inc bx inc di - cmp ebx,[si+offset BMP_File.BMP_width] - jb @@bouclette + cmp ebx,[(bmp_file si).bmp_width] + jb @@bouclette xor bx,bx add di,dx dec cx cmp cx,0 jne @@bouclette clc - pop di si dx cx bx ax - pop bp - retf taille - + ret @@errorshowing: stc - pop di si cx bx ax - pop bp - retf taille - -showbmp ENDP + ret +ENDP showbmp ;==========LOADBMPPALET========= @@ -79,16 +73,14 @@ showbmp ENDP ;-> DS:%0 BMP ;<- ;=============================== -loadbmppalet PROC FAR - ARG pointer:word=taille - push bp - mov bp,sp - push ax bx cx dx si - mov si,[pointer] +PROC loadbmppalet FAR + ARG @pointer:word + USES ax,bx,cx,dx,si + mov si,[@pointer] mov bx,0400h+36h-4 mov cx,100h mov dx, 3c8h -paletteload: +@@paletteload: mov al, cl dec al out dx, al @@ -105,10 +97,8 @@ paletteload: sub bx,4 dec dx dec cl - jnz paletteload - pop si dx cx bx ax - pop bp - retf taille -loadbmppalet ENDP + jnz @@paletteload + ret +ENDP loadbmppalet + -end start