Professional Documents
Culture Documents
INFO STRUC
NAMES DB 32 DUP (?)
STREET DB 32 DUP (?)
CITY DB 16 DUP (?)
INFO ENDS
NAME1 INFO <‘bob smith’ , ‘Cheruthuruthy’, thrissur’>
The literals are surrounded with apostrophes and the entire field is
surrounded with <> symbol.
Use a structure name and field name to select a field from the
structure.
Eg. Name1.names
Program Memory-Addressing
Modes
Used with JMP and CALL instructions
Three distinct forms are
• Direct Program Memory Addressing
• Relative Program Memory Addressing
• Indirect Program Memory Addressing
Direct Program Memory Addressing
• The instruction for direct program memory addressing store
the address with the opcode
• Used by high level languages, BASIC – GOTO and GOSUB
• Eg . The address is stored following the opcode in the
memory
• A one byte (+127 and -128) displacement is used in short jump and 2
byte (+/- 32k) displacement is used for near jumps and calls
• These jumps are considered to be intra segment jumps
• Means any where with in the current code segment.
• Allows forward memory reference or reverse memory reference
• 32 bit (+/- 2G)displacement is also allowed.
Indirect Program Memory Addressing
Use any 16 bit register, any relative register
If a 16 bit register is used then the jump is near
Eg. JMP BX
If a relative register holds the address it is called indirect-indirect or
double indirect jump
Eg . Mov BX,4
JMP TABLE[BX]
Stack Memory-Addressing
Modes
• Stack holds data temporarily and stores return addresses for
procedures
– The stack memory is LIFO memory
– Use PUSH instruction to place data onto stack
– Use POP instruction to remove data from stack
– Call instruction uses stack to hold return address
– RET instruction remove the return address from the stack
• The stack memory is maintained by two registers: SP or ESP, and
SS
• Always operates on word of data (double word with 386 and above)
• When pushed –high order 8 bits placed in sp-1and low order 8 bits
placed in sp-2 location, sp is then decremented by 2.
• Stack memory address is calculated by adding sp and (ss*10)
• When poped the low order bits are removed form sp and high order
from sp+1 then sp is incremented by 2
Example Push and pop instructions
Example Stack program