uxn.h (945B)
1 /* 2 Copyright (c) 2021 Devine Lu Linvega 3 4 Permission to use, copy, modify, and distribute this software for any 5 purpose with or without fee is hereby granted, provided that the above 6 copyright notice and this permission notice appear in all copies. 7 8 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 WITH REGARD TO THIS SOFTWARE. 10 */ 11 12 /* clang-format off */ 13 14 #define PEEK2(d) (*(d) << 8 | (d)[1]) 15 #define POKE2(d, v) { *(d) = (v) >> 8; (d)[1] = (v); } 16 17 /* clang-format on */ 18 19 #define STEP_MAX 0x80000000 20 #define PAGE_PROGRAM 0x0100 21 22 typedef unsigned char Uint8; 23 typedef signed char Sint8; 24 typedef unsigned short Uint16; 25 typedef signed short Sint16; 26 typedef unsigned int Uint32; 27 28 typedef struct { 29 Uint8 dat[0x100], ptr; 30 } Stack; 31 32 typedef struct Uxn { 33 Uint8 *ram, dev[0x100]; 34 Stack wst, rst; 35 } Uxn; 36 37 extern Uint8 emu_dei(Uint8 addr); 38 extern void emu_deo( Uint8 addr, Uint8 value); 39 extern Uxn uxn; 40 41 int uxn_eval(Uint16 pc);