-
Notifications
You must be signed in to change notification settings - Fork 0
/
INIT.ASM
45 lines (35 loc) · 904 Bytes
/
INIT.ASM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
IDEAL
P386
MODEL FLAT, C
ASSUME cs:_TEXT,ds:FLAT,es:FLAT,fs:FLAT,gs:FLAT
include "init.inc"
include "keyb.inc"
include "utils.inc"
CODESEG
;; Initialization code. To clean up the main file
proc init
local @@temp:word
uses eax
ifndef NASM
;; Enable interrupts (lol why are we executing ring 0 instructions, dos is
;; weird)
sti
cld
;; Set the extra segment to be the same as the data segment
;; This is probably not necessary because every time we use ES we probably
;; explicitly set it to some value but better safe than sorry
mov ax, ds
mov es, ax
;; Initialize the FPU for floating point operations
finit
endif
;; Set rounding control to 0. This is the same as in C and makes printing
;; floats SO MUCH EASIER.
fnstcw [@@temp]
mov ax, [@@temp]
or ax, 0c00h
mov [@@temp], ax
fldcw [@@temp]
ret
endp init
END