GDR Forum Index
Podcast Podcast
Dev Dev Logs
Search Search
RSS RSS
Register Register
Log in Log in
Reply to topic GDR Forum Index -> Game Developer's Refuge -> The Commodore 64 (6502 and Friends) Page Previous  1, 2, 3, 4  Next
View previous topic :: View next topic  
Author Message
0xDB
Developer

Joined: 26 Dec 2005
Posts: 1644
Location: Your consciousness.
PostPosted: Sat Apr 04, 2015 5:42 am    Post subject: Reply with quote

PoV (quite some time ago) wrote:

Slightly more complicated.
Code:
L000C:  lda     $D020    ; 4
        clc              ; 2
        adc     #$01     ; 2
        sta     $D020    ; 4
        jmp     L000C    ; 3

I tried to see if I could get the complier to generate faster code, without avail.
Code:
(*(unsigned char *)0xD020)++;


Still generates the same thing (read value, clear carry, add with carry, store value, jump). That's okay though, but it's worth knowing the compiler isn't doing increment optimizations.
That mystery is explained in section 9 here. (The compiler currently does not figure out whether the un-increased value in a post-increment instruction is actually used by anything and thus generates the longer code, so that the un-incremented value could be used from the A register before making the addition and writing it back to RAM.)

Can be fixed using the pre-increment instead:
Code:
++(*(unsigned char *)0xD020);
generates
Code:
inc     $D020

_________________
0xDB
View user's profile Send private message Visit poster's website
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10738
Location: Canadia
PostPosted: Sat Apr 04, 2015 8:16 am    Post subject: Reply with quote

Cool. Thanks for the tip.
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
0xDB
Developer

Joined: 26 Dec 2005
Posts: 1644
Location: Your consciousness.
PostPosted: Wed May 20, 2015 10:50 am    Post subject: Reply with quote

It is good to know where you are (aligned to match full pixel coordinates as a planning aid):

_________________
0xDB
View user's profile Send private message Visit poster's website
Sirocco
Moderator

Joined: 19 Aug 2005
Posts: 9391
Location: Not Finland
PostPosted: Thu May 21, 2015 5:50 pm    Post subject: Reply with quote

I just noticed, quite by accident, that my IDE doesn't differentiate #$D800 and $D800 (two entirely different things) when it dynamically colors the code :(
_________________
NoOP / Reyn Time -- The $ is screwing everyone these days. (0xDB)
View user's profile Send private message Visit poster's website
0xDB
Developer

Joined: 26 Dec 2005
Posts: 1644
Location: Your consciousness.
PostPosted: Sat Jun 20, 2015 12:40 pm    Post subject: Reply with quote

I think Relaunch64 also colors them the same. But Kick Assembler will at least throw an error when using # with a 16-bit value directly on any cpu command because that's not possible. It only becomes a problem when passed to a pseudo-command which does distinguish between the two without having any way to guess the intended behavior.

--- snip ---

There appear to be some really cool (including cartridge versions) enhanced versions of Zak Mc Kraken and Maniac Mansion:
http://csdb.dk/release/?id=98674
http://csdb.dk/release/?id=97811
_________________
0xDB
View user's profile Send private message Visit poster's website
0xDB
Developer

Joined: 26 Dec 2005
Posts: 1644
Location: Your consciousness.
PostPosted: Sun Jun 21, 2015 6:24 am    Post subject: Reply with quote

Hey look, Nostalgia just un-sucked Ghosts 'n Goblins for the C64:
https://www.n0stalgia.org/common/pages/releases.php?op=showrelease&id=329
_________________
0xDB
View user's profile Send private message Visit poster's website
Sirocco
Moderator

Joined: 19 Aug 2005
Posts: 9391
Location: Not Finland
PostPosted: Sun Jun 21, 2015 7:13 am    Post subject: Reply with quote

Wow, that's crazy. The original C64 port was horrifically hard. As noted in the release, it had a pretty bad sprite flickering problem.
_________________
NoOP / Reyn Time -- The $ is screwing everyone these days. (0xDB)
View user's profile Send private message Visit poster's website
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10738
Location: Canadia
PostPosted: Sun Jun 21, 2015 11:59 am    Post subject: Reply with quote

Haha! Great. I played the crap out of the C64 version as a kid.
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
Sirocco
Moderator

Joined: 19 Aug 2005
Posts: 9391
Location: Not Finland
PostPosted: Sun Jun 21, 2015 1:38 pm    Post subject: Reply with quote

I actually finished that damn game when I was a kid :(

I must have been really bored that week or something. Dunno.
_________________
NoOP / Reyn Time -- The $ is screwing everyone these days. (0xDB)
View user's profile Send private message Visit poster's website
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10738
Location: Canadia
PostPosted: Sun Jun 21, 2015 5:01 pm    Post subject: Reply with quote

I've finished at least one of them, I just can't remember if it was the C64, or NES version (as well as the SNES version).
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
0xDB
Developer

Joined: 26 Dec 2005
Posts: 1644
Location: Your consciousness.
PostPosted: Mon Jun 22, 2015 1:17 pm    Post subject: Reply with quote

That new one is still hard but it does not feel as unforgiving as the original (...just a little...). Still could not beat it without cheating.
_________________
0xDB
View user's profile Send private message Visit poster's website
Sirocco
Moderator

Joined: 19 Aug 2005
Posts: 9391
Location: Not Finland
PostPosted: Mon Jul 13, 2015 6:44 pm    Post subject: Reply with quote

I think I just stumbled upon a rare instance where messing with sprites seemed to have given me a perfectly stable raster. It didn't survive a little experimentation, but I got it to work once :)
_________________
NoOP / Reyn Time -- The $ is screwing everyone these days. (0xDB)
View user's profile Send private message Visit poster's website
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10738
Location: Canadia
PostPosted: Mon Nov 02, 2015 12:27 pm    Post subject: Reply with quote

A breakdown of the 6502, from the same dude that did the C64 breakdown video (on page 1 of this thread).

It's pretty nuts. They electrically figured out how the 6502 works, and can physically emulate it.



Dude's website: http://www.pagetable.com/
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10738
Location: Canadia
PostPosted: Mon Nov 02, 2015 3:42 pm    Post subject: Reply with quote

Ho ho ho! Reading through this thread, I stumbled across my old SNES notes. At the time, the only known C compiler for the 65816 (6502 with 24bit address space) was impossible to acquire. Today it's actually free download now (formerly paid).

http://65xx.com/Products/WDCTools/

Windows only, but funny thing, I have the tools running great on Linux... with the sole exception that it's barking, asking for a license key. *shrug*
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
Sirocco
Moderator

Joined: 19 Aug 2005
Posts: 9391
Location: Not Finland
PostPosted: Mon Nov 02, 2015 4:24 pm    Post subject: Reply with quote

I think we made note of that a few months ago? Or maybe not... I might be thinking about a thread over at Lobste.rs.

I'd love to see more SNES demos.
_________________
NoOP / Reyn Time -- The $ is screwing everyone these days. (0xDB)
View user's profile Send private message Visit poster's website
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10738
Location: Canadia
PostPosted: Mon Nov 02, 2015 5:34 pm    Post subject: Reply with quote

Digging in to it, the C compiler (WDC8166CC.EXE) and Optimizer (WDC8166OP.EXE) that are disabled (require a license key). Assembly, Linker, and other tools are fine.
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10738
Location: Canadia
PostPosted: Mon Nov 02, 2015 6:28 pm    Post subject: Reply with quote

Unrelated: http://unixwiz.net/techtips/x86-jumps.html
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10738
Location: Canadia
PostPosted: Fri Mar 17, 2017 11:56 am    Post subject: Reply with quote

So this is new and fancy. The MENSCH, a 6502 family SOC on an Arduino-like board.



http://www.westerndesigncenter.com/wdc/documentation/W65C265QBX.pdf

https://www.amazon.com/WDC-65xx-6502-MENSCH-Microcomputer/dp/B06XGJZS9M/

I would have bought one, but they don't ship to Canada.
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10738
Location: Canadia
PostPosted: Fri Mar 17, 2017 12:10 pm    Post subject: Reply with quote

Random interview with the Bill Mensch, the dude who designed the 6502.


_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10738
Location: Canadia
PostPosted: Mon Mar 20, 2017 5:08 pm    Post subject: Reply with quote

Okay. I ordered a MENSCH.

A bit pricey for me to get one ($29+$10 shipping), but hey.


On a related note, the 6502 and 65816 assembler, C compiler (with standard C library), and optimizer from WDC are now freely available. Behind an e-mail wall.

http://wdc65xx.com/WDCTools

They appear to work fine with Wine.
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
Sirocco
Moderator

Joined: 19 Aug 2005
Posts: 9391
Location: Not Finland
PostPosted: Tue Mar 21, 2017 4:22 am    Post subject: Reply with quote

Quote:

Okay. I ordered a MENSCH.

A bit pricey for me to get one ($29+$10 shipping), but hey.


Yeah, I want one. Dunno exactly what I'd *do* with it, but yeah.... WANT.
_________________
NoOP / Reyn Time -- The $ is screwing everyone these days. (0xDB)
View user's profile Send private message Visit poster's website
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10738
Location: Canadia
PostPosted: Tue Mar 21, 2017 3:17 pm    Post subject: Reply with quote

Amazon stocks them at their warehouse, so if you pad your order, you can at least get free shipping.

But yeah, WANT. Is it useful? Probably not (Arduino's are so much cheaper), but hey, I guess I'm a fan.


That long arse video above actually tells the true history of all the insane 6502 licensing that has gone on over the decades. In a sense, Western Design Center (WDC) was the first company to do the fabless CPU designer business model, like ARM is best known for these days... they just kept quiet about it. The contracts companies like MOS, Ricoh, Apple, and others signed basically said "don't tell anybody you're using our design"... which in hindsight seems somewhat bizarre, but it meant they avoided a bunch of court stuff. *shrug*
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10738
Location: Canadia
PostPosted: Fri May 05, 2017 10:51 am    Post subject: Reply with quote

Cool! Ben Heck got the Nintendo PlayStation working.



From what I can tell, it really is just a Super Nintendo with a CD-ROM. There's a RAM cart you plug in to play the CD games. It has a lousy 256 KB of memory, so you have to fit your executable and data in that, or swap it out for more data loaded from the disc. Pretty standard stuff coming from a Commodore 64 background (just 4x the memory, possibly un-paged (I haven't played with the improved 6502 CPU yet), and like 1400x the storage).
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
Niunio Martinez
Member

Joined: 26 Nov 2013
Posts: 97

PostPosted: Mon May 08, 2017 2:15 am    Post subject: Reply with quote

PoV wrote:
Cool! Ben Heck got the Nintendo PlayStation working.



From what I can tell, it really is just a Super Nintendo with a CD-ROM. There's a RAM cart you plug in to play the CD games. It has a lousy 256 KB of memory, so you have to fit your executable and data in that, or swap it out for more data loaded from the disc. Pretty standard stuff coming from a Commodore 64 background (just 4x the memory, possibly un-paged (I haven't played with the improved 6502 CPU yet), and like 1400x the storage).
Are you saying it is a C64 in steroids? I think I miss something.
_________________
Under redaction...
View user's profile Send private message Visit poster's website
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10738
Location: Canadia
PostPosted: Mon May 08, 2017 2:03 pm    Post subject: Reply with quote

Yep!

The C64, NES, and Atari 2600 all use the 6502 CPU (with 16bit addressing and 8bit registers), but while both Commodore and Atari switched to the Motorola 68000 for the Amiga and Atari ST respectfully (24bit addressing and 32bit registers), Nintendo went with the 65816 (a 6502 derivative with 24bit addressing and 16bit registers).

https://en.wikipedia.org/wiki/WDC_65816/65802#Features

Compared to the 6502.

https://en.wikipedia.org/wiki/MOS_Technology_6502#Registers

Actually the 65816 looks far more like the Z80 than I originally thought (thanks to it appearing you can combine registers), but the Z80 was a register BEAST.

https://en.wikipedia.org/wiki/Zilog_Z80#Registers
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
Reply to topic GDR Forum Index -> Game Developer's Refuge -> The Commodore 64 (6502 and Friends) Page Previous  1, 2, 3, 4  Next

Use this link to get a Sign-On Bonus when you get started!

All trademarks and copyrights on this page are owned by their respective owners. All comments owned by their respective posters.
phpBB code © 2001, 2005 phpBB Group. Other message board code © Kevin Reems.