庞大资源库的计算机教程网站!
设为首页
加入收藏
总编信箱
投稿或申请专栏请先 [登 陆]
首页 操作系统 程序设计 图形图像 媒体动画 机械电子 WEB开发 数 据 库 办公系列 路由技术 网络原理 网络应用
认证考试 安全技术
首页>程序设计>汇编语言>相关源码>正文
资料搜索
Google搜索
Google
返回上级列表

推荐文章

快速保存网页中所有图片的方法
Windows中让光驱巧妙“隐身”技
防范非法用户入侵Win 2000/XP系
两款比较典型的ASP木马防范方法
有关表格边框的css语法整理
Windows XP中可以被禁用的服务
SQL Server导出导入数据方法
Javascript所有对象的属性的获
网页(HTML)中的特殊字符
与篮球共舞,尽显模式本色
QQ病毒的手工清除方法
Photoshop为极品美女打造性感睫
天衣无缝:IIS与PHP水火也相容
SQL Server存储过程编写和优化

汇编的的各类源码--fxn

 作者:本站收集   日期:2005-8-1 15:39:10
字号选择〖 〗/ 双击滚屏 单击停止   
         name      FXN4BH
         page      55,132
         title     'FXN4BH --- demo PC-DOS EXEC function'
;
; FXN4BH --- demonstrate use of the
; PC-DOS 2.0 EXEC function call 4BH
;
; Copyright (c) 1983 by Ray Duncan
;
cr       equ       0dh       ;ASCII carriage return
lf       equ       0ah       ;ASCII line feed
                             ;
cseg     segment   para public 'CODE'
                             ;
         assume    cs:cseg,ds:data,ss:stack
                             ;
demo     proc      far
                             ;at entry DS & ES = PSP
         push      ds        ;Save address for final
         xor       ax,ax     ;FAR RET to PC-DOS on stack
         push      ax
                             ;save copy of SS:SP for use
                             ;after return from overlay
         mov       cs:STK_SEG,ss
         mov       cs:STK_PTR,sp
                             ;
                             ;Reserve 1000H bytes for
                             ;this loader and release
                             ;the rest of memory for
                             ;use by the overlayed program.
         mov       bx,100h   ;ES=segment of PSP of loader
         mov       ah,4ah    ;BX=paragraphs to reserve
         int       21h
                             ;make the messages in data
                             ;segment addressable
         mov       ax,seg DATA
         mov       ds,ax
         mov       es,ax
                             ;jump if memory
                             ;de-allocation failed
         jc        ALLOC_ERR
                             ;print memory successfully
                             ;released
         mov       dx,offset MSG2
         mov       ah,9
         int       21h
                             ;
                             ;now load and execute
                             ;the overlaid program.
         mov       dx,offset PGM_NAME
         mov       bx,offset PAR_BLK
         mov       al,0
         mov       ah,4bh
         int       21h
                             ;restore stack pointers
                             ;to state before EXEC call
         mov       ss,cs:STK_SEG
         mov       sp,cs:STK_PTR
                             ;Make data segment
                             ;addressable again
         mov       ax,seg DATA
         mov       ds,ax
                             ;print message that loader
                             ;successfully regained control
         mov       dx,offset MSG3
         mov       ah,9
         int       21h
                             ;now exit to PC-DOS
         ret

alloc_err:                   ;come here if memory
                             ;cannot be released
         mov       dx,offset MSG1
         mov       ah,9
         int       21h       ;print error message and
         ret                 ;exit to PC-DOS
                             ;
demo     endp
                             ;
                             ;these two variables must
                             ;reside in Code Segment so
                             ;that they are addressable
                             ;after return from overlay.
stk_seg  dw        0         ;original SS contents
stk_ptr  dw        0         ;original SP contents
                             ;
cseg     ends

                             ;declare a stack area
                             ;for use by this loader
stack    segment   para stack 'STACK'
                             ;allow 64 bytes in this case
         db        64 dup (?)
stack    ends

                             ;declare data segment to
                             ;contain variables and tables
data     segment   para public 'DATA'
;
msg1     db        cr,lf
         db        'Unable to release memory.'
         db        cr,lf,'$'
msg2     db        cr,lf
         db        'Memory above loader released.'
         db        cr,lf,'Now loading CHKDSK.COM.'
         db        cr,lf,'$'
msg3     db        cr,lf
         db        'Loader regained control from CHKDSK,'
         db        cr,lf
         db        'now making final exit to PC-DOS.'
         db        cr,lf,'$'
;
                             ;drive, path, and name of program
                             ;to be loaded and executed.
pgm_name db        '\CHKDSK.COM',0
;
par_blk  dw        ENVIR     ;segment address of
                             ;environment descriptor
                             ;
                             ;full address of command line
                             ;to be passed at offset 80H
         dw        offset CMD_LINE     ;in overlaid
         dw        seg CMD_LINE        ;program's PSP
                             ;
                             ;full address of default
                             ;File Control Block to be
                             ;passed at offset 5CH in
         dw        offset FCB1         ;overlaid
         dw        seg FCB1            ;program's PSP
                             ;
                             ;full address of default
                             ;File Control Block to be
                             ;passed at offset 6CH in
         dw        offset FCB2         ;overlaid
         dw        seg FCB2            ;program's PSP
;
                             ;actual command line tail
                             ;to be passed to overlay
cmd_line db        4,' *.*',cr,0
;
                             ;first default FCB to
fcb1     db        0         ;be passed to overlay
         db        11 dup ('?')
         db        25 dup (0)

                             ;second default FCB to
fcb2     db        0         ;be passed to overlay
         db        11 dup (' ')
         db        25 dup (0)
;
data     ends

                             ;declare separate data
                             ;segment to contain
                             ;environment descriptor
envir    segment   para 'ENVIR'
                             ;
                             ;Search path used by PC-DOS
                             ;to look for commands or
                             ;batch files not found in
         db        'PATH=',0 ;the current directory
                             ;
                             ;Search path used by PC-DOS
                             ;to locate COMMAND.COM
         db        'COMSPEC=A:\COMMAND.COM',0
         db        0         ;extra 0 byte designates
                             ;end of environment
envir    ends

         end       demo

上一篇:汇编的的各类源码--getseg_c    下一篇:汇编的的各类源码--frespace  
[发送给好友]  [关闭窗口]  [返回顶部]   转载请注明来源:www.it00.com   
特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
责任编辑: 原点 投稿作者: 本站收集
信息来源: 网络 录入时间: 2005-8-1 15:39:10
关于我们 - 广告服务 - 版权申明 - 网站地图 - 联系方式 - 总编信箱 - 会员投稿