中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net  论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

游客:  注册 | 登录 | 命令行 | 搜索 | 上传 | 帮助 »
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » 求助!请将以下程序编制为COM文件
作者:
标题: 求助!请将以下程序编制为COM文件 上一主题 | 下一主题
zhjipt
初级用户





积分 40
发帖 16
注册 2006-12-3
状态 离线
『楼 主』:  求助!请将以下程序编制为COM文件

此程序按COM文件格式编制,通过汇编、链接并转换为COM文件即可 ***** :13.asm(13.com) :1993.11.28 code segment assume cs:code:ds:code org 100h be: jmp intt popp macro pop ds pop es pop di pop si pop dx pop cx pop bx pop ax popf endm :16进制数值转换为ACII码 hexasc macro add al,090h daa adc al,040h daa endm buff db 0 dat db 'CH:' chl db 0 ch2 db 0 db'CL:' c11 db 0 c12 db 0 db 'DH:' dh1 db 0 dh2 db 0 mseg db'(请选择w/r/空格)' oldint13 dd 0 newint13: sit pushf push ax push bx push cx push dx push si push di push es push ds push cs pup ds cmp ah,03 jz jxl jmp old jxl: cmp dl,80h jx jx2 jmp old jx2: push cx mov buff,ch mov cl,4 mov al,buff shr al,cl hexasc mov ch1,al mov al,buff and al,0fh hexasc mov ch2,al pop cx mov buff,cl mov al,cl mov cl,4 shr al,cl hexasc mov cl1,al mov al,buff and al,0fh hexasc mov c12,al mov buff,dh mov al,dh shr al,cl hexasc mov dhl,al mov al,buff and al,0fh hexasc mov dh2,al lea si,dat mov ah,03h mov bh,0 int 10h push dx mov dx,0029h mov cx,34 loopl: mov ah,02h int 10h mov bl,70h mov ah,09h lodsb int 10h inc dl loop loopl mov ah,02h pop dx int 10h wair:mov ah,0 int 16h cmp al,'w' jz old cmp al,'r' jz rett cmp al,' ' jnz wair cli mov ah,4ch int 21h rett: popp cli iret jmp cs:oldint13 intt: mov ax,3513h int 21h lea di,oldint13 mov[di],bx mov[di+2],es mvo dx,offset newint13 mov ax,2513h int 21h mov dx,offset intt inc dx int 27h code ends end be *****


2006-12-4 11:18
查看资料  发送邮件  发短消息  网志   编辑帖子  回复  引用回复
darkradx
高级用户





积分 972
发帖 420
注册 2004-5-16
状态 离线
『第 2 楼』:  

自己不弄个masm/tasm?




平生进退如飙风
2006-12-5 00:46
查看资料  发送邮件  发短消息  网志   编辑帖子  回复  引用回复
19951001
高级用户

流落街头



积分 570
发帖 272
注册 2005-10-17
来自 北京
状态 离线
『第 3 楼』:  

做什么用的?


2006-12-5 02:02
查看资料  发短消息  网志   编辑帖子  回复  引用回复
zhjipt
初级用户





积分 40
发帖 16
注册 2006-12-3
状态 离线
『第 4 楼』:  

不行呀


2006-12-7 17:15
查看资料  发送邮件  发短消息  网志   编辑帖子  回复  引用回复
zhgwbzhd
高级用户





积分 506
发帖 187
注册 2005-12-4
状态 离线
『第 5 楼』:  

用debug吧,直接编译成.com


2006-12-9 23:30
查看资料  发送邮件  发短消息  网志   编辑帖子  回复  引用回复
本是
银牌会员





积分 2201
发帖 789
注册 2005-1-27
状态 离线
『第 6 楼』:  

你是照书录入的,应该刚学汇编,输入错误: sit-->sti mvo-->mov jx-->jz 变量名(1与l,与ti要分清): cl1,cl2,dh1,dl1,loop1,jx1 wait,init jmp cs:oldint13丢失行号: old: 注释”16进制数值转换为ACII码“应以;开始 assume cs:code, ds:code中的逗号 改正后的源程序见下面: popp macro pop ds pop es pop di pop si pop dx pop cx pop bx pop ax popf endm ;16进制数值转换为ACII码 hexasc macro add al,090h daa adc al,040h daa endm code segment assume cs:code,ds:code org 100h be: jmp init buff db 0 dat db 'CH:' ch1 db 0 ch2 db 0 db 'CL:' cl1 db 0 cl2 db 0 db 'DH:' dh1 db 0 dh2 db 0 mseg db '(请选择w/r/空格)' oldint13 dd 0 newint13: sti pushf push ax push bx push cx push dx push si push di push es push ds push cs pop ds cmp ah,03 jz jx1 jmp old jx1: cmp dl,80h jz jx2 jmp old jx2: push cx mov buff,ch mov cl,4 mov al,buff shr al,cl hexasc mov ch1,al mov al,buff and al,0fh hexasc mov ch2,al pop cx mov buff,cl mov al,cl mov cl,4 shr al,cl hexasc mov cl1,al mov al,buff and al,0fh hexasc mov cl2,al mov buff,dh mov al,dh shr al,cl hexasc mov dh1,al mov al,buff and al,0fh hexasc mov dh2,al lea si,dat mov ah,03h mov bh,0 int 10h push dx mov dx,0029h mov cx,34 loop1: mov ah,02h int 10h mov bl,70h mov ah,09h lodsb int 10h inc dl loop loop1 mov ah,02h pop dx int 10h wait1: mov ah,0 int 16h cmp al,'w' jz old cmp al,'r' jz rett cmp al,' ' jnz wait1 cli mov ah,4ch int 21h rett: popp cli iret old: jmp cs:oldint13 init: mov ax,3513h int 21h lea di,oldint13 mov [di],bx mov [di+2],es mov dx,offset newint13 mov ax,2513h int 21h mov dx,offset init inc dx int 27h code ends end be [ Last edited by 本是 on 2007-1-6 at 03:57 AM ]


   此帖被 +1 点积分    点击查看详情   
评分人:【 xiaohacker 分数: +1  时间:2007-1-8 01:57




my major is english----my love is dos----my teacher is the buddha----my friends--how about U
2007-1-6 03:46
查看资料  发送邮件  发短消息  网志   编辑帖子  回复  引用回复
本是
银牌会员





积分 2201
发帖 789
注册 2005-1-27
状态 离线
『第 7 楼』:  

程序的作用是:运行后驻留内存,并替换INT 13h磁盘处理中断,是写第1硬盘则询问w写、r读、空格则退回DOS(可改为不作任何磁盘操作而返回中断调用程序----删除行末有;;的行并改动提示信息为w to write hd0, r to read only)。 另外,程序中数字转化部分写得啰嗦,键盘测试部分不周全,这样的程序是底层的信息,不一定在汉字系统下运行,所以进一步改进如下: pushh macro push ax push bx push cx push dx push si push di push es push ds endm popp macro pop ds pop es pop di pop si pop dx pop cx pop bx pop ax popf endm ;16进制数值转换为ACII码 hexasc macro add al,090h daa adc al,040h daa endm code segment assume cs:code,ds:code org 100h be: jmp init dat db 'CH:',0,0,'CL:',0,0,'DH:',0,0 mseg db 'Enter (w/r/SPACE):' msglen=$-dat hex2str: add di,3 mov cl,4 mov al,bh shr al,cl hexasc stosb mov al,bh and al,0fh hexasc stosb ret oldint13 dd 0 newint13: sti pushf pushh push cs pop ds cmp ah,03 jz jx1 jmp old jx1: cmp dl,80h jz jx2 jmp old jx2: lea di,dat push cx mov bh,ch call hex2str pop cx mov bh,cl call hex2str mov bh,dh call hex2str lea si,dat mov ah,03h mov bh,0 int 10h push dx mov dx,0029h mov cx,msglen ;34 loop1: mov ah,02h int 10h mov bl,70h mov ah,09h lodsb int 10h inc dl loop loop1 mov ah,02h pop dx int 10h wait1: mov ah,0 int 16h cmp al,'w' jz old cmp al,'W' jz old cmp al,'r' jz rett cmp al,'R' jz rett ;; cmp al,' ';; jnz wait1 cli ;; mov ah,4ch;; int 21h ;; rett: popp cli iret old: jmp cs:oldint13 init: mov ax,3513h int 21h lea di,oldint13 mov [di],bx mov [di+2],es mov dx,offset newint13 mov ax,2513h int 21h mov dx,offset init inc dx int 27h code ends end be [ Last edited by 本是 on 2007-1-6 at 04:40 AM ]




my major is english----my love is dos----my teacher is the buddha----my friends--how about U
2007-1-6 03:57
查看资料  发送邮件  发短消息  网志   编辑帖子  回复  引用回复
本是
银牌会员





积分 2201
发帖 789
注册 2005-1-27
状态 离线
『第 8 楼』:  

注意原INT 13h的中断向量并未保存,此程序仅供高手或虚拟机中使用,否则;)会“麻烦”!!! [ Last edited by 本是 on 2007-1-6 at 04:45 AM ]




my major is english----my love is dos----my teacher is the buddha----my friends--how about U
2007-1-6 04:43
查看资料  发送邮件  发短消息  网志   编辑帖子  回复  引用回复

请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转: