mirror of
git://projects.qi-hardware.com/iris.git
synced 2024-12-29 20:04:34 +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::panic (0)
|
||||||
Kernel::free_cap (reply)
|
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 ():
|
Kernel::Num start ():
|
||||||
// Wait for the debugging device to be active, in case there is one.
|
// Wait for the debugging device to be active, in case there is one.
|
||||||
Kernel::schedule ()
|
Kernel::schedule ()
|
||||||
@ -471,6 +486,7 @@ Kernel::Num start ():
|
|||||||
Kernel::panic (0, "no display")
|
Kernel::panic (0, "no display")
|
||||||
Kernel::Caps display_caps = display_dev->dev.create_user (Kernel::my_memory, 0, 0x15000)
|
Kernel::Caps display_caps = display_dev->dev.create_user (Kernel::my_memory, 0, 0x15000)
|
||||||
Display display = display_caps.get (0)
|
Display display = display_caps.get (0)
|
||||||
|
draw_ball ()
|
||||||
Dev *keyboard_dev = Dev::find (Keyboard::ID, 0)
|
Dev *keyboard_dev = Dev::find (Keyboard::ID, 0)
|
||||||
if !keyboard_dev:
|
if !keyboard_dev:
|
||||||
Kernel::panic (0, "no keyboard")
|
Kernel::panic (0, "no keyboard")
|
||||||
@ -533,7 +549,9 @@ Kernel::Num start ():
|
|||||||
Kernel::panic (Kernel::recv.data[0].l, "invalid operation from child")
|
Kernel::panic (Kernel::recv.data[0].l, "invalid operation from child")
|
||||||
break
|
break
|
||||||
case KEYBOARD:
|
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:
|
for Dev *d = Dev::devs; d; d = d->next:
|
||||||
if d->idx != 0:
|
if d->idx != 0:
|
||||||
continue
|
continue
|
||||||
@ -549,24 +567,16 @@ Kernel::Num start ():
|
|||||||
break
|
break
|
||||||
if Kernel::recv.data[0].l & Keyboard::RELEASE:
|
if Kernel::recv.data[0].l & Keyboard::RELEASE:
|
||||||
continue
|
continue
|
||||||
unsigned const r = 50
|
|
||||||
unsigned which = 0
|
unsigned which = 0
|
||||||
switch Kernel::recv.data[0].l:
|
switch Kernel::recv.data[0].l:
|
||||||
case Key::VOLUME_DOWN:
|
case Key::VOLUME_DOWN:
|
||||||
// Set ball.
|
// Set ball.
|
||||||
for int y = -r; y < r; ++y:
|
draw_ball ()
|
||||||
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
|
|
||||||
which = 2
|
which = 2
|
||||||
break
|
break
|
||||||
case Key::VOLUME_UP:
|
case Key::VOLUME_UP:
|
||||||
// Set square.
|
// Set square.
|
||||||
for int y = -r; y < r; ++y:
|
draw_square ()
|
||||||
for int x = -r; x < r; ++x:
|
|
||||||
((unsigned *)0x15000)[(120 + y) * 320 + 160 + x] = 0xffffff
|
|
||||||
which = 1
|
which = 1
|
||||||
break
|
break
|
||||||
if which != 0:
|
if which != 0:
|
||||||
|
17
memory.ccp
17
memory.ccp
@ -1,4 +1,21 @@
|
|||||||
#pypp 0
|
#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"
|
#include "kernel.hh"
|
||||||
//#define DEBUG_ALLOC
|
//#define DEBUG_ALLOC
|
||||||
|
|
||||||
|
@ -1,4 +1,21 @@
|
|||||||
#pypp 0
|
#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 <iris.hh>
|
||||||
#include <devices.hh>
|
#include <devices.hh>
|
||||||
|
|
||||||
@ -19,7 +36,7 @@ void ball (int x, int y, bool print):
|
|||||||
|
|
||||||
Kernel::Num start ():
|
Kernel::Num start ():
|
||||||
Kernel::my_parent.init_done ()
|
Kernel::my_parent.init_done ()
|
||||||
colour = 0xffffff
|
colour = 0x3f30ff
|
||||||
framebuffer = (unsigned *)0x15000
|
framebuffer = (unsigned *)0x15000
|
||||||
Display display = Kernel::my_parent.get_device <Display> (0x10000)
|
Display display = Kernel::my_parent.get_device <Display> (0x10000)
|
||||||
int x = r, y = r, dx = 3, dy = 0
|
int x = r, y = r, dx = 3, dy = 0
|
||||||
|
@ -1,4 +1,21 @@
|
|||||||
#pypp 0
|
#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 <iris.hh>
|
||||||
#include <devices.hh>
|
#include <devices.hh>
|
||||||
|
|
||||||
@ -17,7 +34,7 @@ void square (int x, int y, bool print):
|
|||||||
|
|
||||||
Kernel::Num start ():
|
Kernel::Num start ():
|
||||||
Kernel::my_parent.init_done ()
|
Kernel::my_parent.init_done ()
|
||||||
colour = 0xffffff
|
colour = 0xffff00
|
||||||
framebuffer = (unsigned *)0x15000
|
framebuffer = (unsigned *)0x15000
|
||||||
Display display = Kernel::my_parent.get_device <Display> (0x10001)
|
Display display = Kernel::my_parent.get_device <Display> (0x10001)
|
||||||
int x = r, y = r, dx = 3, dy = 3
|
int x = r, y = r, dx = 3, dy = 3
|
||||||
|
@ -1,4 +1,21 @@
|
|||||||
#pypp 0
|
#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 <devices.hh>
|
||||||
#include <iris.hh>
|
#include <iris.hh>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user