21 size_t size =
read(data, 2000, file);
25 for(
int j = 0; j < 24; j++) {
26 for(
int i = 0; i < 79; i++) {
50 for(
int j = 0; j < 24; j++) {
52 for(
int i = 0; i < 79; i++) {
54 if(i == cursor.x && j == cursor.y)
57 cputc(view[i][j], LightGrey, 1);
60 else if(i == cursor.x && j == cursor.y) {
62 while(cursor.x > 0 && view[cursor.x - 1][cursor.y] == 0)cursor.x--;
72 printf(
"File: %s size: %i", 0x80, size);
75 if(key.character == 0 && key.scancode == 72) {
81 else if(key.character == 0 && key.scancode == 80 ) {
89 else if(key.character == 0 && key.scancode == 77) {
94 else if(key.character == 0 && key.scancode == 75) {
99 else if(key.character == 8 && key.scancode == 14 && cursor.x > 0) {
101 view[cursor.x ][cursor.y] = 0;
105 else if(key.character == 13 && key.scancode == 28) {
112 else if(key.character == 19 && key.scancode == 31) {
116 for(
int j = 0; j < 24; j++) {
118 for(
int i = 0; i < 79; i++) {
122 data[n] = view[i][j];
130 if(data[n - 1] ==
'\n')
133 printf(
"Saved %iB = %i sectors and %i Bytes\n", n, n / 512, n % 512);
134 int ret =
write(data, n, file);
135 return (ret > 0 ? 0 : ret);
138 view[cursor.x][cursor.y] = key.character;
142 while(key.character != 27 && key.scancode != 1);
Console input output control.
void cputc(char c, Color color, Byte times)
Color put character.
void setCursorPosition(Cursor cursor)
Set position of cursor.
Cursor getCursorPosition(void)
Get position of Cursor.
void cls(void)
Clear screen.
int write(int buf, size_t size, FILE *stream)
Write to file.
FILE * open(int filename, int mode)
Open file.
int read(int buf, size_t size, FILE *stream)
Read from file.
Standard input output library.
Key getc(void)
Wait for key in buffer, get it and clear buffer.
void printf(const int str,...)
C-like printf function.
void putc(Byte character)
Put character.
int memset(int ptr, int value, size_t count)
Set count Bytes of *ptr to value.
useful macros, definitions, enums etc.
#define NULL
pointer to NULL
#define __start
Must be before main function of program to put this function as first in binary file.
Attributes of character on screen.
Key information, got from buffer.