This commit is contained in:
neauoire 2021-02-04 15:38:04 -08:00
parent 9597611918
commit 7ba9782459
2 changed files with 16 additions and 21 deletions

View File

@ -26,22 +26,20 @@ cc uxn.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o uxn
- `( comment )` - `( comment )`
``` ```
( comment ) ;value ( alloc zero-page variable )
;variable1 @0010 ( start at page 1 )
;variable2
;variable3
.there ( 0a 05 GTH ) JMC ,there [ ,0a ,05 GTH ] JMC
:here :here
< when not equal > ( when not equal )
ee ,ee
BRK BRK
:there :there
< when is equal > ( when is equal )
ff ,ff
BRK BRK
``` ```
@ -49,7 +47,6 @@ cc uxn.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o uxn
### Assembler ### Assembler
- Crash on missing label
- Catch overflow/underflow - Catch overflow/underflow
- Constants - Constants
- Jumps should be relative - 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 - Pointers/Literals
- A Three-Way Decision Routine(http://www.6502.org/tutorials/compare_instructions.html) - A Three-Way Decision Routine(http://www.6502.org/tutorials/compare_instructions.html)
- Carry flag?
- Print word to stdout - Print word to stdout
- Draw pixel to screen - Draw pixel to screen
- Detect mouse click - Detect mouse click
- SDL Layer Emulator - SDL Layer Emulator
- Build PPU - Build PPU
- Interrupts, vectors - Add flags..
### 16 Bit Missions
- 16 bits addressing
- jumping to subroutine should be relative
- Implement addressing
- Implement 16 bits operations
## Refs ## Refs

10
uxn.c
View File

@ -165,7 +165,7 @@ error(char *name)
} }
int int
eval() eval(void)
{ {
Uint8 instr = cpu.rom.dat[cpu.rom.ptr++]; Uint8 instr = cpu.rom.dat[cpu.rom.ptr++];
if(cpu.literal > 0) { if(cpu.literal > 0) {
@ -197,7 +197,13 @@ start(FILE *f)
cpu.vreset = mempoke16(0xfffa); cpu.vreset = mempoke16(0xfffa);
cpu.vframe = mempoke16(0xfffc); cpu.vframe = mempoke16(0xfffc);
cpu.verror = mempoke16(0xfffe); 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 */ /* debug */
printf("ended @ %d steps | ", cpu.counter); printf("ended @ %d steps | ", cpu.counter);