uxn/uxn.c

34 lines
769 B
C
Raw Normal View History

2021-01-29 14:17:59 -05:00
#include <stdio.h>
2021-02-08 15:16:39 -05:00
#include "cpu.h"
2021-01-29 14:17:59 -05:00
2021-01-29 14:35:59 -05:00
/*
2021-01-29 14:17:59 -05:00
Copyright (c) 2021 Devine Lu Linvega
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE.
*/
int
main(int argc, char *argv[])
{
2021-01-29 15:14:37 -05:00
FILE *f;
2021-02-08 15:16:39 -05:00
Computer cpu;
2021-01-29 15:14:37 -05:00
if(argc < 2)
2021-02-06 13:39:13 -05:00
return error("No input.", 0);
2021-01-29 15:14:37 -05:00
if(!(f = fopen(argv[1], "rb")))
2021-02-06 13:39:13 -05:00
return error("Missing input.", 0);
2021-02-07 13:46:51 -05:00
if(!load(f))
return error("Load error", 0);
if(!boot())
return error("Boot error", 0);
2021-01-29 15:14:37 -05:00
/* print result */
2021-02-04 16:49:03 -05:00
echos(&cpu.wst, 0x40, "stack");
echom(&cpu.ram, 0x40, "ram");
2021-02-08 14:44:37 -05:00
echof();
2021-01-29 14:17:59 -05:00
return 0;
}