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)