nightloader/code/legacy-bios/bootsector/gdt.asm

55 lines
797 B
NASM
Raw Permalink Normal View History

2023-05-26 19:24:50 +00:00
create_gdt:
mov bx, STAGE_1_GDT_MEMORY_ADDRESS
mov ds, bx
mov bx, 8
mov di, 8
.set_loop:
mov ax, bx
and ax, 0b111
mov [bx], byte 0xff
cmp ax, 0
je .set_loop_condition
mov [bx], byte 0xff
cmp ax, 1
je .set_loop_condition
mov [bx], byte 0xff
cmp ax, 2
je .set_loop_condition
mov [bx], byte 0xff
cmp ax, 3
je .set_loop_condition
mov [bx], byte 0xff
cmp ax, 4
je .set_loop_condition
mov [bx], byte 0xff
cmp ax, 5
je .set_loop_condition
mov [bx], byte 0xff
cmp ax, 6
je .set_loop_condition
mov [bx], byte 0xff
cmp ax, 7
je .set_loop_condition
.set_loop_condition:
cmp bx, 48
jb .set_loop
ret