2022-01-05 12:59:22 +00:00
|
|
|
#include "../uxn.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
Copyright (c) 2022 Devine Lu Linvega, Andrew Alderwick
|
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2022-01-05 13:06:22 +00:00
|
|
|
static const char *errors[] = {
|
|
|
|
"Working-stack underflow",
|
|
|
|
"Return-stack underflow",
|
|
|
|
"Working-stack overflow",
|
|
|
|
"Return-stack overflow",
|
|
|
|
"Working-stack division by zero",
|
|
|
|
"Return-stack division by zero"};
|
2022-01-05 12:59:22 +00:00
|
|
|
|
|
|
|
int
|
2022-01-05 13:06:22 +00:00
|
|
|
uxn_halt(Uxn *u, Uint8 error, Uint16 addr)
|
2022-01-05 12:59:22 +00:00
|
|
|
{
|
2022-01-05 13:06:22 +00:00
|
|
|
fprintf(stderr, "Halted: %s#%04x, at 0x%04x\n", errors[error], u->ram[addr], addr);
|
2022-01-05 12:59:22 +00:00
|
|
|
return 0;
|
|
|
|
}
|