summaryrefslogtreecommitdiff
path: root/terminal/vt52.h
blob: 94502d11581e5731d2ad15801baa1b4ff97c4638 (plain)
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
#ifndef VT52_H
#define VT52_H

#include <stdint.h>


//
// Emulator of a vt52 terminal
//
//  1. pass a term_out and term_in struct to vt52_init(..).
//  2. use the vt52_kb function for terminal/user input (eg. keyboard).
//  3. use the vt52_put function for input from the host/programms.
//
//	    
//
//			    ________
//	vt52_put() ------>  |	    | ----> (term_out_struct)
//			    | VT52  |
//	(term_in_struct)<-- |_______| <---- vt52_kb()
//
//
// OTHER REQUIREMENTS
//
// Your also need to provide some memory allocation 
//
// * uint32_t kballoc(uint32_t bloks); // block wise in-kernel allocation
//

typedef struct term_out_struct
{

    void (*put_char)(uint8_t c,uint8_t color, uint32_t x, uint32_t y);
    void (*update_cursor)(uint32_t col,uint32_t row);

}term_out;

typedef struct term_in_struct
{

    void (*put_char)(uint8_t c);

}term_in;

typedef struct vt52_tty_struct
{

    uint32_t width;
    uint32_t height;
    uint32_t x;
    uint32_t y;
    uint32_t *data; // screen data

    term_out *screen;
    term_in *input;

}vt52_tty;

vt52_tty vt52_init(term_out *screen,term_in *input);
void vt52_put(vt52_tty *tty, uint8_t c);
void vt52_kb(vt52_tty *tty, uint8_t c);

#endif