aboutsummaryrefslogtreecommitdiffstats
path: root/src/uxn/uxn.c
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-05-20 23:41:48 +0200
committerBad Diode <bd@badd10de.dev>2021-05-20 23:41:48 +0200
commitb3f4342b584612f95938f1f00ca2d026a3f3c304 (patch)
tree0189502c98b2d391bfdf5a99c3dcc2d1ba7bf944 /src/uxn/uxn.c
parent431b35d85fa590d199acadbeaf638711eb10c6af (diff)
downloaduxngba-b3f4342b584612f95938f1f00ca2d026a3f3c304.tar.gz
uxngba-b3f4342b584612f95938f1f00ca2d026a3f3c304.zip
Apply asie's patch 5 for PPU fixes and cleanup
Diffstat (limited to 'src/uxn/uxn.c')
-rw-r--r--src/uxn/uxn.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/uxn/uxn.c b/src/uxn/uxn.c
index 8e76660..53f7983 100644
--- a/src/uxn/uxn.c
+++ b/src/uxn/uxn.c
@@ -16,21 +16,12 @@ WITH REGARD TO THIS SOFTWARE.
16/* clang-format off */ 16/* clang-format off */
17 17
18static inline void push8(Stack *s, Uint8 a) { 18static inline void push8(Stack *s, Uint8 a) {
19#ifdef CPU_ERROR_CHECKING
20 if (s->ptr == 0xff) { s->error = 2; return; }
21#endif
22 s->dat[s->ptr++] = a; 19 s->dat[s->ptr++] = a;
23} 20}
24static inline Uint8 pop8_keep(Stack *s) { 21static inline Uint8 pop8_keep(Stack *s) {
25#ifdef CPU_ERROR_CHECKING
26 if (s->kptr == 0) { s->error = 1; return 0; }
27#endif
28 return s->dat[--s->kptr]; 22 return s->dat[--s->kptr];
29} 23}
30static inline Uint8 pop8_nokeep(Stack *s) { 24static inline Uint8 pop8_nokeep(Stack *s) {
31#ifdef CPU_ERROR_CHECKING
32 if (s->ptr == 0) { s->error = 1; return 0; }
33#endif
34 return s->dat[--s->ptr]; 25 return s->dat[--s->ptr];
35} 26}
36static inline void devpoke8(Device *d, Uint8 a, Uint8 b) { d->dat[a & 0xf] = b; d->talk(d, a & 0x0f, 1); } 27static inline void devpoke8(Device *d, Uint8 a, Uint8 b) { d->dat[a & 0xf] = b; d->talk(d, a & 0x0f, 1); }
@@ -55,7 +46,7 @@ IWRAM_CODE
55static inline void 46static inline void
56opcuxn(Uxn *u, Uint8 instr) 47opcuxn(Uxn *u, Uint8 instr)
57{ 48{
58#ifdef CPU_ERROR_CHECKING 49#if 1
59 // With CPU error checking enabled, the codebase becomes too large to fit in ITCM. 50 // With CPU error checking enabled, the codebase becomes too large to fit in ITCM.
60 // Therefore, we take some concessions. 51 // Therefore, we take some concessions.
61 if (instr & 0x40) { 52 if (instr & 0x40) {
@@ -155,8 +146,6 @@ int
155evaluxn(Uxn *u, Uint16 vec) 146evaluxn(Uxn *u, Uint16 vec)
156{ 147{
157 u->ram.ptr = vec; 148 u->ram.ptr = vec;
158 u->wst.error = 0;
159 u->rst.error = 0;
160 while(u->ram.ptr) { 149 while(u->ram.ptr) {
161 opcuxn(u, u->ram.dat[u->ram.ptr++]); 150 opcuxn(u, u->ram.dat[u->ram.ptr++]);
162 } 151 }