uxn

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

commit 86a52e10913f7198e115f4384015de249a82d7db
parent ad19620b823ae74ae841cebbdf25d986a415c45a
Author: neauoire <aliceffekt@gmail.com>
Date:   Sat, 10 Apr 2021 20:55:31 -0700

Fixed issue with controller.key

Diffstat:
Mbuild.sh | 2+-
Mprojects/software/left.usm | 67++++++++++++++++++++++++++++++-------------------------------------
Mprojects/software/noodle.usm | 1-
Mprojects/software/orca.usm | 4+---
Msrc/emulator.c | 5+++--
5 files changed, 35 insertions(+), 44 deletions(-)

diff --git a/build.sh b/build.sh @@ -32,7 +32,7 @@ else fi echo "Assembling.." -./bin/assembler projects/examples/dev.controller.buttons.usm bin/boot.rom +./bin/assembler projects/software/noodle.usm bin/boot.rom echo "Running.." if [ "${2}" = '--cli' ]; diff --git a/projects/software/left.usm b/projects/software/left.usm @@ -45,8 +45,7 @@ |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } |0110 ;Console { pad 8 char 1 byte 1 short 2 } |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 } -|0140 ;Controller { vector 2 button 1 } -|0150 ;Keys { vector 2 key 1 } +|0140 ;Controller { vector 2 button 1 key 1 } |0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 } |0170 ;File { pad 8 name 2 length 2 load 2 save 2 } @@ -56,7 +55,6 @@ ( theme ) #e0fa =System.r #30fa =System.g #30fa =System.b ( vectors ) ,on-mouse =Mouse.vector - ( vectors ) ,on-key =Keys.vector ( vectors ) ,on-button =Controller.vector ( load file ) @@ -70,38 +68,11 @@ BRK -@on-key - - ~Keys #08 NEQ ^$no-backspace JNZ - ( erase ) - ~selection.to ~selection.from SUB2 #0001 NEQ2 ^$erase-multiple JNZ - ~selection.to ~selection.from SUB2 ,shift-left JSR2 - ,$erase-end JMP2 - $erase-multiple - ~selection.from ++ =selection.from - ~selection.to ~selection.from SUB2 ++ ,shift-left JSR2 - $erase-end - ~selection.from -- =selection.from - ^$keys-end JMP - $no-backspace - - ( insert ) - ~selection.to ~selection.from SUB2 ,shift-right JSR2 - ~Keys ~selection.from POK2 - ~selection.from ++ =selection.from - - $keys-end - ~selection.from ++ =selection.to - ( release ) #00 =Keys - ,redraw JSR2 - -BRK - @on-button ( -> ) ( alt + arrow ) - ~Controller #0f AND #02 NEQ ^$no-alt JNZ - ~Controller #04 SFT + ~Controller.button #0f AND #02 NEQ ^$no-alt JNZ + ~Controller.button #04 SFT DUP #01 NEQ ^$no-aup JNZ ( sel word ) ,find-wordstart JSR2 =selection.to $no-aup DUP #02 NEQ ^$no-adown JNZ @@ -117,8 +88,8 @@ BRK $no-alt ( ctrl + arrow ) - ~Controller #0f AND #01 NEQ ^$no-ctrl JNZ - ~Controller #04 SFT + ~Controller.button #0f AND #01 NEQ ^$no-ctrl JNZ + ~Controller.button #04 SFT DUP #01 NEQ ^$no-cup JNZ ( jump scroll ) #0004 ,scroll-up JSR2 $no-cup DUP #02 NEQ ^$no-cdown JNZ @@ -133,8 +104,8 @@ BRK $no-ctrl ( arrow ) - ~Controller #f0 AND #00 EQU ,$no-arrow JNZ2 - ~Controller #f0 AND + ~Controller.button #f0 AND #00 EQU ,$no-arrow JNZ2 + ~Controller.button #f0 AND DUP #10 NEQ ^$no-arrowup JNZ ( clamp ) ~position.y #0000 EQU2 ^$no-arrowup JNZ ,find-lineoffset JSR2 =position.x ~position.y -- =position.y @@ -156,6 +127,28 @@ BRK ,redraw JSR2 $no-arrow + ~Controller.key #08 NEQ ^$no-backspace JNZ + ( erase ) + ~selection.to ~selection.from SUB2 #0001 NEQ2 ^$erase-multiple JNZ + ~selection.to ~selection.from SUB2 ,shift-left JSR2 + ,$erase-end JMP2 + $erase-multiple + ~selection.from ++ =selection.from + ~selection.to ~selection.from SUB2 ++ ,shift-left JSR2 + $erase-end + ~selection.from -- =selection.from + ~selection.from ++ =selection.to + ,redraw JSR2 + BRK + $no-backspace + + ( insert ) + ~selection.to ~selection.from SUB2 ,shift-right JSR2 + ~Controller.key ~selection.from POK2 + ~selection.from ++ =selection.from + ~selection.from ++ =selection.to + ,redraw JSR2 + BRK @on-mouse ( -> ) @@ -199,7 +192,7 @@ BRK BRK $no-chords ( drag ) - ~Mouse.state ~touch.state NEQ ~Controller #0f AND #02 NEQ #0101 EQU2 ^$no-drag JNZ + ~Mouse.state ~touch.state NEQ ~Controller.button #0f AND #02 NEQ #0101 EQU2 ^$no-drag JNZ ( on drag ) ,find-selection JSR2 ++ =selection.to ,clamp-selection JSR2 diff --git a/projects/software/noodle.usm b/projects/software/noodle.usm @@ -303,7 +303,6 @@ BRK ~path.length #1f EQU ^$edit-end JNZ ~Controller.key ,path.name #00 ~path.length ADD2 POK2 ~path.length #01 ADD =path.length - ~Controller.key =Console.byte $edit-end #00 ,path.name #00 ~path.length ADD2 POK2 BRK diff --git a/projects/software/orca.usm b/projects/software/orca.usm @@ -84,7 +84,6 @@ BRK ~Controller.key #00 EQU ^$no-key JNZ ~selection.x1 ~selection.y1 ~Controller.key SET-CELL - ~Controller.key =Console.byte ,redraw JSR2 $no-key @@ -108,8 +107,7 @@ BRK ~selection.x2 #01 ADD =selection.x2 $no-right POP - ~Controller.button #04 NEQ ^$no-backspace JNZ - ~Controller.button =Console.byte + ~Controller.key #08 NEQ ^$no-backspace JNZ ~selection.x1 ~selection.y1 #2e SET-CELL ( put . char ) $no-backspace diff --git a/src/emulator.c b/src/emulator.c @@ -164,8 +164,8 @@ doctrl(Uxn *u, SDL_Event *event, int z) switch(event->key.keysym.sym) { case SDLK_LCTRL: flag = 0x01; break; case SDLK_LALT: flag = 0x02; break; - case SDLK_ESCAPE: flag = 0x04; break; - case SDLK_LSHIFT: flag = 0x08; break; + case SDLK_LSHIFT: flag = 0x04; break; + case SDLK_ESCAPE: flag = 0x08; break; case SDLK_UP: flag = 0x10; break; case SDLK_DOWN: flag = 0x20; break; case SDLK_LEFT: flag = 0x40; break; @@ -332,6 +332,7 @@ start(Uxn *u) doctrl(u, &event, event.type == SDL_KEYDOWN); evaluxn(u, devctrl->vector); u->ram.dat[devctrl->addr + 3] = 0; + break; case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEMOTION: