/demos/trunk/astro/rock.c |
---|
1,8 → 1,12 |
/* |
* Project: S.Ha.R.K. |
* Project: HARTIK (HA-rd R-eal TI-me K-ernel) |
* |
* Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
* Gerardo Lamastra <gerardo@sssup.it> |
* |
* Authors : Paolo Gai <pj@hartik.sssup.it> |
* (see authors.txt for full list of hartik's authors) |
* |
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
* |
* http://www.sssup.it |
10,6 → 14,25 |
* http://hartik.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* 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 2 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, write to the Free Software |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* |
*/ |
#include "asteroid.h" |
PID pid_RC; |
271,7 → 294,7 |
soft_task_def_usemath(ms); |
pid_RC = task_create("RockCreator", rock_creator, &ms, NULL); |
if (pid_RC == NIL) { |
FB26_close(FRAME_BUFFER_DEVICE); |
grx_close(); |
perror("Could not create task <RockCreator>"); |
sys_end(); |
} else |
/demos/trunk/astro/asteroid.h |
---|
1,8 → 1,12 |
/* |
* Project: S.Ha.R.K. |
* Project: HARTIK (HA-rd R-eal TI-me K-ernel) |
* |
* Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
* Gerardo Lamastra <gerardo@sssup.it> |
* |
* Authors : Paolo Gai <pj@hartik.sssup.it> |
* (see authors.txt for full list of hartik's authors) |
* |
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
* |
* http://www.sssup.it |
10,21 → 14,37 |
* http://hartik.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* 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 2 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, write to the Free Software |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* |
*/ |
#include <kernel/func.h> |
#include <stdlib.h> |
#include <drivers/keyb.h> |
#include <drivers/glib.h> |
#include <semaphore.h> |
#include "modules/sem.h" |
#include "modules/hartport.h" |
#include <drivers/shark_keyb26.h> |
#include <drivers/shark_fb26.h> |
#include <math.h> |
#define ASTRO_MOVE/* If defined then astro else defender */ |
#define FRAME_BUFFER_DEVICE 0 |
// DA CALCOLARE |
#define RGB_BLACK rgb16( 0, 0, 0) |
#define RGB_GRAY rgb16(127,127,127) |
/demos/trunk/astro/initfile.c |
---|
1,8 → 1,12 |
/* |
* Project: S.Ha.R.K |
* Project: HARTIK (HA-rd R-eal TI-me K-ernel) |
* |
* Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
* Gerardo Lamastra <gerardo@sssup.it> |
* |
* Authors : Paolo Gai <pj@hartik.sssup.it> |
* (see authors.txt for full list of hartik's authors) |
* |
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
* |
* http://www.sssup.it |
10,46 → 14,44 |
* http://hartik.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* 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 2 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, write to the Free Software |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* |
*/ |
#include "asteroid.h" |
#include "kernel/kern.h" |
#include "modules/edf.h" |
#include "modules/hardcbs.h" |
#include "modules/cbs.h" |
#include "modules/rr.h" |
#include "modules/dummy.h" |
#include "modules/intdrive.h" |
#include <drivers/shark_linuxc26.h> |
#include <drivers/shark_input26.h> |
#include <drivers/shark_keyb26.h> |
/*+ sysyem tick in us +*/ |
#define TICK 0 |
#define TICK 0 //300 |
/*+ RR tick in us +*/ |
#define RRTICK 10000 |
#define RRTICK 300 |
/*+ Interrup Server */ |
#define INTDRIVE_Q 1000 |
#define INTDRIVE_T 10000 |
#define INTDRIVE_FLAG 0 |
void my_close(void *arg) |
{ |
KEYB26_close(); |
INPUT26_close(); |
kern_printf("S.Ha.R.K. closed.\n\n"); |
} |
TIME __kernel_register_levels__(void *arg) |
{ |
struct multiboot_info *mb = (struct multiboot_info *)arg; |
INTDRIVE_register_level(INTDRIVE_Q,INTDRIVE_T,INTDRIVE_FLAG); |
EDF_register_level(EDF_ENABLE_ALL); |
HCBS_register_level(HCBS_ENABLE_ALL, 1); |
CBS_register_level(CBS_ENABLE_ALL, 0); |
RR_register_level(RRTICK, RR_MAIN_YES, mb); |
dummy_register_level(); |
66,12 → 68,10 |
HARTPORT_init(); |
LINUXC26_register_module(); |
INPUT26_init(); |
KEYB26_init(&kparms); |
keyb_set_map(itaMap); |
keyb_def_ctrlC(kparms, NULL); |
KEYB_init(&kparms); |
sys_atrunlevel(my_close, NULL, RUNLEVEL_BEFORE_EXIT); |
__call_main__(mb); |
return (void *)0; |
/demos/trunk/astro/astro.c |
---|
3,6 → 3,9 |
* |
* Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
* |
* Authors : Paolo Gai <pj@hartik.sssup.it> |
* (see authors.txt for full list of hartik's authors) |
* |
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
* |
* http://www.sssup.it |
10,6 → 13,25 |
* http://shark.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* 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 2 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, write to the Free Software |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* |
*/ |
#include "asteroid.h" |
int nshot; /* number of shot active */ |
373,7 → 395,7 |
soft_task_def_usemath(ms); |
pid = task_create("Astro", astro, &ms, NULL); |
if (pid == NIL) { |
FB26_close(FRAME_BUFFER_DEVICE); |
grx_close(); |
perror("Could not create task <astro>"); |
sys_end(); |
} else |
386,7 → 408,7 |
hard_task_def_usemath(mp); |
pid = task_create("Taken", look, &mp, NULL); |
if (pid == NIL) { |
FB26_close(FRAME_BUFFER_DEVICE); |
grx_close(); |
perror("Could not create task <Taken>"); |
sys_end(); |
} else |
402,7 → 424,7 |
hard_task_def_usemath(mp); |
pid_TL = task_create("TurnLeft", turn, &mp, NULL); |
if (pid_TL == NIL) { |
FB26_close(FRAME_BUFFER_DEVICE); |
grx_close(); |
perror("Could not create task <Turn L>"); |
sys_end(); |
} |
417,7 → 439,7 |
hard_task_def_usemath(mp); |
pid_TR = task_create("TurnRight", turn, &mp, NULL); |
if (pid_TR == NIL) { |
FB26_close(FRAME_BUFFER_DEVICE); |
grx_close(); |
perror("Could not create task <Turn R>"); |
sys_end(); |
} |
432,7 → 454,7 |
hard_task_def_usemath(mp); |
pid_SU = task_create("SpeedUP", speed, &mp, NULL); |
if (pid_SU == NIL) { |
FB26_close(FRAME_BUFFER_DEVICE); |
grx_close(); |
perror("Could not create task <Speed UP>"); |
sys_end(); |
} |
447,7 → 469,7 |
hard_task_def_usemath(mp); |
pid_SD = task_create("SpeedDOWN", speed, &mp, NULL); |
if (pid_SD == NIL) { |
FB26_close(FRAME_BUFFER_DEVICE); |
grx_close(); |
perror("Could not create task <Speed DOWN>"); |
sys_end(); |
} |
462,7 → 484,7 |
hard_task_def_usemath(mp); |
pid_SZ = task_create("SpeedZERO", speed, &mp, NULL); |
if (pid_SZ == NIL) { |
FB26_close(FRAME_BUFFER_DEVICE); |
grx_close(); |
perror("Could not create task <Speed ZERO>"); |
sys_end(); |
} |
474,7 → 496,7 |
hard_task_def_usemath(mp); |
pid = task_create("MoveAstro", move, &mp, NULL); |
if (pid == NIL) { |
FB26_close(FRAME_BUFFER_DEVICE); |
grx_close(); |
perror("Could not create task <MoveAstro>"); |
sys_end(); |
} else |
491,7 → 513,7 |
hard_task_def_usemath(mp); |
pid_FL = task_create("FlipAstro", turn, &mp, NULL); |
if (pid_FL == NIL) { |
FB26_close(FRAME_BUFFER_DEVICE); |
grx_close(); |
perror("Could not create task <Flip Astro>"); |
sys_end(); |
} |
527,51 → 549,43 |
k.flag = 0; |
k.scan = KEY_SPC; |
k.ascii = ' '; |
k.status = KEY_PRESSED; |
keyb_hook(k,new_shot,FALSE); |
keyb_hook(k,new_shot); |
k.flag = 0; |
k.scan = KEY_O; |
k.ascii = 'o'; |
k.status = KEY_PRESSED; |
keyb_hook(k,pad,FALSE); |
keyb_hook(k,pad); |
k.flag = 0; |
k.scan = KEY_P; |
k.ascii = 'p'; |
k.status = KEY_PRESSED; |
keyb_hook(k,pad,FALSE); |
keyb_hook(k,pad); |
k.flag = 0; |
k.scan = KEY_S; |
k.ascii = 's'; |
k.status = KEY_PRESSED; |
keyb_hook(k,pad,FALSE); |
keyb_hook(k,pad); |
k.flag = 0; |
k.scan = KEY_Z; |
k.ascii = 'z'; |
k.status = KEY_PRESSED; |
keyb_hook(k,pad,FALSE); |
keyb_hook(k,pad); |
#ifdef ASTRO_MOVE |
k.flag = 0; |
k.scan = KEY_A; |
k.ascii = 'a'; |
k.status = KEY_PRESSED; |
keyb_hook(k,pad,FALSE); |
keyb_hook(k,pad); |
k.flag = 0; |
k.scan = KEY_F; |
k.ascii = 'f'; |
k.status = KEY_PRESSED; |
keyb_hook(k,pad,FALSE); |
keyb_hook(k,pad); |
#else |
k.flag = 0; |
k.scan = KEY_X; |
k.ascii = 'x'; |
k.status = KEY_PRESSED; |
keyb_hook(k,pad,FALSE); |
keyb_hook(k,pad); |
#endif |
} |
/demos/trunk/astro/asteroid.c |
---|
53,6 → 53,18 |
} |
void endfun(KEY_EVT *k) |
{ |
cprintf("Ctrl-Brk pressed! Ending...\n"); |
sys_end(); |
} |
void my_grx_close(void *arg) |
{ |
grx_close(); |
kern_printf("Graphic mode closed.\n"); |
} |
void frame_main() |
{ |
#ifdef ASTRO_MOVE |
80,29 → 92,21 |
frame_astro(); |
} |
void end_func(KEY_EVT *k) { |
FB26_close(FRAME_BUFFER_DEVICE); |
sys_end(); |
} |
int main(int argc, char **argv) |
{ |
KEY_EVT k; |
TIME seme; |
int modenum; |
k.flag = CNTR_BIT; |
k.scan = KEY_C; |
k.ascii = 'c'; |
k.status = KEY_PRESSED; |
keyb_hook(k,end_func,FALSE); |
keyb_hook(k,endfun); |
k.flag = CNTL_BIT; |
k.scan = KEY_C; |
k.ascii = 'c'; |
k.status = KEY_PRESSED; |
keyb_hook(k,end_func,FALSE); |
keyb_hook(k,endfun); |
sem_init(&mx_mat,0,1); |
sem_init(&mx_grf,0,1); |
119,9 → 123,11 |
seme = sys_gettime(NULL); |
srand(seme); |
FB26_init(); |
sys_atrunlevel(my_grx_close, NULL, RUNLEVEL_BEFORE_EXIT); |
FB26_open(FRAME_BUFFER_DEVICE); |
grx_init(); |
modenum = grx_getmode(640, 480, 16); |
grx_setmode(modenum); |
frame_main(); |
/demos/trunk/astro/stat.c |
---|
1,8 → 1,12 |
/* |
* Project: S.Ha.R.K. |
* Project: HARTIK (HA-rd R-eal TI-me K-ernel) |
* |
* Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
* Gerardo Lamastra <gerardo@sssup.it> |
* |
* Authors : Paolo Gai <pj@hartik.sssup.it> |
* (see authors.txt for full list of hartik's authors) |
* |
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
* |
* http://www.sssup.it |
10,6 → 14,25 |
* http://hartik.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* 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 2 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, write to the Free Software |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* |
*/ |
#include "asteroid.h" |
#include <string.h> |
129,7 → 152,7 |
soft_task_def_usemath(ms); |
pid = task_create("StatWrite", stat_write, &ms, NULL); |
if (pid == NIL) { |
FB26_close(FRAME_BUFFER_DEVICE); |
grx_close(); |
perror("Could not create task <StatWrite>"); |
sys_end(); |
} else |
150,13 → 173,11 |
k.flag = 0; |
k.scan = KEY_N; |
k.ascii = 'n'; |
k.status = KEY_PRESSED; |
keyb_hook(k,new_game,FALSE); |
keyb_hook(k,new_game); |
k.flag = 0; |
k.scan = KEY_B; |
k.ascii = 'b'; |
k.status = KEY_PRESSED; |
keyb_hook(k,start_game,FALSE); |
keyb_hook(k,start_game); |
} |
/demos/trunk/astro/makefile |
---|
12,5 → 12,5 |
include $(BASE)/config/example.mk |
asteroid: |
make -f $(SUBMAKE) APP=asteroid INIT= OTHEROBJS="initfile.o astro.o stat.o rock.o" SHARKOPT="__LINUXC26__ __NEWPCI__ __INPUT__ __FB__" |
make -f $(SUBMAKE) APP=asteroid INIT= OTHEROBJS="initfile.o astro.o stat.o rock.o" SHARKOPT="__OLDCHAR__ __GRX__" |