Add Syscall: Exit, PutChar, GetCar, PutString, GetString

This commit is contained in:
Yorick Barbanneau 2021-10-11 22:41:17 +02:00
parent 6f405265a5
commit 80fc250109
15 changed files with 359 additions and 17 deletions

View file

@ -18,7 +18,6 @@
#include "utility.h"
#include "system.h"
#ifdef USER_PROGRAM
#include "progtest.h"
#endif
@ -118,6 +117,7 @@ main (int argc, char **argv)
if (!strcmp (*argv, "-x"))
{ // run a user program
ASSERT (argc > 1);
consoledriver = new ConsoleDriver(NULL,NULL);
StartProcess (*(argv + 1));
argCount = 2;
}
@ -132,6 +132,19 @@ main (int argc, char **argv)
argCount = 3;
}
}
#ifdef CHANGED
else if (!strcmp (*argv, "-sc"))
{ // test the consoledriver
if (argc == 1)
ConsoleDriverTest (NULL, NULL);
else
{
ASSERT (argc > 2);
ConsoleDriverTest (*(argv + 1), *(argv + 2));
argCount = 3;
}
}
#endif // CHANGE
#endif // USER_PROGRAM
#ifdef FILESYS
if (!strcmp (*argv, "-cp"))

View file

@ -33,7 +33,12 @@ SynchDisk *synchDisk;
#ifdef USER_PROGRAM // requires either FILESYS or FILESYS_STUB
Machine *machine; // user program memory and registers
#endif
#ifdef CHANGED // Define our consoledriver Object
ConsoleDriver *consoledriver;
#endif // CHANGED
#endif // USER_PROGRAM
#ifdef NETWORK
PostOffice *postOffice;
@ -230,6 +235,12 @@ Cleanup ()
delete machine;
machine = NULL;
}
#ifdef CHANGED
if (consoledriver) {
delete consoledriver;
consoledriver = NULL;
}
#endif
#endif
#ifdef FILESYS_NEEDED

View file

@ -32,6 +32,13 @@ extern Timer *timer; // the hardware alarm clock
#ifdef USER_PROGRAM
#include "machine.h"
extern Machine *machine; // user program memory and registers
#ifdef CHANGED
#define MAX_STRING_SIZE 8
#include "consoledriver.h"
extern ConsoleDriver *consoledriver; // add console driver
#endif
#endif
#ifdef FILESYS_NEEDED // FILESYS or FILESYS_STUB