annotate user/screen.c3 @ 360:42343d189e14

Bugfix in for loop
author Windel Bouwman
date Fri, 14 Mar 2014 16:11:32 +0100
parents 084cccaa5deb
children
rev   line source
315
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
1 module screen;
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
2
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
3 import ipc;
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
4
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
5 const int num_cols = 80;
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
6 const int num_rows = 25;
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
7
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
8 var int* vidmem;
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
9
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
10 function void clear()
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
11 {
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
12 var int row, col;
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
13
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
14 for (row = 0; row < num_rows; rows++)
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
15 {
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
16 for (col = 0; col < num_cols; cols=cols+1)
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
17 {
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
18 *vidmem = 0x20;
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
19 }
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
20 }
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
21 }
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
22
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
23 function void main()
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
24 {
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
25 // Initialize display
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
26
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
27 clear();
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
28
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
29 while (true)
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
30 {
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
31 var ipc.Msg msg;
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
32 ipc.receive_message(&msg);
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
33 }
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
34 }
084cccaa5deb Added console and screen
Windel Bouwman
parents:
diff changeset
35