blob: 587c396ca19c12c7c22e0561c5d573cdd1073104 (
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
|
/* Move the XL/XE OS to RAM.
Based on the RAMROM code by Joe Miller, from the Mapping the
Atari XL appendix (see the PORTB entry). Uses $6000 to $97FF as a
buffer, so it won't step on the default GR.0 screen if BASIC is
enabled.
*/
#include <stdio.h>
#include <string.h>
#include <atari.h>
#include <6502.h>
#define LO_ROM_SIZE 0x1000
#define HI_ROM_SIZE 0x2800
static char *lo_buf = (char *)0x6000;
static char *hi_buf = (char *)0x7000;
static char *lo_rom = (char *)0xc000;
static char *hi_rom = (char *)0xd800;
static char old_nmi;
static void enable_interrupts(void) {
ANTIC.nmien = old_nmi;
CLI();
}
static void disable_os_rom(void) {
SEI();
old_nmi = ANTIC.nmien;
ANTIC.nmien = 0;
PIA.portb &= 0xfe;
}
void os_to_ram(void) {
memcpy(lo_buf, lo_rom, LO_ROM_SIZE);
memcpy(hi_buf, hi_rom, HI_ROM_SIZE);
disable_os_rom();
memcpy(lo_rom, lo_buf, LO_ROM_SIZE);
memcpy(hi_rom, hi_buf, HI_ROM_SIZE);
enable_interrupts();
}
#if 0
void main(void) {
if(is_xl()) {
puts("XL/XE, copying OS to RAM.");
os_to_ram();
*((char *)0xe003) = 0x7e;
} else {
puts("400/800, can't do.");
}
hang: goto hang;
}
#endif
|