-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHAL.x8664.qemu.Mod
More file actions
62 lines (48 loc) · 1.37 KB
/
Copy pathHAL.x8664.qemu.Mod
File metadata and controls
62 lines (48 loc) · 1.37 KB
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
(* begin-module-short-description
provides a Hardware Abstraction Layer for x86_64.
end-module-short-description *)
(* begin-module-use-description
Module HAL (.i64) exercises features of the compiler in bringing Oberon up from bare metal on x86_64.
end-module-use-description *)
(* begin-module-develop-description
The HAL prepares the Oberon runtime and so cannot rely on it.
* No global variables
* No strings
* No heap allocation
The first thing HAL must do is set up its own stack.
Each platform should have its own HAL. This is the HAL for x86_64 on QEMU.
The HAL remains resident and may be used by other modules.
end-module-develop-description *)
MODULE* HAL;
IMPORT SYSTEM;
CONST
rsData = -56;
rsCtrl = -52;
TYPE
VAR
(* begin-procedure-description
---
**Init** simply returns.
end-procedure-description *)
PROCEDURE Init( i: INTEGER);
VAR x, y, z: INTEGER;
BEGIN
SYSTEM.PUT(rsData,i)
(*
LED(1); z := 0;
REPEAT LED(z); x := 1000;
REPEAT y := 1000;
REPEAT y := y-1 UNTIL y = 0;
x := x-1
UNTIL x = 0;
z := z+1
UNTIL FALSE
*)
END Init;
(* begin-procedure-description
---
**The initialzation code for this module** calls Init and then goes into an infinite loop.
end-procedure-description *)
BEGIN Init(ORD("O")); Init(ORD("b")); Init(ORD("e")); Init(ORD("r")); Init(ORD("o")); Init(ORD("n"));
WHILE TRUE DO END
END HAL.