• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号
您的位置:首页 > 程序设计 >汇编语言 > 汇编源码系列之dosmac

汇编源码系列之dosmac

作者:匿名 字体:[增加 减小] 来源:互联网 时间:2017-06-28

匿名通过本文主要向大家介绍了汇编源码,易语言反汇编源码,win7用远程汇编源码,反汇编源码,易语言汇编源码等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
</div>

这个都是过去DOS时代的汇编源码,虽然已经过去了,但是对于学习汇编还是有帮助的,汇编语言只是程序员一门基础语言,大多人掌握即可,不一定要深入研究.......

;
; Macro file for MSDOS.
;
SUBTTL BREAK a listing into pages and give new subtitles
PAGE
BREAK  MACRO  subtitle
    SUBTTL subtitle
    PAGE
ENDM
BREAK <I_NEED: declare a variable external, if necessary, and allocate a size>
;
; declare a variable external and allocate a size
;
I_NEED MACRO  sym,len
  CODE  ENDS
  DATA  SEGMENT BYTE PUBLIC 'DATA'
  IFIDN  <len>,<WORD>
    EXTRN  &sym:WORD
  ELSE
    IFIDN  <len>,<DWORD>
      EXTRN  &sym:DWORD
    ELSE
      EXTRN  &sym:BYTE
    ENDIF
  ENDIF
  DATA  ENDS
  CODE  SEGMENT BYTE PUBLIC 'CODE'
ENDM
;
; call a procedure that may be external. The call will be short.
;
invoke MACRO  name
&.xcref
  add_ext name,near
&.cref
  CALL  name
ENDM
PAGE
;
; jump to a label that may be external. The call will be near.
;
transfer  MACRO  name
&.xcref
  add_ext name,near
&.cref
  JUMP  name
ENDM
;
; get a short address in a word
;
short_addr MACRO  name
  IFDIF  <name>,<?>
&.xcref
    add_ext name,near
&.cref
    DW OFFSET DOSGROUP:name
  ELSE
    DW ?
  ENDIF
ENDM
;
; get a long address in a dword
;
long_addr  MACRO  name
&.xcref
  add_ext name,far
&.cref
  DD name
ENDM
;
; declare a PROC near or far but PUBLIC nonetheless
;
procedure  MACRO  name,distance
    PUBLIC name
name  PROC  distance
ENDM
PAGE
;
; define a data item to be public and of an appropriate size/type
;
I_AM  MACRO  name,size
  PUBLIC name
  IFIDN <size>,<WORD>
    name  DW ?
  ELSE
    IFIDN <size>,<DWORD>
      name  DD ?
    ELSE
      IFIDN <size>,<BYTE>
        name  DB ?
      ELSE
        name  DB size DUP (?)
      ENDIF
    ENDIF
  ENDIF
ENDM
PAGE
;
; play games with a possible external. Create a new
; macro for the symbol and text, and string it together
; with a central invoker
;
.xcref
.xcref ?i
.xcref def_mac
.xcref ?z0
.xcref add_ext
.cref
IF1
  ?i=0
ENDIF
?z0 macro
endm
;
; add an external declaration to s with type t if it is not defined
;
add_ext macro  s,t
&.xcref
&.xcref ?&s
&.cref
  IFNDEF  ?&s
    ?i = ?i + 1
    def_mac   ?z&%?i,?z&%(?i-1),s,t
  ENDIF
endm
;
; define a macro called that possibly externals s:t and then calls macro n
;
def_mac macro  m,n,s,t
&.xcref
&.xcref ?&s
&.xcref m
&.cref
m  macro
  ifndef s
    extrn s:&t
  endif
  purge m
  purge ?&s
  n
endm
?&s macro
&endm
endm
;
; call the macro chain
;
do_ext macro
&.xcref
  expand_mac ?z%?i
&.cref
endm
PAGE
expand_mac macro m
  m
endm
;
; define an entry in a procedure
;
entry macro name
  PUBLIC name
name:
endm
BREAK <ERROR - print a message and then jump to a label>
error macro code
  local a
.xcref
  MOV AL,code
  transfer  SYS_RET_ERR
.cref
ENDM
BREAK <JUMP - real jump that links up shortwise>
;
; given a label <lbl> either 2 byte jump to another label <lbl>_J
; if it is near enough or 3 byte jump to <lbl>
;
jump  macro lbl
  local a
.xcref
  a:
  ifndef lbl&_J            ; is this the first invocation
    JMP lbl
  ELSE
    IF lbl&_J GE $
      JMP lbl
    ELSE
      IF ($-lbl&_J) GT 126      ; is the jump too far away?
        JMP lbl
      ELSE              ; do the short one...
        JMP lbl&_J
      ENDIF
    ENDIF
  ENDIF
endm
BREAK <RETURN - return from a function>
return macro
  local a
.xcref
a:
  RET
ret_l = a
endm
BREAK <CONDRET - conditional return>
makelab macro l,cc,ncc
  j&ncc  a              ; j<NCC> a:
  return               ; return
  a:                 ; a:
  ret_&cc = ret_l           ; define ret_<CC> to be ret_l
endm
condret macro  cc,ncc
  local  a,b
  ifdef  ret_l            ; if ret_l is defined
    if (($ - ret_l) le 126) and ($ gt ret_l)
                    ;   if ret_l is near enough then
      a: j&cc  ret_l      ;     a: j<CC> to ret_l
      ret_&cc = a         ;     define ret_<CC> to be a:
    else
      makelab a,cc,ncc
    endif
  else
    ifdef  ret_&cc           ; if ret_<CC> defined
      if (($ - ret_&cc) le 126) and ($ gt ret_&cc)
                      ;   if ret_<CC> is near enough
        a: j&cc  ret_&cc     ;     a: j<CC> to ret_<CC>
        ret_&cc = a         ;     define ret_<CC> to be a:
      else
        makelab a,cc,ncc
      endif
    else
      makelab a,cc,ncc
    endif
  endif
endm
;condret macro  cc,ncc
;  local  a,b
;  ifdef  ret_l            ; if ret_l is defined
;    if (($ - ret_l) le 126) and ($ gt ret_l)
;                    ;   if ret_l is near enough then
;      a: j&cc  ret_l      ;     a: j<CC> to ret_l
;      ret_&cc = a         ;     define ret_<CC> to be a:
;      exitm
;    endif
;  endif
;  ifdef  ret_&cc           ; if ret_<CC> defined
;    if (($ - ret_&cc) le 126) and ($ gt ret_&cc)
;                    ;   if ret_<CC> is near enough
;      a: j&cc  ret_&cc     ;     a: j<CC> to ret_<CC>
;      ret_&cc = a         ;     define ret_<CC> to be a:
;      exitm
;    endif
;  endif
;  j&ncc  a              ; j<NCC> a:
;  return               ; return
;  a:                 ; a:
;  ret_&cc = ret_l           ; define ret_<CC> to be ret_l
;endm
BREAK <RETZ - return if zero, links up shortwise if necessary>
retz  macro
  condret z,nz
endm
BREAK <RETNZ - return if not zero, links up shortwise if necessary>
retnz  macro
  condret nz,z
endm
BREAK <RETC - return if carry set, links up shortwise if necessary>
retc  macro
  condret c,nc
endm
BREAK <RETNC - return if not carry, links up shortwise if necessary>
retnc  macro
  condret nc,c
endm


</div> </div> </div> </div>
分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • 汇编源码系列之inthand
  • 汇编源码系列之cdcheck
  • 汇编源码系列之cldoc12
  • 汇编源码系列之basload
  • 汇编源码系列之basmain
  • 汇编源码系列之brk2
  • 汇编源码系列之cleanf
  • 汇编源码系列之charop
  • 汇编源码系列之sertype
  • 汇编源码系列之comint

相关文章

  • 2017-06-28DOS6.0源程序中的硬盘引导记录源程序FDBOOT.ASM
  • 2017-06-28树型视图控件详解
  • 2017-06-17子程序的嵌套
  • 2017-06-28汇编DeviceIoControl接口详解
  • 2017-06-28结构化程序方法在汇编语言中的应用
  • 2017-06-28给程序加个图标
  • 2017-06-17系统配置查询(BIOS,INT 10H)
  • 2017-06-17串操作类指令
  • 2017-06-28用汇编语言编写消息框程序
  • 2017-06-28详解驻留exe文件

文章分类

  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号

最近更新的内容

    • 汇编教程:连接数据源
    • 给程序加个图标
    • 如何使用DLL中的资源
    • 汇编数据转换操作小技巧
    • 汇编处理程序多重启动
    • 汇编源代码之汇编语言制作的光带菜单及源程序(1.0)
    • 汇编教程:VxD程序设计入门
    • 汇编源码系列之dossym
    • 用汇编语言编写消息框程序
    • Win32汇编程序的结构和语法

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有