zoukankan      html  css  js  c++  java
  • 汇编语言-环境安装及各个寄存器介绍

    汇编语言

    安装汇编语言环境

    1. 首先,下载DosBox,DOSBox 是一个 DOS 模拟程序。MAC安装就比较简单了,dmg直接打开DOSBox.app拖进 /Applications
    2. 下载debug.exe和masm
    3. 建立一个编译汇编文件的文件夹
    4. 将下载好的debug.exe文件和masm文件放到相应文件夹下面,为了方便,我假设这个文件夹路径为Users/Your Name/Documents/Assembly

    下面是简单效果图:


    小技巧:

    在我们每次打开DOSBox的时候,都要这么麻烦对其C盘文件进行设置(mount c /Users/Your Name/Documents/assembly),这不是很麻烦的事情吗?这个我们查看README文件,发现了下面的话:

    The configuration file is automatically created the first time you run DOSBox.
    The file can be found in:
       (Windows)  "Start/WinLogo Menu"->"All Programs"->DOSBox-0.74->Options
       (Linux)    ~/.dosbox/dosbox-0.74.conf
       (MAC OS X) "~/Library/Preferences/DOSBox 0.74 Preferences"
    The file is divided into several sections. Each section starts with a
    [section name] line. The settings are the property=value lines where value can
    be altered to customize DOSBox.
    # and % indicate comment-lines.
    

    因此,我们只要根据路径『~/Library/Preferences/DOSBox 0.74 Preferences』,打开偏好设置文件,在最后位置键入

    [autoexec]
    # Lines in this section will be run at startup.
    # You can put your MOUNT lines here.
    mount c /Users/Your Name/Documents/Assembly
    set PATH=Z:;c:
    c:

    那么,每次运行DOSBox的时候,我们就可以不再重新设置C盘路径了。

    路径中的your name,改成你自己的帐号名。


    各个寄存器的介绍:

    通用寄存器:

    AX,BX,CX,DX 称作为数据寄存器:

    AX (Accumulator):累加寄存器,也称之为累加器;

    BX (Base):基地址寄存器;

    CX (Count):计数器寄存器;

    DX (Data):数据寄存器;

    SP 和 BP 又称作为指针寄存器:

    SP (Stack Pointer):堆栈指针寄存器;

    BP (Base Pointer):基指针寄存器;


    SI 和 DI 又称作为变址寄存器:

    SI (Source Index):源变址寄存器;

    DI (Destination Index):目的变址寄存器;


    控制寄存器:

    IP (Instruction Pointer):指令指针寄存器;

    FLAG:标志寄存器;


    段寄存器:

    CS (Code Segment):代码段寄存器;

    DS (Data Segment):数据段寄存器;

    SS (Stack Segment):堆栈段寄存器;

    ES (Extra Segment):附加段寄存器;


    debug工具命令介绍

  • 相关阅读:
    PAT (Advanced Level) 1060. Are They Equal (25)
    PAT (Advanced Level) 1059. Prime Factors (25)
    PAT (Advanced Level) 1058. A+B in Hogwarts (20)
    PAT (Advanced Level) 1057. Stack (30)
    PAT (Advanced Level) 1056. Mice and Rice (25)
    PAT (Advanced Level) 1055. The World's Richest (25)
    PAT (Advanced Level) 1054. The Dominant Color (20)
    PAT (Advanced Level) 1053. Path of Equal Weight (30)
    PAT (Advanced Level) 1052. Linked List Sorting (25)
    PAT (Advanced Level) 1051. Pop Sequence (25)
  • 原文地址:https://www.cnblogs.com/AbeDay/p/5026858.html
Copyright © 2011-2022 走看看