Compilation (iii)

Source: Internet
Author: User

This program realizes the content: reads a 1-7 number from the keyboard, and displays the corresponding week the English word.

The program is implemented using the Address table. Use seven processor segments to display 1~7 corresponding English words respectively, and save the first address in the Address table.

Address Table: Defines a sub-store in a data segment table, which holds the starting address of 7 handler segments sequentially. You can then align the numbers entered with the corresponding Address table subscript (that is, the mapping function). It is important to note that the branch address stored in the Address table is 16 bits and occupies two bytes. So when the subscript corresponds, you need to multiply by two. For example, if the subscript is I, then the entry address of the first handler segment is called Table[i*2]. Multiply by two in the assembly can be left-shifted one implementation.

Specific as follows:

  

;reads a 1-7 number from the keyboard and displays the English words for the corresponding weekstack segment Stack db theDUP (?) Stack Endsdata segment'Data'msg0 db 0dh,0ah,'input Number (1-7):', 0dh,0ah,'$'MSG1 db 0dh,0ah,'Monday', 0dh,0ah,'$'MSG2 db 0dh,0ah,'Tuesday', 0dh,0ah,'$'MSG3 db 0dh,0ah,'Wednesday', 0dh,0ah,'$'MSG4 db 0dh,0ah,'Thursday', 0dh,0ah,'$'MSG5 db 0dh,0ah,'Friday', 0dh,0ah,'$'Msg6 db 0dh,0ah,'Saturday', 0dh,0ah,'$'Msg7 db 0dh,0ah,'Sunday', 0dh,0ah,'$'tab DW PROCA,PROCB,PROCC,PROCD,PROCE,PROCF,PROCG; Address Table data Endscode segment'Code'assumeCS:Codeds:DataSS:StackStart:    movAx,datamovDs,axmovDx,offset msg0movah,09hint21Hmovah,01hint21HCMPal,31hJLStartCMPal,37hJGStartDecAlSubal,30hCBW    SHLAx1    movBx,axjmpTAB[BX]Proca:    movDx,offset MSG1movah,09hint21hjmp DonePROCB:    movDx,offset MSG2movah,09hint21hjmp DonePROCC:    movDx,offset MSG3movah,09hint21hjmp DoneProCD:    movDx,offset MSG4movah,09hint21hjmp DoneProce:    movDx,offset MSG5movah,09hint21hjmp DonePROCF:    movDx,offset Msg6movah,09hint21hjmp DonePROCG:    movDx,offset Msg7movah,09hint21hjmp DoneDone :        movax,4c00hint21hcode ends End start

Compilation (iii)

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.