Uxn - Virtual Computer

Aha, this perhaps could map onto the gate I/O, depending on how roms are expecting to use it. Teletype has eight gate inputs, when any of these receives an edge, we want to set the appropriate bits of the “gate input” register and call a vector. There are four gate outputs, I currently have these mapped to 4 bits of a register and update the I/O when that register is written to. I think this would all fit into the console address space, but this data is not text in general, so it might not be compatible with how a given rom wants to use the console.

There are also four analog outputs, and two analog inputs. On Teletype each of these has a 14 bit resolution, where 0 is 0V and 16383 is 10V. I was thinking these would be four 16-bit registers to give the rom full control over output voltages. When you want to use Teletype as a sequencer, however, you generally want to output the specific DAC values that correspond to note numbers – for Orca specifically I would guess this is the main use case?

I confess I am a very inexperienced Orca user, I would love to hear if some folks using both Orca and a modular system have given some thought to what their ideal ops would be.

2 Likes

I don’t think there’s enough space on that little screen to juggle 4 shorts at once. We’d need a way to differentiate which port we’re using, and which note value we want to send to which jack. In orca, normally, note values are octave note, that forms a byte midi pitch value. We could add an extra port to target a specific device?

device octave value there would be a max of 36 “devices” that we can send to, we’d have to devise a mapping that makes sense, like 0-4 gate out, 5-8 note out, etc… Would that work for you? I could modify the midi operator to stop sending the 6 bytes and convert it to that scheme.

1 Like

nice !! i was just wondering about file system access for the emulator but this is even better

1 Like

The emulator has a tiny File device that can read and write, I’ve implemented it in a few projects, including orca(here). It just save/load a length of bytes in and out of memory. :slight_smile: You can find tutorial examples here.

To Load

#1000 .File/length DEO2 ( how many bytes )
;filename .File/name DEO2 ( address of the path to the file )
#1234 .File/load DEO2 ( where should it be written in memory )

To Save

#1000 .File/length DEO2 ( how many bytes )
;filename .File/name DEO2 ( address of the path to for file )
#5678 .File/save DEO2 ( where should it be written in memory )
2 Likes

I think this makes a lot of sense and would leave room to grow – the host could map different “devices” to panel outputs, or i2c note messages, or a parallel port, or websocket, or Gameboy link cable… At the memory map level I am tempted to maybe think of this as an expanded notion of the “console” device to a “bus” device, which adds an additional device identifier register (either 1 or 2 bytes) that allows the emulator to interpret “writing to the console” in one or more ways depending on the device.

In keeping with Unix reserved file descriptors, device 1 could mean “stdout” and 2 could mean “stderr”. The host could set this device ID register before calling the .Console/vector and restore it afterwards, and the program could write it to select different buses to write to. Each device implemented by the host could then have some freedom to select what it means to write a byte / short / buffer. To use binary data this way you would need to know a length when working with buffers, this could be done with an additional length register or by using length-prefixed strings.

2 Likes

Incidentally, the GBA can potentially accept keyboard input through the linkport:

https://www.brolinembedded.se/projects/keyboard/

I also believe this can be a much more straightforward process given that with a PS/2 adapter, LSDJ accepts keyboard input, albeit less conventionally:

Though I doubt this unconventional usage reflects any specific constraint of the system or port. (certainly utilizes a hell of a lot of keys)

4 Likes

More smol victories…
I finally stepped outside of my Python comfort zone and jumped into the world of C…. it took a few days (and tutorials, and a ton of errors) but I’m pretty proud of where it has brought me.
New doors are opening.
Infinite thanks to @neauoire for all the help along the way.
If anyone out there needs some assistance in getting things up and running, I’m slightly less under-qualified in this realm than I was a few days ago, and always happy to help… just holler.

13 Likes

(Just three days? Yo, pass a brother those tutorials)

(Unless I should just go right to assembly in the opinions of the… assembled)

(Biased tho it may be)

1 Like

@Ghost_Cat That’s awesome! I’m glad you’ve got it all figured out. You’re ready to make your first little assembly program in uxn now. :fist:

image

8 Likes

Got orca running on the DS version but I still have absolutely no idea how to even begin using that so I will have to try and compile some of the other roms and try those :slight_smile:

With the DS version, is there any way to load different roms? I tryed all imaginable buttons/combos but couldn’t find any menu or anything. Does it only load the one titled ‘boot.rom’ or am I missing something?

Got orca running on the DS version but I still have absolutely no idea how to even begin using that so I will have to try and compile some of the other roms and try those

The difference here is that the operator you’ll want to use to make notes is the = character instead of :.

Playing a note on the DS with Orca

With the DS version, is there any way to load different roms?

Not that I know of, it would be nice to be able to browse the various roms, I agree.

5 Likes

thanks!! Will give that a go and finally start learning Orca :slight_smile:

2 Likes

the way i got around that is creating a folder for each different application and putting in each one a copy of uxnds and a boot.rom (which is that particular application renamed). not ideal but it works! some roms work better than others on NDS though

3 Likes

So I managed to compile UXN and then Orca.tal on my Raspberry Pi Zero W and audio worked great through my cheap DAC hat (respeaker 2.0) For reference I’m using an old apple emac usb keyboard and I’m running raspbian lite without a window manager.

There seems to be no way to exit uxnemu / orca ? This might be intentional?
The delete key also does not work, backspace does though, I should be able to fix this myself though…
For anyone else out there in “keyboard only mode” I just found there are some useful shortcuts in orca.tal for saving and loading.

There seems to be no way to exit uxnemu / orca ?

Depends how you open Uxn, if you don’t have a window manager… I haven’t really considered that situation. Right now it expects the window to be closed, I don’t have any decoration so I do cmd+shift+q on i3.

The delete key also does not work, backspace does though, I should be able to fix this myself though

Let’s write some assembly!

The delete key was not mapped in Orca, I added just now. If you’re interested to know how to add it yourself, it would mean replacing:

DUP #08 ! ,&no-backspace JCN
	CHAR-DOT ;fill-block JSR2 
	;redraw JSR2 POP BRK &no-backspace

With

DUP #08 ! OVR #7f ! #0101 == ,&no-backspace JCN
	CHAR-DOT ;fill-block JSR2 
	;redraw JSR2 POP BRK &no-backspace

It now jumps only if the keycode is both NOT #08 and NOT #7f, with DUP #08 ! OVR #7f ! #0101 ==

5 Likes

@neauoire are you aware of Freeputer? Seems like a less art-focused kindred spirit given the goals and Forth inspiration.

1 Like

It’s the first time I heard of it, it’s kindda neat. Unfortunately, it was left off in a very incomplete state. I can’t seem to find any real usable applications for it. It’s pretty common for these experimental virtual machines to be just abandoned after they are able to spit out hello world and the fibonacci sequence.

Uxn is a sort of cross between CollpaseOS(with graphics and sound), a Famicom(with general computing devices) and Pico-8(with available sources).

3 Likes

You all may find this game that was recently released interesting. It’s an old school RPG that was coded for the Apple II in assembly. You can play it on modern computers through an emulator.

~/uxn

bin/uxnemu bin/orca.rom | bin/uxnemu bin/drum-rack.rom 
9 Likes

@abalone I love it :smiley: It’s nice to hear something pleasant come out of the simple audio chip.

I’ve been super busy these past couple of days figuring out how to implement readable text in Uxn. Here’s a Uxn window loading 3 fonts and displaying some text on the screen!

17 Likes