EMAIL can now load EDIT, and vice versa.

This commit is contained in:
Bobbi Webber-Manners 2020-07-15 18:51:46 -04:00
parent 532c0cd4a3
commit 1a1b499e43
2 changed files with 17 additions and 32 deletions

View File

@ -9,6 +9,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <conio.h>
#include <peekpoke.h>
@ -566,27 +567,21 @@ void page_up(void) {
cursor_up();
}
/*
* Delete from cursor to EOL.
* If at EOL, delete EOL char.
*/
void kill_line(void) {
// TODO
}
/*
* Load EMAIL.SYSTEM to $2000 and jump to it
* (Code is in language card space so it can't possibly be trashed)
* (This code is in language card space so it can't possibly be trashed)
*/
#pragma code-name (push, "LC")
void load_email(void) {
static char *emailer = "EMAIL.SYSTEM";
FILE *fp = fopen(emailer, "rb");
char *p = 0x280;
uint16_t l;
if (!fp)
goto err;
l = fread((void*)0x2000, 1, 512, fp);
if (l == 0)
goto err;
strcpy(p + 1, emailer);
*p = strlen(emailer);
__asm__("jmp $2000"); // That's all folks!
err:
printf("Can't load EMAIL.SYSTEM");
fclose(fp);
exec("/IP65/EMAIL.SYSTEM", NULL);
}
#pragma code-name (pop)
@ -627,6 +622,10 @@ int edit() {
case 0x06: // Ctrl-F "PAGE DOWN"
page_down();
break;
// case 0x0b: // Ctrl-K "KILL LINE"
// kill_line();
// draw_screen();
// break;
case 0x0C: // Ctrl-L "REFRESH"
draw_screen();
break;

View File

@ -1527,25 +1527,11 @@ void create_blank_outgoing() {
/*
* Load EDIT.SYSTEM to $2000 and jump to it
* (Code is in language card space so it can't possibly be trashed)
* (This code is in language card space so it can't possibly be trashed)
*/
#pragma code-name (push, "LC")
void load_editor(void) {
static char *editor = "EDIT.SYSTEM";
FILE *fp = fopen(editor, "rb");
char *p = 0x280;
uint16_t l;
if (!fp)
goto err;
l = fread((void*)0x2000, 1, 512, fp);
if (l == 0)
goto err;
strcpy(p + 1, editor);
*p = strlen(editor);
__asm__("jmp $2000"); // That's all folks!
err:
error(ERR_NONFATAL, "Can't load EDIT.SYSTEM");
fclose(fp);
exec("/IP65/EDIT.SYSTEM", NULL);
}
#pragma code-name (pop)