Log In  

15

Cart [#47025#] | Copy | Code | 2017-12-04 | Link
15

Intro

What if there was a fantasy console in a fantasy console? That's a question that I never got. Instead, I was curious to see if I could come up with a way to get some form of programming on Pico-8.

Well, here you go. The language resembles CPU instructions. The fantasy console allows up to 256 instructions in ROM and has 256 byte RAM which can be viewed at runtime.

The console itself comes with a 16x16 1-bit display and 6 buttons. All IO can be directly accessed and manipulated through RAM. For convenience, it's marked with green (display) and yellow (input) in the editor.

Also, I came up with this idea due to the Ludum Dare theme "The more you have, the worse it is". I actually did it during Ludum Dare and finished it in time. I guess it's an unofficial Ludum Dare entry :-)

Usage

Navigating the editor can be done using the D-pad (arrow keys). Most interactions are done using X.
The available interactions can be seen at the bottom of the editor.

For the sake of space I decided to use binary to display numbers. This might require a bit of getting used to but most values can be found in decimal at the bottom of the screen when interacting with a number.

Writing Code

Pressing X on an empty line will display all the available instructions.
After choosing one the editor might prompt for additional parameters.
Parameters always come with a value represented as an 8-bit number.
A prompt will appear to set the value of the parameter.

To remove a line of code hold the O button and press X.

To move a line of code hold the O button and move it up or down using the D-pad.

Once you're ready to try out your program navigate to the console in the bottom right using the D-pad.
The play button will start to blink. Pressing X will now start the program.
The play button will start blinking again once the program reaches the end.
To terminate the program (for example to get out of an infinite loop) press X and O at the same time.

Saving the program can be done by pressing left twice when in the rom section.
Please note that there's a limit to the size of the program which is smaller then 256 instructions. each instructions takes between 3 and 5 byte to save and a maximum of 256 bytes are saved.

Instructions

Set (address value)
Sets value at address to value.

Add (address, value)
Adds value to the value at address.

Subtract
Subtracts value to the value at address.

Jump (rom address)
Jumps the program count to rom address.

Jump if zero (rom address, value)
Jumps the program count to rom address if value equals zero.

Jump if not zero (rom address, value)
Jumps the program count to rom address if value equals zero (higher than zero).

Or (ram address, value)
Bitwise or value to the value at address.

And (ram address, value)
Bitwise and value to the value at address.

Not (ram address, value)
Bitwise not for value and stores value at address.

Bit shift left (ram address, value)
Shift bits to left at address value times.

Bit shift right (ram address, value)
Shift bits to right at address value times.

Call (rom address)
Jumps the program count to rom address and adds the current rom address to the program stack.

Return
Jumps the program count the the last rom address that was added to the program stack.

End

Well, I hope that you folks can have a bit of fun with it. Let me know if you were patient enough to make anything!
Also, feel free to make suggestions. There's plenty of space left for more instructions if needed.


Version 0.11a
Cart [#47024#] | Copy | Code | 2017-12-04 | Link
15

Version 0.10

Cart [#47015#] | Copy | Code | 2017-12-04 | Link
15

Version 0.9:

Cart [#46974#] | Copy | Code | 2017-12-03 | Link
15

fantasy-console computer programming 8-bit 1-bit interface switch
P#46975 2017-12-03 20:31 ( Edited 2017-12-04 10:05)

::

That's a slick interface and a great idea. It seems like fun to mess around with.

P#47001 2017-12-04 01:29

::

Now to create a fantasy console within your fantasy console within a fantasy console.

It will have one instruction, MADD, and the output will be a single 7-segment LED digit.

The, uh, games won't be much fun. Snake will end quite quickly.

Or, I could play Opus Magnum for eight hours straight.

Decisions, decisions...

P#47008 2017-12-04 05:52

::

Thanks a lot!

Yeah I'm not sure if that would be feasible :-P Would be cool though!

P#47010 2017-12-04 06:12

::

Any info about the memory mapping?

P#47017 2017-12-04 08:22

::

@moechofe The screen is mapped from 0 to 31 (bx00011111) and each bit represents a pixel on the screen. Starting at the top left going from left to right all the way to the bottom.

The input is located at 32 (bx00100000). The first bit (right most) is d-pad left, the second bit is d-pad right and so on (The order is the same as Pico-8). The last two bits are not used.

The rest of the memory is all yours. The call stack is stored in a separate "memory bank" and not accessible.

I've just added some bitwise operations which are pretty much a necessity to be able to do anything. In a bit, I'll add bit shifting as well.

Currently in the process of trying to create a set pixel function and seeing what I need on the way. I would like to have a pixel walking around on the screen as the default program.

P#47022 2017-12-04 08:57 ( Edited 2017-12-04 09:00)

::

Micro-8 now comes with a default program.

The default program allows you to plot a line using the d-pad.

Line 2 to 13 can be used as a function to draw a pixel on the screen. The function takes a single parameter by setting the value at ram address 240. This value is the position the pixel will be drawn at.

E.g.

[=][240][8]
[call][2]

I've also fixed several errors and added bit shifting. There was also a bug in the display which has now been resolved.

P#47026 2017-12-04 10:04

Log in to post a comment

user:
password:

New User | Account Help
:: New User
X
About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2017-12-16 03:23 | 0.238s | 1835k | Q:47