forked from fox32-arch/fox32rom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fox32rom_okm.asm
272 lines (241 loc) · 4.75 KB
/
fox32rom_okm.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
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
; fox32rom routine definitions for Okameron
; PROCEDURE Panic(
; str: POINTER TO CHAR;
; );
Panic:
jmp panic
; PROCEDURE NewEvent(
; eventType,
; eventArg0,
; eventArg1,
; eventArg2,
; eventArg3,
; eventArg4,
; eventArg5,
; eventArg6: INT;
; );
NewEvent:
push r7
mov r7, 0
call new_event
pop r7
ret
; PROCEDURE GetNextEvent(event: POINTER TO ARRAY 8 OF INT);
GetNextEvent:
push r8
mov r8, r0
call get_next_event
mov [r8], r0
add r8, 4
mov [r8], r1
add r8, 4
mov [r8], r2
add r8, 4
mov [r8], r3
add r8, 4
mov [r8], r4
add r8, 4
mov [r8], r5
add r8, 4
mov [r8], r6
add r8, 4
mov [r8], r7
pop r8
ret
; PROCEDURE ScancodeToAscii(scancode: CHAR;): CHAR;
ScancodeToAscii:
jmp scancode_to_ascii
; PROCEDURE ShiftPressed();
ShiftPressed:
jmp shift_pressed
; PROCEDURE ShiftReleased();
ShiftReleased:
jmp shift_released
; PROCEDURE CapsPressed();
CapsPressed:
jmp caps_pressed
; PROCEDURE FillBackground(color: INT;);
FillBackground:
jmp fill_background
; PROCEDURE DrawStrToBackground(
; str: POINTER TO CHAR;
; x, y, fgColor, bgColor: INT;
; );
DrawStrToBackground:
jmp draw_str_to_background
; PROCEDURE DrawFontTileToBackground(
; c: CHAR;
; x, y, fgColor, bgColor: INT;
; );
DrawFontTileToBackground:
jmp draw_font_tile_to_background
; PROCEDURE DrawFormatStrToBackground(
; str: POINTER TO CHAR;
; x, y, fgColor, bgColor,
; format0, format1, format2: INT;
; );
DrawFormatStrToBackground:
push r10
push r11
push r12
push r13
push r14
push r15
mov r10, r5
mov r11, r6
mov r12, r7
mov r13, 0
mov r14, 0
mov r15, 0
call draw_format_str_to_background
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
ret
; PROCEDURE FillOverlay(color, overlay: INT;);
FillOverlay:
jmp fill_overlay
; PROCEDURE DrawStrToOverlay(
; str: POINTER TO CHAR;
; x, y, fgColor, bgColor, overlay: INT;
; );
DrawStrToOverlay:
jmp draw_str_to_overlay
; PROCEDURE DrawFormatStrToBackground(
; str: POINTER TO CHAR;
; x, y, fgColor, bgColor, overlay,
; format0, format1: INT;
; );
DrawFormatStrToOverlay:
push r10
push r11
push r12
push r13
push r14
push r15
mov r10, r5
mov r11, r6
mov r12, r7
mov r13, 0
mov r14, 0
mov r15, 0
call draw_format_str_to_overlay
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
ret
; PROCEDURE DrawFilledRectangleToOverlay(
; x, y, width, height, color, overlay: INT;
; );
DrawFilledRectangleToOverlay:
jmp draw_filled_rectangle_to_overlay
; PROCEDURE RYFSOpen(
; name: POINTER TO CHAR;
; id: INT;
; struct: POINTER TO ROMFile;
; ): INT;
RYFSOpen:
jmp ryfs_open
; PROCEDURE RYFSSeek(
; offset: INT;
; struct: POINTER TO ROMFile;
; );
RYFSSeek:
jmp ryfs_seek
; PROCEDURE RYFSTell(
; struct: POINTER TO ROMFile;
; ): INT;
RYFSTell:
jmp ryfs_tell
; PROCEDURE RYFSRead(
; size: INT;
; struct: POINTER TO ROMFile;
; destination: POINTER TO CHAR;
; );
RYFSRead:
jmp ryfs_read
; PROCEDURE RYFSReadWholeFile(
; struct: POINTER TO ROMFile;
; destination: POINTER TO CHAR;
; );
RYFSReadWholeFile:
jmp ryfs_read_whole_file
; PROCEDURE RYFSGetSize(
; struct: POINTER TO ROMFile;
; ): INT;
RYFSGetSize:
jmp ryfs_get_size
; PROCEDURE RYFSGetFileList(
; buffer: POINTER TO CHAR;
; id: INT;
; );
RYFSGetFileList:
jmp ryfs_get_file_list
; PROCEDURE RYFSWrite(
; size: INT;
; struct: POINTER TO ROMFile;
; source: POINTER TO CHAR;
; );
RYFSWrite:
jmp ryfs_write
; PROCEDURE StringToInt(
; str: POINTER TO CHAR;
; radix: INT;
; ): INT;
StringToInt:
jmp string_to_int
; PROCEDURE CopyMemoryChar(
; source, destination: POINTER TO CHAR;
; size: INT;
; );
CopyMemoryChar:
jmp copy_memory_bytes
; PROCEDURE CopyMemoryInt(
; source, destination: POINTER TO INT;
; size: INT;
; );
CopyMemoryInt:
jmp copy_memory_words
; PROCEDURE CopyString(
; source, destination: POINTER TO CHAR;
; );
CopyString:
jmp copy_string
; PROCEDURE CompareMemoryChar(
; source, destination: POINTER TO CHAR;
; size: INT;
; ): INT;
CompareMemoryChar:
call compare_memory_bytes
ifz mov r0, 0
ifnz mov r0, 1
ret
; PROCEDURE CompareMemoryInt(
; source, destination: POINTER TO INT;
; size: INT;
; ): INT;
CompareMemoryInt:
call compare_memory_words
ifz mov r0, 0
ifnz mov r0, 1
ret
; PROCEDURE CompareString(
; source, destination: POINTER TO CHAR;
; size: INT;
; ): INT;
CompareString:
call compare_string
ifz mov r0, 0
ifnz mov r0, 1
ret
; PROCEDURE StringLength(
; source: POINTER TO CHAR;
; ): INT;
StringLength:
jmp string_length