feat: mise à jour du code pour compilation sur LZASM en stdcall

This commit is contained in:
Nicolas Hordé 2007-03-28 15:54:19 +00:00
parent e1b6696324
commit dd7a8c05ee
1 changed files with 46 additions and 56 deletions

View File

@ -1,77 +1,71 @@
.model tiny model tiny,stdcall
.486 p586N
smart
locals locals
.code jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\divers.h"
include "..\include\bmp.h"
org 0h org 0h
include ..\include\mem.h
include ..\include\bmp.h
start: start:
header exe <,1,0,,,,offset exports,> header exe <"CE",1,0,0,offset exports,offset imports,,>
exports:
db "showbmp",0
dw showbmp
db "loadbmppalet",0
dw loadbmppalet
dw 0
exporting
declare showbmp
declare loadbmppalet
ende
importing
use VIDEO,showpixel
endi
;==========SHOWBMP========= ;==========SHOWBMP=========
;Affiche le BMP pointée par DS:%0 en %1, %2 ;Affiche le BMP pointée par DS:%0 en %1, %2
;<- DS:%0 BMP, %1 coordonnées X, %2 coordonnées Y ;<- DS:%0 BMP, %1 coordonnées X, %2 coordonnées Y
;-> ;->
;========================== ;==========================
showbmp PROC FAR PROC showbmp FAR
ARG pointer:word, x:word, y:word=taille ARG @pointer:word, @x:word, @y:word
push bp USES ax,bx,cx,dx,si,di
mov bp,sp mov si,[@pointer]
push ax bx cx dx si di cmp [word ptr (bmp_file si).bmp_filetype],"MB"
mov si,[pointer]
cmp word ptr [si+BMP_file.BMP_FileType],"MB"
jne @@errorshowing jne @@errorshowing
mov edi,[si+BMP_BitMapOffset] mov edi,[(bmp_file si).bmp_bitmapoffset]
add di,si add di,si
mov ah,8
xor ebx,ebx xor ebx,ebx
mov ecx,[si+offset BMP_File.BMP_height] mov ecx,[(bmp_file si).bmp_height]
mov edx,[si+offset BMP_File.BMP_width] mov edx,[(bmp_file si).bmp_width]
and dx,11111100b and dx,11111100b
cmp edx,[si+offset BMP_File.BMP_width] cmp edx,[(bmp_file si).bmp_width]
jae @@noadjust jae @@noadjust
add dx,4 add dx,4
@@noadjust: @@noadjust:
sub dx,[si+offset BMP_File.BMP_width] sub edx,[(bmp_file si).bmp_width]
@@bouclette: @@bouclette:
mov al,[di]
push bx cx push bx cx
add bx,[x] add bx,[@x]
add cx,[y] add cx,[@y]
int 47h call [showpixel],bx,cx,[word ptr di]
pop cx bx pop cx bx
inc bx inc bx
inc di inc di
cmp ebx,[si+offset BMP_File.BMP_width] cmp ebx,[(bmp_file si).bmp_width]
jb @@bouclette jb @@bouclette
xor bx,bx xor bx,bx
add di,dx add di,dx
dec cx dec cx
cmp cx,0 cmp cx,0
jne @@bouclette jne @@bouclette
clc clc
pop di si dx cx bx ax ret
pop bp
retf taille
@@errorshowing: @@errorshowing:
stc stc
pop di si cx bx ax ret
pop bp ENDP showbmp
retf taille
showbmp ENDP
;==========LOADBMPPALET========= ;==========LOADBMPPALET=========
@ -79,16 +73,14 @@ showbmp ENDP
;-> DS:%0 BMP ;-> DS:%0 BMP
;<- ;<-
;=============================== ;===============================
loadbmppalet PROC FAR PROC loadbmppalet FAR
ARG pointer:word=taille ARG @pointer:word
push bp USES ax,bx,cx,dx,si
mov bp,sp mov si,[@pointer]
push ax bx cx dx si
mov si,[pointer]
mov bx,0400h+36h-4 mov bx,0400h+36h-4
mov cx,100h mov cx,100h
mov dx, 3c8h mov dx, 3c8h
paletteload: @@paletteload:
mov al, cl mov al, cl
dec al dec al
out dx, al out dx, al
@ -105,10 +97,8 @@ paletteload:
sub bx,4 sub bx,4
dec dx dec dx
dec cl dec cl
jnz paletteload jnz @@paletteload
pop si dx cx bx ax ret
pop bp ENDP loadbmppalet
retf taille
loadbmppalet ENDP
end start