-
Notifications
You must be signed in to change notification settings - Fork 0
/
drivers.dasm
116 lines (101 loc) · 2.07 KB
/
drivers.dasm
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
; ======================================================================
; This is only the needed drivers. Not anything else. I AM NOT AN OS ^^
; ======================================================================
;;;FONCTION write (0x1)
;;;DESCRIPTION Writes the text in arguments
;;;ARG B Address of the string
;;;ARG I Where to write (begins at 0x8000)
;;;If Z = 0xABAB, then writing in highlighted mode.
:write
set PUSH, I
:write_loop0
set [I], [B]
ifn Z, 0xABAB
bor [I], [color]
ife Z, 0xABAB
bor [I], [color_hl]
add I, 1
add B, 1
ifn [B], 0
set PC, write_loop0
set I, POP
set PC, POP
:detectPeriphs
HWN I
SET J, 0
:detectPeriphs_loop
HWQ J
IFE A, 0xf615
IFE B, 0x7349
SET [monitor], J
IFE A, 0x7406
IFE B, 0x30CF
SET [keyboard], J
IFE A, 0x24C5
IFE B, 0x4FD5
JSR detectPeriphs_addFloppy
IFE A, 0x525D
IFE B, 0x4AC5
JSR detectPeriphs_addHD
ADD J, 1
IFN J, I
SET PC, detectPeriphs_loop
SET PC, POP
:detectPeriphs_addHD
SET A, 0x0005
HWI J
set PC, detectPeriphs_addDisk
:detectPeriphs_addFloppy
set A, 0
hwi J
IFE B, 0 ; STATE_NO_MEDIA
set PC, POP
set PC, detectPeriphs_addDisk
:detectPeriphs_addDisk
SET A, [n_drives]
ifl A, 6
SET [drives + A], J
ADD [n_drives], 1
SET PC, POP
; =============
; Waits until disk operation finished
; I for the Ith floppy drive
; =============
:loadFloppy_waitFinish
set A, 0
:loadFloppy_waitFinish_loop0
hwi [drives + I]
ife B, 0x0003 ;If STATE_BUSY
set PC, loadFloppy_waitFinish_loop0
set PC, POP
:clear
set PUSH, I
SET I, 0x8000
:clear_loop
SET [I], 0xF020
ADD I, 1
IFN I, 0x8180
set PC, clear_loop
SET I, POP
set PC, POP
; =======================
; A : Start
; B : End
; C : Address to copy to
; =======================
:memcpy
set [C], [A]
add A, 1
add C, 1
ifn A, B
set PC, memcpy
set PC, POP
:monitor DAT 0
:keyboard DAT 0
:drives DAT 0, 0, 0, 0, 0, 0
:drives_compatible DAT 0, 0, 0, 0, 0, 0
:drives_startSectors DAT 0, 0, 0, 0, 0, 0
:drives_nSectors DAT 0, 0, 0, 0, 0, 0
:n_drives DAT 0
:color DAT 0xF000
:color_hl DAT 0x0F00