Bored doing just awesome pixel art for the C64 so.....

Coders forum. Discuss techniques, swap code snippets, ask for help etc. relating to all forms of software development.
llamaprotector
Baaaa!
Baaaa!
Posts: 648
Joined: Fri Apr 23, 2010 2:00 am 0

Bored doing just awesome pixel art for the C64 so.....

Post by llamaprotector »

Right I can code but not in ASM on 6502 so I was wondering if there is...

1. A good book on C64 general routines (custom chip access for 6581 or 6526)
2. General list of instr for 6502 ASM
3. Tips on how to use the memory map

Obviously ASM on a C64 is a bit special because you can run things in a sort of time sliced way that is nothing like any high level language on the C64, although Laser Basic does allow 3 concurrent tasks.
User avatar
gravy
Sheepie Whore
Sheepie Whore
Posts: 19572
Joined: Wed May 01, 2002 1:28 pm 0
Location: The Other Place

Re: Bored doing just awesome pixel art for the C64 so.....

Post by gravy »

llamaprotector wrote:Obviously ASM on a C64 is a bit special because you can run things in a sort of time sliced way that is nothing like any high level language on the C64, although Laser Basic does allow 3 concurrent tasks.
Eh?
User avatar
Istar
Baaaaaa!
Baaaaaa!
Posts: 4869
Joined: Mon Apr 22, 2002 4:42 pm 0
Location: London, UK.

Re: Bored doing just awesome pixel art for the C64 so.....

Post by Istar »

I think lp might be referring to the IRQ mechanism (whether from the CIA or VIC-II).

@lp there are loads of online resources for C64 assembler programming, general 6502 programming, and the C64 memory map. Google. Lemon64 is not a bad place to begin.
User avatar
gilesgoat
Sheepie Whore
Sheepie Whore
Posts: 27259
Joined: Wed Sep 03, 2003 7:54 am 0
Location: Monfalcone, Italy
Contact:

Re: Bored doing just awesome pixel art for the C64 so.....

Post by gilesgoat »

gravy wrote:
llamaprotector wrote:Obviously ASM on a C64 is a bit special because you can run things in a sort of time sliced way that is nothing like any high level language on the C64, although Laser Basic does allow 3 concurrent tasks.
Eh?
.. the more I read that sentence above the more I think it sounds "incredible" even if I am not really sure about what it really means ...

The "Eh?" is appropriate.
Giles the billy goat
"Baa"
llamaprotector
Baaaa!
Baaaa!
Posts: 648
Joined: Fri Apr 23, 2010 2:00 am 0

Re: Bored doing just awesome pixel art for the C64 so.....

Post by llamaprotector »

Designing routines in something like a souped up BASIC has a completely different mentality as it's just one massive bit of code that does nothing independently and steps through it all in sequence where as in ASM you would run bits of machine code to do various things automatically via interrupts etc like looped animations of sprites for spinning wheels or scrolling the background or playing music and basically check for things that are conditional like collisions or player input (fire lasers etc). You can sort of do this in Laser BASIC as it allows 3 concurrent tasks. However 17kb is all you have left for writing your game on a 64kb computer in that system so it's no good :D
User avatar
gravy
Sheepie Whore
Sheepie Whore
Posts: 19572
Joined: Wed May 01, 2002 1:28 pm 0
Location: The Other Place

Re: Bored doing just awesome pixel art for the C64 so.....

Post by gravy »

That's a pretty bad way to write games.

You'd create a display abstraction that would probably work off of interrupts and do some processing but the game itself? You'd do it in the foreground.

If you want to make a game that's fairly simply but still could look really nice you really don't need very much at all to happen in interrupts
User avatar
sack
Baaaaaaa!
Baaaaaaa!
Posts: 7077
Joined: Fri May 10, 2002 4:13 pm 0
XBL Gamertag: evilgopher
PSN: sixFiveOhTwo
Location: Rijswijk, The Netherlands
Contact:

Re: Bored doing just awesome pixel art for the C64 so.....

Post by sack »

interrupts are for things you can't miss on a per-frame basis, are quick and are timing critical.

If possible you should build things up in your main loop in a way the interrupts can just blindly read off the data and use it as needed
User avatar
gilesgoat
Sheepie Whore
Sheepie Whore
Posts: 27259
Joined: Wed Sep 03, 2003 7:54 am 0
Location: Monfalcone, Italy
Contact:

Re: Bored doing just awesome pixel art for the C64 so.....

Post by gilesgoat »

loops, state machines and linked lists are your friends ...

Even "interrupts and do things" I think could be 'questionable' .. more maybe about "interrupts collects info as fast as possible and adds it into a queue thing and exits as soon as it can " but then
beware you need atomic operations when using the queue.

Queues IMHO are another of those "best friends".

But I see you mean for time-critical thing, ok if the stuff it's like "doing things during the Nth scanline interrupt" and such that's a thing, but remember overall KISS.
Giles the billy goat
"Baa"
User avatar
gravy
Sheepie Whore
Sheepie Whore
Posts: 19572
Joined: Wed May 01, 2002 1:28 pm 0
Location: The Other Place

Re: Bored doing just awesome pixel art for the C64 so.....

Post by gravy »

gilesgoat wrote: But I see you mean for time-critical thing, ok if the stuff it's like "doing things during the Nth scanline interrupt" and such that's a thing, but remember overall KISS.
Definitely.

What game do you want to write?

That's the most important thing.

If you're starting out in assembly I'd advise:

- Single screen : no scorlling or panel
- 8 sprites
- Simple logic - can easily be completed at a good interactive rate (20fps is fine for a starter)

You won't need any interrupts there, the code will be pretty simple and it'll mean your chances of actually finishing the project a lot higher.

There's been some great games written that way; Spy Vs Spym Jack Attack and Confuzion are examples of excellent games that both work in those constraints. There's plenty more.

The biggest problem with most hobby game projects (and I'm hugely guilty of this) is they're actually technology projects. The tech gets done and the game never gets finished. If you can lower the tech reqs and concentrate on the game you're much more likely to end up with something others can play.
User avatar
sack
Baaaaaaa!
Baaaaaaa!
Posts: 7077
Joined: Fri May 10, 2002 4:13 pm 0
XBL Gamertag: evilgopher
PSN: sixFiveOhTwo
Location: Rijswijk, The Netherlands
Contact:

Re: Bored doing just awesome pixel art for the C64 so.....

Post by sack »

If you're feeling really lazy do what I did as a kid and put the score panel down the right hand side :)

(sprite MSB register? What's that all about then?)
User avatar
merman
Sheepie Whore
Sheepie Whore
Posts: 10943
Joined: Wed Feb 16, 2005 1:44 pm 0
XBL Gamertag: merman1974
Yahoo Messenger: andrewrfisher
Location: Skegness, England
Contact:

Re: Bored doing just awesome pixel art for the C64 so.....

Post by merman »

sack wrote:If you're feeling really lazy do what I did as a kid and put the score panel down the right hand side :)

(sprite MSB register? What's that all about then?)
A single byte of memory can only hold 0-255, a sprit e's X-position can run from 0-343 (this includes positions under the screen border, allowing you to move a sprite smoothly into view).

To cope with the extra section, you have the sprite MSB or Most Significant Bit. This is stored in a separate register with one bit for each of the eight hardware sprites. If the bit is set, the sprite is at positions 255-343 on the right of the screen.

You can see this sort of bug/problem in early games and some US imports. Either the sprite flickers briefly or appears in the wrong place because the MSB is set wrong. And many games have a large score panel on the right so there is less need to use the MSB.
Twitter, Xbox, Wii U and Steam - merman1974
ZZAP is back - https://www.patreon.com/zzapmagazine
User avatar
gravy
Sheepie Whore
Sheepie Whore
Posts: 19572
Joined: Wed May 01, 2002 1:28 pm 0
Location: The Other Place

Re: Bored doing just awesome pixel art for the C64 so.....

Post by gravy »

I wonder why everyone doesn't understand what a rhetorical question is? :D
User avatar
venusian
Baaaaaaa!
Baaaaaaa!
Posts: 6653
Joined: Wed Nov 06, 2002 2:22 pm 0
Location: South Gloucestershire

Re: Bored doing just awesome pixel art for the C64 so.....

Post by venusian »

Because the urge to appear clever overrides the urge to...

Oh, hang on.
User avatar
sack
Baaaaaaa!
Baaaaaaa!
Posts: 7077
Joined: Fri May 10, 2002 4:13 pm 0
XBL Gamertag: evilgopher
PSN: sixFiveOhTwo
Location: Rijswijk, The Netherlands
Contact:

Re: Bored doing just awesome pixel art for the C64 so.....

Post by sack »

I think I skipped that part of the manual because I was still laughing at the SEX register
llamaprotector
Baaaa!
Baaaa!
Posts: 648
Joined: Fri Apr 23, 2010 2:00 am 0

Re: Bored doing just awesome pixel art for the C64 so.....

Post by llamaprotector »

Thanks for the advice everybody :D

Ultimately I actually want to code my own conversion of the VCS version of Vanguard on the C64. I did some graphics for it and there is no way to do it nicely in BASIC (Laser BASIC compiled or CBM BASIC V2).

I had the idea if the screen is scrolled under its own automatic routine then my code just needs to do conditional things. If you hit the background it wouldn't matter in this game as the screen always scrolls. If I ran the scroller after line 200 is drawn each frame then it would be nice and silky smooth I thought.

For other stuff though it would be a simple case of dumping some bytes in specific memory locations so those routines can check for collisions and update player/enemies/bullet positions etc.

There was a really excellent website that had a tutorial on writing machine code (may have been from Commodore User or Your Commodore magazine feature) and by lesson 3 you were multiplexing a sprite or 8 8O If anyone remembers that site would appreciate a link.
sack wrote:If you're feeling really lazy do what I did as a kid and put the score panel down the right hand side :)

(sprite MSB register? What's that all about then?)
And that's exactly why I didn't like Raiden on the Atari Jaguar...huge brown panel too of all colours 8O Too much like huge brown pants of the video gaming world :lol:

I thought this way all the time until one day in my 20s I had a couple of spliffs in a row sitting in a coffee shop and the answer came to me instantly like a revelation, I think I still have the code I wrote on the back of the menu sheet there and then.
Post Reply