1

I am trying to make a static IDT in 32-bit mode with only assembly.

I can make the lower half of the address without errors by using dw isr, but when I use dw isr >> 16 to define the higher half of the address, NASM gives me the following error:

idt.asm:25: error: shift operator may only be applied to scalar values

Is there any way to make the IDT using NASM ?

PS. Yes, I've seen this post, but I don't want to use the linker since my kernel is very small and all written in assembly.

Sep Roland
  • 33,889
  • 7
  • 43
  • 76
Cyao
  • 727
  • 4
  • 18
  • 3
    Do label arithmetic to gain a scalar value that NASM will allow to shift. For example, if your section starts with (say) `org 7C00h` then you can do arithmetic like `dw (isr - $$ + 7C00h) >> 16`. In general, the delta between two labels that are in the same section results in a scalar value that you can then use in all kinds of calculations, including shifts and division. – ecm Oct 02 '22 at 17:24
  • If you edit your question to include more of a complete example I may be able to tell you the exact calculation that you need. – ecm Oct 02 '22 at 17:27

0 Answers0