PCEngineFans.com - The PC Engine and TurboGrafx-16 Community Forum

Tech and Homebrew => Turbo/PCE Game/Tool Development => Topic started by: MNKyDeth on October 29, 2016, 05:21:52 AM

Title: Getting started programming?
Post by: MNKyDeth on October 29, 2016, 05:21:52 AM
So I have been starting to teach myself the 6502 assembly language from http://6502.org/tutorials/

I have went through most of the easy6502 and read a lot of the rest of the stuff there.

I can do basic little dot movements and color changes and seem to know how to use JMP, JSR and RTS. INC, IN.... etc.

So beyond these instructions and manuals where would be the next logical step to progress my learning of how to program for this console?


Edit: Wooops, thought I put this under the  PCE  Tool Game development. If a mod could move it, that would be great.
Title: Re: Getting started programming?
Post by: elmer on October 29, 2016, 06:09:45 AM
Congratulations on taking the step to learn 6502/6280 programming.  8)

It's not the easiest path, but you'll find that it'll completely open up the PCE's maximum performance for you, and you'll never look your PC/iPhone/RaspberryPI in quite the same way ever again.  :wink:

Do you know any other programming languages, or is this your first?

<EDIT>

One good thing to do (IMHO) would be to read more of the pages linked to from 6502.org, especially Garth Wilson's site that has a dumper-truck full of useful info/advice for 6502 programming http://wilsonminesco.com/links.html

You don't have to read-and-understand it all ... it's just a bunch of stuff that you can skim through to get immersed in how the 6502 is used in practice. Then you can keep on going back there later on as you learn more, to see specific techniques in use and learn new ones.

His page(s) on 6502 Stacks will probably introduce you to a whole bunch of useful info that you may not have seen yet.
Title: Re: Getting started programming?
Post by: MNKyDeth on October 29, 2016, 07:37:52 AM
Mostly what I have done is a little experimenting with some of the branches. I wrote a little endless loop that would cycle through the colors on the 4 or 5 memory areas the little windows provided me.

It would just increment the color by one, compare that color value and once it reached a certain value it would then cycle to the next part of the loop. Once it got to the end it would JMP back to the top and start all over again.

So I havn't done much but I can see how some of the stuff was and some of the confusing stuff of why certain things either worked or didn't.

This is this first programming language I have messed with for this long. I have been poking around at it for about the past month.

I have messed with ruby, perl, python and such but never got past hello world. The only thing I can do any scripting with right now is BASH on Linux.
Title: Re: Getting started programming?
Post by: elmer on October 29, 2016, 09:11:32 AM
This is this first programming language I have messed with for this long. I have been poking around at it for about the past month.


OK, that's not a problem at all, but I'm going to suggest that you take a little step backwards for a few weeks before getting back into 6502/6280 assembly language on the PCE.

Assembly language is absolutely great for creating fast programs, but the reason that it's not used much any more is that it's a very verbose, often hard-to-read, and fairly slow-to-write language.

The incredible power that is gives you comes at the cost of having to manually take care of all of the tiny details of a program.

I'm not suggesting that you ditch the idea of programming in it ... far from it. But I am suggesting that you *start* by tackling the problem from a different perspective.

My advice to you would be to read this thread ...
    
Learn to code through a series of challenges?
http://www.pcenginefx.com/forums/index.php?topic=21498.0

... and then set yourself the task of writing that simple dots-on-the-screen Pong game in a high-level-language first.

You could either do it in PlayBasic like technozombie did, or do it in HuC if you really want to stick with the PCE.

You'll learn a lot of the basics of breaking down a task into some simple program steps, and you'll have the satisfaction of having something working that is your own code that you understand and can build on.

I'd recommend PlayBasic more than HuC at this point, because you'll have a decent debugger to use to see what's going wrong (and you will make a lot of errors, we all do).

You'd also have technozombie's version to look at for a comparison (AFTER you're done!).

If you do that, then you can take your simple Pong program, and figure out how to implement it in 6502 on the PCE.

The point is ... if you do it that way, you'll already have something that you understand to use as a template for your 6502 code.

For a fairly-novice programmer, it can be off-putting to start with the totally-blank-space that assembly language provides you, and know just where to start.

You might even take a middle step, and translate it from PlayBasic, to Huc, to 6502.

There are some good arguments for doing that.
Title: Re: Getting started programming?
Post by: johnnykonami on October 29, 2016, 09:58:07 AM
And please, don't forget to ASSBANK where you should have ASSCHUNK'D.
Title: Re: Getting started programming?
Post by: MNKyDeth on October 29, 2016, 03:33:02 PM
lol

Well, I started with the 6502 mostly because I do have a hard time sticking with a language. My spare time right now is filled with repairing these consoles and learning Russian.

I learn the programming in my free time at work. So it is fairly sporadic when I can sit down and concentrate on it but I really wanted to get into something with programming even if it is not extremely useful today.

These systems hold my interest far more than Java does so learning 6502 seemed logical.
Title: Re: Getting started programming?
Post by: elmer on October 29, 2016, 05:24:17 PM
Well, I started with the 6502 mostly because I do have a hard time sticking with a language. My spare time right now is filled with repairing these consoles and learning Russian.
...
These systems hold my interest far more than Java does so learning 6502 seemed logical.

The thing is ... these systems are basically blank when you turn them on.

You've got to understand the hardware, and know what you want to write.

They're not really something like an old C64 or Atari 800 BASIC environment where it's easy to "play around".
 
OK, if you want to dive in ... here's my cut down SCD template that I wrote to get some idea of how much of HuC and the Super CDROM BIOS I could easily disable and get around.

It's not documented, it's not overly efficient, and it's not self-contained (it still uses a couple of BIOS functions).

But it's the simplest PCE assembly language "Hello, World!" source code that I have to hand.

https://www.dropbox.com/s/pqaw0cptdfqk7kn/template_scd.zip?dl=0

Run "build.cmd" to assemble the source into a PCE ISO file, and then run "run.cmd" to run the ISO in Mednafen (if you've got Mednafen set up in the directory above).

To make any sense out of it all, you're going to need the PCE CD programming documentation from bonknut's site, and also the regular PCE hardware documentation (or Charles MacDonald's pcetech.txt file).

P.S. If you don't want to go blind trying to read Mednafen's default debugging font, you should download the build that I modified to use a larger font.

https://www.dropbox.com/s/6rpkviyhgihw4gt/mednafen-0.9.38.7-x86-elmer-2.zip?dl=0

There's a link to that file in another one of the threads somewhere, and I really do need to build a new one sometime soon with all of Rypheca's latest changes (like Saturn support).
Title: Re: Getting started programming?
Post by: Bonknuts on October 29, 2016, 07:31:56 PM
Here's an old tutorial set I was working on back in '08:
http://www.pcedev.net/tuts/chapter_0.txt
http://www.pcedev.net/tuts/chapter_1.txt
http://www.pcedev.net/tuts/chapter_2.txt
http://www.pcedev.net/tuts/chapter_3.txt

 Has some stuff in there specific to PCEAS. Note: There's a typo that says 1023 cycles for the TIMER, but it's actually 1024 cycles.

 And here's two skeleton examples that were supposed to go with it (can't find the rest):
http://www.pcedev.net/tuts/example_1.zip
http://www.pcedev.net/tuts/example_2.zip


 Ohh! These cribsheets should come in handy (they are made for printing out on high res paper and put in a plastic protector; quick access at hand):
http://www.pcedev.net/blog/files/Otaku_no_PCE_cribsheet_page1_v1_0_3.png
http://www.pcedev.net/blog/files/Otaku_no_PCE_cribsheet_page2_0_1_4.png
Title: Re: Getting started programming?
Post by: ccovell on October 30, 2016, 01:44:46 AM
Great written tutorials!  I was actually winding up to make some PCE ASM tutorial videos for YouTube, since there seems to be nothing out there, and you already covered the basics in those text files!

The main thing that has held me back from starting with the basics is the dilemma of recommending either an old MagicKit since the library portion is still "small" and easy for a beginner to grok, or stay contemporary and use the PCEAS in the latest Artemio/Elmer build of HuC.
The latter appears to make at least 4 banks just for library routines, even just for ASM-only projects!

So, I'm leaning towards the former.  Anyone have any advice?  Or, are textfile tutorials good enough?
Title: Re: Getting started programming?
Post by: Bonknuts on October 30, 2016, 06:05:19 AM
Would you be talking in the videos? The reason I ask, is not everyone learns the same way. Sometimes people need to hear someone explain it (visual and auditory), besides having the written explanations. For something like this, there's a steep learning curve in the immediate beginning because all the things involved (cpu, assembler itself, tools, video, audio, etc). It's calming to hear someone explain it in a lecture/tutorial style presentation, and helps with the anxiety and frustration of starting out.
Title: Re: Getting started programming?
Post by: elmer on October 30, 2016, 07:22:01 AM
Great written tutorials!

I agree, those are brilliant starting points! Thanks Bonknuts!  :D


So, I'm leaning towards the former.  Anyone have any advice?  Or, are textfile tutorials good enough?

IMHO, different tutorial examples should always be single source files that get more and more complex as the different concepts are introduced.

But there's an argument to be made for have 2 source files ... one for new code, and one for the code that you're building on.

I really don't think that there should be any use of library functions in assembly language tutorials.

IMHO, the whole point is to learn how to accomplish things yourself, and not just rely on some huge bank of hidden library functions.

I'm using Bonknuts's version of pceas, and that one doesn't seem to be including any library files/functions into the final ISO image ... an ISO, since I'm more interested in a minimal SCD template, rather than a minimal HuCard template.


Would you be talking in the videos?
...
For something like this, there's a steep learning curve in the immediate beginning because all the things involved (cpu, assembler itself, tools, video, audio, etc). It's calming to hear someone explain it in a lecture/tutorial style presentation, and helps with the anxiety and frustration of starting out.

It's a very steep curve for someone with no programming experience! There are so many new concepts to learn all at once.

I'd agree that a few good videos, with a friendly and calming voice, would be help immensely.

At least to cover the initial steps of getting set up, building the code, running it in Mednafen and then using the debugger.

One or two videos of the first few tutorial examples would help out, too.

I don't think that you'd need to explain what a CPU is, or how it works ... there are plenty of existing videos for that to link to.
Title: Re: Getting started programming?
Post by: Bonknuts on October 30, 2016, 07:45:59 AM
Just to note: I didn't proof read any of these tutorial chapters. I'm sure there are affect/effect, where/were, and other grammatical mistakes - you'll just have to bare with it. Those chapters are basically just a stream of consciousness on the topic, with some attempt at ordering. They aren't meant for someone that has zero experience in assembly. At least some novice experience is required, even just the bare basics. But regardless of that, I've always found docs and tutorials to be helpful, even if redundant, because you'll reach that level at some point and it'll make more sense then.  (Note: it's weird to see my writing style from 8 years ago).


 A tutorial on using the mednafen debugger would be very valuable too. People tend to shy away from debuggers for some reason. But to me, they are immensely helpful in tracking down bugs. I even use it in my Java class to fix things like complex reference bugs (advance linkedlist stuffs). Too bad the instructors don't want to teach the students on how to use it - they say wait until later classes to learn how to use it. Meh. It's a valuable tool and should be learned how to be used early on.
Title: Re: Getting started programming?
Post by: Bonknuts on October 30, 2016, 08:00:38 AM
IMHO, the whole point is to learn how to accomplish things yourself, and not just rely on some huge bank of hidden library functions.

 I know there are two camps when it comes to this, but I totally agree. Especially for someone learning a system like this; having in-depth knowledge really is the key to working system on a low level. If you rely on fancy libraries, when starting out, you'll never really get the feel of things. Re-inventing the wheel, gives you intimate knowledge and experience of how the wheel works - vs someone who's only ever borrowed the wheel for whatever purpose. In higher level system development, that probably doesn't matter so much. But for the goal here, working with assembly, and limited resources (cpu, ram, etc), I think it's a must have strength.
Title: Re: Getting started programming?
Post by: ccovell on October 30, 2016, 01:26:18 PM
Yes, I would be talking in the video, no guarantees about calm or soothing-sounding voices.  I would start by talking about how the PCE works internally, using games as examples (in Mednafen) to show how RAM & VRAM are arranged & used, etc.

The idea of my tutorials is to get a person writing demos & the basic skeleton of a game, so I'm more leaning towards starting out with the early (<8k in $E000-) MKit library and stripping it even more (perhaps even in-video) & rebuild it like a hotrod.  :)
Title: Re: Getting started programming?
Post by: Necromancer on October 31, 2016, 02:13:23 AM
Edit: Wooops, thought I put this under the  PCE  Tool Game development. If a mod could move it, that would be great.

Done.

Good luck with the learnenings.
Title: Re: Getting started programming?
Post by: DarkKobold on November 01, 2016, 05:35:49 PM
Well, I started with the 6502 mostly because I do have a hard time sticking with a language. My spare time right now is filled with repairing these consoles and learning Russian.
...
These systems hold my interest far more than Java does so learning 6502 seemed logical.

The thing is ... these systems are basically blank when you turn them on.

You've got to understand the hardware, and know what you want to write.



... Oh thank god for HuC :D
Title: Re: Getting started programming?
Post by: TheOldMan on November 01, 2016, 06:20:43 PM
Quote
... Oh thank god for HuC :D

Roflmao.
Learn real C, then come back to HuC.
Title: Re: Getting started programming?
Post by: megatron-uk on November 02, 2016, 06:25:08 AM
Yep, then running screaming away from it.  :lol:

It is easy to get something up and running, but if you do want to port anything or do something slightly approaching ANSI standard it's a big pain in the bum. One of the reasons I never got around to finishing the FAT filesystem driver for the Everdrive is the lack of struct support, so doing anything with the FAT table was a pain, calculating offset after offset for table entries... argh!

That and the lack of 'long' support. Yes, I know it is slow on a 8bit cpu, but my word, when you don't have 32bit integer support these days you do feel it!
Title: Re: Getting started programming?
Post by: Arkhan on November 14, 2016, 04:02:00 PM
As a side note, if you want good 6502

read Assembly Lines for Apple II, or Programming the C64 by Butterfield.

They are both 6502 books, and will teach you alot of important things.   The authors of those books are excellent at explaining things that will apply even to PCE
Title: Re: Getting started programming?
Post by: ccovell on November 17, 2016, 06:12:59 PM
Well, I've put together a video for a PCE assembly / tech tutorial: https://www.youtube.com/watch?v=Hp6UaGcPXbY

This first video is just a general overview of the PCE hardware / CPU / VDC capabilities.

It took a while to get some quiet time around the house / get over technical obstacles (M$ f**kers!) but anyway.  This video is still unlisted, so feel free to post your comments & criticism here!

[edit] I recommend using a YouTube downloader to download the video at its highest size (720 HD or whatever) and watch it in your free time.
Title: Re: Getting started programming?
Post by: esteban on November 17, 2016, 09:00:59 PM
Covell: You had me at "PCE"...
Title: Re: Getting started programming?
Post by: elmer on November 18, 2016, 03:29:37 AM
Nice!  :)
Title: Re: Getting started programming?
Post by: Gredler on November 18, 2016, 04:58:11 AM
oh man this is awesome, thanks so much!
Title: Re: Getting started programming?
Post by: Bonknuts on November 18, 2016, 05:59:05 AM
Dude..! Your voice is perfect. Keep doing these :D
Title: Re: Getting started programming?
Post by: ccovell on November 19, 2016, 12:23:40 AM
OK, if nobody has any problems with the content or delivery, then this thing's going live soon.
Title: Re: Getting started programming?
Post by: ccovell on November 22, 2016, 10:40:01 AM
My 2nd video (first half, anyway) is up:
https://youtu.be/0URhghSyb5E
I cover how some of the greatest PCE soundtracks get their rich sound.
Title: Re: Getting started programming?
Post by: elmer on November 22, 2016, 12:04:45 PM
I cover how some of the greatest PCE soundtracks get their rich sound.

That was really fun to watch, thanks! :D

It's great to see all of those clever techniques in use.
Title: Re: Getting started programming?
Post by: ccovell on November 22, 2016, 02:11:12 PM
Video 02, second half is up, making your own waveforms & sounds:
https://youtu.be/vHnWW5_jxiE
Title: Re: Getting started programming?
Post by: XtoF on November 29, 2016, 03:05:52 AM
@ccovell Quite nice and interesting videos!  8)

To answer the original question, what would you think about using the CC65  (http://cc65.github.io/doc/)compiler/assembler suite, as an alternative to 100% hand coded ASM?
I never coded anything targeting the PCE, but I'm currently using it to learn the Apple II. Of course the performance of the compiled C code is bad, but I find it sufficient in the non-critical loops.
And it's easier to experiment in C than in ASM  :wink:
Title: Re: Getting started programming?
Post by: elmer on November 29, 2016, 04:59:34 AM
Learn real C, then come back to HuC.


Yep, then running screaming away from it.  :lol:

It is easy to get something up and running, but if you do want to port anything or do something slightly approaching ANSI standard it's a big pain in the bum. One of the reasons I never got around to finishing the FAT filesystem driver for the Everdrive is the lack of struct support, so doing anything with the FAT table was a pain, calculating offset after offset for table entries... argh!

That and the lack of 'long' support. Yes, I know it is slow on a 8bit cpu, but my word, when you don't have 32bit integer support these days you do feel it!

Well, it does have a lot more ANSI stuff in Uli's new HuC, especially "struct"s.

That should make it easier for newcomers to pick up and use (except that there's so little documentation on it).

And as Bonknuts pointed out, there are some 32-bit math functions down deep inside that you can call from assembly language.

But ... it's still *far* from compatible with true ANSI C code, and so you'd end up doing a lot of assembly work.

HuC is really a C-lite language designed for making games.


To answer the original question, what would you think about using the CC65  (http://cc65.github.io/doc/)compiler/assembler suite, as an alternative to 100% hand coded ASM?
I never coded anything targeting the PCE, but I'm currently using it to learn the Apple II. Of course the performance of the compiled C code is bad, but I find it sufficient in the non-critical loops.
And it's easier to experiment in C than in ASM  :wink:

If you look, you'll find threads here about CC65/CA65.

There are so many things that I like about it, especially all the work that has gone into optimizing it, and into making it fully ANSI-compatible.

But, the price that has been paid in terms of code-generation complexity, and performance is a little bit too high for my comfort.

There's also little support in their libraries and system for the PCE's memory model and CD usage ... support of the PCE is at an early "work-in-progress" stage.

CA65 itself (especially when used with CC65) currently has some problems when it comes to zero-page variables that I've been trying to sort out with the guys there.

The root-problem itself is buried deep within the core of CA65, and I'm not sure when it will be fixed.

If you want to use C on the PC Engine, then I'd have to currently recommend HuC over CC65, especially after the work that Uli did on improving the ANSI-compatibility.

Unfortunately, the documentation on HuC, and how to get the best use out of it, is sadly lacking.

I'm a programmer ... I'd rather have a root-canal than write documentation, and this is one stand-out area where I've got to tip my hat to the CC65 guys!  :clap:


<EDIT>

I never coded anything targeting the PCE, but I'm currently using it to learn the Apple II.

BTW ... I ran across your blog a few weeks ago, and enjoyed reading it!  :)

If you choose to try writing something for the PCE, then you'll find it to be a much more powerful machine than the Apple II, and the Hu6280 processor really adds some nice intructions to the 6502 architecture that make it so much more pleasant to work with.

That's another problem that I have with CC65 ... it takes very little advantage of the 65C02 improvements, and has no optimization at all for the Hu6280 improvements.
Title: Re: Getting started programming?
Post by: Bonknuts on November 29, 2016, 07:15:20 AM
Deleted posted. It belongs in its own topic and not really relevant for getting started.
Title: Re: Getting started programming?
Post by: XtoF on November 30, 2016, 12:26:44 AM
Thanks for these precise answers, you guys know your stuff!  8)
I'd never heard about HuC before, but now that I do, I'm going straight to Uli's Github! :)
   
As a matter of fact, I'm new owner of a CoreGrafX. I was always intrigued by this little machine, since I read a review of an imported cardridge of Parodius, back in the time. Now that I can play the actual game, I can say that I'm quite impressed!

So I intend to learn more details about the machine and roaming these forums seems like a perfect way to start!   :D
Title: Re: Getting started programming?
Post by: elmer on November 30, 2016, 06:01:10 AM
I'd never heard about HuC before, but now that I do, I'm going straight to Uli's Github! :)

You might want to look at my fork instead, there are a few important bug fixes.

I've updated the first message in this thread with a whole bunch of links to PCE information and development tools.

TED v2 Programming Notes
http://www.pcenginefx.com/forums/index.php?topic=20120.0


Quote
So I intend to learn more details about the machine and roaming these forums seems like a perfect way to start!   :D

Welcome!  :)

You'll find a lot of useful and interesting stuff if you browse through the old threads.
Title: Re: Getting started programming?
Post by: Bonknuts on November 30, 2016, 08:24:05 AM
Considering my last post was not really relevant for getting started, it got me thinking about "Getting into advance topics" for PCE. Something that could cover not only how certain data structures and algorithms fit more nicely with the 65x design in relation to the PCE, but also additional addon hardware and using that hardware (hysnc and advance VDC effects, arcade card, SF2 mapper, CD programming).

 I don't know if anyone besides myself has written code and demos for the SF2 mapper, but PCEAS inability to handle anything beyond 1megabit and since there's no linker system - it makes handling organization of data painful or wasteful. Injecting the data into rom and expanding it with external tools is not a problem, but putting those labels and attributes into the main source file remains a by hand process. Normally I don't complain about PCEAS not having a linker, but this is probably one case that I would argue otherwise. From my perspective, if you're going to develop a hucard game without the intent to sell in physical form, the SF2 mapper is a great choice. It just needs additional tools; both for HuC and for PCEAS.

 But yeah...
Title: Re: Getting started programming?
Post by: elmer on November 30, 2016, 10:03:42 AM
Considering my last post was not really relevant for getting started, it got me thinking about "Getting into advance topics" for PCE. Something that could cover not only how certain data structures and algorithms fit more nicely with the 65x design in relation to the PCE, but also additional addon hardware and using that hardware (hysnc and advance VDC effects, arcade card, SF2 mapper, CD programming).

More information and especially examples, would be great!  :)

I think that there's still a lot of "hidden" stuff about HuC, like your discovery of the __fastcall interface, that still isn't properly documented.

I'm definitely not the guy to do it ... but new PCE developers could really do with more documentation about HuC, and how to use it.

You know ... things like avoiding large local-variables, and making things global or static.

Stuff that isn't "normal" C practice.

Web-pages or a wiki that could be included in github would be perfect ... but blog posts or updates to Archaic Pixels would still improve things for everyone else.


Quote
Normally I don't complain about PCEAS not having a linker, but this is probably one case that I would argue otherwise. From my perspective, if you're going to develop a hucard game without the intent to sell in physical form, the SF2 mapper is a great choice. It just needs additional tools; both for HuC and for PCEAS.

You're welcome to help in the process of modifying the ASxxxx assembler/linker to be more-friendly for PCE usage, and more compatible with PCEAS.

I've already added Hu6280 support to it.

https://github.com/jbrandwood/aspce

And I'm happy to add other-people's improvements into my fork of HuC.

That's the beauty of github ... you can just create you own fork of the project, and then send me a pull-request when you've got something working.
Title: Re: Getting started programming?
Post by: ccovell on January 04, 2017, 12:12:32 AM
Episode 3 is up on my tutorial.  I don't get started coding yet, but I do take the necessary step of linking to programs & info sources.  Plus a bit about PCX files & 9-bit colour.
https://www.youtube.com/watch?v=PSZj04DFOVY
Title: Re: Getting started programming?
Post by: elmer on January 07, 2017, 05:46:30 AM
Episode 3 is up on my tutorial.  I don't get started coding yet, but I do take the necessary step of linking to programs & info sources.  Plus a bit about PCX files & 9-bit colour.

I've watched the whole thing now ... cool stuff, thanks for making that!  8)  :D

It's a little bit slow-paced (IMHO) ... but there's really good stuff in there, although it's not quite how I'd personally choose to set things up.

It was funny to see that you're still using your Amiga toolset to create artwork.  :lol:

I know that I'm stuck in my personal comfort-zone, too ... with my Brief keymapping in the text editor, customized bitmap fonts in Windows, and use of grafx2 (Deluxe Paint, Deluxe Animator clone).

I really should be using ProMotion more, particularly now that there's a free version to recommend to people.

I was definitely a bit surprised to see you dropping stuff into the Windows directory instead of just editing the user path to add stuff ... especially because Mircosoft seem to be trying to lock down the Windows directory more-and-more with each revision.

**************

BTW ... does anyone know who runs the Archaic Pixels site, and how to get an account to edit stuff?

The whole site disappeared for a few weeks last year, but I see that it is back up now.
Title: Re: Getting started programming?
Post by: ccovell on January 07, 2017, 12:12:57 PM
Thanks for the comments.  Yeah, someone commented in YouTube to just get on with the programming, already, and I agree.  But I also wanted to point complete beginners towards where they could actually find and set up the assembler & documentation, because there isn't a single resource AFAIK on the web for this.

Heh, yeah, I could also have told people how to edit their path string.  :-)

I did mention the good programs like Grafx2, and I'm sure the Gimp is serviceable too. Maybe.  I am aghast at how people just do pixel art in MSPaint (and Photoshop to a degree)...
Title: Re: Getting started programming?
Post by: Gredler on January 07, 2017, 12:37:57 PM
Photoshop's art tools are unparalleled, I dug around for a long time but still haven't found anything that comes close to it.

If you could manually arrange indexed palettes easier there would be no need for anything else, but between Photoshop to make the art and gimp to clean up the palettes everything else seems less flexable and much less powerful.

Smart objects for tilemaps alone make it worth it, then layers and selection tools pffft fuggidaboutit!
Title: Re: Getting started programming?
Post by: ccovell on January 07, 2017, 12:40:20 PM
Deluxe Paint has layers too!  Well... up to 2 of them, anyway.   :D
Title: Re: Getting started programming?
Post by: Arkhan on January 07, 2017, 09:30:58 PM
Photoshop's art tools are unparalleled, I dug around for a long time but still haven't found anything that comes close to it.

If you could manually arrange indexed palettes easier there would be no need for anything else, but between Photoshop to make the art and gimp to clean up the palettes everything else seems less flexable and much less powerful.

Smart objects for tilemaps alone make it worth it, then layers and selection tools pffft fuggidaboutit!



I use PaintShopPro because Photoshop is a giant piece of shit that inverts PCX palettes for whatever dumb reason and it angers my a$$hole.


Also, it lets you manually arrange and deal with indexed palettes.

and doesn't tard out with RAW files.



and isn't $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Title: Re: Getting started programming?
Post by: ccovell on January 07, 2017, 10:36:48 PM
I use PaintShopPro because Photoshop is a giant piece of shit that inverts PCX palettes for whatever dumb reason and it angers my a$$hole.

I did actually mention and show that in my video.  The P$-> PCX part, not your angered a$$hole, I mean.
Title: Re: Getting started programming?
Post by: Arkhan on January 08, 2017, 12:23:14 AM
lol.

It's horrible of them to do that to the PCX files.  Someone needs punched.
Title: Re: Getting started programming?
Post by: Bonknuts on January 08, 2017, 07:12:49 AM
Thanks for the comments.  Yeah, someone commented in YouTube to just get on with the programming, already, and I agree.  But I also wanted to point complete beginners towards where they could actually find and set up the assembler & documentation, because there isn't a single resource AFAIK on the web for this.

Heh, yeah, I could also have told people how to edit their path string.  :-)

I did mention the good programs like Grafx2, and I'm sure the Gimp is serviceable too. Maybe.  I am aghast at how people just do pixel art in MSPaint (and Photoshop to a degree)...
I thought the video was fine. Some tutorials tend to race through things, and it can be frustrating for beginners IMO. I think the pacing in your videos is fine.
 
Title: Re: Getting started programming?
Post by: elmer on January 08, 2017, 11:49:06 AM
BTW ... when you said in the video that the necessary documentation was spread out all over the place ... well, I've just finished cleaning up the scans of the Hudson's English developer docs that have been floating out there on the interwebs for a while, including finally finishing off the splitting up and cleanup of the scan of the CD docs from bonknuts's site.

That makes a tidy little package of 10 reasonably-sized pdf files that cover all of the information that is needed to develop on the PCE in assembly-language, except for the SGX and Arcade Card.

IMHO, it would be good to have a single public website that you could point to in your videos that would have links to all the useful info, including Charles MacDonald's PCEtech and SGXtech documents, Bonknuts's Arcade Card document and PCE Cribsheets, and your PCEMon.

Now personally, I'd favor putting that page somewhere on esteban's tg-16.com, if he's willing ...

... partly because it's a short url, partly because he's already doing an amazing job of archiving a huge collection of PCE documentation, partly because his site is backed-up on the Internet Archive Wayback Machine at web.archive.org, and partly because he's a neutral 3rd-party, and then we don't have to worry about delicate developer-egos.  :wink:
Title: Re: Getting started programming?
Post by: ccovell on January 08, 2017, 12:35:31 PM
then we don't have to worry about delicate developer-egos.
NOW JUST WHAT ARE YOU IMPLYING, SIR?

;-)
Title: Re: Getting started programming?
Post by: Bonknuts on January 08, 2017, 03:10:47 PM
and then we don't have to worry about delicate developer-egos.  :wink:

 *looks up as he's laying out eggshells....* Hahaha
Title: Re: Getting started programming?
Post by: Gredler on January 08, 2017, 04:13:48 PM
I use PaintShopPro because Photoshop is a giant piece of shit that inverts PCX palettes for whatever dumb reason and it angers my a$$hole.

A giant piece of shit? It is a inconvenience to use gimp to clean up the palette, but I think it's quite hyperbolic to think photoshop worse than a minor headache when it comes to fixing palettes. As far as art creation goes, there's not a whole lot out there that can come close to competing with it; it's not even worth arguing, unless something can be shown to me by an artist to say otherwise. The tools in photoshop are unparalleled, and it's a world wide standard in digital art. It's a verb.

Also, it lets you manually arrange and deal with indexed palettes.

Gimp, you taught me this!

and doesn't tard out with RAW files.
I would consider PCX a compressed file, not a raw file. A psd is about as raw as you're going to get for art generation purposes.

and isn't $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

I upgraded my CS6 (attained very affordably) with a monthly 10$ subscription to CC. What I get with that $10/mo pays for itself hand over fist repeatedly.

Compared to the collectards around, and the cost of an average lunch or dinner where I live, that's not a terrible price. I'd drop that down to a dollar sign or two.

I'd love to see a better solution that CC/CS6 + Gimp, but maybe my tenure in photoshop outweighs the headaches of opening another program to palette organize my art.
Title: Re: Getting started programming?
Post by: Arkhan on January 08, 2017, 05:37:41 PM
A giant piece of shit? It is a inconvenience to use gimp to clean up the palette, but I think it's quite hyperbolic to think photoshop worse than a minor headache when it comes to fixing palettes. As far as art creation goes, there's not a whole lot out there that can come close to competing with it; it's not even worth arguing, unless something can be shown to me by an artist to say otherwise. The tools in photoshop are unparalleled, and it's a world wide standard in digital art. It's a verb.
You realize PSP is often suggested as an alternative to Photoshop, right?  It's actually a quite powerful program with the same sort of tools and features as Photoshop.   In addition to correctly handling palettes.

Besides, Photoshop is generally only an "industry standard" because it's shoved down everyone's throat, and up their ass, simultaneously.   

...and is often taught/provided in university, and thus people just stick with it because they were taught it, got it cheap, and don't want to pay more money.

Go try PSP out.  There's a free trial. 

To that note, many artists aren't using Photoshop anymore.  They're using PSP, or Clip Studio, or that other one that I forget the name of. 

mostly because everyone got collectively tired of Adobe charging out the tits for their software, and then moving to a subscription model.

I took a survey of ~20 artists at an artist alley at a con about 6 months ago.  1/20 were using Photoshop, and he was only using it to touch up someone elses work, because "he already had a copy".



Quote
I would consider PCX a compressed file, not a raw file. A psd is about as raw as you're going to get for art generation purposes.

Cool.  I am talking about the .RAW file format.    Another format that is handy when working on old platforms.   MSX uses this.   

I am pretty sure a RAW is about as raw as you're going to get, as it's literally raw data.   

Quote
I upgraded my CS6 (attained very affordably) with a monthly 10$ subscription to CC. What I get with that $10/mo pays for itself hand over fist repeatedly.

Compared to the collectards around, and the cost of an average lunch or dinner where I live, that's not a terrible price. I'd drop that down to a dollar sign or two.

I'd love to see a better solution that CC/CS6 + Gimp, but maybe my tenure in photoshop outweighs the headaches of opening another program to palette organize my art.
I bought PSP X9 for 45$.    in 5 months, I won't have to pay 10$.   

I'm sorry, subscribing to art software is kind of stupid.   What do you get for that 10$/month that was lacking when you weren't subscribed?


Also:

Elmer, lol, wtf do programmer egos have to do with hosting a zip file of PDFs?   I'd like to think nobody is that much of a dipshit that they'd sabotage and take down documentation out of spite. 

It would be nice to host them all in a place where they're viewable online.
Title: Re: Getting started programming?
Post by: Gredler on January 08, 2017, 06:21:04 PM
Nice I will check PSP out. Last time I used it I was like 10 years old and it was rad vs paint, but once I got Photoshop I never looked back, maybe I should thanks for the suggestion.

I didn't realize RAW was an actual file format for images, I was assuming you are using it as a adjective for a file that is at its rawest and most flexible state - it makes more sense to be a  file containing "raw data." Apologies for the symantics confusion.

I find it surprising that you are debating that Photoshop is not the standard because of its proliferation in the professional art development implementation. 

They teach Photoshop at school because it's the standard, and if you try to get a job in most digital art fields and say "PSP" they will laugh at you if you even get an interview without Photoshop on your resume.

Hobbiests yeah I can see it being all sorts of random apps and tools, but the vast majority of studios just get Adobe software, Photoshop for raster and illustrator for vector (and now zbrush for zpixels).

As for the subscription it's for a lot of features you can read about them on the product page, I take advantage of quite a few of them and also just like the constant updates support and expansion of the program. I could have lived with cs6 for a long time, but like I said the 10$ a month pays for itself easily.

Seriously dude, maybe Photoshop sucks for making art on these platforms and I will happily look into other options, but so far nothing competes with Photoshop and for all modern digital raster images it can't be beaten. 20+ years of bias leans me towards Photoshop for sure though, so I am open ears for retro tools to do pce work with :)

Edit: just looked into PSP, looks cool man I will try the demo this week for sure. What version did you get for 49? It's on sale right now for 79.

I am surprised to hear Corel owns it now! I used PSP first, then Corel draw and hated that, then sent back to PSP until I got Photoshop 2.0 from a BBS :P I didn't own a copy until cs2, then upgraded to 3, and 6, and CC. I've made my living off Photoshop since middle school, so buying it always made sense.
Title: Re: Getting started programming?
Post by: Arkhan on January 08, 2017, 06:47:46 PM
I've actually had PSP since 7.    I upgraded mine for 45$ or whatever.


The other reason I think Adobe sucks is basically what they've done to themselves.

Adobe f*cked up CoolEdit, and turned their software into this juggernaut of nonsense.

Don't you have to login to use the subscription based one?
Title: Re: Getting started programming?
Post by: Gredler on January 08, 2017, 07:16:06 PM
You don't have to be online, and it's a one time login. You have to be online for updates obviously and that probably checks your credentials but it's never asked me to logon after the initial installation.

I can see your trpedation about Adobe because of audition/cooledit. I kinda feel the same way about Autodesk and Maya, but after acclimating to max by need of a job I had, I found that Maya (and max) getting shared features between the two makes them both better. These megacorps be shitting on our habits, it's rough dude I feel ya


I used PSP either 1 or 2, can't remember very well. I used it to draw Mario
Title: Re: Getting started programming?
Post by: ccovell on January 26, 2017, 10:29:10 PM
Two new videos, one on CPU instructions, and the other, we get started writing some code:
https://www.youtube.com/watch?v=RQRvZE_uU0U

https://www.youtube.com/watch?v=rCCRgMlozTc
Title: Re: Getting started programming?
Post by: Pokun on February 06, 2017, 11:37:26 AM
A beginner tutorial for assembly, that's just what PC Engine needs!

Just finished watching them all and they are great tutorials! A bit slow at first but you show a lot of things that's not so easy to show in a written document so that's cool, and when you finally get to coding it's just great.

I'm looking forward to see more.


I don't know if anyone besides myself has written code and demos for the SF2 mapper, but PCEAS inability to handle anything beyond 1megabit and since there's no linker system - it makes handling organization of data painful or wasteful. Injecting the data into rom and expanding it with external tools is not a problem, but putting those labels and attributes into the main source file remains a by hand process. Normally I don't complain about PCEAS not having a linker, but this is probably one case that I would argue otherwise. From my perspective, if you're going to develop a hucard game without the intent to sell in physical form, the SF2 mapper is a great choice. It just needs additional tools; both for HuC and for PCEAS.
Hmm why can't it handle bigger than 2 Mbit if I may ask?
Now when cc65 handles Hu6280, what about using ca65 and the linker ld65 from the cc65 suit? That's what I'm doing for Snes and it's one of the most popular assemblers for Nes (although I'm using asm6 for Nes because it's simple like PCEAS). For newbie tutorials, PCEAS2 is probably the better choice though.
Title: Re: Getting started programming?
Post by: elmer on February 09, 2017, 04:47:15 PM
Hmm why can't it handle bigger than 2 Mbit if I may ask?

I suspect that Bonknuts means 8Mbit (1MByte), which is the largest cartridge size.

I know that the Catastrophy guys are using well over 1Mbit (128KByte).

It can probably be extended to handle larger cart sizes, but nobody has done so, probably because nobody  has needed the extra space.


Quote
Now when cc65 handles Hu6280, what about using ca65 and the linker ld65 from the cc65 suit? That's what I'm doing for Snes and it's one of the most popular assemblers for Nes (although I'm using asm6 for Nes because it's simple like PCEAS). For newbie tutorials, PCEAS2 is probably the better choice though.

CC65 is already usable on the PCE, I've used it.

It's just missing a lot of usability stuff like libraries, and it doesn't take any advantage of the Hu6280 or the memory segmentation/paging.

CA65 already understands Hu6280, but it has a problem with our zero-page being at $2000 instead of $0000.

You can see a long discussion of my attempts to talk to the guys about that on their github bug-tracker.

The discussion stopped a while back, and I don't know if there's ever going to be an official fix ... there are some deep-seated problems in Ulrich's original CA65 code-design that will take some fixing.

So, for the moment, PCEAS really is the best choice available (IMHO).

And while HuC lacks a lot of the code-optimizations in CC65, it does a number of things better (for the PCE), and its library is helping folks make games today.
Title: Re: Getting started programming?
Post by: Pokun on February 10, 2017, 01:22:13 AM
Quote
It can probably be extended to handle larger cart sizes, but nobody has done so, probably because nobody  has needed the extra space.
So PCEAS simply rejects assembling larger HuCard ROMs than 1 MB? Sounds like another mostly pointless restriction like the forced 8 kB banks thing that was fixed in PCEAS2.

Quote
CC65 is already usable on the PCE, I've used it.
Yes, I was mainly discussing the assembler CA65.

CA65 already understands Hu6280, but it has a problem with our zero-page being at $2000 instead of $0000.

You can see a long discussion of my attempts to talk to the guys about that on their github bug-tracker.

The discussion stopped a while back, and I don't know if there's ever going to be an official fix ... there are some deep-seated problems in Ulrich's original CA65 code-design that will take some fixing.

So, for the moment, PCEAS really is the best choice available (IMHO).
I see, it would be useful if it simply had an assembly directive to relocate the Zero Page to wherever the user want:
Quote
  .zploc $2000  ;tell assembler where the Zero Page is
And then you are done with it for PC Engine. Would be useful for 65816's relocatable Direct Page as well.

Thanks for the explanation though. It sounds like CA65 isn't really ready for the Hu6280 yet, I guess I'll stick to PCEAS2. The main problem I have with it so far is that it doesn't have a complete readme file. The documentation that comes with Magicengine and HuC doesn't seem to be complete for PCEAS.
Title: Re: Getting started programming?
Post by: elmer on February 20, 2017, 09:58:42 AM
So PCEAS simply rejects assembling larger HuCard ROMs than 1 MB?

Errrr ... What would you like it to do?  :-k

This is no standardized mapping scheme for > 1MB HuCard ROMs.

There was only one > 1MB HuCard ROM ever released, and nobody has implemented its mapping scheme in a homebrew HuCard release (that I know of).


Sounds like another mostly pointless restriction like the forced 8 kB banks thing that was fixed in PCEAS2.

I'm sure that the original PCEAS devs thought that it made sense.

It didn't really ... because they already handled an incbin that crossed bank boundaries, but ... oh, well.

BTW, PCEAS2 does NOT properly fix the problem.  #-o


Quote from: bonknuts
http://pcedev.wordpress.com/2012/02/06/new-tg16pce-assembler/

Opcodes that cross 8k bank boundaries no longer create an error and stop assembling. That is to say, if one or more opcode’s byte cross that boundary. Now it will generate a warning instead, but assemble correctly.

Well, PCEAS2 doesn't fail when a bank is crossed, that part was definitely fixed.

But it doesn't actually assemble correctly.

None of the bytes that cross the boundary are written to the new bank, and they just stay at the default $FF.

You can see that if you edit his test2.asm, line 102 and change "lda #$FF" to "lda #$23" and run go.bat.

   99           5FFF        .org $5fff
  100  01:5FFF            cross_bank:
  101  01:5FFF            .loop
  102  01:5FFF  A9 FF       lda #$23
  103  02:6001  80 FC       bra .loop



I'll be fixing this in the next build of Uli's HuC, because it's messing up Huzak when there's tune data larger than 8KB.


I see, it would be useful if it simply had an assembly directive to relocate the Zero Page to wherever the user want:
Quote
  .zploc $2000  ;tell assembler where the Zero Page is
And then you are done with it for PC Engine. Would be useful for 65816's relocatable Direct Page as well.

That's what they've been trying to implement.

But there are some deep-seated design choices (I'd call them "mistakes") that get a bit confused when $00xx is not a zero-page location.
Title: Re: Getting started programming?
Post by: Pokun on February 20, 2017, 08:57:59 PM
Heh well it kind of makes sense to assume that the Zero Page is always page 0. I guess Hudson should have called it the $20-page or something. :) I guess that's why they renamed it the Direct Page for 65816 in the first place, since it's relocatable to other pages.

So PCEAS simply rejects assembling larger HuCard ROMs than 1 MB?
Errrr ... What would you like it to do?  :-k

This is no standardized mapping scheme for > 1MB HuCard ROMs.

There was only one > 1MB HuCard ROM ever released, and nobody has implemented its mapping scheme in a homebrew HuCard release (that I know of).
I see, so then it's not an artificial rejection but rather a matter of running out of addressing space.
Ideally it still should be possible to make games using the Street Fighter II' mapper somehow though.

Sounds like another mostly pointless restriction like the forced 8 kB banks thing that was fixed in PCEAS2.
I'm sure that the original PCEAS devs thought that it made sense.
Yeah well it's not as much a matter of making sense as a matter of putting unecessary restrictions on the assembler. There's no telling when you need to do something different than the usual way, and then these kinds of restrictions get in the way. That's why I think giving warnings and making things optional is the way to go.
For NESASM (the Famicom version of PCEAS if I understand things correctly) the forced 8 kB banks makes zero sense though (unless you are using certain mappers) which is why people dislike it over at Nesdev.net.

Quote
Well, PCEAS2 doesn't fail when a bank is crossed, that part was definitely fixed.

But it doesn't actually assemble correctly.

None of the bytes that cross the boundary are written to the new bank, and they just stay at the default $FF.
Oh I had no idea it wasn't really fixed. I've yet to make a program that is big enough to need more than one ROM bank of code.

So which version of PCEAS is the one to go with? I'd prefer an assembler that doesn't create extra banks and stuff that you don't tell it to. I'll create my own libraries.
Title: Re: Getting started programming?
Post by: elmer on February 21, 2017, 03:09:20 PM
Oh I had no idea it wasn't really fixed. I've yet to make a program that is big enough to need more than one ROM bank of code.

So which version of PCEAS is the one to go with? I'd prefer an assembler that doesn't create extra banks and stuff that you don't tell it to. I'll create my own libraries.

AFAIK, no version of PCEAS automatically creates or uses extra banks ... by itself.

If you *choose* to use the "proc" functionality in PCEAS, that was designed for HuC, to allow for the automatic relocation of functions into different banks ... then "yes", you'll end up with extra junk, and you'll be locked into HuC's uncommon memory-map.

If you avoid "proc" functions, and just code as normal in regular assembly-language, then PCEAS has no overhead.

I use the latest version of PCEAS, from the latest version of HuC that I've posted, and I just code in pure assembly language without using any of the HuC or MagicKit libraries, or functions. or memory map.

So, although I'm obviously biased, I'd recommend that you use the PCEAS and selected equates from the latest HuC, and just ignore (or delete) all of the other files in the download.

If you're programming in assembly-language, then just avoid huc.inc and startup.asm, they're a mess!  #-o

At least then, you'd know who to come to with any complaints.  :roll:

Uli added various enhancements to bonknuts' changes in PCEAS 3.22, and I've added more of my own since.

Or you can just look at the most recent patches in github, and apply those to bonknuts' 3.22 source files, if you'd like to go that route.
Title: Re: Getting started programming?
Post by: Pokun on February 21, 2017, 09:37:11 PM
Ah so Bonknut's improvements are already in these HuC forks. Good, I'll just grab the assembler. Thanks!

Edit: OK I'm using this (http://www.pcenginefx.com/forums/index.php?topic=21350.msg487200#msg487200) one.
Title: Re: Getting started programming?
Post by: elmer on February 22, 2017, 04:07:39 AM
Ah so Bonknut's improvements are already in these HuC forks. Good, I'll just grab the assembler. Thanks!

Edit: OK I'm using this (http://www.pcenginefx.com/forums/index.php?topic=21350.msg487200#msg487200) one.

Yep, that's the latest build, with the bank-crossing fix.


Quote from: bonknuts
http://pcedev.wordpress.com/2012/02/06/new-tg16pce-assembler/

Though what I would like to add in the future is <# and >#for shorthand #low() and #high() directives, which have nothing to do with ZP addressing.

I don't remember if I documented it anywhere, but the version of PCEAS in the new HuC already contains a change so that "<" and ">" are unary-operators and synonyms for low() and high().

i.e.

lda #<label
lda #>label


Gives you the low byte and high byte of the label, just like in almost-every-other 6502 assembler that I've ever seen.
Title: Re: Getting started programming?
Post by: Pokun on February 22, 2017, 05:22:11 AM
Yup those are great additions. I saw those in the thread. The #^(label) shorthand for #BANK(label) was also added.
But no I don't think you documented it at all. PCEAS has always been plagued by a lack of documentation. lol

(The original "usage.txt" file doesn't even mention how zero page addressing is done!)
Title: Re: Getting started programming?
Post by: ccovell on December 14, 2017, 05:28:58 PM
A little bump since I've added episode 5 to my tutorial videos:

http://www.chrismcovell.com/PCEdev/