Browse Source

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

feature/test
Nicolas Hordé 17 years ago
parent
commit
dd7a8c05ee
  1. 102
      lib/bmp.asm

102
lib/bmp.asm

@ -1,77 +1,71 @@
.model tiny
.486
smart
model tiny,stdcall
p586N
locals
.code
org 0h
jumps
codeseg
option procalign:byte
include ..\include\mem.h
include ..\include\bmp.h
include "..\include\mem.h"
include "..\include\divers.h"
include "..\include\bmp.h"
start:
header exe <,1,0,,,,offset exports,>
org 0h
exports:
db "showbmp",0
dw showbmp
db "loadbmppalet",0
dw loadbmppalet
dw 0
start:
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

Loading…
Cancel
Save