-
Notifications
You must be signed in to change notification settings - Fork 1
/
gameros.inc
executable file
·118 lines (102 loc) · 1.72 KB
/
gameros.inc
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
; Copyright © 2013 - 2021 by Brett Kuntz. All rights reserved.
KERNEL_ADDR equ 0200h
STACK_SEG equ 9000h
BINARY_SIZE equ 2000h
SECTOR_COUNT equ (BINARY_SIZE - 1) / 512
IMAGE_TAG equ 12349292h
FOOTER_TAG equ 69692388h
BIOS_SEG equ 07C0h
int3 textequ <xchg bx, bx>
intro macro
cli
mov ax, cs
mov ds, ax
mov es, ax
lss sp, farptr(9000h, 0)
mov eax, cr0
and eax, 9FFFFFFBh
or al, 2
mov cr0, eax
mov eax, cr4
and ax, 9FB7h
or eax, 600h
mov cr4, eax
cld
finit
sti
endm
enable_nmi macro
in al, 70h
and al, 7Fh
out 70h, al
endm
disable_nmi macro
in al, 70h
or al, 80h
out 70h, al
endm
halt macro
local X
X: hlt
jmp X
endm
clrscr macro
mov ax, 3
int 10h
endm
dbgout macro txt:vararg
local A, B
cli
jmp A
B db txt
A:
clrscr
mov ax, 1301h
mov bx, 0Ah
mov cx, sizeof B
mov dx, 0
push cs
pop es
mov bp, offset B
int 10h
sti
endm
eoi macro
mov al, 20h
out 20h, al
endm
reboot macro
far_jmp 0FFFFh, 0000h
endm
far_jmp macro segarg:req, offarg:req
db 0EAh
dw offarg, segarg
endm
txt macro string:vararg
local A, B
jmp A
B db string, 0
A:
exitm <offset B>
endm
farptr macro segarg:req, offarg:req
local A, B
jmp A
B dd (segarg shl 16) or offarg
A:
exitm <B>
endm
BOOT_FOOTER macro
org boot + 510
dw 0AA55h
endm
IMAGE_FOOTER macro
org boot + BINARY_SIZE - 4
dd FOOTER_TAG
endm
option casemap:none
.model tiny, stdcall, farstack
.686p
.mmx
.xmm
.code