-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcpm-conio.c
61 lines (52 loc) · 1.28 KB
/
cpm-conio.c
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
/*
Requires console compatiblity
zcc +cpm -o cpm-conio.com -subtype=z80pack -create-app cpm-conio.c --generic-console -pragma-define:CONSOLE_COLUMNS=80 -pragma-define:CONSOLE_ROWS=24
vio zcc +cpm -o cpm-conio.com -subtype=z80pack -create-app cpm-conio.c --generic-console -pragma-define:CONSOLE_COLUMNS=80 -pragma-define:CONSOLE_ROWS=24 --vio
*/
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
// Global key variable
int key;
char x,y=10;
int main()
{
/* Cursor off */
printf("\e[1;1H\e[?25l");
/* Clear Screen */
clrscr();
/* Loop until Q is pressed */
while ((key = toupper(cgetc())) != 'Q')
{
// Delete the character
gotoxy(x,y);
putch('.');
// keys;
switch (key)
{
case 'W':
case 'w':
y--;
break;
case 'A':
case 'a':
x--;
break;
case 'S':
case 's':
y++;
break;
case 'D':
case 'd':
x++;
break;
default:
break;
}
gotoxy(x,y);
putch('@');
}
// Cursor on
printf("\e[?25h");
return(0);
}