diff options
| author | B. Watson <urchlay@slackware.uk> | 2026-04-26 03:14:47 -0400 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2026-04-26 03:14:47 -0400 |
| commit | 7bf23d5b680f4cfaf2a4f1d1f03005cd1c1473a9 (patch) | |
| tree | 1adc185679c6cd66608dfcfd13c0a61cb819053a /config | |
| parent | d8e36c6648558fa43865ea238412124e5c2a95f9 (diff) | |
| download | fujinet-chat-7bf23d5b680f4cfaf2a4f1d1f03005cd1c1473a9.tar.gz | |
Add files I forgot to add to the repo. Apparently nobody builds this from source but me...
Diffstat (limited to 'config')
| -rw-r--r-- | config/os2ram.c | 55 | ||||
| -rw-r--r-- | config/os2ram.h | 6 |
2 files changed, 61 insertions, 0 deletions
diff --git a/config/os2ram.c b/config/os2ram.c new file mode 100644 index 0000000..587c396 --- /dev/null +++ b/config/os2ram.c @@ -0,0 +1,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 diff --git a/config/os2ram.h b/config/os2ram.h new file mode 100644 index 0000000..46d0a0e --- /dev/null +++ b/config/os2ram.h @@ -0,0 +1,6 @@ +/* cc65's libsrc/atari/ostype.s offers detailed OS type detection. + All we care about is "Is it an XL/XE or a 400/800?", which + boils down to this: */ +#define is_xl() ( *((char *)0xfcd8) != 0xa2 ) + +void os_to_ram(void); |
