-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathlibbasic_test.c
More file actions
60 lines (48 loc) · 1.3 KB
/
Copy pathlibbasic_test.c
File metadata and controls
60 lines (48 loc) · 1.3 KB
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
/* _
** ___ ___ _ _|_|___ ___
** | _| .'|_'_| |_ -|_ -|
** |_| |__,|_,_|_|___|___|
** raxiss (c) 2021
**
** GNU General Public License v3.0
** See https://github.com/iss000/oricOpenLibrary/blob/main/LICENSE
**
*/
/* ================================================================== *
* libsedoric code *
* ================================================================== */
#ifdef __CC65__
#include <stdio.h>
#else
#include <lib.h>
#endif
/* macros as free bonus ;) */
#define poke(addr, val) do *((unsigned char*)(addr)) = val; while(0)
#define peek(addr) (*((unsigned char*)(addr)))
#define call(addr) ((void (*)())(addr))()
#include "libbasic.h"
static char* fname = "TEST.TXT";
static void waitkey(void)
{
printf("\nPress any key...");
while(!peek(0x2df));
poke(0x2df,0);
}
void main(void)
{
basic("CLS");
printf("Content of disk A:\n");
printf("------------------\n\n");
basic("!DIR");
printf("\n\n\n");
waitkey();
basic("CLS:PRINT\"Hello world\"");
basic("!SAVEO\"SAMPLE.SCR\",A#BB80,E#BFDF:!DIR");
printf("\n\n\nFile SAMPLE.SCR saved!\n");
waitkey();
basic("CLS");
basic("!LOAD\"SAMPLE.SCR\",N");
printf("\n\n\nFile SAMPLE.SCR loaded!\n");
waitkey();
printf("\n\n\nDone.");
}