From 7ba9782459adba7b3e58f82a7df88da721319980 Mon Sep 17 00:00:00 2001 From: neauoire Date: Thu, 4 Feb 2021 15:38:04 -0800 Subject: [PATCH] * --- README.md | 27 ++++++++------------------- uxn.c | 10 ++++++++-- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 4e0a482..c5731bf 100644 --- a/README.md +++ b/README.md @@ -26,22 +26,20 @@ cc uxn.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o uxn - `( comment )` ``` -( comment ) +;value ( alloc zero-page variable ) -;variable1 -;variable2 -;variable3 +@0010 ( start at page 1 ) -.there ( 0a 05 GTH ) JMC +,there [ ,0a ,05 GTH ] JMC :here - < when not equal > - ee + ( when not equal ) + ,ee BRK :there - < when is equal > - ff + ( when is equal ) + ,ff BRK ``` @@ -49,7 +47,6 @@ cc uxn.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o uxn ### Assembler -- Crash on missing label - Catch overflow/underflow - Constants - Jumps should be relative @@ -58,20 +55,12 @@ cc uxn.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o uxn - Pointers/Literals - A Three-Way Decision Routine(http://www.6502.org/tutorials/compare_instructions.html) -- Carry flag? - Print word to stdout - Draw pixel to screen - Detect mouse click - SDL Layer Emulator - Build PPU -- Interrupts, vectors - -### 16 Bit Missions - -- 16 bits addressing -- jumping to subroutine should be relative -- Implement addressing -- Implement 16 bits operations +- Add flags.. ## Refs diff --git a/uxn.c b/uxn.c index 2245164..c203c4c 100644 --- a/uxn.c +++ b/uxn.c @@ -165,7 +165,7 @@ error(char *name) } int -eval() +eval(void) { Uint8 instr = cpu.rom.dat[cpu.rom.ptr++]; if(cpu.literal > 0) { @@ -197,7 +197,13 @@ start(FILE *f) cpu.vreset = mempoke16(0xfffa); cpu.vframe = mempoke16(0xfffc); cpu.verror = mempoke16(0xfffe); - while(!(cpu.status & FLAG_HALT) && eval(cpu)) + /* eval reset */ + cpu.rom.ptr = cpu.vreset; + while(!(cpu.status & FLAG_HALT) && eval()) + ; + /*eval frame */ + cpu.rom.ptr = cpu.vframe; + while(!(cpu.status & FLAG_HALT) && eval()) ; /* debug */ printf("ended @ %d steps | ", cpu.counter);