EMAIL: Added code to disconnect /RAM on startup

This commit is contained in:
Bobbi Webber-Manners 2020-08-17 13:17:46 -04:00
parent 5994a4f8fa
commit 76b30e919e
2 changed files with 28 additions and 2 deletions

View File

@ -4,7 +4,8 @@
// Bobbi June, July 2020
/////////////////////////////////////////////////////////////////
// - TODO: Get rid of all uses of malloc(). Don't need it.
// TODO: Bug handling an attachment of type text/plain.
// TODO: Get rid of all uses of malloc(). Don't need it.
#include <stdio.h>
#include <stdlib.h>
@ -1988,6 +1989,30 @@ void keyboard_hdlr(void) {
}
}
/*
* Disconnect RAM disk /RAM
*/
void disconnect_ramdisk(void) {
uint8_t i, j;
uint8_t *devcnt = (uint8_t*)0xbf31; // Number of devices
uint8_t *devlst = (uint8_t*)0xbf32; // Disk device numbers
uint16_t *s0d1 = (uint16_t*)0xbf10; // s0d1 driver vector
uint16_t *s3d2 = (uint16_t*)0xbf26; // s3d2 driver vector
if (*s0d1 == *s3d2)
return; // No /RAM connected
for (i = *devcnt; i > 0; --i) {
if ((devlst[i] == 0xbf) || (devlst[i] == 0xbb) ||
(devlst[i] == 0xb7) || (devlst[i] == 0xb3))
break;
}
if (i > 0) {
for (j = i; j < *devcnt; ++j) {
devlst[j] = devlst[j + 1];
}
}
*s3d2 = *s0d1;
--(*devcnt);
}
void main(void) {
uint8_t *pp;
@ -1997,6 +2022,7 @@ void main(void) {
if ((*pp & 0x30) != 0x30)
error(ERR_FATAL, "Need 128K");
videomode(VIDEOMODE_80COL);
disconnect_ramdisk();
readconfigfile();
reverse = 0;
first_msg = 1;

View File

@ -4,7 +4,7 @@
// Bobbi June 2020
/////////////////////////////////////////////////////////////////
#define PROGNAME "emai//er v0.97"
#define PROGNAME "emai//er v0.98"
// Configuration params from POP65.CFG
char cfg_server[40]; // IP of POP3 server