[BITS 32] [ORG 0x10000] _header: dd 1 dd _file_end - _header dd 10000h dd 'code' dd _code_section dd _code_section_end - _code_section dd SECT_PRES | PROT_EXEC | PROT_READ dd 'data' dd _data_section dd _data_section_end - _data_section dd SECT_PRES | PROT_READ | PROT_WRITE dd 'rdat' dd _readonly_data_section dd _readonly_data_section_end - _readonly_data_section dd SECT_PRES | PROT_READ dd 'impt' dd 0 dd 0 dd 0 dd 'expt' dd _export_section dd _export_section_end - _export_section dd SECT_PRES | PROT_READ _header_end: _code_section: [SECTION .text] KrnMain: sub esp, 64 push 10001110b push TmrSystemTickIsr push 20h call KrnInsertIDTEntry push 10001111b push ExcGPIsr push 0Dh call KrnInsertIDTEntry push 10001111b push ExcDFIsr push 08h call KrnInsertIDTEntry push 10001111b push ExcUDIsr push 06h call KrnInsertIDTEntry push 10001111b push ExcNMIIsr push 02h call KrnInsertIDTEntry lidt [idt_desc] mov eax, cr4 or eax, 600h mov cr4, eax call KrnGetRTCTime call KrnGetCursorPos mov dword [screen_row], eax mov dword [screen_col], edx ... so on and so forth ... %include "src/kernel/syscall.asm" %include "src/kernel/screen.asm" %include "src/kernel/cpu_features.asm" %include "src/kernel/exceptions.asm" %include "src/kernel/memory.asm" %include "src/kernel/crt.asm" _code_section_end: align 16, db 0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; [SECTION .data] _data_section: idt: times 8 * 64 db 0 idt_desc: dw (idt_desc - idt - 1) dd idt systemtick dd 0 uptime dd 0 ... global variables here ... _data_section_end: align 16, db 0 _readonly_data_section: itoastr: db '0123456789abcdefghijklmnopqrstuvwxyz', 0 ... strings here ... str_fmt_time db '%2x/%2x/%2x %2x:%2x:%2x', 0Ah, 0 _readonly_data_section_end: align 16, db 0 _export_section: dd 2 dd 1 dd exstr1 dd KrnInsertIDTEntry dd 2 dd exstr2 dd KrnLoadDriverLL ;;export string pool exstr1: db 'KrnInsertIDTEntry', 0 exstr2: db 'KrnLoadDriverLL', 0 _export_section_end: times 0x4000-($-$$) db 0 _file_end: