郁闷求助,帮我看看这个显示bmp的程序到底哪里不对吧,万分感谢!
data segment
;file path
pathname db 'e:\masm5\c.bmp',00
;handle
handle dw ?
;store
bmpdate1 db 256*4 dup(?)
bmpdate2 db 64000 dup(?)
len dw ?
row db 0
endcde db 0
data ends
;--------------------------------------------------------
;stack
stack segment
dw 100h dup(?)
stack ends
;-------------------------------------------------------
prognam segment
assume cs:prognam,ds:data,ss:stack
main proc far
;set stack
push ds
xor ax,ax
push ax
;set ds register to current data
mov ax,data
mov ds,ax
;main part of the program
call openf
call readf1
call dispy1
call readf2
call dispy2
mov ah,0
int 16h
mov ax,3
int 10h
mov ax,4c00h
int 21h
mov ax,4c00h
int 21h
main endp
;-------------------------------------------------------
;设置调色板
dispy1 proc near
;set the palett
mov cx,256
lea si,bmpdate1
p:
mov dx,3c8h
mov ax,cx
dec ax
out dx,al
inc dx
mov al,[si+2]
shr al,1
shr al,1
out dx,al
mov al,[si+1]
shr al,1
shr al,1
out dx,al
mov al,[si]
shr al,1
shr al,1
out dx,al
add si,4
loop p
ret
dispy1 endp
;---------------------------------------------------
;读象素的颜色信息
readf2 proc near
mov ah,42h
mov al,0
mov bx,handle
mov cx,0
mov dx,436h
int 21h
mov ah,3fh
lea dx,bmpdate2
mov cx,64000
int 21h
ret
readf2 endp
;---------------------------------------------------
;打开文件
openf proc near
lea dx,pathname
mov ah,3dh
mov al,0
int 21h
mov handle,ax
ret
openf endp
;---------------------------------------------------
;读入调色板信息
readf1 proc near
mov ah,42h
mov al,0
mov bx,handle
mov cx,0
mov dx,36h
int 21h
mov ah,3fh
lea dx,bmpdate1
mov cx,256*4
int 21h
ret
readf1 endp
;显示bmp
dispy2 proc near
mov bx,0a000h
mov es,bx
mov ax,0013h
int 10h
mov ax,0
mov di,ax
lea si,bmpdate2
mov cx,64000
dis:
mov ax,[si]
stosb
inc di
add si,2
loop dis
ret
dispy2 endp
prognam ends
end main
这个是用来显示256色bmp文件的,我为了简单一点把bmp图像改成320*200的大小,但是现在显示出来是花的,只能看到一点大概的轮廓,各位帮帮小弟吧!!