This commit is contained in:
julianb0 2019-06-08 09:47:19 +02:00
parent c667bd23fc
commit d6089b3999
No known key found for this signature in database
GPG Key ID: DDF8325C95299A62
3 changed files with 4 additions and 20 deletions

View File

@ -47,9 +47,6 @@ struct ctx_t
// Read next instruction
ushort (*get)(ctx_t *ctx);
// For disassembly
FILE *disf;
// Step by step
int step;

View File

@ -16,7 +16,6 @@ void _except(ctx_t *ctx, int code, char *fmt, ...)
t.c_lflag |= ECHO;
tcsetattr(0, TCSANOW, &t);
log("\nException %d - ", code);
va_start(ap, fmt);
@ -34,7 +33,8 @@ void _except(ctx_t *ctx, int code, char *fmt, ...)
//
// Shut down devices
//
if (devfiniall(ctx) < 0) {
if (devfiniall(ctx) < 0)
{
log("Couldn't deinitialize devices\n");
exit(-100 - code);
}

View File

@ -1,6 +1,7 @@
// The OS/K Team licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#include <signal.h>
#include <dv/dev.h>
#include <sys/time.h>
#include <termio.h>
@ -28,20 +29,6 @@ ushort bget(ctx_t *ctx)
return c;
}
ushort dget(ctx_t *ctx)
{
static int i = 0;
if (i >= fwsize) {
log("Finished disassembling\n");
fclose(ctx->disf);
exit(0);
}
rip += 2;
return fwprog[i++];
}
ctx_t main_ctx;
void sigint(int _)
@ -87,6 +74,7 @@ int main(int argc, char **argv)
//
// Signal handling
//
signal(SIGINT, sigint);
//
// Load program
@ -121,7 +109,6 @@ int main(int argc, char **argv)
main_ctx.mz = MEMSIZE;
main_ctx.get = bget;
main_ctx.disf = NULL;
main_ctx.r[RIP].val = MEMOFF;