Wang Shuang, assembler, 296, uses variables to locate subprograms

Source: Internet
Author: User

Wang Shuang didn't use the variable. He only said it was another label method.

There is such a paragraph on the 296 page of the bookCode

 1   Charstack:  JMP  Short charstart  2   3   Table DW charpush, charpop, charshow  4   5 Top DW, 0  6   7   Charstart:  Push BX  8   9                Push  DX  10   11                Push  Di  12   13                Push  Es  14   15                CMP Ah, 2  16  17                 Ja  Sret  18   19                 MoV  BL, ah  20   21                 MoV BH, 0  22   23                 Add  BX, BX  24   25                 JMP Word PTR table [BX]  26   27 ..............................................

 

 

Problem:

I am using emu8086. The last line of code JMP word PTR table [BX] cannot always jump to the correct position.

The value of BX must be 2 each time. Table [BX] indicates the variable at the position BX/2.

Solution:

Later I found out that it was the default ds, and table [BX] is equivalent to DS: Table [BX], so of course it cannot jump correctly, as long as it is changed to CS: table [BX.

The value of BX must be 2 each time. Table [BX] indicates the variable at the position BX/2.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.