Author Topic: help getting started in homebrew!!  (Read 2305 times)

syntacsugar

  • Newbie
  • *
  • Posts: 8
help getting started in homebrew!!
« on: February 24, 2009, 01:39:04 PM »
hey everybody,

just wondering if any of you can help me get started with trying to code things for the pcengine/turbografx. I have some programming experience and i'm always working on my programming skills, and i would like to make something for a console or any machine, since i love the pcengine i want to give it a try. so my questions are:

what tools are out there?
which should i use?
are there any tutorials or source code or smaller programs that i can look at to see how things work?
is there a special library to help with developement?
and is there a place to get a flash hucard?
also from what i've been able to gather you can code in asm or c++ which is best?
know of any resources/books to learn assembly?

i know it may be a ton of questions, but i have yet to find any place that could answer them. even getting back into programming like i have was a headache theres so many languages out there that its hard to know where to start or which to start with. i would appreciate it if anyone with any experience could point me in the right direction or share how they got started.

thanks

Tom

  • Guest
Re: help getting started in homebrew!!
« Reply #1 on: February 25, 2009, 03:27:25 AM »


Quote
what tools are out there?


 We usually write our own. I usually just write command line converter/utilities in C for PC - no GUI stuff. Nothing fancy. The assemblers and compilers also have some support for converting palettes, maps, tiles, and graphics for you. Though nothing fancy.

Quote
which should i use?

 If you go the C route, then you have access of the internal function that can import MAPPY tilemaps. But the compiler generally generates slower code than even unoptimized assembly by hand.

Quote
are there any tutorials or source code or smaller programs that i can look at to see how things work?


 I have a WIP tutorial - here. Even if you choose not to code in assembly, the tutorial can help you understand the other hardware at a low level.

Quote
is there a special library to help with developement?


 Both HuC C compiler and Magickit Assembler have a large library of useful functions. Though some of us are purists and and write out own libs for more speed and/or more functionality ;) It's not as difficult as it might sound.

Quote
and is there a place to get a flash hucard?


 I highly recommend tototek over neoflash. The only down side to tototek cards is that they require a parallel port VS Neoflash USB connection. I never could get the tototek card to communicate with the parallel port on my laptop either. I didn't try to hard since it works with my PC.

 You can also make your own if you have a general rom programmer. Hack up one of those 'barney' import converters and solder a DIP zif. Zif makes taking the DIP flash chip out for programming real nice :). Flash is easy to find (AM29F040B DIP version).

Quote
also from what i've been able to gather you can code in asm or c++ which is best?


 Whatever suits your needs. HuC compiler is pretty decent IMO, but like all 65x based solutions speed comes from low level optimizations. HuC supports inline ASM functionality, but you have to be really careful not to step on the toes of the compiler's generated setup. Otimizations for speed on the PCE also come from having complete control of mapping in near/far data. You have much less control over this in HuC with inline ASM because of the compiler's setup/needs. If the PCE had a flat memory layout, then this wouldn't be an issue for the C plus inline ASM route.

  A weird thing with HuC is that it only has support for 16bit variables. You can define "chars", but the compiler will treat the char as a 16bit var with the top half zero'd out. It also has some issues with treating some near data as far data, creating quite a bit of overhead in cycles. The compiler also has an its own stack system (not the real stack) for argument passing and it's really slow if you pass more than a single argument (single arguments are passed in two registers). So you'll have to use global variables for speed (write values to the global variables, then call the function), etc.

Quote
know of any resources/books to learn assembly?


 There are a ton of 65x (6502) tutorials, docs, books, forums, etc on the net. The PC-Engine CPU is based on that 65x. It has additional instructions that Rockwell added when WDC licensed they 'C02 out in trade for fabrication (WDC weren't a large enough company to fabricate their own chips). Rockwell chips are usually referred to as 'CS02 or 'C02S. Anyway, you can learn on the original 6502 instruction set just fine, then take advantage of the newer instructions later. The original 6502 instruction set is very simple and easy to understand. It's an easy processor to learn on. Among the many sites, the 6502.org forum is pretty good for help in learning the 65x.

Quote
i know it may be a ton of questions, but i have yet to find any place that could answer them. even getting back into programming like i have was a headache theres so many languages out there that its hard to know where to start or which to start with. i would appreciate it if anyone with any experience could point me in the right direction or share how they got started.

thanks


 My recommendation would be to go the ASM route. There's are a ton of retro platforms that used the 65x that are still very active (atari systems and computers, apple computers, C64/plus4/plus16, nes, lynx, etc) so the CPU is extremely popular. And there are people who still build small computer systems (SBC's) with the 65x, not to mention it's still widely sold for embedded systems. It's not a dead cpu ;) Even the 65816 (16bit version) is almost identical in code except the regs and arithmetic have been extended to 16bit. Almost exact same instructions. My point is, that you'll find plenty of support because of its wide use across platforms.

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: help getting started in homebrew!!
« Reply #2 on: February 25, 2009, 11:23:37 AM »
To learn/understand 6502, I say get the book Machine Language for the Commodore 64 and other Commodore Computers by Jim Butterfield.

Its not for the PC Engine, but it is still a good ML book...

here is a link to a buncha 6502/C= related books (pdf)

http://www.bombjack.org/commodore/books.htm

As for getting started you want to get a good text editor (Textpad, Notepad++!) and dive headfirst into some assembly. Itll save you headaches and such in the end.  set up MagicKit and try out some source stuff and go to town.

also, a good paint program is pretty important.  NeoPaint is my favorite.  Grafx2 is also good, and obviously Photoshop.

good luck :)
[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.

syntacsugar

  • Newbie
  • *
  • Posts: 8
Re: help getting started in homebrew!!
« Reply #3 on: February 27, 2009, 03:00:18 PM »
thanks for the link..funny thing was i was looking at the atariarchive site and saw some assembler books but you can't dld them. i actually have a c64 time to dust it off and give it some use. i've started reading through one of them already, so i'm on my way . any place i can get some specs about the turbografx/pc engine . to learn more about the hardware?

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: help getting started in homebrew!!
« Reply #4 on: February 28, 2009, 01:57:53 PM »
if you go to here, the Magic Kit website:http://www.magicengine.com/mkit/

it has full docs on the hardware.  Its all pretty quick reading and then you can just reference it when needed.

I wouldnt dust off your C64 and fire a real one up.  All the hardware mishaps of it being so old will annoy and discourage you...

fire up Vice and do it there.  It has a built in monitor and is alot easier than trying to set up a real C64 anymore. (There are also some cross assemblers and Cross-C stuff..)
[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.

syntacsugar

  • Newbie
  • *
  • Posts: 8
Re: help getting started in homebrew!!
« Reply #5 on: March 01, 2009, 03:18:47 PM »
wow thanks for that. lol i took my c64 out and everything even had to fiddle with the rf switches and everything. now i dont' have to fire it up then keep looking back at my monitor. and i really relieved that i can run vice on linux since thats what i'm using right now.but i've looked up vice and ive gone over to :
http://turbo.style64.org/tmp.php and got tasm. so i'm hitting the books, and od-ing on assembler thank god i dont' have to type it in !!!!  is this a good choice of assembler to use?
« Last Edit: March 01, 2009, 03:28:38 PM by syntacsugar »

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: help getting started in homebrew!!
« Reply #6 on: March 02, 2009, 11:41:21 AM »
tasm/tmp is THE only assembler you should use on a C64 lol.

but, why not just cut your teeth on 65SC02 for the PC engine? 

You can use magic kit, the docs, and a book and get crackin and then compile/test on Magic Engine or Mednafen
[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.

syntacsugar

  • Newbie
  • *
  • Posts: 8
Re: help getting started in homebrew!!
« Reply #7 on: March 05, 2009, 04:08:55 PM »
i'm gonna take your advice on that, i've gotten tons of pdf's , got magickit, and some other cross assemblers, and i've been reading the book you suggested and looking at other asm tutorials.and i've just been write very small routines to see what they do..it's pretty interesting, i'd love to look at the source for some demo's. you know where i can find any? so far its been mostly c64 stuff i've come across, and the few i found linking of of the magickit site.

ccovell

  • Hero Member
  • *****
  • Posts: 2245
Re: help getting started in homebrew!!
« Reply #8 on: March 05, 2009, 10:21:08 PM »
Several of my demos have ASM source code included: http://www.disgruntleddesigner.com/chrisc/creations.html

(They may not assemble perfectly with the latest versions of MagicKit, but they may prove instructive.   :-"

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: help getting started in homebrew!!
« Reply #9 on: March 06, 2009, 10:05:14 PM »
(They may not assemble perfectly with the latest versions of MagicKit, but they may prove instructive.   :-"

batcpy syntax changed, and the vsync stuff is different...  :mrgreen:

so worse case scenario, you'll assemble a rastery one, it'll make you fix batcpy, then you will get it built and run it and realize all the raster swirling is not working.... its fixable once you know more of what you're doing.

but, other then that, they're informative. :-D
[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.

syntacsugar

  • Newbie
  • *
  • Posts: 8
Re: help getting started in homebrew!!
« Reply #10 on: March 15, 2009, 11:44:38 AM »
thanks...funny i think i may have come across that site before while trying to learn more about programming this machine.

Charlie

  • Full Member
  • ***
  • Posts: 247
Re: help getting started in homebrew!!
« Reply #11 on: June 19, 2009, 01:30:15 PM »
So, who is the ASM programming guru I should contact?  Or should I just post my questions here?
Thanks
Charlie

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: help getting started in homebrew!!
« Reply #12 on: June 19, 2009, 08:07:39 PM »
So, who is the ASM programming guru I should contact?  Or should I just post my questions here?
Thanks
Charlie


post them here. they will probably get answered!

or pop into #utopiasoft on Efnet
[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.

Charlie

  • Full Member
  • ***
  • Posts: 247
Re: help getting started in homebrew!!
« Reply #13 on: June 22, 2009, 01:01:40 PM »
Ok, so

In "huc.inc", there is this:
           .zp
__sp
__stack    .ds 2
__arg_idx  .ds 1
__temp     .ds 8
__ptr      .ds 2
__fbank    .ds 1
__fptr     .ds 2
__expr     .ds 2

There is no size for "__sp"; does this mean a default size value?  What is it?  Or does it mean something else?

Thanks
Charlie

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: help getting started in homebrew!!
« Reply #14 on: June 24, 2009, 08:03:25 AM »
shit theres an interesting question...

is it the stackpointer?

Hmm...
[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.