forked from SinclairQL/sQLux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
QL_screen.c
61 lines (53 loc) · 1.27 KB
/
QL_screen.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
61
/*
* (c) UQLX - see COPYRIGHT
*/
#include <stdio.h>
#include "QL68000.h"
#include "QL_config.h"
#include "QL_screen.h"
screen_specs qlscreen =
{
128 * 1024,
128 * 1024 + 32 * 1024,
0x8000,
128,
256,
512,
};
struct SCREENDEF
{
uw32 scrbase;
uw32 scrlen;
uw16 linel;
uw16 xres;
uw16 yres;
};
static int PtrPatchOk=0;
void QLPatchPTRENV(void)
{
uw32 scrdef_search;
//struct SCREENDEF *scrdef;
int flag;
scrdef_search=((Ptr)pc-8000) - (void *)memBase;
while ( LookFor(&scrdef_search,0x20000,24000)) {
struct SCREENDEF *scrdef = (void *)memBase + scrdef_search;
if (RL(&(scrdef->scrlen))==0x8000 &&
RW(&(scrdef->linel)) ==0x80 &&
RW(&(scrdef->xres)) ==0x200 &&
RW(&(scrdef->yres)) ==0x100 ) {
PtrPatchOk=1;
WL(&(scrdef->scrbase),qlscreen.qm_lo);
WL(&(scrdef->scrlen),qlscreen.qm_len);
WW(&(scrdef->linel),qlscreen.linel);
WW(&(scrdef->xres),qlscreen.xres);
WW(&(scrdef->yres),qlscreen.yres);
return;
} else {
scrdef_search = scrdef_search + 2;
}
}
if (!PtrPatchOk)
printf("WARNING: could not patch Pointer Environment\n");
else
printf("Patched Pointer Environment with screen size\n");
}