Uxn - Virtual Computer

Sorry, we’re all pretty new working with Windows, lots of strange particularities. We’ll try to fix the windows build asap.

Nothing to be sorry about, I can help to debug and test, since I am the one using Win. :slight_smile:

Are you getting error messages in the terminal when you assemble piano.tal, into piano.rom yourself?

You figured it out before I could answer, but do you mean when running with uxncli am I right?

In left, press ctrl+r to write a filepath, and ctrl+o to open the file. See the Left Manual.

Got it, I like how it works.

Edit

Yup, the Windows build of piano has an issue due to Win’s line-endings. Will fix

Woa that was quick, thank you!

yo también! actualmente en la cdmx, ¿y tú?
uxn meetup when? haha

También por la CDMX, en el Estado de México, yo me apunto para un Meetup! :open_mouth:

EDIT:

I have just noticed on itch.io that uxn roms run on Android, but I haven’t found how to run it on such a device.

image

Is there any documentation someone could share with me about this?

Regards!

1 Like

Hi, I’m getting started on Uxn and uxntal (following this wonderful tutorial: compudanzas — uxn tutorial: day 1, the basics). It was a bit of a struggle to get through I install but it seems i’ve managed it. However, I can’t get the functions keys (F1, F2, F3) to work … I am using a laptop so the function keys are tied to multimedia functions (sound, brightness …), but I disabled this mode in the BIOS, yet no result.
When I launch a program if I type a function key I get a code in the terminal (^[OP, ^[OQ or ^[OR) but I get no screenshot, no zoom and no debug mode.

If somebody know a solution and could help me, or has a clue as to were to look for a fix, it would help me a lot.
Thanks in advance !

Which operating system are you using?

SDL runs on Android, but it’s a bit tricky. The people I’ve seen using Uxn on Android tablets were using the browser client.

1 Like

I’ve installed Termux, which is basically a standard command line interface for Android. Compiling Uxn there works super fine, after installing build tools, git and SDL. And learning about life in the command line (which i had from before).

Termux can run the standard Unix graphics environment X11 and it’s network transport VNC. I then use a VNC viewer. This is a medium-advanced setup, but works.

3 Likes

If you have some time, and have to go jump through these hoops again, do you think you could put together a sort of guide?

Sure thing. Is here on llllllllines good? It’ll get a bit buried. I don’t have a blog or something like that at the moment (boo I’m an impoverished netizen!). Well I could do a GitHub thing.

Here’s a loose sketch, I’ll update as necessary.

First get the command line environment in place and a graphical UI with two Android apps

  1. Install command line environment Termux. It’s powerful and loads of fun, but for now we focus on just getting Uxn going. Old versions are available via Google Play, the newer versions moved to alternative app store F-Droid.
  2. Install X11 graphical user interface. Follow the steps in that doc but basically apt install x11-repo and apt install tigervnc fluxbox.
  3. On Android side install a VNC client e.g. VNC viewer.

Then get the build environment in place.

  1. Install compiler and build tools with apt install clang git.
  2. Install SDL with apt install sdl2.

Ok onetime setup is complete. Run the steps below to update and run Uxn

  1. Acquire Uxn source code with git clone https://git.sr.ht/~rabbits/uxn the first time, or git pull to retrieve updates.
  2. Build Uxn with ./build.sh

Run the whole stack

  1. In Termux, run vncserver -localhost. You might want to tweak the -geometry argument later on to minimize scrolling
  2. Tell X11 where the screen is with export DISPLAY=:1 or whatever display number vncserver reported.
  3. Run your VNC client and connect to localhost on start.
  4. Run Uxn with bin/uxnemu bin/piano.rom or another rom, e.g. Orca

To bring down the environment, disconnect your VNC client, press Ctrl-C in the terminal you ran uxnemu, and run vncserver -kill.

(from the top of my head, I’ll update as I recall. I also made this comment a wiki which I believe means anyone can edit it)

6 Likes

I started porting uxn to libretro:

6 Likes

I’m using Fedora 34 right now, on what used to be a windows Laptop. It seems that I have other troubles with displaying things in general. I’ve moved to the day2 part of the tutorial made by @sejo and cannot display the sprites. I was thinking about reinstalling the assembler + emulator to see if it makes any changes

That’s strange, I’m not sure why you can’t see anything and use any keys, I’d need to know more details. I’m also using Linux, maybe your two issues are related :slight_smile: Try setting up the environment again, maybe that’ll fix things! Have you been able to run any of the roms? Could you show me what the file attempting to draw sprites looks like?

Oh! that’s terrific, I know that’ll make a lot of people very happy. Keep us posted with the updates on here, lemme know when it’s ready to test and I’ll take it for a spin and link it in the docs.

That’s PERFECT, I will add it to awesome-uxn, many people have asked me for this.

2 Likes

Piano launched fine the first time I installed everything, but i haven’t managed to run other roms (i’ve tried left and noodle). The compilation fails … :confused:
I will do a fresh install, and also maybe check on another computer. Thanks for your help
And also thanks for buidling and realising all of this, I’ve just spend the weekend playing arsound with unx/unxtal and had tons of fun ! :grinning:

2 Likes

is there any kind of guide/resource for porting uxn to new platforms? I’m working on an OS right now, and I’d like to port uxn to it. I’m trying to make it a sort of “uxn machine” similar to java machines or lisp machines

2 Likes

There isn’t, people making ports usually follow this sequence:

  • Porting uxn.c
  • Porting the Console device.
  • Porting the Screen device.
  • Keyboard/Mouse events
  • File, Date, Audio devices

If you need a hand, hop on IRC.

2 Likes

alright, thanks, I’ll try those

Wrote a little Uxntal cheatsheet for anyone interested :slight_smile:

Cheatsheet

Uxntal is a stack-machine assembly language targeting the Uxn virtual machine.

Stack machine programming might look at bit odd, as it uses a postfix notation,
which means that operators are always found at the end of an operation. For
instance, one would write 3 4 + instead of 3 + 4.

The expression written (5 + 10) * 3 in conventional notation would be
written 10 5 + 3 * in reverse Polish notation.

( This is a comment )

( All programming in Unxtal is done by manipulating the stack )

#12 ( push a byte )
#3456 ( push a short )

( Uxn has 32 opcodes, each opcode has 3 possible modes )

POP ( pop a byte )
POP2 ( pop a short )

( The modes are:
	2 The short mode consumes two bytes from the stack.
	k The keep mode does not consume items from the stack.
	r The return mode makes the operator operate on the return-stack. )

#12 #34 ADD ( 46 )
#12 #34 ADDk ( 12  34  46 )

( The modes can be combined )

#1234 #5678 ADD2k ( 12  34  56  78  68  ac )

( The arithmetic/bitewise opcodes are:
	ADD SUB MUL DIV
	AND ORA EOR SFT )

( New opcodes can be created using macros )

%MOD2 { DIV2k MUL2 SUB2 }

#1234 #0421 MOD2 ( 01  b0 )

( ---------------------------------------------------------------------------- )

( A short is simply two bytes, each byte can be manipulated )

#1234 SWP ( 34  12 )
#1234 #5678 SWP2 ( 56  78  12  34 )
#1234 #5678 SWP ( 12  34  78  56 )

( Individual bytes of of a short can be removed from the stack )

#1234 POP ( 12 )
#1234 NIP ( 34 )

( The stack opcodes are:
	POP DUP NIP SWP OVR ROT )

( ---------------------------------------------------------------------------- )

( To compare values on the stack with each other )

#12 #34 EQU ( 00 )
#12 #12 EQU ( 01 )

( Logic opcodes will put a flag with a value of either 00 or 01 )

#12 #34 LTH 
#78 #56 GTH 
	#0101 EQU2 ( 01 )

( The logic opcodes are:
	EQU NEQ GTH LTH )

( ---------------------------------------------------------------------------- )

( Uxn's accessible memory is as follow: 
	256 bytes of working stack 
	256 bytes of return stack
	65536 bytes of memory
	256 bytes of IO memory )

( The addressable memory is between 0000-ffff )

#12 #0200 STA ( stored 12 at 0200 in memory )
#3456 #0201 STA2 ( stored 3456 at 0201 in memory )
#0200 LDA2 ( 12  34 )

( The zero-page can be addressed with a single byte )

#1234 #80 STZ2 ( stored 12 at 0080 in memory )
#80 LDZ2 ( 12  34 )

( Devices are ways for Uxn to communicate with the outside world
	There is a maximum of 16 devices connected to Uxn at once
	Device bytes are called ports, the Console device uses the 10-1f ports
	The console's port 18 is called /write )

%EMIT { #18 DEO }

#31 EMIT ( print "1" to console )

( A label is equal to a position in the program )
@parent ( defines a label "parent" )
	&child ( defines a sublabel "parent/child" )

( Label positions can be pushed on stack )
;parent ( push the absolute position, 2 bytes )
,parent ( push the relative position, 1 byte )
.parent ( push the zero-page position, 1 byte )

( The memory opcodes are:
	LDZ STZ LDR STR
	LDA STA DEI DEO )

( ---------------------------------------------------------------------------- )

( Logic allows to create conditionals )

#12 #34 NEQ ,skip JCN
	#31 EMIT
	@skip

( Logic also allows to create for-loops )

#3a #30
@loop
	DUP EMIT ( print "123456789" to console )
	INC GTHk ,loop JCN
POP2

( Logic also allows to create while-loops )

;word
@while
	LDAk EMIT
	INC2 LDAk ,while JCN
POP2
BRK

@word "vermillion $1

( Subroutines can be jumped to and returned from with the JSR opcode )

;word ,print-word JSR
BRK

@print-word ( word* -- )
	@while
		LDAk EMIT
		INC2 LDAk ,while JCN
	POP2
JMP2r

@word "cerulean

( The jump opcodes are: 
	JMP JCN JSR )
7 Likes

There is also Termux Desktop

It uses Openbox, helps setup a nice desktop automatically.

1 Like

I added basic mouse support to the libretro port of uxn:

Next step will be audio, I suppose it will be a bit more difficult.

4 Likes

Watching your progress. Excited to try it. Let me know if you need any testing done.

I just tried to clone the repository to my netbook and got a certificate error. Had anyone else problems with git clone? Thank you for your help.

git clone https://git.sr.ht/~rabbits/uxn

It’s read only, there shouldn’t be any certificates involved.

It was a problem with an expired certficate. Thanks to stackoverflow I could fix the configuration. Next problem to tackle is to find out why no sound is produced.

1 Like