uxn/src/uxn.h

44 lines
967 B
C
Raw Normal View History

2021-02-08 15:17:50 -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.
*/
/* clang-format off */
2023-08-17 12:25:24 -04:00
#define PEEK2(d) (*(d) << 8 | (d)[1])
2023-08-25 12:38:03 -04:00
#define POKE2(d, v) { *(d) = (v) >> 8; (d)[1] = (v); }
2023-03-01 13:35:42 -05:00
2022-01-03 16:23:57 -05:00
/* clang-format on */
#define PAGE_PROGRAM 0x0100
2023-03-01 13:35:42 -05:00
typedef unsigned char Uint8;
typedef signed char Sint8;
typedef unsigned short Uint16;
typedef signed short Sint16;
typedef unsigned int Uint32;
2021-02-08 15:16:39 -05:00
typedef struct {
2023-08-17 12:25:24 -04:00
Uint8 dat[0x100], ptr;
2021-02-15 13:12:44 -05:00
} Stack;
2021-02-08 15:16:39 -05:00
typedef struct Uxn {
2023-08-25 12:38:03 -04:00
Uint8 *ram, dev[0x100];
2023-04-11 13:14:29 -04:00
Stack wst, rst;
2021-02-08 17:18:01 -05:00
} Uxn;
2021-02-08 15:16:39 -05:00
/* required functions */
extern Uint8 emu_dei(Uxn *u, Uint8 addr);
2023-10-30 17:14:02 -04:00
extern void emu_deo(Uxn *u, Uint8 addr, Uint8 value);
/* built-ins */
int uxn_eval(Uxn *u, Uint16 pc);