uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 9dda5bdf1bf55088b5e2bb4d3e1fb58fc33bfc19
parent 169e659ab880b4b1515d46f4f317bcedae06d694
Author: neauoire <aliceffekt@gmail.com>
Date:   Thu,  8 Apr 2021 16:47:38 -0700

Removed unused function call in emu

Diffstat:
Mbuild.sh | 2+-
Mprojects/software/orca.usm | 52+++++++++++++++++++++++++++++++++++++++++++---------
Msrc/emulator.c | 20+++++++++-----------
3 files changed, 53 insertions(+), 21 deletions(-)

diff --git a/build.sh b/build.sh @@ -32,7 +32,7 @@ else fi echo "Assembling.." -./bin/assembler projects/software/nasu.usm bin/boot.rom +./bin/assembler projects/software/noodle.usm bin/boot.rom echo "Running.." if [ "${2}" = '--cli' ]; diff --git a/projects/software/orca.usm b/projects/software/orca.usm @@ -7,13 +7,6 @@ - Locking ports - Detect capitalization - Draw Interface - - Position - - Frame - - BPM - - Toggle Guides - - New - - Save - - Load - Comments - Load/Save - Copy/Paste @@ -21,6 +14,7 @@ ) %RTN { JMP2r } +%8+ { #0008 ADD2 } %8* { #0008 MUL2 } %8/ { #0008 DIV2 } %MOD { DUP2 DIV MUL SUB } @@ -281,6 +275,38 @@ RTN RTN +@draw-interface ( -- ) + + ~Screen.height #0008 SUB2 =Sprite.y + + ( TODO: Position ) + ( TODO: Frame ) + ( TODO: BPM ) + + ~Screen.width #0028 SUB2 =Sprite.x + + ( TODO: Toggle Guides ) + ~Sprite.x 8+ =Sprite.x + ,eye_icns =Sprite.addr + #01 =Sprite.color + + ( TODO: New ) + ~Sprite.x 8+ =Sprite.x + ,filestate_icn =Sprite.addr + #01 =Sprite.color + + ( TODO: Load ) + ~Sprite.x 8+ =Sprite.x + ,load_icn =Sprite.addr + #01 =Sprite.color + + ( TODO: Save ) + ~Sprite.x 8+ =Sprite.x + ,save_icn =Sprite.addr + #01 =Sprite.color + +RTN + @redraw ( -- ) #00 ~grid.height @@ -299,6 +325,8 @@ RTN DUP2 LTH ^$ver JNZ POP2 + ,draw-interface JSR2 + RTN ( char to b36 ) @@ -326,18 +354,24 @@ RTN ( b36 to char-lc ) @b36clc [ - 30 31 32 33 34 35 36 37 38 39 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a - ] @cursor_icn [ 80c0 e0f0 f8e0 1000 ] @blank_icn [ 0000 0000 0000 0000 ] +@eye_icns + [ 0038 4492 2810 0000 ] ( open ) + [ 0000 0082 4438 0000 ] ( closed ) + +@filestate_icn [ 1054 28c6 2854 1000 ] +@load_icn [ feaa d6aa d4aa f400 ] +@save_icn [ fe82 8282 848a f400 ] + @font ( specter8-frag font ) [ 0000 0000 0000 0000 0008 0808 0800 0800 diff --git a/src/emulator.c b/src/emulator.c @@ -17,8 +17,6 @@ WITH REGARD TO THIS SOFTWARE. #include "ppu.h" #include "apu.h" -int initapu(Uxn *u, Uint8 id); - static SDL_AudioDeviceID audio_id; static SDL_Window *gWindow; static SDL_Renderer *gRenderer; @@ -27,14 +25,11 @@ static Ppu ppu; static Apu apu; static Device *devsystem, *devscreen, *devmouse, *devkey, *devctrl, *devapu; -#pragma mark - Helpers - -/* clang-format off */ -int clamp(int val, int min, int max) { return (val >= min) ? (val <= max) ? val : max : min; } -void setflag(Uint8 *a, char flag, int b) { if(b) *a |= flag; else *a &= (~flag); } -/* clang-format on */ - -#pragma mark - Core +int +clamp(int val, int min, int max) +{ + return (val >= min) ? (val <= max) ? val : max : min; +} int error(char *msg, const char *err) @@ -188,7 +183,10 @@ doctrl(Uxn *u, SDL_Event *event, int z) case SDLK_LEFT: flag = 0x40; break; case SDLK_RIGHT: flag = 0x80; break; } - setflag(&u->ram.dat[addr], flag, z); + if(z) + u->ram.dat[addr] |= flag; + else + u->ram.dat[addr] &= (~flag); } #pragma mark - Devices