Есть вот такой вариант. Код (Text): struc descriptor [def] { common local .base,.limit,.type .base = 0 .type = 0x0010; defaults: byte-granularity 16-bit not-present DPL0 read-only not-accessed data forward match =base==v, def \{ .base = v \} match =limit==v, def \{ \local matched matched equ 0 match vv*=4k,v \\{ .limit = vv .type = .type or 0x8000 restore matched matched equ 1 \\} match =0, matched \\{ .limit = v \\} restore matched \} match =a, def \{ .type = .type or 1 \} match =w, def \{ .type = .type or 2 \} match =e, def \{ .type = .type or 4 \} match =code, def \{ .type = .type or 8 \} match =r, def \{ .type = .type or 2 \} match =c, def \{ .type = .type or 4 \} match =dpl==.dpl, def \{ .type = .type and not 0x0060 or ((.dpl) and 3) shl 5 \} match =p, def \{ .type = .type or 0x80 \} match =avl==.avl, def \{ .type = .type and not 0x0100 or ((.avl) and 1) shl 12 \} match =64bit, def \{ .type = .type or 0x2000 \} match =32bit, def \{ .type = .type or 0x4000 \} common if .type and 0x6008 = 0x6008 display "Reserved combination of L and D bits in code segment descriptor", 13, 10 err end if dw .limit and 0xFFFF dw .base and 0xFFFF db .base shr 16 and 0xFF db .type and 0xFF db (.type shr 8 and 0xF0) or (.limit shr 16 and 0x0F) db .base shr 24 and 0xFF } macro descriptor [def] { common local . . descriptor def } Использовать примерно так: Код (Text): code0 descriptor code, 32bit, base=0, limit=0xFFFFFF*4k, p, r code3 descriptor code, dpl=3, 32bit, base=0, limit=0xFFFFFF*4k, p, r data3 descriptor data, dpl=3, 32bit, base=0, limit=0xFFFFFF*4k, p, w Не совсем про прерывания, но общая идея должна быть ясна.
У меня все просто, но не менее эффективно. Первые два параметра могут быть либо селектором и смещением, либо базой и лимитом. Это зависит от типа дескриптора, определяемого флагами. DF_USE32 и DF_PAGED определяются по-особому, поэтому я их тоже покажу. Код (Text): ... DF_PRESENT equ 80h DF_USE16 equ 0 DF_USE32 equ 400000h DF_BYTED equ 0 DF_PAGED equ 800000h DF_DATA32 equ (DF_DATA or DF_DUALACTION or DF_USE32 or DF_PAGED) DF_CODE32 equ (DF_CODE or DF_DUALACTION or DF_USE32 or DF_PAGED) macro desc p1, p2, p3 { dw (p2) and 0FFFFh dw (p1) and 0FFFFh db (p1) shr 16 and 0FFh db (p3) and 0FFh or DF_PRESENT db ((p2) or (p3)) shr 16 and 0FFh db ((p1) or (p2)) shr 24 }