ASM写标准dll文件的问题

happysealing 2004-05-06 11:13:24
以下是用汇编写的串行通信的程序,请问如何把它修改成能编译成16位dll的程序?又如何把它修改成能编译成32位dll的程序?还有就是看看我修改的程序有什么问题,帮忙改正一下!
'串口通信接收程序
data segment
sendend db 'send success!',13,10,'$'
reverr db 'revieice error!', 13,10,'$'
data ends
code segment
main proc far
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax

call i8250


reveice:mov dx,3fdh
in al,dx
test al,01h

jz reveice
rec: mov dx,3f8h
in al,dx
and al,7fh
cmp al,0dh
je exit
disp:mov ah,2
mov dl,al
int 21h
jmp reveice
error :lea dx,reverr
mov ah,9
int 21h
jmp exit_1

exit:
lea dx,sendend
mov ah,9
int 21h

exit_1:mov ah,4ch
int 21h
ret
main endp
i8250 proc near
mov dx,3fbh
mov al,80h
out dx,al
mov dx,3f9h
mov al,00h
out dx,al
mov dx,3f8h
mov al,60h
out dx,al
mov dx,3fbh
mov al,03h
out dx,al
mov dx,3f9h
mov al,00h
out dx,al
mov dx,3fch
mov al,0
out dx,al

ret
i8250 endp

code ends
end start

'我修改的供编译成dll的程序
.386
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
include kernel32.inc
includelib user32.lib
includelib kernel32.lib
.data
sendend db 'send success!',13,10,'$'
reverr db 'revieice error!', 13,10,'$'
.code
DllEntry proc hInstDLL:HINSTANCE, reason:DWORD, reserved1:DWORD
mov eax,TRUE
ret
DllEntry Endp
main proc far
call i8250


reveice:mov dx,3fdh
in al,dx
test al,01h

jz reveice
rec: mov dx,3f8h
in al,dx
and al,7fh
cmp al,0dh
je exit
disp:mov ah,2
mov dl,al
int 21h
jmp reveice
error :lea dx,reverr
mov ah,9
int 21h
jmp exit_1

exit:
lea dx,sendend
mov ah,9
int 21h

exit_1:mov ah,4ch
int 21h
ret
main endp
i8250 proc near
mov dx,3fbh
mov al,80h
out dx,al
mov dx,3f9h
mov al,00h
out dx,al
mov dx,3f8h
mov al,60h
out dx,al
mov dx,3fbh
mov al,03h
out dx,al
mov dx,3f9h
mov al,00h
out dx,al
mov dx,3fch
mov al,0
out dx,al

ret
i8250 endp
end DllEntry

...全文
43 3 点赞 打赏 收藏 举报
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
happysealing 2004-05-09
我看了罗云杉的Win32汇编,说是Win32汇编中不用int *来进行BIOS和DOS调用,那我这段程序怎么修改成32位汇编程序并把它编译成32位dll呢?
  • 打赏
  • 举报
回复
happysealing 2004-05-07
谢谢Purpleendurer,看过了,但关于dll编写的例子太少!望提供更多这方面的资料!
  • 打赏
  • 举报
回复
紫郢剑侠 2004-05-06
关于DLL的编写,楼主可以看MASM32附带的ICZTUTES。
  • 打赏
  • 举报
回复
相关推荐
发帖
汇编语言
加入

2.1w+

社区成员

汇编语言(Assembly Language)是任何一种用于电子计算机、微处理器、微控制器或其他可编程器件的低级语言,亦称为符号语言。
申请成为版主
帖子事件
创建了帖子
2004-05-06 11:13
社区公告
暂无公告