Author Topic: HuC - Newbie questions?  (Read 682 times)

Trenton_net

  • Hero Member
  • *****
  • Posts: 503
HuC - Newbie questions?
« on: June 20, 2016, 08:01:18 AM »
Hey everyone,

So I had a look at HuC on Github (https://github.com/uli/huc) and it seems interesting enough to play with. But lacking some kind of direction, I had some newbie questions regarding it. :-)

For example, I assume the development environment is probably Linux only and not Windows? Or at the very least, I need Cygwin installed? Also, they provide you with 'make' files all over the place, but what exactly do I need to use them (for example compiling the examples)? Is there a proper way I need to setup and compile HuC for the first time, before I can use the compiler to make my own PCE binaries?

Any help would be appreciated as I'm pretty green to all of this. The example code looks straight forward enough, but getting all the tooling setup is another story lol!

PS: If your using something like the Everdrive to run your binaries on, what is the maximum PCE size allowed? I assume HuC will generate PCE binaries of any arbitrary size? Or will it actually warn you if you exceed a particular amount?
« Last Edit: June 20, 2016, 08:04:07 AM by Trenton_net »

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: HuC - Newbie questions?
« Reply #1 on: June 20, 2016, 08:31:40 AM »
AFAIK, HuC has traditionally been for Windows-based machines.

It's annoying that Uli added some unix-specific code in his changes that broke Windows compatibility, which means that folks now need to run cygwin to compile his upgraded version HuC for Windows.

I'm curious enough to see his changes that I'm installing cygwin on a old machine, and will attempt to compile/upload a build for folks to play with.

Are you an experienced C programmer?

Do you have any linux experience?

Do you actually want to install/run cygwin (you don't need it if you just want to use makefiles for your PCE development)?

TheOldMan

  • Hero Member
  • *****
  • Posts: 958
Re: HuC - Newbie questions?
« Reply #2 on: June 20, 2016, 08:41:51 AM »
Quote
AFAIK, HuC has traditionally been for Windows-based machines.

Odd. I always thought it was for linux machines, with windows compatability via cygwin.
Fwiw, the call used to fork the assembler isn't completely compatible with cygwin; that's why you
sometimes have to hit a key to get back to the prompt.

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: HuC - Newbie questions?
« Reply #3 on: June 20, 2016, 09:15:50 AM »
Odd. I always thought it was for linux machines, with windows compatability via cygwin.

Linux-ish, yep, but definitely not cygwin ... I haven't seen any old binary packages that included the huge cygwin1.dll file.

AFAIK, it used to be built with msys/mingw which is much cleaner, but Uli's changes added some code that requires some linux library functions that mingw doesn't support.

He didn't need to do it that way, but he did, and so you're stuck with needing to include 3.6MB of cygwin dlls now. At least until/unless someone rewrites a couple of his additions in a more cross-platform fashion.

Anyway, here's a prebuilt Windows package of Artemio Urbina's fork of Uli's version of HuC, and no cygwin installation is needed.

Artemio added a few extra nice features on top of Uli's changes.

https://www.dropbox.com/s/4dy8tujysefqupd/huc-aurbina-2016-06-20.zip?dl=0

BTW ... if someone wants to host that, then please go ahead, I don't particularly want it cluttering up my DropBox account forever.

I'll be curious to see if it generates better code than the example that Arkhan got me to run in the other recent HuC thread.

P.S.

To compile it from source, you just need to install cygwin, and then add the "gcc-core", "gcc-g++" and "git" packages, and those should pull in all the other packages that you need as dependencies.

I may have manually added the "make" package, too, but I think that came in automatically as a dependency.

Trenton_net

  • Hero Member
  • *****
  • Posts: 503
Re: HuC - Newbie questions?
« Reply #4 on: June 20, 2016, 09:28:00 AM »
AFAIK, HuC has traditionally been for Windows-based machines.

It's annoying that Uli added some unix-specific code in his changes that broke Windows compatibility, which means that folks now need to run cygwin to compile his upgraded version HuC for Windows.

I'm curious enough to see his changes that I'm installing cygwin on a old machine, and will attempt to compile/upload a build for folks to play with.

Are you an experienced C programmer?

Do you have any linux experience?

Do you actually want to install/run cygwin (you don't need it if you just want to use makefiles for your PCE development)?


Hey,

I'm somewhat experienced with C++, and I'm very experienced with Linux generally. The reason I ask what platform this toolchain works best on is because I wasn't sure if some of the programs referenced, like "mod2mml" was built for Linux or Windows.

I assume if I'm using Linux, I can just install g++, build the main HuC compiler, then I'll get a "bin" folder with all the tools like "mod2mml" all ready for use?
« Last Edit: June 20, 2016, 09:33:23 AM by Trenton_net »

spenoza

  • Hero Member
  • *****
  • Posts: 2751
Re: HuC - Newbie questions?
« Reply #5 on: June 20, 2016, 10:17:01 AM »
I think we need to push for Ruby on Rails for Hu6280. How can we be expected to program if we can't use, like, real words and stuff? Geez...

(No, I'm not lampooning anyone in this thread or otherwise on this forum.)
<a href="http://www.pcedaisakusen.net/2/34/103/show-collection.htm" class="bbc_link" target="_blank">My meager PC Engine Collection so far.</a><br><a href="https://www.pcenginefx.com/forums/" class="bbc_link" target="_blank">PC Engine Software Bible</a><br><a href="http://www.racketboy.com/forum/" c

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: HuC - Newbie questions?
« Reply #6 on: June 20, 2016, 10:21:21 AM »
I'm somewhat experienced with C++, and I'm very experienced with Linux generally. The reason I ask what platform this toolchain works best on is because I wasn't sure if some of the programs referenced, like "mod2mml" was built for Linux or Windows.

Everything is just command-line based.

If you're comfortable in linux (and have the right packages installed), then it's all as simple as a "git clone" and a "make", and then everything will be in the huc/bin directory.


I'll be curious to see if it generates better code than the example that Arkhan got me to run in the other recent HuC thread.

And the answer is "yes", it does.

It is still really, really horrible compared to hand-written assembly, but it's not quite as bad as it was.


**********************************************
Original C Source ("char" is unsigned)
**********************************************

char arr1[8];
char arr2[8];

void foo1 (char index)
{
  if (arr1[index] < arr2[index]) foo2();
}


**********************************************
Old HuC generated code
**********************************************

       __pushw
       __ldwi   _arr1
       __pushw
       __ldb_s  2
       __addws
       __ldb_p
       __pushw
       __ldwi  _arr2
       __pushw
       __ldb_s  4
       __addws
       __ldb_p
         jsr    lt
       __lbeq   LL3
         call   _foo2
LL3:   __addmi  2,__stack
         rts


**********************************************
Uli HuC generated code
**********************************************

        __pushw
        __ldwi  _arr1
        __addb_s        0
        __ldb_p
        __pushw
        __ldwi  _arr2
        __addb_s        2
        __ldb_p
          jsr   lt
        __lbeq  LL3
          call  _foo2
LL3:    __addmi 2,__stack
          rts


Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: HuC - Newbie questions?
« Reply #7 on: June 20, 2016, 02:16:51 PM »
Insanity was half developed on a Linux install before the laptop died and I used a Windows one after that.

That version of HuC had existed since what, 2003 or 2005?

[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: HuC - Newbie questions?
« Reply #8 on: June 20, 2016, 04:14:09 PM »
I think we need to push for Ruby on Rails for Hu6280. How can we be expected to program if we can't use, like, real words and stuff? Geez...

 :lol: :wink:


Insanity was half developed on a Linux install before the laptop died and I used a Windows one after that.

That version of HuC had existed since what, 2003 or 2005?

Yep, definitely dual-platform, using linux-style development tools (makefiles).

But AFAIK, it's always been dual-platform using mingw as the development environment for the Windows version ... I could be wrong on that, though.

It's only Uli's recent changes that have broken the compatibility with mingw, and forced the use of the heavier-weight cygwin in order to compile a Windows version of HuC.

I've always thought of the Windows version as the "main" one, just because that was most users platform-of-choice up until just the last few years.

I've been running linux machines too for many years ... but I still find that it has enough annoyances as a desktop that I spend nearly all of my time in Windows.

I think that I'm going to finally be forced into developing on linux in order to get the 6502 simulator for SDCC written.

Hopefully gdb has some decent front-ends by now.  :pray:

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: HuC - Newbie questions?
« Reply #9 on: June 20, 2016, 04:48:43 PM »
I've never even touched linux. Mostly because I haven't had the need to.

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: HuC - Newbie questions?
« Reply #10 on: June 22, 2016, 10:05:18 PM »
I've never even touched linux. Mostly because I haven't had the need to.

Once you realize you can make GNOME look like Amiga OS, you will want to need to Linux.
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

Trenton_net

  • Hero Member
  • *****
  • Posts: 503
Re: HuC - Newbie questions?
« Reply #11 on: June 23, 2016, 03:54:36 AM »
I've never even touched linux. Mostly because I haven't had the need to.

Once you realize you can make GNOME look like Amiga OS, you will want to need to Linux.

I agree. If you thought Android gave users freedom of choice, then Linux will just blow your mind.

I used to be a hard-line Windows supporter (MS-DOS, Windows 2000, etc), but once I tasted Linux I never went back. As long as you can ignore all the BS and FUD people try to spout about it (Ie. It's too hard for the average Joe to use, etc), and are not actually afraid of learning something "new" (Ie. Anything not made by Microsoft), then you'll find its one of the most liberating and powerful operating systems around. Just grab any distribution that uses DEB packages/repos (Ie. Ubuntu, Mint, Debian) and you'll be already set!

I remember the first day I installed Linux, I went "Ok, So first I need to uninstall all the pre-installed junk, and then re-install all the proper apps I want one by one." and then I realized "Oh, Firefox is already installed. Libre Office is already installed. I guess I don't need to remove and add as much as I thought". Even then, installing stuff was a breeze! Just pick the handful of items you want to install from the repos (or app-store if you will), click GO, and just get a coffee. It literally does it all for you. Best of all, non of this "You just installed Flash! Because this application is garbage, it requires you to restart your computer now. Ok or Cancel". :-)



Punch

  • Hero Member
  • *****
  • Posts: 3278
Re: HuC - Newbie questions?
« Reply #12 on: June 23, 2016, 05:29:48 AM »
Trenton_net your experience is not consistent with mine (and many others), I use arch nowadays but when I used to try to get into those "easy" distributions, it would ALWAYS self-destruct after some updates. No, the "average joe" doesn't want to dive into a tty screen to dick around with configuration files and packages without any sort of user friendly software, and it is not because they're afraid of learning "new" stuff. These linux distributions were never geared towards user experience and saying "lol they're too dumb to learn how to use anything outside of micro$oft products" isn't helping to bring anyone on board.

You just updated your distribution! But we broke your X Window Server and we won't notify you, good luck next reboot! A breeze, indeed.