What is meaning about INITSEG in file bootsect.s?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
leetow2003
Member
Member
Posts: 70
Joined: Fri Nov 19, 2010 6:54 pm

What is meaning about INITSEG in file bootsect.s?

Post by leetow2003 »

I read the file bootsect.s,I think the INITSEG is constant,
Look:

Code: Select all

.text
BOOTSEG  = 0x07c0			
INITSEG  = 0x9000
...
entry start
start:
	mov	ax,#BOOTSEG
	mov	ds,ax
	mov	ax,#INITSEG
	mov	es,ax
...
        jmpi	go,INITSEG
...
if
mov ax,INITSEG
means "Go to the memory location 0x9000, get the value stored there, and put that value into the A register."
and
jmpi go,INITSEG
means "jump immediate under all conditions to the far address go + 0x9000 and continue execution there."

so I am puzzled,why I can't realize:
jmpi go,INITSEG
it mean:"jump to the memory location 0x9000,get the value stored there, then to the far address go + the value , and continue execution there."?
Antti
Member
Member
Posts: 923
Joined: Thu Jul 05, 2012 5:12 am
Location: Finland

Re: What is meaning about INITSEG in file bootsect.s?

Post by Antti »

You did not understand correctly. This looks like early Linux source code.

Code: Select all

.text
BOOTSEG  = 0x07c0
INITSEG  = 0x9000
   ...

entry start
start:
   mov   ax,#BOOTSEG           ; Register ax has value 0x07c0
   mov   ds,ax                 ; Segment register ds has value 0x07c0
   mov   ax,#INITSEG           ; Register ax has value 0x9000
   mov   es,ax                 ; Segment register es has value 0x9000

   ...

   jmpi   go,INITSEG           ; Far jump

go:
   nop                         ; Code is executing at 0x9000:go
                               ; Register cs has value 0x9000 and
                               ; register ip has value of "go" label.
leetow2003
Member
Member
Posts: 70
Joined: Fri Nov 19, 2010 6:54 pm

Re: What is meaning about INITSEG in file bootsect.s?

Post by leetow2003 »

Antti wrote:You did not understand correctly. This looks like early Linux source code.

Code: Select all

.text
BOOTSEG  = 0x07c0
INITSEG  = 0x9000
   ...

entry start
start:
   mov   ax,#BOOTSEG           ; Register ax has value 0x07c0
   mov   ds,ax                 ; Segment register ds has value 0x07c0
   mov   ax,#INITSEG           ; Register ax has value 0x9000
   mov   es,ax                 ; Segment register es has value 0x9000

   ...

   jmpi   go,INITSEG           ; Far jump

go:
   nop                         ; Code is executing at 0x9000:go
                               ; Register cs has value 0x9000 and
                               ; register ip has value of "go" label.
I want to know: jmpi go,INITSEG,just now INITSEG is equal to 0x9000,
and mov ax,#INITSEG,just now #INITSEG is also equal to 0x9000,
INITSEG is equal to #INITSEG?
but
mov ax,#INITSEG
mov ax,INITSEG
they are not the same meaning.
How to realize #INITSEG and INITSEG?
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: What is meaning about INITSEG in file bootsect.s?

Post by dozniak »

leetow2003 wrote: jmpi go,INITSEG ; Far jump

INITSEG is equal to #INITSEG?
The interpretation of the values for far jump is different. jmpi could not read a value at address INITSEG, because this is segment number specification, so it is interpreted literally as "jmp far 0x9000:go"
Learn to read.
Post Reply