mirror of
git://projects.qi-hardware.com/iris.git
synced 2024-12-28 12:49:54 +02:00
working demo
This commit is contained in:
parent
7a8d7c28c4
commit
fb85d0f1d7
@ -418,6 +418,21 @@ static void get_device ():
|
||||
Kernel::panic (0)
|
||||
Kernel::free_cap (reply)
|
||||
|
||||
static void draw_ball ():
|
||||
int const r = 50
|
||||
for int y = -r; y < r; ++y:
|
||||
for int x = -r; x < r; ++x:
|
||||
if x * x + y * y > r * r:
|
||||
((unsigned *)0x15000)[(120 + y) * 320 + 160 + x] = 0x000000
|
||||
else:
|
||||
((unsigned *)0x15000)[(120 + y) * 320 + 160 + x] = 0x3f30ff
|
||||
|
||||
static void draw_square ():
|
||||
int const r = 50
|
||||
for int y = -r; y < r; ++y:
|
||||
for int x = -r; x < r; ++x:
|
||||
((unsigned *)0x15000)[(120 + y) * 320 + 160 + x] = 0xffff00
|
||||
|
||||
Kernel::Num start ():
|
||||
// Wait for the debugging device to be active, in case there is one.
|
||||
Kernel::schedule ()
|
||||
@ -471,6 +486,7 @@ Kernel::Num start ():
|
||||
Kernel::panic (0, "no display")
|
||||
Kernel::Caps display_caps = display_dev->dev.create_user (Kernel::my_memory, 0, 0x15000)
|
||||
Display display = display_caps.get (0)
|
||||
draw_ball ()
|
||||
Dev *keyboard_dev = Dev::find (Keyboard::ID, 0)
|
||||
if !keyboard_dev:
|
||||
Kernel::panic (0, "no keyboard")
|
||||
@ -533,7 +549,9 @@ Kernel::Num start ():
|
||||
Kernel::panic (Kernel::recv.data[0].l, "invalid operation from child")
|
||||
break
|
||||
case KEYBOARD:
|
||||
if in_system && Kernel::recv.data[0].l == (Key::ENTER | Keyboard::RELEASE):
|
||||
if !in_system:
|
||||
break
|
||||
if Kernel::recv.data[0].l == (Key::ENTER | Keyboard::RELEASE):
|
||||
for Dev *d = Dev::devs; d; d = d->next:
|
||||
if d->idx != 0:
|
||||
continue
|
||||
@ -549,24 +567,16 @@ Kernel::Num start ():
|
||||
break
|
||||
if Kernel::recv.data[0].l & Keyboard::RELEASE:
|
||||
continue
|
||||
unsigned const r = 50
|
||||
unsigned which = 0
|
||||
switch Kernel::recv.data[0].l:
|
||||
case Key::VOLUME_DOWN:
|
||||
// Set ball.
|
||||
for int y = -r; y < r; ++y:
|
||||
for int x = -r; x < r; ++x:
|
||||
if x * x + y * y > r * r:
|
||||
((unsigned *)0x15000)[(120 + y) * 320 + 160 + x] = 0x000000
|
||||
else:
|
||||
((unsigned *)0x15000)[(120 + y) * 320 + 160 + x] = 0xffffff
|
||||
draw_ball ()
|
||||
which = 2
|
||||
break
|
||||
case Key::VOLUME_UP:
|
||||
// Set square.
|
||||
for int y = -r; y < r; ++y:
|
||||
for int x = -r; x < r; ++x:
|
||||
((unsigned *)0x15000)[(120 + y) * 320 + 160 + x] = 0xffffff
|
||||
draw_square ()
|
||||
which = 1
|
||||
break
|
||||
if which != 0:
|
||||
|
17
memory.ccp
17
memory.ccp
@ -1,4 +1,21 @@
|
||||
#pypp 0
|
||||
// Iris: micro-kernel for a capability-based operating system.
|
||||
// memory.ccp: Page allocation system.
|
||||
// Copyright 2009 Bas Wijnen <wijnen@debian.org>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "kernel.hh"
|
||||
//#define DEBUG_ALLOC
|
||||
|
||||
|
@ -1,4 +1,21 @@
|
||||
#pypp 0
|
||||
// Iris: micro-kernel for a capability-based operating system.
|
||||
// source/ball.ccp: Bouncing ball demo.
|
||||
// Copyright 2009 Bas Wijnen <wijnen@debian.org>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iris.hh>
|
||||
#include <devices.hh>
|
||||
|
||||
@ -19,7 +36,7 @@ void ball (int x, int y, bool print):
|
||||
|
||||
Kernel::Num start ():
|
||||
Kernel::my_parent.init_done ()
|
||||
colour = 0xffffff
|
||||
colour = 0x3f30ff
|
||||
framebuffer = (unsigned *)0x15000
|
||||
Display display = Kernel::my_parent.get_device <Display> (0x10000)
|
||||
int x = r, y = r, dx = 3, dy = 0
|
||||
|
@ -1,4 +1,21 @@
|
||||
#pypp 0
|
||||
// Iris: micro-kernel for a capability-based operating system.
|
||||
// source/bsquare.ccp: Floating square demo.
|
||||
// Copyright 2009 Bas Wijnen <wijnen@debian.org>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <iris.hh>
|
||||
#include <devices.hh>
|
||||
|
||||
@ -17,7 +34,7 @@ void square (int x, int y, bool print):
|
||||
|
||||
Kernel::Num start ():
|
||||
Kernel::my_parent.init_done ()
|
||||
colour = 0xffffff
|
||||
colour = 0xffff00
|
||||
framebuffer = (unsigned *)0x15000
|
||||
Display display = Kernel::my_parent.get_device <Display> (0x10001)
|
||||
int x = r, y = r, dx = 3, dy = 3
|
||||
|
@ -1,4 +1,21 @@
|
||||
#pypp 0
|
||||
// Iris: micro-kernel for a capability-based operating system.
|
||||
// source/display-emu.ccp: Display interface emulation layer.
|
||||
// Copyright 2009 Bas Wijnen <wijnen@debian.org>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <devices.hh>
|
||||
#include <iris.hh>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user