Help with porting Arduboy core?

https://github.com/MiSTer-devel/Main_MiSTer/wiki

Moderators: Mug UK, Zorro 2, Greenious, spiny, Sorgelig, Moderator Team

User avatar
uXe
Atari User
Atari User
Posts: 40
Joined: Thu Nov 21, 2019 1:57 am
Location: Adelaide, South Australia
Contact:

Re: Help with porting Arduboy core?

Postby uXe » Tue Jan 14, 2020 11:55 am

I sort of cover this in the README.md on the GitHub releases folder:

The .HEX files as produced by the Arduino IDE have been modified for use with the core, an empty block of 512 bytes is added to the start and used for non-volatile EEPROM storage, and an end-of-file marker (0x1A) is added to the end.

(Note: this is not a 1:1 FPGA based emulation of the ATmega32U4 microcontroller used in the Arduboy - at this stage it is more a 'simulation' of an Arduboy, using a RISC-V 'soft' microcontroller and a modified version of the Arduboy libraries to re-compile games for this platform... so, existing pre-compiled Arduboy .HEX files are not going to run on this right now! But the majority of Arduboy games are open-source anyway, so it is not a big deal to make any necessary adjustments to the code and then re-compile a compatible .HEX file.)


Long story short - I was already familiar with the Arduboy libraries, so for me the most rewarding path was to take the FPGArduino RISC-V core, port it to MiSTer, and adapt the Arduboy C++ code to fit it... which means games need to be recompiled using the modified libraries - a different path would be to take something like this AVR core for example as a starting point:

https://github.com/freecores/avr_core

and adapt it, and build upon it, and have it emulate every possible register and instruction of the ATmega32U4 until you have shaped it to fit around already pre-compiled Arduboy HEX files without having to modify them at all...

Also - Sorgelig, maybe adding this core to the official MiSTer repo (so it downloads automatically during updates) would help alleviate a lot of the issues / pain users seem to be having right now because of the need to download the files manually off GitHub?

PS. ...VIDEO! :D


trashuncle
Atari nerd
Atari nerd
Posts: 46
Joined: Fri Jul 05, 2019 9:34 pm

Re: Help with porting Arduboy core?

Postby trashuncle » Tue Jan 14, 2020 12:04 pm

Thanks for the explanation. I believe this wouldn't be added to the main updater /repository until it is more complete? Will you need to recompile the entire arduboy library or do you think a better process will come about?

User avatar
uXe
Atari User
Atari User
Posts: 40
Joined: Thu Nov 21, 2019 1:57 am
Location: Adelaide, South Australia
Contact:

Re: Help with porting Arduboy core?

Postby uXe » Tue Jan 21, 2020 5:23 am

uXe wrote:Have just uploaded Super-Crate-Buino.ino.HEX (still unfinished - need to work on sound) and a new Arduboy.rbf file - instructions for the game are here:

http://legacy.gamebuino.com/forum/viewt ... =17&t=3151

PS. Hold UP and press DOWN for a weapons cheat! :wink:


Added in the sounds now - new Super-Crate-Buino.ino.HEX and Arduboy.rbf files uploaded to GitHub! :)

(PS. scores are saved, and scores unlock the higher levels - resetting the core gets you back to the title screen to try higher levels once they are unlocked...)

User avatar
uXe
Atari User
Atari User
Posts: 40
Joined: Thu Nov 21, 2019 1:57 am
Location: Adelaide, South Australia
Contact:

Re: Help with porting Arduboy core?

Postby uXe » Sun Feb 02, 2020 12:21 pm

Good news - have found a brilliant collaborator, Iulian Gheorghiu - author of XMEGA-CORE:

https://opencores.org/projects/attiny_atmega_xmega_core

...and we are slowly, surely, experimentally working our way towards eventually having full compatibility with the pre-compiled Arduboy .HEX files! [smilie=greencolorz4_pdt_01.gif]

NML32
Atari Super Hero
Atari Super Hero
Posts: 667
Joined: Tue Mar 11, 2014 1:54 am
Location: USA/Florida

Re: Help with porting Arduboy core?

Postby NML32 » Sun Feb 02, 2020 3:12 pm

uXe wrote:Good news - have found a brilliant collaborator, Iulian Gheorghiu - author of XMEGA-CORE:

https://opencores.org/projects/attiny_atmega_xmega_core

...and we are slowly, surely, experimentally working our way towards eventually having full compatibility with the pre-compiled Arduboy .HEX files! [smilie=greencolorz4_pdt_01.gif]

Thank you, this is great news. :cheers:

trashuncle
Atari nerd
Atari nerd
Posts: 46
Joined: Fri Jul 05, 2019 9:34 pm

Re: Help with porting Arduboy core?

Postby trashuncle » Mon Feb 03, 2020 10:44 am

Awesome!!! Can't wait for the updates

User avatar
uXe
Atari User
Atari User
Posts: 40
Joined: Thu Nov 21, 2019 1:57 am
Location: Adelaide, South Australia
Contact:

Re: Help with porting Arduboy core?

Postby uXe » Sat Feb 08, 2020 10:44 am

Indcsion wrote:Would it be easy to convert arduventure?


...continuing to work on the XMEGA branch of the repo (using MorgothCreator's ATmega core), we can now run Arduventure with sound! https://github.com/uXeBoy/Arduboy_MiSTe ... f?raw=true (still need to re-implement loading hex files from SD, and saving EEPROM to SD, so for right now EEPROM will be lost when the core is closed and it is limited to the one pre-injected game...)

User avatar
uXe
Atari User
Atari User
Posts: 40
Joined: Thu Nov 21, 2019 1:57 am
Location: Adelaide, South Australia
Contact:

Re: Help with porting Arduboy core?

Postby uXe » Sat Feb 15, 2020 3:55 am

OK, the new ATmega32U4 compatible release is now available! :megaphone:

Hopefully now the core can be made 'MiSTer official' and get some more visibility / improvements from others?

https://github.com/uXeBoy/Arduboy_MiSTe ... f?raw=true

A collection of .bin files converted and tested so far can be found here (you can hit the green 'Clone or download' button as pictured, and then 'Download ZIP' to get them all at once if you like):

https://github.com/uXeBoy/ArduboyCollection

Download.png


MorgothCreator also has donate links on his page for the atmega core for those who are so inclined:

https://github.com/MorgothCreator/atmeg ... -soft-core

...if you experience any glitches then a warm reset from the OSD, or a cold reset of MiSTer should sort it!
You do not have the required permissions to view the files attached to this post.

NML32
Atari Super Hero
Atari Super Hero
Posts: 667
Joined: Tue Mar 11, 2014 1:54 am
Location: USA/Florida

Re: Help with porting Arduboy core?

Postby NML32 » Sat Feb 15, 2020 5:01 am

Great job!! :cheers:
Thank you to everyone involved in bringing this core to MiSTer.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5796
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Help with porting Arduboy core?

Postby Sorgelig » Sat Feb 15, 2020 3:37 pm

wow!
Finally someone made open source AVR core!
uXe wrote:Hopefully now the core can be made 'MiSTer official' and get some more visibility / improvements from others?

i've sent invitation to MiSTer-devel. After accepting you can create the repository there.

kublai
Atari User
Atari User
Posts: 41
Joined: Tue Nov 19, 2019 6:59 pm

Re: Help with porting Arduboy core?

Postby kublai » Sat Feb 15, 2020 8:49 pm

Thanks very much your hard work on adding another new core to Mister.

User avatar
uXe
Atari User
Atari User
Posts: 40
Joined: Thu Nov 21, 2019 1:57 am
Location: Adelaide, South Australia
Contact:

Re: Help with porting Arduboy core?

Postby uXe » Sat Feb 15, 2020 10:33 pm

...you're welcome :D

OK, repo is up!

https://github.com/MiSTer-devel/Arduboy_MiSTer

...the 'sys' folder probably needs an update - I'm not certain where to find the latest version? (the one there now I had just borrowed from the PET2001 repo back at the beginning of this thread as was suggested)


Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5796
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Help with porting Arduboy core?

Postby Sorgelig » Sun Feb 16, 2020 9:22 am

You can take latest sys in recently released (by me) cores. Currently it's SNES, NES.

User avatar
BitsNStuff
Atari maniac
Atari maniac
Posts: 88
Joined: Tue Oct 16, 2018 7:55 am
Contact:

Re: Help with porting Arduboy core?

Postby BitsNStuff » Tue Feb 18, 2020 12:10 am

@uXe Out of interest, do you know if you'll be attempting to incorprorate the Arcade versions of the Arduboy at some point? I'm not actually sure how different thehardware is, well, apart from the fact that they obviously include a colour screen.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5796
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Help with porting Arduboy core?

Postby Sorgelig » Tue Feb 18, 2020 8:04 am

I think, the next step is to support HEX files loading directly. You can add either another atmega core for conversion on the fly, or other cores like Z80, ZPU, etc for this task.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5796
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Help with porting Arduboy core?

Postby Sorgelig » Tue Feb 18, 2020 8:10 am

BitsNStuff wrote:@uXe Out of interest, do you know if you'll be attempting to incorprorate the Arcade versions of the Arduboy at some point? I'm not actually sure how different thehardware is, well, apart from the fact that they obviously include a colour screen.

Micro Arcade looks fishy.. unlike generic Arduboy HW these Micro-Arcades are per-game offers. Hardcoded games without ability to change. Otherwise why they have to offer different "versions" even as a packs of 3-4 while being universal it should allow to load any game.

User avatar
BitsNStuff
Atari maniac
Atari maniac
Posts: 88
Joined: Tue Oct 16, 2018 7:55 am
Contact:

Re: Help with porting Arduboy core?

Postby BitsNStuff » Tue Feb 18, 2020 3:07 pm

Sorgelig wrote:
BitsNStuff wrote:@uXe Out of interest, do you know if you'll be attempting to incorprorate the Arcade versions of the Arduboy at some point? I'm not actually sure how different thehardware is, well, apart from the fact that they obviously include a colour screen.

Micro Arcade looks fishy.. unlike generic Arduboy HW these Micro-Arcades are per-game offers. Hardcoded games without ability to change. Otherwise why they have to offer different "versions" even as a packs of 3-4 while being universal it should allow to load any game.

Yeah, that's what I was expecting to be honest. Obviously the standard version is open source but the licensed versions are unlikely to be due to whatever licensing restrictions have been put in place by the owners. It's a nice little core without the licensed games and without the colur anyway,

User avatar
uXe
Atari User
Atari User
Posts: 40
Joined: Thu Nov 21, 2019 1:57 am
Location: Adelaide, South Australia
Contact:

Re: Help with porting Arduboy core?

Postby uXe » Wed Feb 19, 2020 3:57 am

Sorgelig wrote:I think, the next step is to support HEX files loading directly. You can add either another atmega core for conversion on the fly, or other cores like Z80, ZPU, etc for this task.


Easiest way to support HEX would be to have the HPS do the conversion from HEX to BIN on-the-fly and send the data over the ioctl signals as normal? Otherwise you are double-handling the data, sending it once from HPS to FPGA, and then again processing and sending the same data a second time between two virtual CPUs?

First issue on the to do list that needs resolving though is around the Timers / sound... as noted on MorgothCreator's repo:

https://github.com/MorgothCreator/atmeg ... -soft-core

Observed some issues with TIM3 on 'arduboy-rtl-emulator' project, so is needed to
"Fix situations where on random times at core reset the TIM3 prescaller is setup at
wrong value ( at /64 instead of /8 core clock )" need to check in what situation
this issue is manifesting.


We haven't been able to puzzle this out yet, but sometimes (not everytime!) the pitch of the sound comes out much lower / slower than it should... a reset usually quickly resolves this, but it is weird / annoying that this bug can not be consistently recreated :shrug:

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5796
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Help with porting Arduboy core?

Postby Sorgelig » Wed Feb 19, 2020 10:46 am

uXe wrote:Easiest way to support HEX would be to have the HPS do the conversion from HEX to BIN on-the-fly and send the data over the ioctl signals as normal? Otherwise you are double-handling the data, sending it once from HPS to FPGA, and then again processing and sending the same data a second time between two virtual CPUs?

Special support on HPS side is only for special cases when doing it in FPGA is impossible or hard. Otherwise core-specific handling should be done in FPGA. Arduboy core is quite small and doesn't consume much resources. There are still many resources available on FPGA to add converter there and make the core self-containing.

User avatar
uXe
Atari User
Atari User
Posts: 40
Joined: Thu Nov 21, 2019 1:57 am
Location: Adelaide, South Australia
Contact:

Re: Help with porting Arduboy core?

Postby uXe » Wed Feb 19, 2020 11:05 am

Fair enough :wink:

Speaking of those available resources - I was thinking that using the rotate screen Arcade functionality might be a handy addition? There are some games that would benefit from being able to rotate the view - 1943 and the '3in1' games are a good example!

User avatar
Newsdee
Atari God
Atari God
Posts: 1538
Joined: Fri Sep 19, 2014 8:40 am

Re: Help with porting Arduboy core?

Postby Newsdee » Wed Feb 19, 2020 11:22 am

Would this core have code that can help with Gameduino?

I don't know how good are the games for it, though. Arduboy was a neat little physical device (I have one) so that makes it more fun to code for.


Return to “MiSTer”

Who is online

Users browsing this forum: No registered users and 10 guests