<commit_before>%include "consts.asm"

[org 0x07c00]

init:
  mov ax, cs  
  mov ds, ax
  mov es, ax

; The loader load one sector from floppy disk to memory(0x1000:0000).
; When error occured, the loader execute read label again
read:
  mov ax, 0x1000
  mov es, ax
  mov bx, 0

  mov ah, 2
  mov al, 1                   ; Number of sectors to be loaded
  mov ch, 0                   ; Cylinder
  mov cl, 2                   ; Sector
  mov dh, 0                   ; Head
  mov dl, 0                   ; Drive
  int 0x13

  jc read

prepare:
  cli

  lgdt [gdtr]

; set 32bits code effective state.
  mov eax, cr0
  or eax, 0x00000001
  mov cr0, eax

; clear cpu's fetch and decode units.
  jmp $+2
  nop
  nop

; initialize 16bits registers.
  mov bx, SData_Selector<commit_msg>Fix comments.<commit_after>%include "consts.asm"

[org 0x07c00]

init:
  mov ax, cs  
  mov ds, ax
  mov es, ax

; "Read phase"
; The loader loads one sector from floppy disk to memory(0x1000:0000).
; When error occured, the loader execute read label again.
read:
  mov ax, 0x1000
  mov es, ax
  mov bx, 0

  mov ah, 2
  mov al, 1                   ; Number of sectors to be loaded
  mov ch, 0                   ; Cylinder
  mov cl, 2                   ; Sector
  mov dh, 0                   ; Head
  mov dl, 0                   ; Drive
  int 0x13

  jc read

; "Prepare phase"
; 1. Set 32 bits effective in cr0 register.
; 2. Initialize cpu units. 
; 3. initialize 16bits registers.
;
; [Notes]
;   About "Initialize cpu units"
;     Actually it is a fetch unit and a decode unit.
;     Because there is a possibility of unexpected movement
;     when shifting to 32 bits while each 16-bit op code is included.
;
prepare:
  cli

  lgdt [gdtr]

; set 32 bits effective
  mov eax, cr0
  or eax, 0x00000001
  mov cr0, eax

; initialize cpu units
  jmp $+2
  nop
  nop

; initialize 16bits registers
  mov bx, SData_Selector
{'fraction_non_alphanumeric': 0.06796628029504742, 'fraction_numerical': 0.05374077976817703, 'mean_word_length': 2.0142857142857142, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1291152', 'n_tokens_mistral': 744, 'n_tokens_neox': 631, 'n_words': 269}