Declaring initialized data with NASM
Hello, World!
i'm only using assembly in my toy OS project, (not trying to be a badass or anything, i just think it's a fun way to learn 32 bit assembly coming from the 16 bit world of the 8086) and i'm working on my IDT now, so i have something like this for each entry:
Code:
;interrupt 00
;division by zero exception
dw 0x0000 ;offset low word
dw 0x0008 ;selector
dw 0x8E00 ;present and ring 0
dw 0x0000 ;offset upper word
i'd like to have the offset initialized when i assemble it rather than write it in as it runs, like this:
Code:
dd div_by_zero_handler
but the upper and lower words are split all topsy-turvy like. Reading through the NASM manual, it seems like what i want are the >> and & operators, but when i try
Code:
;interrupt 00
;division by zero exception
dw isr_00 & 0xFFFF ;offset low word
dw 0x0008 ;selector
dw 0x8E00 ;present and ring 0
dw isr_00 >> 16 & 0xFFFF ;offset upper word
NASM spits it back out saying "shift operator may only be applied to scalar values."
Kinda long post, but my question is this:
How can i initialize data using only the upper or lower word of an address?