compiling troubles : part 1

Programming, for all ages and all languages.
Post Reply
kerim

compiling troubles : part 1

Post by kerim »

I have a problem when compiling my kernel with NASM. The problem is related to interrupt vector routines (SetVector, GetVector).

-- GetVector --
...
mov bx, es:[di] ; put low byte in BX
mov ax, es:[di]+2 ; put high byte in AX
...

-- SetVector --
...
mov word es:[al*4], dx ; put low byte first
mov es:[al*4+2], ds ; put high byte then
...

For these 4 lines, compiler says :

intvec.inc:25: error: invalid combination of opcode and operands
intvec.inc:26: error: invalid combination of opcode and operands
intvec.inc:46: error: invalid combination of opcode and operands
intvec.inc:47: error: invalid combination of opcode and operands

Please H E L P :'(
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:compiling troubles : part 1

Post by Pype.Clicker »

your syntax for get vector is wrong.

Code: Select all

  mov bx, [es:di]    
    mov ax, [es:di+2]  

Code: Select all

    mov word es:[al*4], dx  ; put low byte first
you cannot use the "*4" feature with non-32 registers. only
[es:eax*4] will be allowed.

Code: Select all

    mov es:[al*4+2], ds    ; put high byte then
same as above, plus you cannot have mov <mem>,ds. You should expand it into "mov <reg>,ds ; mov <mem>,<reg>".
kerim

Re:compiling troubles : part 1

Post by kerim »

maybe I should use

shl al, 2 ???
kerim

Re:compiling troubles : part 1

Post by kerim »

thank you ! the problem is solved !
Post Reply