Changeset d6cc453 in mainline


Ignore:
Timestamp:
2006-06-02T19:22:08Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
53daee3
Parents:
e87e18f
Message:

Made tetris compile and somewhat run.
Slightly better console.

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    re87e18f rd6cc453  
    3939        ns \
    4040        fb \
    41         console
     41        console \
     42        tetris
    4243
    4344ifeq ($(ARCH), amd64)
  • console/console.c

    re87e18f rd6cc453  
    285285                case CONSOLE_PUTCHAR:
    286286                        write_char(consnum, IPC_GET_ARG1(call));
     287                        gcons_notify_char(consnum);
    287288                        break;
    288289                case CONSOLE_CLEAR:
     
    297298                case CONSOLE_GOTO:
    298299                       
    299                         screenbuffer_goto(&(connections[consnum].screenbuffer), IPC_GET_ARG1(call), IPC_GET_ARG2(call));
     300                        screenbuffer_goto(&(connections[consnum].screenbuffer), IPC_GET_ARG2(call), IPC_GET_ARG1(call));
    300301                       
    301302                        break;
    302303
    303304                case CONSOLE_GETSIZE:
    304                         arg1 = fb_info.cols;
    305                         arg2 = fb_info.rows;
     305                        arg1 = fb_info.rows;
     306                        arg2 = fb_info.cols;
    306307                        break;
    307308                case CONSOLE_FLUSH:
  • console/gcons.c

    re87e18f rd6cc453  
    4949static int console_vp;
    5050static int cstatus_vp[CONSOLE_COUNT];
     51static int console_has_input[CONSOLE_COUNT];
    5152static int cstat_row, cstat_col; /* Size of cstatus buttons */
    5253
     
    5657        CONS_ACTIVE = 0,
    5758        CONS_IDLE,
    58         CONS_HAS_INPUT
     59        CONS_HAS_INPUT,
     60        CONS_DISCONNECTED
    5961};
    6062
     
    6567        {0xd0d0d0, 0x808080},
    6668        {0xd0d0d0, 0x0},
    67         {0xd0d0d0, 0xa04040}
     69        {0xd0d0d0, 0xa04040},
     70        {0xd0d0d0, 0x0}
    6871};
    6972
     
    109112        set_style(stat_colors[state].fgcolor, stat_colors[state].bgcolor);
    110113        clear();
    111         snprintf(data, 5, "%d", consnum+1);
    112         for (i=0;data[i];i++)
    113                 putch(data[i], 0, i);
     114        if (state != CONS_DISCONNECTED) {
     115                snprintf(data, 5, "%d", consnum+1);
     116                for (i=0;data[i];i++)
     117                        putch(data[i], 0, i);
     118        }
    114119}
    115120
     
    122127        active_console = consnum;
    123128        draw_stat(consnum, CONS_ACTIVE);
     129        console_has_input[consnum] = 0;
     130
    124131        vp_switch(console_vp);
    125132}
     
    130137                return;
    131138
     139        if (consnum == active_console || console_has_input[consnum])
     140                return;
     141
     142        console_has_input[consnum] = 1;
     143        draw_stat(consnum, CONS_HAS_INPUT);
     144       
    132145        vp_switch(console_vp);
    133146}
     
    145158
    146159        for (i=0;i < CONSOLE_COUNT; i++)
    147                 draw_stat(i, i == active_console ? CONS_ACTIVE : CONS_IDLE);
     160                draw_stat(i, i == active_console ? CONS_ACTIVE : CONS_DISCONNECTED);
    148161        vp_switch(console_vp);
    149162}
  • console/gcons.h

    re87e18f rd6cc453  
    3232void gcons_init(int phone);
    3333void gcons_change_console(int consnum);
     34void gcons_notify_char(int consnum);
    3435
    3536#endif
  • libc/include/err.h

    re87e18f rd6cc453  
    3030#define _libc__ERR_H_
    3131
    32 extern void errx (int __status, __const char *__format, ...)
    33         __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
     32#define errx(status,fmt,...) { printf((fmt),##__VA_ARGS__);_exit(status);}
    3433
    3534#endif
  • libc/include/io/stream.h

    re87e18f rd6cc453  
    2727 */
    2828
     29#ifndef __libc_STREAM_H_
     30#define __libc_STREAM_H_
     31
    2932#include <libarch/types.h>
    3033
     
    3942fd_t open(const char *fname, int flags);
    4043int get_fd_phone(int fd);
     44
     45#endif
  • tetris/screen.c

    re87e18f rd6cc453  
    9898{
    9999
     100        resume_normal();
    100101        send_call(con_phone, CONSOLE_CLEAR, 0);
    101102        curscore = -1;
     
    187188
    188189
    189 #if vax && !__GNUC__
    190 typedef int regcell;    /* pcc is bad at `register char', etc */
    191 #else
    192 typedef cell regcell;
    193 #endif
    194 
    195190/*
    196191 * Update the screen.
     
    200195{
    201196        cell *bp, *sp;
    202         regcell so, cur_so = 0;
     197        cell so, cur_so = 0;
    203198        int i, ccol, j;
    204199        static const struct shape *lastshape;
     
    300295{
    301296       
    302         if (set || CEstr == NULL) {
    303                 int l = strlen(s);
    304 
    305                 moveto(Rows - 2, ((Cols - l) >> 1) - 1);
    306                 if (set)
    307                         putstr(s);
    308                 else
    309                         while (--l >= 0)
    310                                 (void) putchar(' ');
    311         } else {
    312                 moveto(Rows - 2, 0);
    313                 putpad(CEstr);
    314         }
    315 }
     297        int l = strlen(s);
     298       
     299        moveto(Rows - 2, ((Cols - l) >> 1) - 1);
     300        if (set)
     301                putstr(s);
     302        else
     303                while (--l >= 0)
     304                        (void) putchar(' ');
     305}
  • tetris/tetris.c

    re87e18f rd6cc453  
    4646 */
    4747
    48 //#include <sys/param.h>
    4948#include <sys/time.h>
    5049#include <sys/types.h>
    5150
    5251#include <err.h>
    53 //#include <signal.h>
    5452#include <stdio.h>
    5553#include <stdlib.h>
Note: See TracChangeset for help on using the changeset viewer.