Proof of concept: Programming the NES with blocks
Moderator: Moderators
- orlaisadog
- Posts: 166
- Joined: Thu May 31, 2018 11:12 am
- Location: Bristol, England
Proof of concept: Programming the NES with blocks
I haven't posted on here in ages, but I made a proof of concept for programming the NES in a Scratch-like language. I ported the "hello world" project from this tutorial to it. I noticed that this Scratch clone has something called "Codification" so it can compile the script into any language, including C, so I made it compile to cc65-compatible code. It really is any language because it's completely customisable, and it could be tweaked to compile into assembly language, but for now, I made it use C.
To try it you need to download this file, then go to this link and press the button that looks like a piece of paper, then "Import" and then import the .xml file. You can change the script if you want then click the script to compile it to C, which is shown in the variable on the right. You can right click it and press "export" to save it. Download this template and replace the contents of "hello.c" with the generated program, and compile it.
This might be a good way to introduce people to NES programming or even quickly test out concepts if you're used to languages like Scratch.
To try it you need to download this file, then go to this link and press the button that looks like a piece of paper, then "Import" and then import the .xml file. You can change the script if you want then click the script to compile it to C, which is shown in the variable on the right. You can right click it and press "export" to save it. Download this template and replace the contents of "hello.c" with the generated program, and compile it.
This might be a good way to introduce people to NES programming or even quickly test out concepts if you're used to languages like Scratch.
- Attachments
-
- Hello World script
- nes.png (44.12 KiB) Viewed 8911 times
-
- NES.xml
- Just in case the Dropbox link stops working
- (38.39 KiB) Downloaded 181 times
Re: Proof of concept: Programming the NES with blocks
This is pretty cool. I recently started using Scratch for coding games with the kids I teach and was very impressed at how quickly it's possible to put a game together. I immediately wondered if something like that would work on the NES.
I feel like what makes Scratch good for games is the way it's able to move objects around. Programming movement is incredibly simple, and I think that's an important aspect to carry over to the NES for this to work well. The event system is pretty handy too.
I feel like what makes Scratch good for games is the way it's able to move objects around. Programming movement is incredibly simple, and I think that's an important aspect to carry over to the NES for this to work well. The event system is pretty handy too.
- orlaisadog
- Posts: 166
- Joined: Thu May 31, 2018 11:12 am
- Location: Bristol, England
Re: Proof of concept: Programming the NES with blocks
I use Scratch, and I really need to move on, but I'm really good at it now. I can do basic 3D.
Also, I'm working on an assembly language version of this now.
Edit: Wait, are you a teacher?
Also, I'm working on an assembly language version of this now.
Edit: Wait, are you a teacher?
- Attachments
-
- snip3.PNG (11.63 KiB) Viewed 8892 times
- orlaisadog
- Posts: 166
- Joined: Thu May 31, 2018 11:12 am
- Location: Bristol, England
Re: Proof of concept: Programming the NES with blocks
I'm making progress with the assembly version
Re: Proof of concept: Programming the NES with blocks
This seems like a great way to make sure your program is structurally sound. Very interesting.
https://twitter.com/bitinkstudios <- Follow me on twitter! Thanks!
https://www.patreon.com/bitinkstudios <- Support me on Patreon!
https://www.patreon.com/bitinkstudios <- Support me on Patreon!
- orlaisadog
- Posts: 166
- Joined: Thu May 31, 2018 11:12 am
- Location: Bristol, England
Re: Proof of concept: Programming the NES with blocks
Is ASM6 a good choice for the assembler?
- orlaisadog
- Posts: 166
- Joined: Thu May 31, 2018 11:12 am
- Location: Bristol, England
Re: Proof of concept: Programming the NES with blocks
By the way, the labels don't need to wrap around the script but it's easier to organise things that way.
- orlaisadog
- Posts: 166
- Joined: Thu May 31, 2018 11:12 am
- Location: Bristol, England
Re: Proof of concept: Programming the NES with blocks
Do you mean the hat blocks? They would be hard because it's single threadedtokumaru wrote:The event system is pretty handy too.
Re: Proof of concept: Programming the NES with blocks
Currently, yeah.orlaisadog wrote:Wait, are you a teacher?
If you're editing everything with blocks I don't think that the underlying assembler matters much... As long as the complete toolchain allows you to go from blocks to binary, everything should be fine.orlaisadog wrote:Is ASM6 a good choice for the assembler?
Well, so is Scratch... "Threads" in Scratch are run sequentially, with the interpreter controlling when each script starts and stops. I think that a proper NES version of scratch also needs to be able to manage threads, otherwise most of the benefits are lost.orlaisadog wrote:Do you mean the hat blocks? They would be hard because it's single threaded
As I see it, the biggest benefit of using Scratch is not that it replaces typing with draggable blocks, but that it manages objects mostly automatically, so you don't have to bother with every little detail. You just describe the behavior of each object, very linearly, and the interpreter takes care of updating everything in parallel.
- orlaisadog
- Posts: 166
- Joined: Thu May 31, 2018 11:12 am
- Location: Bristol, England
Re: Proof of concept: Programming the NES with blocks
An interpreter would be too slow
- orlaisadog
- Posts: 166
- Joined: Thu May 31, 2018 11:12 am
- Location: Bristol, England
Re: Proof of concept: Programming the NES with blocks
The problem is that is isn't written from scratch (get it?) so I don't have much control over how it works
Re: Proof of concept: Programming the NES with blocks
I get that this is just a proof of concept, but for something like this to be really useful for NES programming it has to do more than just create linear programs with blocks, otherwise it's just more annoying than simply typing.
I don't think an interpreter would be to slow if only a handful of scripts are running at any given time, but I guess it should be possible to compile to pseudo-threads too, if the points where the scripts yield was hardcoded.
I don't think an interpreter would be to slow if only a handful of scripts are running at any given time, but I guess it should be possible to compile to pseudo-threads too, if the points where the scripts yield was hardcoded.
- orlaisadog
- Posts: 166
- Joined: Thu May 31, 2018 11:12 am
- Location: Bristol, England
Re: Proof of concept: Programming the NES with blocks
I'll try to add psuedo-threading if you think it would be useful, but I originally thought of it being an easier way to use an assembler so I wouldn't have type so much or to remember opcodes.
- orlaisadog
- Posts: 166
- Joined: Thu May 31, 2018 11:12 am
- Location: Bristol, England
Re: Proof of concept: Programming the NES with blocks
Maybe I could get more control if I use Blockly
Edit: It might be too hard though:
Edit: It might be too hard though:
Creating a new language generator for Blockly is a fairly large undertaking, and with that in mind the documentation doesn't seem to offer much in terms of help with creating one.
- orlaisadog
- Posts: 166
- Joined: Thu May 31, 2018 11:12 am
- Location: Bristol, England
Re: Proof of concept: Programming the NES with blocks
Multithreading could work like this