(ref) Removed format comment
This commit is contained in:
parent
526696d44b
commit
c4c55f0adf
30
ref/uxn.c
30
ref/uxn.c
|
@ -1,12 +1,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/* clang-format off */
|
|
||||||
|
|
||||||
#define PEEK2(d) (*(d) << 8 | (d)[1])
|
#define PEEK2(d) (*(d) << 8 | (d)[1])
|
||||||
#define POKE2(d, v) { *(d) = (v) >> 8; (d)[1] = (v); }
|
#define POKE2(d, v) { *(d) = (v) >> 8; (d)[1] = (v); }
|
||||||
|
|
||||||
/* clang-format on */
|
|
||||||
|
|
||||||
typedef unsigned char Uint8;
|
typedef unsigned char Uint8;
|
||||||
typedef signed char Sint8;
|
typedef signed char Sint8;
|
||||||
typedef unsigned short Uint16;
|
typedef unsigned short Uint16;
|
||||||
|
@ -30,21 +26,6 @@ console_input(Uxn *u, char c, int type)
|
||||||
return uxn_eval(u, PEEK2(d));
|
return uxn_eval(u, PEEK2(d));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
console_deo(Uint8 *d, Uint8 port)
|
|
||||||
{
|
|
||||||
switch(port) {
|
|
||||||
case 0x8:
|
|
||||||
fputc(d[port], stdout);
|
|
||||||
fflush(stdout);
|
|
||||||
return;
|
|
||||||
case 0x9:
|
|
||||||
fputc(d[port], stderr);
|
|
||||||
fflush(stderr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Uint8
|
Uint8
|
||||||
emu_dei(Uxn *u, Uint8 addr)
|
emu_dei(Uxn *u, Uint8 addr)
|
||||||
{
|
{
|
||||||
|
@ -54,15 +35,13 @@ emu_dei(Uxn *u, Uint8 addr)
|
||||||
void
|
void
|
||||||
emu_deo(Uxn *u, Uint8 addr, Uint8 value)
|
emu_deo(Uxn *u, Uint8 addr, Uint8 value)
|
||||||
{
|
{
|
||||||
Uint8 p = addr & 0x0f, d = addr & 0xf0;
|
|
||||||
u->dev[addr] = value;
|
u->dev[addr] = value;
|
||||||
switch(d) {
|
switch(addr) {
|
||||||
case 0x10: console_deo(&u->dev[d], p); break;
|
case 0x18: fputc(u->dev[0x18], stdout), fflush(stdout); return;
|
||||||
|
case 0x19: fputc(u->dev[0x19], stderr), fflush(stderr); return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clang-format off */
|
|
||||||
|
|
||||||
#define FLIP { s = ins & 0x40 ? &u->wst : &u->rst; }
|
#define FLIP { s = ins & 0x40 ? &u->wst : &u->rst; }
|
||||||
#define JUMP(x) { if(m2) pc = (x); else pc += (Sint8)(x); }
|
#define JUMP(x) { if(m2) pc = (x); else pc += (Sint8)(x); }
|
||||||
#define POP1(o) { o = s->dat[--*sp]; }
|
#define POP1(o) { o = s->dat[--*sp]; }
|
||||||
|
@ -132,8 +111,6 @@ uxn_eval(Uxn *u, Uint16 pc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clang-format on */
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -151,7 +128,6 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
fread(&u.ram[0x0100], 0xff00, 1, f);
|
fread(&u.ram[0x0100], 0xff00, 1, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
/* eval */
|
|
||||||
u.dev[0x17] = argc - i;
|
u.dev[0x17] = argc - i;
|
||||||
if(uxn_eval(&u, 0x0100)) {
|
if(uxn_eval(&u, 0x0100)) {
|
||||||
for(; i < argc; i++) {
|
for(; i < argc; i++) {
|
||||||
|
|
Loading…
Reference in New Issue