File: video.h

package info (click to toggle)
gpsim 0.26.1-2.1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 11,200 kB
  • sloc: cpp: 86,839; sh: 18,875; asm: 16,815; ansic: 4,468; makefile: 1,308; lex: 1,129; yacc: 823; pascal: 177; perl: 93; awk: 44
file content (110 lines) | stat: -rw-r--r-- 2,576 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
   Copyright (C) 2003 Ralf Forsberg

This file is part of the libgpsim_modules library of gpsim

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library 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
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see 
<http://www.gnu.org/licenses/lgpl-2.1.html>.
*/


#ifndef __VIDEO_H__
#define __VIDEO_H__

/* IN_MODULE should be defined for modules */
#define IN_MODULE

#include "../src/stimuli.h"
#include "../src/ioports.h"
#include "../src/symbol.h"
#include "../src/modules.h"

#include <gtk/gtk.h>

class Video;
class Video_Interface;

/*********************************************************
 *
 * Create a class derived from the IOPIN class that
 * will allow us to intercept when the I/O input is being
 * driven. (This isn't done for PIC I/O pins because the
 * logic for handling I/O pin changes resides in the ???
 * class.)
 */


class IOPIN_Monitor : public IOPIN
{
private:
  Video *video;
public:

  virtual void setDrivenState( bool new_state);

  IOPIN_Monitor (Video *v, const char *opt_name) 
    : IOPIN(opt_name) , video(v)
    { 
    }

};


#define XRES 640
#define YRES 625

class Video : public Module
{
public:

  IOPIN * sync_pin;
  IOPIN * lume_pin;
  guint64 sync_time; // gpsim cycle counter at last H-sync
  int scanline;
  unsigned char line[XRES]; // buffer for one line
  unsigned char shadow[XRES][YRES]; // pixmap mirror
  Processor *cpu;

  GtkWidget *window;
  GtkWidget *da;
  GdkGC *white_gc, *black_gc, *grey_gc;
  GdkPixmap *pixmap;
  int line_nr;
  int last_line_nr;

  GdkColor black_color, grey_color, white_color;
  
  Video(const char *);
  ~Video(void);

  // Inheritances from the Package class
  virtual void create_iopin_map(void);

  virtual void update_state(void);
  virtual int get_num_of_pins(void) {return 2;};
  void copy_scanline_to_pixmap(void);
  int check_for_vrt1(void);
  int check_for_vrt2(void);
  guint64 cycles_to_us(guint64 cycles);
  guint64 us_to_cycles(guint64 cycles);
  void refresh(void);
  static Module *construct(const char *new_name);

private:
    Video_Interface *interface;

};

#endif //  __VIDEO_H__