First off i just want to say hi to everybody! Im a Java/Visual Basic programmer of 3 years and a always wanted to learn assembly, but im having alittle trouble understanding segments and offsets.
At the bottom is a piece of a simple Hello World prog using a86 compiler.
The way segments and offsets were explained to me was with this formula.
;OFFSET = SEGMENT * 16
;SEGMENT = OFFSET / 16 (the lower 4 bits are lost)
From what i can gather the total number of bits with the
segment and offset combined is always 20, the Message can never be more than 2 word size(32 bits) or an error occures.
So question number one: Does the segment hold 16 bits and the offset hold 4?
Question number two: If i program with 32 bit registers can
i forgo using segments and offsets or are they always used?
Thanks for the help!
Message db "Yummy Ham!$" ; message to be display
mov dx,OFFSET Message ; offset of Message is in DX
mov ax,SEG Message ; segment of Message is in AX
mov ds,ax ; move segment of Message into a segment reg
At the bottom is a piece of a simple Hello World prog using a86 compiler.
The way segments and offsets were explained to me was with this formula.
;OFFSET = SEGMENT * 16
;SEGMENT = OFFSET / 16 (the lower 4 bits are lost)
From what i can gather the total number of bits with the
segment and offset combined is always 20, the Message can never be more than 2 word size(32 bits) or an error occures.
So question number one: Does the segment hold 16 bits and the offset hold 4?
Question number two: If i program with 32 bit registers can
i forgo using segments and offsets or are they always used?
Thanks for the help!
Message db "Yummy Ham!$" ; message to be display
mov dx,OFFSET Message ; offset of Message is in DX
mov ax,SEG Message ; segment of Message is in AX
mov ds,ax ; move segment of Message into a segment reg