Author Topic: ASM on PC Engine  (Read 578 times)

AmigaHeretic

  • Newbie
  • *
  • Posts: 6
ASM on PC Engine
« on: January 07, 2009, 03:35:32 PM »
Hi there.  New to the site and just got approved to post!  So I've been looking at doing some coding on the PCE and have been testing out HUC and checking out some source code around the internet.

Now I've made a couple of .c HUC programs and it look like it converts it to .s and then PCEAS compiles/links it into a .pce rom.  Question is that there seem to be a ton of .asm files out there, but PCEAS that comes in HUC archice (Magic Kit I assume) doesn't know what to do with these files. (I'm using Winsystem :-( ) Is there another ASM compiler people are using?  Or ??  I can't get any .asm files I found out there to compile, but have no problem compiling the .s files HUC makes.

Is there any good reference material to get to know the PCE HD?  Have no real ASM experience so I may be trouble anyway as I noticed trying to debug HUC code is 'fun' so far. 

My TG16 and Duo are my favorite video game system of all time.  It's been exciting getting some stuff running on it. 

Thanks!
AmigaHeretic

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: ASM on PC Engine
« Reply #1 on: January 07, 2009, 10:11:13 PM »
HuC uses a rebuilt pceas.exe (V 3.21) and different .asm libraries.   The assembly files it generates and passes to the pceas.exe it comes with, wont work with Magic Kit's v2.51 assembler....


so... if you write stuff in HuC, it's not entirely backwards compatible with MagicKit

I suggest you dive headfirst into MagicKit v2.51

grab a decent 6502 assembly book from somewhere, and check out the included pce demos.


also make sure you look at the PCE documents so you know how the hardware works.
[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.

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: ASM on PC Engine
« Reply #2 on: January 07, 2009, 10:41:42 PM »
(Wheres the post edit button! I feel retarded double posting! >_<  :-" )

I fired you an email with the pce demos in assembly for Magic Kit

If you grab plain ol' Magic Kit 2.51, it has the PC Engine hardware documentation also (in the /docs folder).  It explains how sprites work, how the PSG works, and all that good stuff.  It is pretty handy.  I printed it all out, put in page protectors, and stuck it in an aluminum binder.   It is my PC Engine tome.  :-D

OH and the catch about doing Magic kit vs. Hu-C

if you set PCE_INCLUDE on windows to the hu-c folder, and your PATH includes /huc/bin, you will have to change these to point to mkit251_dos/include and mkit251_dos/bin instead in order to properly assemble any .asm files that were written with Magic Kit as the target.  Otherwise it might try using the Hu-C libraries and or the Hu-c version of pceas.exe, and that wont work!

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

Necromancer

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 21335
Re: ASM on PC Engine
« Reply #3 on: January 08, 2009, 04:00:30 PM »
Welcome aboard, AmigaHeretic.  :)

(Wheres the post edit button! I feel retarded double posting! >_<  :-" )

The 'modify' button is in the top right of your post, nestled between the 'quote' and 'remove' buttons.  :wink:
U.S. Collection: 97% complete    155/159 titles

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: ASM on PC Engine
« Reply #4 on: January 08, 2009, 04:28:38 PM »
Welcome aboard, AmigaHeretic.  :)

(Wheres the post edit button! I feel retarded double posting! >_<  :-" )

The 'modify' button is in the top right of your post, nestled between the 'quote' and 'remove' buttons.  :wink:
...
...
... oh! ... i am used to it being on the bottom right and saying EDIT from another forum.

woops! ;-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.

AmigaHeretic

  • Newbie
  • *
  • Posts: 6
Re: ASM on PC Engine
« Reply #5 on: January 09, 2009, 02:21:15 AM »
@Arkhan

Great! Thanks for all the information.  I actually downloaded MK 2.51, but assumed it was older than the 3.21 that came with HuC, so that clears it up.  Thanks for the heads up on the path too that probably would have caused me more headaches! 

Guess I'll be spending a lot of time at http://www.6502.org/ ? :-)

I'll probably print out the docs and start playing around.  Maybe this'll help me get better at my 68000asm too.

AmigaHeretic

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: ASM on PC Engine
« Reply #6 on: January 09, 2009, 12:30:15 PM »
hehe.
yeah, a good 6502 book or two on ebay is always a plus also.

As long as its not called 6502 for dummies, or LEARN 6502 IN 30 DAYS!  :-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.

Tom

  • Guest
Re: ASM on PC Engine
« Reply #7 on: January 09, 2009, 01:04:53 PM »
If you're looking for a book, then something about the 65C02 would be better or R65C02S if you can find it. Also, not sure why Arkhan (<_< ) hasn't mentioned the PCE coding IRC channel on efnet (utopiasoft). You can get lots of PCE assembly help there. Hardware too.

 If you never coded for a 65x, but have for 68k or x86 or z80 - then be prepared to be baffled ;)

 Totally different style of coding. If you're looking for DOCs, I have many  :)

nodtveidt

  • Guest
Re: ASM on PC Engine
« Reply #8 on: January 11, 2009, 05:14:47 AM »
I didn't find the transition from the 65xx to the x86 to be too terrible, but the Z80 and 68K are truly weird beasts in comparison.

AmigaHeretic

  • Newbie
  • *
  • Posts: 6
Re: ASM on PC Engine
« Reply #9 on: January 11, 2009, 09:34:27 AM »
The book I started with is Eyes, David & Lichty's "Programming the 65816 Including the 6502, 65C02 and the 65802".

But it looks like there are tons of 6502 books so I'll try to get some others later.

Thanks for IRC info I'll will have to check it out especially as I get stuck. :)  And I'll probably be hitting you up for docs at some point, so thanks again for the offer.


Just been playing around with some basics.  Coming from the Amiga it's just a little different.  The sprites are kinda cool with each one being to have it's own 16 color palette.  So even though there are only 512 colors it actually offers a some cool possibilities.    If anyone has a recommendation or let me know what you guys pixel your images in that would be great.  The few test sprites I did in Photoshop, but I've never really had to use something other than 8bit, 16, 24bit color in it.  Making graphics on the Amiga which is "12bit" color I just used one the paint programs there.  Never thought about how I'd go about doing Amiga 12bit graphics on PC.   So not a huge deal, but it would nice to see if there was something where I could just straight chose 9bit palette (which I can probably do in Photoshop more easily than I'm doing, but...)  so that I can match up the #000-#888 numbers a little more easily. 

Thanks for all the help guys!


Tom

  • Guest
Re: ASM on PC Engine
« Reply #10 on: January 11, 2009, 11:44:59 AM »
   So not a huge deal, but it would nice to see if there was something where I could just straight chose 9bit palette (which I can probably do in Photoshop more easily than I'm doing, but...)  so that I can match up the #000-#888 numbers a little more easily. 


 There are converted color charts show all the colors, and then some mapped logically or HSL like this - http://pcedev.net/gfx_tools/ . Those are just some rough ones.
 
 Photoshop have a nice feature - posterize. Set the levels 8 to force to 3bit R/G/B. Or you can manually edit a palettized picture using R/G/B *36 entries. N*32 tends to be to dark, but 36 increments shifts back down to 3bit just fine and looks better in PS too. Looks closer.

 I actually use photoshop to manage my tilesets/palettes and even build maps. Set the grid to 8x8 and 'snap' on, and copy paste my tiles. I use mask layers(50%) to keep track of which tiles belong to which palette set:
 

 I currently embed the subpalette code into the colors themselves. The slight differences between the increment signifies the associating subpalette.

Code: [Select]
        //R,G,B
array = { 0,0,0
          0,0,1
          0,1,0
          1,0,0
          1,0,1
          1,1,0
          //etc
          }
Code: [Select]
If(n>0) { converted_value=n*(36-array[(sub_pal*3)+i]); }
 else { converted_value=array[(sub_pal*3)+i]; }

 i = red(0), green(1), or blue(2).
 n=0 to 7.

 I export all the tileset ACT palettes and run it through my util and create a master 256 color palette with each subpalette being one of 16 groups of color and each group having its own unique identifying colors per segment. I force the final layer to 8bit and this master palette. Photoshop resnaps the colors of the whole picture into the proper ranges. On the receiving side, for the entire picture (or FMP 1.0 file) I just treat of the upper 4bits of the 8bit pixel as the subpalette number and the lower 4bits as direct pixels.

 That's if you have larger more complex palette arranged tilemaps. For smaller/simpler projects, you can just keep track of the tiles by hand and use the directives of Mkit (PCEAS) for facilitating that. My current project had 1350 unique tiles and there's no way I was going to keep track of that by hand, let alone if I need to make modifications and shuffle tiles.

« Last Edit: January 11, 2009, 11:51:59 AM by Tom »

AmigaHeretic

  • Newbie
  • *
  • Posts: 6
Re: ASM on PC Engine
« Reply #11 on: January 11, 2009, 05:32:39 PM »
That's sounds like a great way of keeping a lot of tiles organized. I'll have to try posterize again and just see how I can get the colors to match up.  Just need to play with it a bunch I guess.

I found a program I already had can do sort of what I was originally thinking and that is just basically going into a sort of direct 9 bit mode.  So I can go in and choose say, 16 to 256 colors out of a maximum palette of 512.  Then the R, G, B sliders each only go from 0-7.  It shows 32 colors colors on each line, so if I'm getting this right those would be for example the first two palettes, etc.  Nice thing is I can quickly see by clicking on a color basically $1,7,4 or whatever.  For the moment with just a few sprites it works OK.

Made a YouTube video of it because the program is an Amiga program, which is fine, but still on the look out for something on Win that does a similar function.



Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: ASM on PC Engine
« Reply #12 on: January 11, 2009, 09:02:55 PM »
hopefully you dig grafx2 and its amiga paint program style setup!

its a shame they never implemented a few of the final features.... at least you probably wont die without them...all the important stuff (all the brushes and effects, colors/palettes, lines and stuff) are there..  plus its lightweight, handles PCX format awesomely, and you can set the screen res to PCE screen res and see your sprite as it'd appear in a game. 

the brush grab options are my favorite part.  Makes animating easy.

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